text
stringlengths
4
6.14k
#pragma once #include <stdlib.h> namespace daw { namespace radio { namespace medtronic { namespace packets { namespace types { enum MedtronicPacketType: uint8_t { Pump = 0xA2, Glucometre = 0xA5, EnliteSensorWarmup = 0xAA, EnliteSensor = 0xAB }; } struct __attribute__( (packed) ) glucometre { union { uint8_t raw[7]; struct { uint8_t packet_type; // always 0xA5 uint32_t device_id : 24; uint16_t glucose_value; uint8_t crc; }; }; }; struct __attribute__( (packed) ) sensor { union { uint8_t raw[33]; struct { uint8_t packet_type; // either 0xAA or 0xAB uint32_t device_id : 24; uint8_t version; // always 13(0x0D) uint8_t unknown01; // always 0x1D uint8_t isig_adjust; // maybe 0x21 uint8_t sequence_number; uint8_t recent_isig_values[4]; uint8_t unknown02; // usually 0x00. however, 0x02 when Change Sensor uint16_t unknown03; // usually 0x6767. however, 0x0000 when Sensor Error uint8_t battery_level; // usually 0x9D uint8_t past_isig_values[14]; uint16_t crc; }; }; }; } } // namespace medtronic } // namespace radio } // namespace daw
BOOLEAN OpenNvapi_Initialize(); UINT8 OpenNvapi_GetLoad(); UINT16 OpenNvapi_GetEngineClock(); UINT16 OpenNvapi_GetMemoryClock(); UINT16 OpenNvapi_GetMaxEngineClock(); UINT16 OpenNvapi_GetMaxMemoryClock(); UINT64 OpenNvapi_GetTotalMemory(); UINT64 OpenNvapi_GetFreeMemory(); UINT8 OpenNvapi_GetTemperature(); VOID OpenNvapi_ForceMaximumClocks();
// // SSZipArchive.h // SSZipArchive // // Created by Sam Soffes on 7/21/10. // Copyright (c) Sam Soffes 2010-2015. All rights reserved. // #ifndef _SSZIPARCHIVE_H #define _SSZIPARCHIVE_H #import <Foundation/Foundation.h> #include "SSZipCommon.h" NS_ASSUME_NONNULL_BEGIN extern NSString *const SSZipArchiveErrorDomain; typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) { SSZipArchiveErrorCodeFailedOpenZipFile = -1, SSZipArchiveErrorCodeFailedOpenFileInZip = -2, SSZipArchiveErrorCodeFileInfoNotLoadable = -3, SSZipArchiveErrorCodeFileContentNotReadable = -4, SSZipArchiveErrorCodeFailedToWriteFile = -5, SSZipArchiveErrorCodeInvalidArguments = -6, }; @protocol SSZipArchiveDelegate; @interface SSZipArchive : NSObject // Password check + (BOOL)isFilePasswordProtectedAtPath:(NSString *)path; + (BOOL)isPasswordValidForArchiveAtPath:(NSString *)path password:(NSString *)pw error:(NSError * __nullable * __nullable)error NS_SWIFT_NOTHROW; // Unzip + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination; + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(nullable id<SSZipArchiveDelegate>)delegate; + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(nullable NSString *)password error:(NSError * *)error; + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(nullable NSString *)password error:(NSError * *)error delegate:(nullable id<SSZipArchiveDelegate>)delegate NS_REFINED_FOR_SWIFT; + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination preserveAttributes:(BOOL)preserveAttributes overwrite:(BOOL)overwrite password:(nullable NSString *)password error:(NSError * *)error delegate:(nullable id<SSZipArchiveDelegate>)delegate; + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * __nullable error))completionHandler; + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(nullable NSString *)password progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * __nullable error))completionHandler; // Zip // without password + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths; + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath; + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory; // with password, password could be nil + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(nullable NSString *)password; + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(nullable NSString *)password; + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password; + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler; - (instancetype)initWithPath:(NSString *)path; @property (NS_NONATOMIC_IOSONLY, readonly) BOOL open; - (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password; - (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password; - (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName withPassword:(nullable NSString *)password; - (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password; @property (NS_NONATOMIC_IOSONLY, readonly) BOOL close; @end @protocol SSZipArchiveDelegate <NSObject> @optional - (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo; - (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath; - (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; - (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; - (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; - (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath; - (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total; - (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath; @end NS_ASSUME_NONNULL_END #endif /* _SSZIPARCHIVE_H */
#include <pololu/orangutan.h> #include <stdio.h> // for printf() /* * pushbuttons2: for the Orangutan LV, SV, SVP, X2, and 3pi robot. * * This example uses the OrangutanPushbuttons library to detect user input * from the pushbuttons. Each button press and release triggers an event * (the buzzer plays a note) while the LCD continuously displays the time * that has elapsed. The functions get_single_debounced_button_press() * and get_single_debounced_button_release() make it easy to perform such * button-triggered activities within your main loop. These functions * are non-blocking, so the rest of your main loop can run while waiting * for the buttons to be pressed or released, and they should be called * repeatedly. * * http://www.pololu.com/docs/0J20 * http://www.pololu.com * http://forum.pololu.com */ int main() { lcd_init_printf(); clear(); // clear the LCD printf("Time: "); while (1) { unsigned char button = get_single_debounced_button_press(ANY_BUTTON); switch (button) { case BUTTON_A: play_note(A(4), 50, 10); break; case BUTTON_B: play_note(B(4), 50, 10); break; case BUTTON_C: play_note(C(5), 50, 10); } button = get_single_debounced_button_release(ANY_BUTTON); switch (button) { case BUTTON_A: play_note(A(5), 50, 10); break; case BUTTON_B: play_note(B(5), 50, 10); break; case BUTTON_C: play_note(C(6), 50, 10); } unsigned long ms = get_ms(); // get elapsed milliseconds // convert to the current time in minutes, seconds, and hundredths of seconds unsigned char centiseconds = (ms / 10) % 100; unsigned char seconds = (ms / 1000) % 60; unsigned char minutes = (ms / 60000) % 60; lcd_goto_xy(0, 1); // go to the start of the second LCD row // print as [m]m:ss.cc (m = minute, s = second, c = hundredth of second) printf("%2u:%02u.%02u", minutes, seconds, centiseconds); } }
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* term.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dlancar <dlancar@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/10/13 16:33:48 by dlancar #+# #+# */ /* Updated: 2016/12/09 17:40:23 by dlancar ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef TERM_H # define TERM_H /* ** XTERM use VT100 codes ** other use ANSI codes */ # ifndef XTERM # define CURSOR_UP "\033[F" # define CURSOR_DOWN "\033[E" # else # define CURSOR_UP "\x1B[1A" # define CURSOR_DOWN "\x1B[1B" # endif # define CURSOR_SET(x, y) (ft_printf("\e[%d,%dH", (x), (y))) # define CURSOR_HOME "\x1B[H" # define CLEAR_LINE "\x1B[K" # define CLEAR "\x1B[2J\x1B[H" # define KNRM "\x1B[0m" # define RED "\x1B[31m" # define GREEN "\x1B[32m" # define YELLOW "\x1B[33m" # define BLUE "\x1B[34m" # define MAGENTA "\x1B[35m" # define CYAN "\x1B[36m" # define WHITE "\x1B[37m" # define RESET "\x1B[0m" #endif
#ifndef _MONSTER_AVENGERS_DATASET_CORE_ARMOR_SET_H_ #define _MONSTER_AVENGERS_DATASET_CORE_ARMOR_SET_H_ #include <array> #include "base/properties.h" namespace monster_avengers { namespace dataset { typedef std::vector<int> JewelSet; struct ArmorSet { ArmorSet() = default; std::array<int, PART_NUM> ids; std::array<JewelSet, PART_NUM> jewels; }; } // namespace dataset } // namespace monster_avengers #endif // _MONSTER_AVENGERS_DATASET_CORE_ARMOR_SET_H_
#pragma once #include "pch.h" #include <string> #include "IEntityComponent.h" #include "Resources\BitmapResourceHandle.h" using namespace PinnedDownClient::Resources; using namespace PinnedDownCore; namespace PinnedDownClient { namespace Components { class SpriteComponent : public PinnedDownCore::IEntityComponent { public: static const HashedString SpriteComponentType; const HashedString & GetComponentType() const { return SpriteComponentType; } std::shared_ptr<BitmapResourceHandle> sprite; }; } }
/** MIT License Copyright (c) 2017 Douglas Chidester Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "insertion-sort.h" void insertionSort(int* array, int length) { int i, j, swap; for(i = 1; i < length; ++i) { swap = array[i]; for(j = i - 1; j >= 0 && array[j] > swap; --j) { array[j + 1] = array[j]; } array[j + 1] = swap; } }
#import <CoreData/CoreData.h> @interface SSManagedObject : NSManagedObject + (id)objectWithID:(NSString *)objectID; + (id)objectWithID:(NSString *)objectID inContext:(NSManagedObjectContext *)context; + (NSArray *)objectsWithIDs:(NSSet *)objectIDs; + (NSArray *)objectsWithIDs:(NSSet *)objectIDs inContext:(NSManagedObjectContext *)context; @end
/* * 2015/11/22 * Tony Guo * R04458006 * * HW4 * */ #ifndef _COMPRESSION_ #define _COMPRESSION_ #include <iostream> #include <fstream> #include <sstream> #include <algorithm> #include <string> #include <vector> #include <bitset> #include <map> #include <cmath> #include <memory> enum{ FULL = 0, FAST }; enum{ INTRA = 0, INTER }; class Compression { public: Compression(std::string path,unsigned int raw_width,unsigned int raw_height,unsigned int block_size = 8): path(path),raw_width(raw_width),raw_height(raw_height),block_size(block_size){} void LoadRawImage(std::vector<std::vector<unsigned char> >&); void LoadRawVideo(std::vector<std::vector<std::vector<unsigned char> > >&); void OneD_Block_DCT(std::vector<std::vector<unsigned char> >&,std::vector<std::vector<double> >&); void OneD_Block_IDCT(std::vector<std::vector<double> >&,std::vector<std::vector<unsigned char> >&); void Quantization(std::vector<std::vector<double> >&,const int); void IQuantization(std::vector<std::vector<double> >&,const int); void NextFrame(std::vector<std::vector<std::vector<unsigned char> > >&,std::vector<std::vector<unsigned char> >&,unsigned int); void ME(std::vector<std::vector<unsigned char> >&,std::vector<std::vector<unsigned char> >&,int,unsigned int); void MC(std::vector<std::vector<unsigned char> >&,std::vector<std::vector<unsigned char> >&); void SubImage(std::vector<std::vector<unsigned char> > &src1,std::vector<std::vector<unsigned char> > &src2,std::vector<std::vector<unsigned char> > &dst) { for(size_t i = 0;i < src1.size();++i){ for(size_t j = 0;j < src1[i].size();++j){ dst[i][j] = limit(src1[i][j] - src2[i][j]); } } } void AddImage(std::vector<std::vector<unsigned char> > &src1,std::vector<std::vector<unsigned char> > src2,std::vector<std::vector<unsigned char> > dst) { for(size_t i = 0;i < src1.size();++i){ for(size_t j = 0;j < src1[i].size();++j){ dst[i][j] = limit(src1[i][j] + src2[i][j]); } } } inline unsigned int TotalFrame(){return total_frame;} inline double PSNRComputing(std::vector<std::vector<unsigned char> > &origin_image,std::vector<std::vector<unsigned char> > &idct) { double mse = 0,psnr = 0; for(int i = 0;i < raw_width;i++){ for(int j = 0;j < raw_height;j++){ mse += (origin_image[i][j] - idct[i][j]) * (origin_image[i][j] - idct[i][j]); } } if(mse != 0){ mse /= raw_width * raw_height; psnr = 10 * std::log10((255 * 255) / mse); } else{ psnr = 999999; } //std::cout << "PSNR : " << psnr << " dB" << std::endl; return psnr; } inline double C(double value) { return (value == 0)?1.0f/std::sqrt(2.0f):1.0f; } inline double limit(double value) { return (value < 0)?0:(value > 255)?255:value; } private: std::string path; unsigned int raw_width,raw_height; unsigned int block_size; unsigned int total_frame; std::vector< std::pair<int,int> > MV; /* std::vector<std::vector<unsigned char> > origin_image; std::vector<std::vector<double> > dct; std::vector<std::vector<unsigned char> > idct; std::vector<std::vector<std::vector<unsigned char> > > video; */ }; #endif
// Copyright (C) 2002-2011 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #ifndef __I_OS_OPERATOR_H_INCLUDED__ #define __I_OS_OPERATOR_H_INCLUDED__ #include "IReferenceCounted.h" #include "irrString.h" namespace irr { //! The Operating system operator provides operation system specific methods and informations. class IOSOperator : public virtual IReferenceCounted { public: //! Get the current operation system version as string. virtual const core::stringc& getOperatingSystemVersion() const = 0; //! Get the current operation system version as string. /** \deprecated Use getOperatingSystemVersion instead. This method will be removed in Irrlicht 1.9. */ _IRR_DEPRECATED_ const wchar_t* getOperationSystemVersion() const { return core::stringw(getOperatingSystemVersion()).c_str(); } //! Copies text to the clipboard virtual void copyToClipboard(const c8* text) const = 0; //! Get text from the clipboard /** \return Returns 0 if no string is in there. */ virtual const c8* getTextFromClipboard() const = 0; //! Get the processor speed in megahertz /** \param MHz The integer variable to store the speed in. \return True if successful, false if not */ virtual bool getProcessorSpeedMHz(u32* MHz) const = 0; //! Get the total and available system RAM /** \param Total: will contain the total system memory \param Avail: will contain the available memory \return True if successful, false if not */ virtual bool getSystemMemory(u32* Total, u32* Avail) const = 0; }; } // end namespace #endif
//https://code.google.com/p/nya-engine/ #pragma once //write_to_buf return used size or 0 if failed //to_data size should be allocated with enough size #include <vector> #include <string> #include <stddef.h> #include "math/vector.h" #include "math/quaternion.h" namespace nya_formats { struct nms { unsigned int version; struct chunk_info { unsigned int type; unsigned int size; const void *data; }; enum section_type { mesh_data, skeleton, materials }; std::vector<chunk_info> chunks; nms(): version(0) {} public: bool read_chunks_info(const void *data,size_t size); public: struct header { unsigned int version; unsigned int chunks_count; }; static size_t read_header(header &out_header,const void *data,size_t size=nms_header_size); static size_t read_chunk_info(chunk_info &out_chunk_info,const void *data,size_t size); public: size_t get_nms_size(); size_t write_to_buf(void *to_data,size_t to_size); //to_size=get_nms_size() public: static size_t write_header_to_buf(unsigned int chunks_count,void *to_data,size_t to_size=nms_header_size) { header h; h.version=latest_version,h.chunks_count=chunks_count; return write_header_to_buf(h,to_data,to_size); } static size_t write_header_to_buf(const header &h,void *to_data,size_t to_size=nms_header_size); static size_t get_chunk_write_size(size_t chunk_data_size); static size_t write_chunk_to_buf(const chunk_info &chunk,void *to_data,size_t to_size); //to_size=get_chunk_size() public: const static size_t nms_header_size=16; const static unsigned int latest_version=2; }; struct nms_mesh_chunk { enum el_type { pos, normal, color, tc0=100 }; enum vertex_atrib_type { float16, float32, uint8 }; enum ind_size { no_indices=0, index2b=2, index4b=4 }; struct element { unsigned int type; unsigned int dimension; unsigned int offset; vertex_atrib_type data_type; std::string semantics; element(): type(0),dimension(0),offset(0),data_type(float32) {} }; enum draw_element_type { triangles, triangle_strip, points, lines, line_strip }; struct group { nya_math::vec3 aabb_min; nya_math::vec3 aabb_max; std::string name; unsigned int material_idx; unsigned int offset; unsigned int count; draw_element_type element_type; group(): material_idx(0),offset(0),count(0),element_type(triangles) {} }; struct lod { std::vector<group> groups; }; nya_math::vec3 aabb_min; nya_math::vec3 aabb_max; std::vector<element> elements; unsigned int verts_count; unsigned int vertex_stride; const void *vertices_data; ind_size index_size; unsigned int indices_count; const void *indices_data; std::vector<lod> lods; public: nms_mesh_chunk(): verts_count(0),vertex_stride(0),vertices_data(0), index_size(no_indices),indices_count(0),indices_data(0) {} public: size_t read_header(const void *data,size_t size,int version); //0 if invalid public: size_t get_chunk_size() const { return write_to_buf(0,0); } size_t write_to_buf(void *to_data,size_t to_size) const; }; struct nms_material_chunk { struct texture_info { std::string semantics; std::string filename; }; struct string_param { std::string name; std::string value; }; struct vector_param { std::string name; nya_math::vec4 value; }; struct int_param { std::string name; int value; int_param(): value(0) {} }; struct material_info { std::string name; std::vector<texture_info> textures; std::vector<string_param> strings; std::vector<vector_param> vectors; std::vector<int_param> ints; public: void add_texture_info(const char *semantics,const char *filename,bool unique=true); void add_string_param(const char *name,const char *value,bool unique=true); void add_vector_param(const char *name,const nya_math::vec4 &value,bool unique=true); void add_int_param(const char *name,int value,bool unique=true); }; std::vector<material_info> materials; public: bool read(const void *data,size_t size,int version); public: size_t get_chunk_size() const { return write_to_buf(0,0); } size_t write_to_buf(void *to_data,size_t to_size) const; }; struct nms_skeleton_chunk { struct bone { std::string name; nya_math::quat rot; nya_math::vec3 pos; int parent; bone(): parent(-1) {} }; std::vector<bone> bones; public: void sort(); int get_bone_idx(const char *name) const; public: bool read(const void *data,size_t size,int version); public: size_t get_chunk_size() const { return write_to_buf(0,0); } size_t write_to_buf(void *to_data,size_t to_size) const; }; }
// // 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 "DVTInvalidation-Protocol.h" @class DVTBorderedView, DVTObservingToken, DVTStackBacktrace, DVTTextCompletionSession, DVTTextCompletionWindowResizeAnimation, DVTViewController<DVTInvalidation>, NSDictionary, NSScrollView, NSString, NSTableColumn, NSTableView, NSTextField, NSViewAnimation; @interface DVTTextCompletionListWindowController : NSWindowController <DVTInvalidation, NSTableViewDataSource, NSTableViewDelegate, NSAnimationDelegate> { NSTextField *_messagesField; NSTableView *_completionsTableView; NSTableColumn *_iconColumn; NSTableColumn *_typeColumn; NSTableColumn *_titleColumn; NSScrollView *_completionsScrollView; DVTBorderedView *_quickHelpView; DVTBorderedView *_divider; NSTextField *completionUserText; NSTextField *fuzzyCompletionDivider; DVTTextCompletionSession *_session; struct CGRect _referenceFrameInView; DVTTextCompletionWindowResizeAnimation *_resizeAnimation; NSViewAnimation *_fadeOutAnimation; DVTObservingToken *_sessionCompletionsObserver; DVTObservingToken *_sessionSelectionObserver; NSDictionary *_selectedTitleCellAttributes; NSDictionary *_selectedTypeCellAttributes; DVTViewController *_infoContentViewController; int _hideReason; BOOL _showingWindow; BOOL _shouldIgnoreSelectionChange; BOOL _quickHelpOnTop; BOOL _showingAboveText; BOOL _completionsOnTop; BOOL _completionSelectionHasQuickView; float _completionLabelPadding; float _titleOriginX; int _previousMode; DVTBorderedView *_contentView; NSTableColumn *_leftPaddingColumn; struct CGSize _completionsTextSize; } + (id)_nonSelectedTypeColor; + (id)_nonSelectedTitleColor; + (void)initialize; @property __weak NSTableColumn *leftPaddingColumn; // @synthesize leftPaddingColumn=_leftPaddingColumn; @property __weak DVTBorderedView *contentView; // @synthesize contentView=_contentView; @property int previousMode; // @synthesize previousMode=_previousMode; @property float titleOriginX; // @synthesize titleOriginX=_titleOriginX; @property BOOL completionSelectionHasQuickView; // @synthesize completionSelectionHasQuickView=_completionSelectionHasQuickView; @property BOOL completionsOnTop; // @synthesize completionsOnTop=_completionsOnTop; @property float completionLabelPadding; // @synthesize completionLabelPadding=_completionLabelPadding; @property struct CGSize completionsTextSize; // @synthesize completionsTextSize=_completionsTextSize; @property BOOL showingAboveText; // @synthesize showingAboveText=_showingAboveText; @property(nonatomic) int hideReason; // @synthesize hideReason=_hideReason; @property(readonly) DVTTextCompletionSession *session; // @synthesize session=_session; @property(readonly) BOOL showingWindow; // @synthesize showingWindow=_showingWindow; @property(readonly) NSScrollView *completionsScrollView; // @synthesize completionsScrollView=_completionsScrollView; @property(readonly) NSString *debugStateString; - (id)tableView:(id)arg1 toolTipForCell:(id)arg2 rect:(struct CGRect *)arg3 tableColumn:(id)arg4 row:(long long)arg5 mouseLocation:(struct CGPoint)arg6; - (void)tableView:(id)arg1 willDisplayCell:(id)arg2 forTableColumn:(id)arg3 row:(long long)arg4; - (void)tableViewSelectionDidChange:(id)arg1; - (id)tableView:(id)arg1 objectValueForTableColumn:(id)arg2 row:(long long)arg3; - (long long)numberOfRowsInTableView:(id)arg1; - (void)_updateInfoNewSelection; - (BOOL)showInfoForSelectedCompletionItem; - (id)_selectedCompletionItem; - (void)showInfoPaneForCompletionItem:(id)arg1; - (void)close; - (void)_loadColorsFromCurrentTheme; - (void)_themeColorsChanged:(id)arg1; - (id)_notRecommendedAttributes; - (id)_usefulPrefixAttributes; - (id)_messageTextAttributes; - (struct CGRect)_preferredWindowFrameForTextFrame:(struct CGRect)arg1 columnsWidth:(double *)arg2 titleColumnX:(double)arg3; - (void)_getTitleColumnWidth:(double *)arg1 typeColumnWidth:(double *)arg2; - (void)_updateSelectedRow; - (void)_updateCurrentDisplayState; - (void)_updateCurrentDisplayStateForQuickHelp; - (void)hideFuzzyCompletionElements; - (void)completionsOnTopIsNo; - (void)completionsOnTopIsYes; - (void)_startDelayedAnimation; - (void)_doubleClickOnRow:(id)arg1; - (void)animationDidEnd:(id)arg1; - (void)animationDidStop:(id)arg1; - (void)hideWindowWithReason:(int)arg1; - (void)_hideWindow; - (void)showWindowForTextFrame:(struct CGRect)arg1 explicitAnimation:(BOOL)arg2; - (void)primitiveInvalidate; - (void)dealloc; - (void)windowDidLoad; - (id)initWithSession:(id)arg1; - (id)window; // Remaining properties @property(retain) DVTStackBacktrace *creationBacktrace; @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) DVTStackBacktrace *invalidationBacktrace; @property(readonly) Class superclass; @property(readonly, nonatomic, getter=isValid) BOOL valid; @end
/* Copyright (c) 2013 Pauli Nieminen <suokkos@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #include <QQuickItem> class MouseEvent; class GlobalMouseAreaPrivate; class GlobalMouseArea : public QQuickItem { Q_OBJECT Q_PROPERTY(bool containsMouse READ containsMouse NOTIFY containsMouseChanged) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged) public: explicit GlobalMouseArea(QQuickItem *parent = 0); ~GlobalMouseArea(); bool enabled() const; bool containsMouse() const; bool hoverEnabled() const; Qt::MouseButtons pressed() const; void setEnabled(bool); void setHoverEnabled(bool h); signals: void enabledChanged(); void containsMouseChanged(); void hoverEnabledChanged(); void pressed(MouseEvent *mouse); void released(MouseEvent *mouse); void doubleClicked(MouseEvent *mouse); void positionChanged(MouseEvent *mouse); public slots: protected: void setContainsMouse(bool v); bool setPressed(QPointF &pos, Qt::MouseButton button, bool v); bool sendMouseEvent(QMouseEvent *event); virtual void mousePressEvent(QMouseEvent *event); virtual void mouseReleaseEvent(QMouseEvent *event); virtual void mouseDoubleClickEvent(QMouseEvent *event); virtual void mouseMoveEvent(QMouseEvent *event); virtual void mouseUngrabEvent(); virtual void hoverEnterEvent(QHoverEvent *event); virtual void hoverMoveEvent(QHoverEvent *event); virtual void hoverLeaveEvent(QHoverEvent *event); virtual bool childMouseEventFilter(QQuickItem *i, QEvent *e); virtual void windowDeactivateEvent(); virtual void itemChange(ItemChange change, const ItemChangeData& value); virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *); private: void handlePress(); void handleRelease(); void ungrabMouse(); class GlobalMouseAreaPrivate *d; };
// // WeatherNowItemView.h // WeatherDemo // // Created by Kireto on 8/9/14. // Copyright (c) 2014 No Name. All rights reserved. // #import <UIKit/UIKit.h> @class AirportModel; @class WeatherModel; @interface WeatherNowItemView : UIView - (void)customizeForAirport:(AirportModel*)airport andWeather:(WeatherModel*)weatherModel; @end
// // SAButton.h // CoolSnail // // Created by quqi on 15/10/10. // Copyright © 2015年 牵着蜗牛走的我. All rights reserved. // #import <UIKit/UIKit.h> @interface SAButton : UIButton @end
#ifndef SCOPEGRAPH_AGENT_BASE_H__ #define SCOPEGRAPH_AGENT_BASE_H__ #include <cohear/Sender.h> #include <cohear/Receiver.h> namespace sg { namespace detail { class AgentBase { public: AgentBase() { _sender.registerSlot(_agendAdded); } void connect(AgentBase& other) { getSender().connect(other.getReceiver()); other.getSender().connect(getReceiver()); } void disconnect(AgentBase& other) { getSender().disconnect(other.getReceiver()); other.getSender().disconnect(getReceiver()); } chr::Receiver& getReceiver() { return _receiver; } chr::Sender& getSender() { return _sender; } /** * Called by scopes after the agent has been connected to them. */ void introduceAs(std::shared_ptr<AgentBase> agent) { AgentAdded signal(agent); _agendAdded(signal); } private: chr::Receiver _receiver; chr::Sender _sender; chr::Slot<AgentAdded> _agendAdded; }; } // namespace detail } // namespace sg #endif // SCOPEGRAPH_AGENT_BASE_H__
/* * PlayDirector.h * * Created on: 12.5.2015 * Author: mikko */ #ifndef PLAYDIRECTOR_H_ #define PLAYDIRECTOR_H_ #include "Stage.h" #include "Robot.h" #include "Script.h" #include "MVision.h" #include "ArduinoConnection.h" #include <thread> class PlayDirector { Script* script; Stage* stage; MVision* mvision; ArduinoConnection* ard; bool tracking; void executeCommand(ScriptCommand *cmd); // void test(); void trackRobot(Robot* r); public: PlayDirector(); void setArduinoConnection(ArduinoConnection* c); void setMVision(MVision* v); void executeScript(); void executeScript(string script); void startSession(int connection); void setScript(string script); void setScript(Script* script); void setStage(Stage* s); bool sendRobotLocation(Robot* r); bool sendAllRobotLocations(); Stage* getStage(); bool directRobotTo(string robot_id, StagePoint p); bool directRobotTo(string robot_id, string target_id); void test(); }; #endif /* PLAYDIRECTOR_H_ */
@interface MyClassControll : NSObject <SomeProtocol> @property(nonatomic, strong) IBOutlet UILabel *label; - (void)fuga; @end
// // RDThomas.h // Thomas // // Created by lihui on 2017/1/5. // Copyright © 2017年 org.richard. All rights reserved. // #import <Foundation/Foundation.h> #import "RDMacros.h" //! Project version number for RDSysUrlSchemeSession. FOUNDATION_EXPORT double RDSysUrlSchemeSessionVersionNumber; //! Project version string for RDSysUrlSchemeSession. FOUNDATION_EXPORT const unsigned char RDSysUrlSchemeSessionVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <RDSysUrlSchemeSession/PublicHeader.h> /// open wifi page (无线网络) RD_EXPORT NSString *const RDSysPageWifi; /// open about page (蓝牙) RD_EXPORT NSString *const RDSysPageBluetooth; /// open hotsopt page (个人热点) RD_EXPORT NSString *const RDSysPageHotspot; /// open about page RD_EXPORT NSString *const RDSysPageAbout; /// open General(通用) RD_EXPORT NSString *const RDSysPageGeneral; /// open Cellular(蜂窝移动) RD_EXPORT NSString *const RDSysPageCellular; /// open iCloud RD_EXPORT NSString *const RDSysPage_iCloud; /// open iCloud strorage RD_EXPORT NSString *const RDSysPage_iCloudStorage; /// open app store RD_EXPORT NSString *const RDSysPageStore; /// open notification(通知) RD_EXPORT NSString *const RDSysPageNotification; /// open DISPLAY (显示) RD_EXPORT NSString *const RDSysPageDisplay; /// open Location (位置) RD_EXPORT NSString *const RDSysPageLocation; /// open Keyboard(键盘) RD_EXPORT NSString *const RDSysPageKeyboard; /// open DateTime(日期时间) RD_EXPORT NSString *const RDSysPageDateTime; /// open VPN RD_EXPORT NSString *const RDSysPageVPN; /// open Phone(电话) RD_EXPORT NSString *const RDSysPagePhone; /// open Sounds(声音) RD_EXPORT NSString *const RDSysPageSounds; /// open Photos(照片) RD_EXPORT NSString *const RDSysPagePhotos; /// open Wallpaper(壁纸) RD_EXPORT NSString *const RDSysPageWallpaper; /// open BATTERY_USAGE(电池设置) RD_EXPORT NSString *const RDSysPageBATTERY; /// open ACCESSIBILITY(辅助功能) RD_EXPORT NSString *const RDSysPageACCESSIBILITY; /// open iOS SoftwareUpdate(iOS 更新) RD_EXPORT NSString *const RDSysPageSysUpdate; @interface RDThomas : NSObject /** <#Description#> @param aPageName <#aPageName description#> @param aCompletion <#aCompletion description#> */ + (void)openPage:(NSString *)aPageName completionHandler:(void (^)(BOOL aSuccess))aCompletion; + (void)openOwnSettingsPageWith:(void (^)(BOOL aSuccess))aCompletion; @end
// // DDPSMBFileHashCache.h // DanDanPlayForiOS // // Created by JimHuang on 2017/11/21. // Copyright © 2017年 JimHuang. All rights reserved. // #import "DDPBase.h" @interface DDPSMBFileHashCache : DDPBase @property (copy, nonatomic) NSString *key; @property (copy, nonatomic) NSString *md5; @property (strong, nonatomic) NSDate *date; @end
// -*- C++ -*- //$Id: config-borland-common.h 79134 2007-07-31 18:23:50Z johnnyw $ // The following configuration file contains defines for Borland compilers. #ifndef ACE_CONFIG_BORLAND_COMMON_H #define ACE_CONFIG_BORLAND_COMMON_H #include /**/ "ace/pre.h" #define ACE_HAS_CUSTOM_EXPORT_MACROS #define ACE_Proper_Export_Flag __declspec (dllexport) #define ACE_Proper_Import_Flag __declspec (dllimport) #define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T #define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE<CLASS, LOCK>; #define ACE_IMPORT_SINGLETON_DECLARATION(T) template class __declspec (dllimport) T #define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllimport) SINGLETON_TYPE <CLASS, LOCK>; # if (__BORLANDC__ == 0x540) // The linker in C++Builder 4 has trouble with the large number of DLL // function exports created when you compile without inline functions. // Therefore we will always use inline functions with this version of // the compiler. # if defined (__ACE_INLINE__) # undef __ACE_INLINE__ # endif /* __ACE_INLINE__ */ # define __ACE_INLINE__ 1 # else /* __BORLANDC__ == 0x540 */ // In later versions of C++Builder we will prefer inline functions by // default. The debug configuration of ACE is built with functions // out-of-line, so when linking your application against a debug ACE // build, you can choose to use the out-of-line functions by adding // ACE_NO_INLINE=1 to your project settings. # if !defined (__ACE_INLINE__) # define __ACE_INLINE__ 1 # endif /* __ACE_INLINE__ */ # endif /* __BORLANDC__ == 0x540 */ # define ACE_CC_NAME ACE_TEXT ("Borland C++ Builder") # define ACE_CC_MAJOR_VERSION (__BORLANDC__ / 0x100) # define ACE_CC_MINOR_VERSION (__BORLANDC__ % 0x100) # define ACE_CC_BETA_VERSION (0) # define ACE_CC_PREPROCESSOR_ARGS "-q -P- -o%s" # define ACE_EXPORT_NESTED_CLASSES 1 # define ACE_HAS_CPLUSPLUS_HEADERS 1 # define ACE_HAS_EXCEPTIONS # define ACE_HAS_GNU_CSTRING_H 1 # define ACE_HAS_NONCONST_SELECT_TIMEVAL # define ACE_HAS_SIG_ATOMIC_T # define ACE_HAS_STANDARD_CPP_LIBRARY 1 # define ACE_HAS_STDCPP_STL_INCLUDES 1 # define ACE_HAS_STRERROR # define ACE_HAS_STRING_CLASS 1 # define ACE_HAS_TEMPLATE_SPECIALIZATION 1 # define ACE_HAS_TEMPLATE_TYPEDEFS 1 # define ACE_HAS_USER_MODE_MASKS 1 # define ACE_LACKS_ACE_IOSTREAM 1 # define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 # define ACE_LACKS_STRPTIME 1 # if (__BORLANDC__ < 0x590) # define ACE_LACKS_PLACEMENT_OPERATOR_DELETE 1 # endif # define ACE_LACKS_PRAGMA_ONCE 1 # define ACE_HAS_NEW_NOTHROW # define ACE_TEMPLATES_REQUIRE_SOURCE 1 # define ACE_SIZEOF_LONG_DOUBLE 10 # define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%Lu") # define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%Ld") # define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 # define ACE_USES_STD_NAMESPACE_FOR_STDC_LIB 0 # define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) # define ACE_LACKS_SWAB #include /**/ "ace/post.h" #endif /* ACE_CONFIG_BORLAND_COMMON_H */
#ifndef _IMPORTERMATERIAL_H_ #define _IMPORTERMATERIAL_H_ #include "Importer.h" #include <string> namespace ImporterMaterial { bool Import(const char* file_name, std::string& output); bool Load(const char* file_name, int * texture); }; #endif // !
/* * frame.h * * Created on: Feb 18, 2017 * Author: Brian Schnepp * License: See 'LICENSE' in root of this repository. */ #ifndef FRAME_H_ #define FRAME_H_ #include "PfInstance.h" #include "component.h" #include <string> #include <X11/Xlib.h> #include <xcb/xcb.h> /** * Base class for a frame on Pathfinder * You must create a PfInstance first, then bind this frame to it. You should __not__ need to call AssignInstance. */ namespace PathDraw { class PfInstance; class Frame: public Component { public: Frame(); Frame(std::string title); virtual ~Frame(); /** Sets the size of the frame in pixels. */ void SetSize(unsigned int w, unsigned int h); /** Sets the position on the screen of the frame. */ void SetPos(uint16_t x, uint16_t y); /** Sets the border width of this frame. */ void SetBorderWidth(int w); /** Gets the width of this frame. */ int GetWidth(); /** Gets the height of this frame. */ int GetHeight(); /** Gets the X-coodinate of this frame */ int GetPosX(); /** Gets the Y-coordinate of this frame. */ int GetPosY(); /** Gets the border width of this frame */ int GetBorderWidth(); /** Gets the currently used instance by this frame. */ PfInstance* GetInstance(); /** Gets the window object... */ uint32_t GetWindow(); /** Sets up whatever it needs, then actually creates/displays the window.*/ void CreateFrame(); /* Sets the title of the frame to something else. */ void SetTitle(char const* newTitle); //Something's wrong with G++ here, so... protected: uint32_t frame; std::string title; PfInstance* instance; private: int bwidth; }; } #endif /* FRAME_H_ */
#include <stdio.h> #include <unistd.h> #include <string.h> #include <sys/socket.h> #include <bluetooth/bluetooth.h> #include <bluetooth/l2cap.h> int main(int argc, char **argv) { struct sockaddr_l2 loc_addr = { 0 }, rem_addr = { 0 }; char buf[1024] = { 0 }; int s, client, bytes_read; unsigned int opt = sizeof(rem_addr); // allocate socket s = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP); // bind socket to port 0x1001 of the first available // bluetooth adapter loc_addr.l2_family = AF_BLUETOOTH; loc_addr.l2_bdaddr = *BDADDR_ANY; loc_addr.l2_psm = htobs(0x1001); bind(s, (struct sockaddr *)&loc_addr, sizeof(loc_addr)); // put socket into listening mode listen(s, 1); // accept one connection client = accept(s, (struct sockaddr *)&rem_addr, &opt); ba2str( &rem_addr.l2_bdaddr, buf ); fprintf(stderr, "accepted connection from %s\n", buf); // read data from the client memset(buf, 0, sizeof(buf)); bytes_read = recv(client, buf, sizeof(buf), 0); if( bytes_read > 0 ) { printf("received [%s]\n", buf); } // close connection close(client); close(s); return 0; }
/* Fibonacci number generation The program takes an input N from the command line It uses a non-recursive technique to generate the value of N Checks for conditions mentioned in the coding challenge. */ #include <stdio.h> #include <stdlib.h> #include <math.h> // Checks if a number is prime int isPrime(long long n){ if(n < 2){ return 0; } else if(n == 2){ return 1; } else if(n % 2){ return 0; } else{ for(long long i = 3; i < n; i += 2){ if(n % i == 0){ return 0; } } } return 1; } // Generate N fibonacci numbers void fibonacci(unsigned long long n){ long long a = 0, b = 1, c = 0; printf("%llu\n", a); printf("%llu\n", b); for(long long i = 2; i < (n + 1); i++){ c = a + b; a = b; b = c; if(c % 3 == 0 && c % 5 == 0){ printf("FizzBuzz\n"); } else if(c % 3 == 0){ printf("Buzz\n"); } else if(c % 5 == 0){ printf("Fizz\n"); } else if(isPrime(c) == 1){ printf("BuzzFizz\n"); } else{ printf("%llu\n", c); } } } int main(int argc, char *argv[]){ if(argc < 2){ printf("Program expects the value of N"); return -1; } long long n = strtoul(argv[1], NULL, 10); fibonacci(n); return 0; }
#include <linux/module.h> #include <linux/init.h> MODULE_LICENSE("Dual MIT/GPL"); static int symple_driver_init(void) { printk(KERN_ALERT "driver loaded\n"); return 0; } static void simple_driver_exit(void) { printk(KERN_ALERT "driver unloaded\n"); } module_init(symple_driver_init); module_exit(simple_driver_exit);
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "UITextField.h" @interface PUOffsetTextField : UITextField { } - (struct CGRect)editingRectForBounds:(struct CGRect)arg1; @end
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "bplustree.h" #include "pdfindex.h" #include "pdfmem.h" #include "pdfread.h" #include "pdffilter.h" #include "pdfdoc.h" extern pdf_parser *parser_inst; pdf_map * pdf_map_create() { pdf_map * m = pdf_malloc(sizeof(pdf_map)); if (m) memset(m, 0, sizeof(pdf_map)); return m; } void pdf_map_delete(pdf_map *m) { pdf_map *t = m; while (m) { t = m->next; pdf_free(m); m = t; } } pdf_map * pdf_map_insert(int n, int gen) { pdf_map * m = parser_inst->map; while (m->generation != gen) { if (!m->next) { m->next = pdf_map_create(); m->next->generation = gen; } m = m->next; } if (!m) { m = pdf_map_create(); } if (!m->head) { m->head = bpt_new_tree(n); } return m; } pdf_map * pdf_map_find(int gen) { pdf_map *m = parser_inst->map; while (m) { if (m->generation == gen) return m; else m = m->next; } return m; } int pdf_obj_insert(int n, int gen, void *d) { pdf_map *m = pdf_map_insert(n, gen); pdf_obj *o = NULL; if (o = pdf_obj_find(n, gen)) { char buf[128]; sprintf(buf, "Duplicated object (%d,%d) is found, old one is removed!\n", n, gen); DMSG(buf); pdf_obj_delete(o); pdf_free(o); } bpt_insert(m->head, n, d); return 0; } pdf_obj * pdf_obj_find(int n, int gen) { pdf_map *m = pdf_map_find(gen); return (pdf_obj*)bpt_search(m->head, n); } void pdf_obj_walk() { pdf_map * m = parser_inst->map;//&a_pdf_map; for (;m; m = m->next) { bpt_walk(m->head, NULL); } } void free_array(pdf_obj *o) { if (o && o->t == eArray) { int i; for (i = 0; i < o->value.a.len; i++) { pdf_obj_delete(&o->value.a.items[i]); } if (o->value.a.len) pdf_free(o->value.a.items); //else if (o->value.a.items) // pdf_free(o->value.a.items); } } // Remove a single obj void pdf_obj_delete(pdf_obj *o) { if (!o) return; switch(o->t) { case eDict: dict_free(o->value.d.dict); break; case eString: case eHexString: pdf_free(o->value.s.buf); break; case eName: #ifndef HASHMAP pdf_free(o->value.k); #endif break; case eArray: free_array(o); break; default: break; } } void pdf_obj_free() { pdf_map * m = parser_inst->map;//&a_pdf_map; pdf_map *i = m; if (!parser_inst && !parser_inst->map) return; for (; i != 0; i = i->next) { /* delete obj tree nodes */ bpt_delete_node(i->head, (leaf_action)pdf_obj_delete); } i = m; for (; i!=0; i=i->next) { /* delete obj tree */ bpt_destroy(i->head); pdf_free(i->head); } } int pdf_obj_count() { int c = 0; pdf_map * i = parser_inst->map; for (; i!=0; i=i->next) { c += bpt_count_leaf(i->head); } return c; }
/* Write a program to read two floating point number and find the sum of it's squares and print it. */ #include <stdio.h> int main () { float a, b, sum; printf("Enter any two floating numbers: "); scanf("%f %f", &a, &b); sum = (a * a) + (b * b); printf("The sum of squares of %.2f and %.2f is %.2f\n", a, b, sum); return 0; }
#pragma once class cMapController : public common::cObservable2 ,public common::cSingleton<cMapController> { public: cMapController(void); ~cMapController(void); bool CreateDefaultTerrain(); bool LoadTRNFile(const string &fileName); bool LoadHeightMap(const string &fileName); bool LoadHeightMapTexture(const string &fileName); bool SaveTRNFile(const string &fileName); graphic::cTerrainEditor& GetTerrain(); graphic::cTerrainCursor& GetTerrainCursor(); const string& GetHeightMapFileName(); const string& GetTextureFileName(); void BrushTerrain(CPoint point, const float elapseT); void BrushTexture(CPoint point); void UpdateBrush(); void UpdateSplatLayer(); void UpdateHeightFactor(const float heightFactor); void UpdatePlaceModel(); void SendNotifyMessage(const NOTIFY_TYPE::TYPE type); void ChangeEditMode(EDIT_MODE::TYPE mode); EDIT_MODE::TYPE GetEditMode() const; private: graphic::cTerrainEditor m_terrain; graphic::cTerrainCursor m_cursor; string m_textFileName; EDIT_MODE::TYPE m_editMode; }; inline graphic::cTerrainEditor& cMapController::GetTerrain() { return m_terrain; } inline graphic::cTerrainCursor& cMapController::GetTerrainCursor() { return m_cursor; } inline const string& cMapController::GetHeightMapFileName() { return m_terrain.GetHeightMapFileName(); } inline const string& cMapController::GetTextureFileName() { return m_textFileName; } inline EDIT_MODE::TYPE cMapController::GetEditMode() const { return m_editMode; }
/* bit-array.h * Reseni IJC-DU1, priklad a) b), 28.2.2013 * Autor: Michal Kozubik, FIT, xkozub03@stud.fit.vutbr.cz * Prelozeno: gcc 4.7.2 * Hlavickovy soubor s definicemi maker a inline funkci pro praci s bitovym * polem. Vyber maker/inline funkci je realizovan definovanim USE_INLINE pri * prekladu programu */ #ifndef _BIT_ARRAY_H_ #define _BIT_ARRAY_H_ #include "error.h" // Typ bitoveho pole typedef unsigned long BitArray_t[]; /* Vytvoreni bitoveho pole typu BitArray_t. * Pocet polozek BitArray_t[n] nutnych pro praci s polem je vypocitan pomoci * pozadovaneho poctu bitu a sizeof(BitArray_t) (+1 kvuli indexaci od nuly * a +1 kvuli tomu, ze v arr[0] je ulozena informace o velikosti pole) */ #define BitArray(arr, size) unsigned long arr[(size-1L)/(sizeof(unsigned long)*8)+2L] = {0}; \ arr[0]=(unsigned long)size // Navraceni velikosti pole (pocet bitu) #define BitArraySize(arr) (arr[0]) // Ziskani hodnoty bitu na pozici index, pomoci pomocne promenne mask, ktera // je nastavena a pouzita vyuzitim operatoru carka. Neobsahuje kontrolu mezi. #define DU1_GET_BIT_(arr, index) (arr[INX(index, sizeof(arr[0]))]&(1L<<position(index,sizeof(arr[0]))))\ ? 1 : 0 // Nastaveni hodnoty bitu na pozici index, pomoci pomocne promenne mask, ktera // je nastavena a pouzita vyuzitim operatoru carka. Neobsahuje kontrolu mezi. #define DU1_SET_BIT_(arr, index, expr) (expr==0)\ ?(arr[INX(index, sizeof(arr[0]))]&=~(1L<<position(index, sizeof(arr[0]))))\ :(arr[INX(index, sizeof(arr[0]))]|=1L<<position(index, sizeof(arr[0]))) /* Zjisti pozici hledaneho bitu v pouzitem datovem typu (sizeof(BitArray_t)). * Napr. chceme-li 10. bit v poli deklarovanem jako unsigned char, je jeho * pozice rovna 2. bitu v 2. polozce pole => position==1 (idnexace od nuly) */ #define position(index,size) (index-((index/(size*8))*(size*8))) /* Zjisteni indexu pole, ve kterem se nachazi hledany bit. Napr. pro hledani * 10. bitu v poli unsigned charu => INX == 2 (zde jiz neni odexace od nuly), * jelikoz arr[0] je vyhrazeno pro velikost pole */ #define INX(index, size) ((index)/(size*8)+1L) #ifdef USE_INLINE // Pri definovanem makru USE_INLINE pri prekladu // Testovani mezi pole a pripadne chybove hlaseni nebo nastaveni bitu // pres inline funkci static inline void SetBit(BitArray_t arr, unsigned long index, int expr) { if (index < 0 || index >= arr[0]) FatalError("Index %ld mimo rozsah 0..%ld", (long) index, (long) (arr[0] - 1)); DU1_SET_BIT_(arr, index, expr); } // Testovani mezi pole a pripadne chybove hlaseni nebo ziskani hodnoty bitu // pres inline funkci static inline int GetBit(BitArray_t arr, unsigned long index) { if (index < 0 || index >= arr[0]) FatalError("Index %ld mimo rozsah 0..%ld", (long) index, (long) (arr[0] - 1)); return DU1_GET_BIT_(arr, index); } #else // Testovani mezi pole a pripadne chybove hlaseni nebo nastaveni bitu #define SetBit(arr, index, expr) (index<0 || index>=arr[0])\ ?(FatalError("Index %ld mimo rozsah 0..%ld", (long)index, (long)(arr[0]-1)),2)\ :(DU1_SET_BIT_(arr, index, expr)) // Testovani mezi pole a pripadne chybove hlaseni nebo ziskani hodnoty bitu #define GetBit(arr, index) (index<0 || index>=arr[0])\ ?(FatalError("Index %ld mimo rozsah 0..%ld", (long)index, (long)(arr[0]-1)), 2)\ :(DU1_GET_BIT_(arr,index)) #endif #endif
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sts=4 et sw=4 tw=99: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jit_none_MoveEmitter_none_h #define jit_none_MoveEmitter_none_h #include "jit/IonMacroAssembler.h" #include "jit/MoveResolver.h" namespace js { namespace jit { class MoveEmitterNone { public: MoveEmitterNone(MacroAssemblerNone &) { MOZ_CRASH(); } void emit(const MoveResolver &) { MOZ_CRASH(); } void finish() { MOZ_CRASH(); } }; typedef MoveEmitterNone MoveEmitter; } // namespace jit } // namespace js #endif /* jit_none_MoveEmitter_none_h */
// // OpenGLView.h // LearnOpenGLES01 // // Created by 黄维平 on 2017/4/19. // Copyright © 2017年 hwp. All rights reserved. // #import <UIKit/UIKit.h> @interface OpenGLView : UIView @end
/* * heartbeat.h - Heart-beat task SiriDB. * * There is one and only one heart-beat task thread running for SiriDB. For * this reason we do not need to parse data but we should only take care for * locks while writing data. */ #ifndef SIRI_HEARTBEAT_H_ #define SIRI_HEARTBEAT_H_ #include <siri/siri.h> void siri_heartbeat_init(siri_t * siri); void siri_heartbeat_stop(siri_t * siri); void siri_heartbeat_force(void); #endif /* SIRI_HEARTBEAT_H_ */
#include <stdio.h> #include <time.h> // 159.335 assignment 3 // This is a working memory allocation program // but it is slow and uses lots of memory. // Martin Johnson 2000-2014 // the following is fixed by the OS // you are not allowed to change it #define PAGESIZE 4096 // you may want to change the following lines if your // machine is very faster or very slow to get sensible times // but when you submit please put them back to these values. #define NO_OF_POINTERS 2000 #define NO_OF_ITERATIONS 200000 // change the following lines to test the real malloc and free #define MALLOC mymalloc #define FREE myfree // The following ugly stuff is to allow us to measure // cpu time. #h typedef struct { unsigned long l,h; } ti; typedef struct { unsigned long sz,ml,tp,ap,tpg,apg,tv,av; } ms; #ifdef __cplusplus extern "C" { #endif unsigned long * _stdcall VirtualAlloc(void *,unsigned long,unsigned long,unsigned long); int _stdcall VirtualFree(void *,unsigned long,unsigned long); void _stdcall GlobalMemoryStatus(ms *); void * _stdcall GetCurrentProcess(void); unsigned long _stdcall GetVersion(void); int _stdcall GetProcessTimes(void *, ti *,ti *, ti *, ti *); void _stdcall Sleep(unsigned long); #ifdef __cplusplus } #endif //------------------------------------------------------------ struct Node{ int size; struct hearder *prev; struct hearder *next; }header; //------------------------------------------------------------ int cputime(void) { // return cpu time used by current process ti ct,et,kt,ut; if(GetVersion()<0x80000000) { // are we running on recent Windows GetProcessTimes(GetCurrentProcess(),&ct,&et,&kt,&ut); return (ut.l+kt.l)/10000; // include time in kernel } else return clock(); // for very old Windows } int memory(void) { // return memory available to current process ms m; GlobalMemoryStatus(&m); return m.av; } // you are not allowed to change the following function void *allocpages(int n) { // allocate n pages and return start address return VirtualAlloc(0,n * PAGESIZE,4096+8192,4); } // you are not allowed to change the following function int freepages(void *p) { // free previously allocated pages. return VirtualFree(p,0,32768); } //~ void *mymalloc(int n) { // very simple memory allocation //~ void *p; //~ p=allocpages((n/PAGESIZE)+1); //~ if(!p) puts("Failed"); //~ return p; //~ } //------------------------------------------------------------------ void *mymalloc(int n) { if(n==0){ return null; } n=n+sizeof(int); int ns = find_optimal_memory_size(n); } //-------2^k-------------------------------------------------------- static inline int find_optimal_memory_size(int n){ int suitable_size=PAGESIZE; while(suitable_size < n){ suitable_size=suitable_size << 1;// 32 << 1 = 64 } return suitable_size; } //------------------------------------------------------------------- int myfree(void *p) { // very simple free int n; n=freepages(p); if(!n) puts("Failed"); return n; } unsigned seed=7652; int myrand() { // pick a random number seed=(seed*2416+374441)%1771875; return seed; } int randomsize() { // choose the size of memory to allocate int j,k; k=myrand(); j=(k&3)+(k>>2 &3)+(k>>4 &3)+(k>>6 &3)+(k>>8 &3)+(k>>10 &3); j=1<<j; return (myrand() % j) +1; } int main() { int i,k; unsigned char *n[NO_OF_POINTERS]; // used to store pointers to allocated memory int size; int s[5000]; // used to store sizes when testing int start_time; int start_mem; for(i=0;i<NO_OF_POINTERS;i++) { n[i]=0; // initially nothing is allocated } start_time=cputime(); start_mem=memory(); for(i=0;i<NO_OF_ITERATIONS;i++) { k=myrand()%NO_OF_POINTERS; // pick a pointer if(n[k]) { // if it was allocated then free it // check that the stuff we wrote has not changed if(n[k][0]!=(unsigned char)(int)(n[k]+s[k]+k)) printf("Error when checking first byte!\n"); if(s[k]>1 && n[k][s[k]-1]!=(unsigned char)(int)(n[k]-s[k]-k)) printf("Error when checking last byte!\n"); FREE(n[k]); } size=randomsize(); // pick a random size n[k]=(unsigned char *)MALLOC(size); // do the allocation s[k]=size; // remember the size n[k][0]=(unsigned char)(int)(n[k]+s[k]+k); // put some data in the first and if(size>1) n[k][size-1]=(unsigned char)(int)(n[k]-s[k]-k); // last byte } // print some statistics printf("That took %.3f seconds and used %d bytes\n", ((float)(cputime()-start_time))/1000, start_mem-memory()); return 1; }
/* * image_pointcloud_nodelet.h * * Created on: 11.08.2014 * Author: fnolden */ #ifndef SYNC_REMAP_NODELET_H_ #define SYNC_REMAP_NODELET_H_ #include <ros/ros.h> #include <sstream> #include <string.h> #include <map> #include <iostream> #include <functional> #include <image_transport/image_transport.h> #include <tf/transform_broadcaster.h> #include "nodelet/nodelet.h" #include <pcl_ros/point_cloud.h> #include <cv_bridge/cv_bridge.h> #include <opencv/cv.h> #include <eigen3/Eigen/Core> #include <message_filters/subscriber.h> #include <message_filters/synchronizer.h> #include <message_filters/sync_policies/approximate_time.h> #include <sensor_msgs/Image.h> #include <sensor_msgs/PointCloud2.h> #include <dynamic_reconfigure/server.h> #include <image_cloud/sync_remapConfig.h> namespace image_cloud { typedef sensor_msgs::PointCloud2 PointCloud; typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Image, sensor_msgs::CameraInfo, PointCloud> Image_to_cloud_sync; class Remap : public nodelet::Nodelet { typedef image_cloud::sync_remapConfig Config; typedef dynamic_reconfigure::Server<Config> ReconfigureServer; public: virtual void onInit(); virtual ~Remap(); virtual void callback(const sensor_msgs::ImageConstPtr& input_msg_image, const sensor_msgs::CameraInfoConstPtr &input_msg_image_info, const PointCloud::ConstPtr &input_msg_cloud); virtual void reconfigure_callback(Config &config, uint32_t level); virtual void init_params(); virtual void init_sub(); virtual void init_pub(); virtual void params(); private: boost::shared_ptr<ReconfigureServer> reconfigure_server_; boost::shared_ptr<message_filters::Subscriber<PointCloud> > image_sub2; boost::shared_ptr<message_filters::Subscriber<sensor_msgs::Image> > image_sub; boost::shared_ptr<message_filters::Subscriber<sensor_msgs::CameraInfo> > image_info_sub; boost::shared_ptr<message_filters::Synchronizer<Image_to_cloud_sync> > sync; boost::shared_ptr<image_transport::ImageTransport> it_; ros::Publisher pub_image2_; ros::Publisher pub_image_info_; image_transport::Publisher pub_image_; std::string node_name_; boost::mutex config_lock_; Config config_; ros::NodeHandle nh_; }; } /* end namespace */ #endif /* SYNC_REMAP_NODELET_H_ */
// // SBUIMenuLogoController.h // slingball // // Created by Jacob Hauberg Hansen on 2/26/10. // Copyright 2010 Novasa Interactive. All rights reserved. // #import <Foundation/Foundation.h> #import "SBUIMenuController.h" @interface SBUIMenuLogoController : SBUIMenuController { } @end
#pragma once #include <reflectionzeug/base/template_helpers.h> #include <reflectionzeug/property/PropertySignedIntegral.h> #include <reflectionzeug/property/PropertyUnsignedIntegral.h> #include <reflectionzeug/property/PropertyFloatingPoint.h> #include <reflectionzeug/property/PropertyBool.h> #include <reflectionzeug/property/PropertyString.h> #include <reflectionzeug/property/PropertyColor.h> #include <reflectionzeug/property/PropertyFilePath.h> #include <reflectionzeug/property/PropertyArray.h> #include <reflectionzeug/property/PropertyEnum.h> #include <reflectionzeug/property/AbstractVisitor.h> namespace reflectionzeug { /** * @brief * Class to throw compiler errors */ template <typename T> class PropertyError; /** * @brief * Class to recognize unsupported property types */ template <typename T> class UnsupportedPropertyType : public AbstractTypedProperty<T> { public: /* If you got here from a compiler error, you have tried to instanciate a property for an unsupported type. Please create your own property extension class for the unsupported type by inheriting from AbstractTypedProperty<DataType> (and any matching abstract interfaces), and provide a specialization of PropertTypeSelector<DataType> with using Type = DataType; */ PropertyError<T> error; public: template <typename... Args> UnsupportedPropertyType(Args&&... /*args*/) { } virtual ~UnsupportedPropertyType() { } virtual std::string toString() const { return ""; } virtual bool fromString(const std::string & /*string*/) { return false; } }; /** * @brief * Helper class for selecting property types * * Specialize this class template to register a new property type. * Define the property class that you want to use as typedef Type. */ template <typename T, typename = void> struct PropertyTypeSelector { using Type = UnsupportedPropertyType<T>; }; /** * @brief * Property selector for properties of type bool */ template <> struct PropertyTypeSelector<bool> { using Type = PropertyBool; }; /** * @brief * Property selector for properties of type Color */ template <> struct PropertyTypeSelector<Color> { using Type = PropertyColor; }; /** * @brief * Property selector for properties of type std::string */ template <> struct PropertyTypeSelector<std::string> { using Type = PropertyString; }; /** * @brief * Property selector for properties of type FilePath */ template <> struct PropertyTypeSelector<FilePath> { using Type = PropertyFilePath; }; /** * @brief * Property selector for properties of integral types */ template <typename T> struct PropertyTypeSelector<T, helper::EnableIf<helper::isSignedIntegral<T>>> { using Type = PropertySignedIntegral<T>; }; /** * @brief * Property selector for properties of unsigned integral types */ template <typename T> struct PropertyTypeSelector<T, helper::EnableIf<helper::isUnsignedIntegral<T>>> { using Type = PropertyUnsignedIntegral<T>; }; /** * @brief * Property selector for properties of floating point types */ template <typename T> struct PropertyTypeSelector<T, helper::EnableIf<helper::isFloatingPoint<T>>> { using Type = PropertyFloatingPoint<T>; }; /** * @brief * Property selector for properties of array types */ template <typename T> struct PropertyTypeSelector<T, helper::EnableIf<helper::isArray<T>>> { using Type = PropertyArray<typename T::value_type, std::tuple_size<T>::value>; }; /** * @brief * Property selector for properties of enum types */ template <typename T> struct PropertyTypeSelector<T, helper::EnableIf<std::is_enum<T>>> { using Type = PropertyEnum<T>; }; /** * @brief * Property to access a named value of a class or group * * A property represents a named typed value that can represent, * e.g., a configuration option or a state of an object. Its * value resides outside of the property itself and is usually * accessed by defining getter and setter functions for the value. * * Usually, properties should be created either inside a PropertyGroup * or inside an Object, and control the status of this object. * Properties are an interface that can be used to automatically announce * and access values of an object, mainly for the purpose of user interaction. * This can be used to create automatic GUI interfaces and to provide * scripting interface for your classes. * * @see propertyguizeug * @see scriptzeug */ template <typename T> class Property : public PropertyTypeSelector<T>::Type { public: /** * @brief * Constructor */ template <typename... Args> Property(Args&&... args); /** * @brief * Destructor */ virtual ~Property(); // Virtual AbstractProperty interface virtual void accept(AbstractVisitor * visitor) override; }; } // namespace reflectionzeug #include <reflectionzeug/property/Property.hpp>
void testFunction(char c1,int i1) { switch(c1){ // GOOD case 12: break; case 10: break; case 9: break; } switch(i1){ // GOOD for(i1=0;i1<20;i1++){ case 12: case 10: case 9: } } switch(c1){ // BAD case 12: break; case 10: break; case 9: break; dafault: } switch(c1){ // BAD c1=c1*2; case 12: break; case 10: break; case 9: break; } if((c1<6)&&(c1>0)) switch(c1){ // BAD case 8: break; case 5: break; case 3: break; case 1: break; } if((c1<6)&&(c1>0)) switch(c1){ // BAD case 3: break; case 1: break; } }
/*! * Gauged * https://github.com/chriso/gauged (MIT Licensed) * Copyright 2014 (c) Chris O'Hara <cohara87@gmail.com> */ #ifndef GAUGED_SORT_H_ #define GAUGED_SORT_H_ #include <stdint.h> /** * Various sorting strategies. */ typedef struct gauged_mergesort_s { uint32_t *buffer; uint32_t *output; size_t size; size_t depth; } gauged_mergesort_t; #define GAUGED_SORT_INSERTIONSORT_MAX 64 /** * Sort an array. */ uint32_t *gauged_sort(uint32_t *, size_t); #endif
// // Circular.h // GSTween // // Created by Garrit Schaap on 13.02.14. // Copyright (c) 2014 Garrit Schaap. All rights reserved. // // //#import <UIKit/UIKit.h> typedef CGFloat (^easeBlock)(CGFloat time); @interface Circular : NSObject + (easeBlock)easeIn; + (easeBlock)easeOut; + (easeBlock)easeInOut; @end
#include <log.h> #include <lib/tree.h> #include <beryllium/device.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <mutex.h> tree_t * device_tree = NULL; device_t * dev_root = NULL; device_t * kernel_ns = NULL; void device_tree_enumerate(tree_node_t * node, size_t height) { if (!node) return; device_t * dnode = (device_t *)node->value; if (dnode) { char *interface; char *type; switch(dnode->interface) { case DEVICE_INTERFACE_KERNEL: interface= "KERN"; break; case DEVICE_INTERFACE_PCI: interface= "PCI"; break; case DEVICE_INTERFACE_USB: interface= "USB"; break; case DEVICE_INTERFACE_ACPI: interface= "ACPI"; break; case DEVICE_INTERFACE_IO: interface= "IO"; break; default: interface= "UNKN"; break; } switch(dnode->type) { case DEVICE_TYPE_NAMESPACE: type= "NS"; break; case DEVICE_TYPE_BUS: type= "BUS"; break; case DEVICE_TYPE_HARDWARE: type= "HW"; break; case DEVICE_TYPE_INTERGRATED: type= "VK"; break; default: type= "??"; break; } printf("%3s|",type); for (uint32_t i = 0; i < height; ++i) { printf(" "); } printf("%s (%s)",dnode->name,interface); } printf("\n"); foreach(child, node->children) { device_tree_enumerate(child->value, height + 4); } } uint8_t device_search_tree_comparator(void *a, void *b) { if (a == b) { return 1; } else { return 0; } } uint8_t device_search_name_comparator(void *a, void *b) { device_t * dnode = (device_t *)a; if (strcmp(dnode->name,b) == 0) { return 1; } return 0; } tree_node_t * device_search_tree_node(device_t * device) { tree_node_t * result; result = tree_find(device_tree, device, &device_search_tree_comparator); return result; } tree_node_t * device_search_node(char *name) { tree_node_t * result; result = tree_find(device_tree, name, &device_search_name_comparator); return result; } device_t * device_search(char *name) { tree_node_t * result; result = tree_find(device_tree, name, &device_search_name_comparator); return result->value; } void device_manager_insert(device_t * device,device_t * parent) { tree_node_t * res = device_search_node(parent->name); if(res == NULL) { klog(LOG_WARN,"device_manager_insert","Inserting device %s failed. The parent does not exist in the device tree!\n"); return; } tree_node_insert_child(device_tree, res, device); } void device_manager_remove(device_t * device) { //Note, change device_tree->root to parent from device_t tree_node_remove(device_tree, device_search_tree_node(device)); } int device_manager_start() { device_tree = tree_create(); dev_root = malloc(sizeof(device_t)); dev_root->name = "device_root"; dev_root->type = 0; dev_root->flags = 0; dev_root->permissions = 0; dev_root->interface = DEVICE_INTERFACE_KERNEL; tree_set_root(device_tree, dev_root); device_manager_insert_kernel(); return 0; } int has_inserted_staticially = 0; extern device_t pit_device,serial_device,keyboard_device; void device_manager_insert_kernel() { if(has_inserted_staticially) return; klog(LOG_DEBUG,"device_manager_insert_kernel","Inserting kernel provided drivers...\n"); ///Setup the kernel namespace kernel_ns = malloc(sizeof(device_t)); kernel_ns->name = "kernel_ns"; kernel_ns->type = DEVICE_TYPE_NAMESPACE; kernel_ns->flags = 0; kernel_ns->interface = DEVICE_INTERFACE_KERNEL; device_manager_insert(kernel_ns, device_search("device_root")); #ifdef X86 device_manager_insert(&pit_device, device_search("kernel_ns")); device_manager_insert(&serial_device, device_search("kernel_ns")); device_manager_insert(&keyboard_device, device_search("kernel_ns")); #endif has_inserted_staticially = 1; } uint32_t device_stop(device_t * dev) { if(dev == NULL) return 0xFFFFFFFF; klog(LOG_DEBUG,"device_stop","Shutting down device %s... \n",dev->name); if(dev->status!=DEVICE_STATUS_ONLINE) //Device is already online, so do nothing to it { return dev->status; } else //Bring down device { if(dev->driver == NULL) return 0xFFFFFFFE; mutex_lock(dev->mutex); int ret = dev->driver->stop(); if(ret == 0) { dev->status = DEVICE_STATUS_HALTED; } else { dev->status = DEVICE_STATUS_ONLINE; } mutex_unlock(dev->mutex); } return dev->status; } /** Starts a device. Returns an error code or the device status set **/ uint32_t device_start(device_t * dev) { if(dev == NULL) return 0xFFFFFFFF; if(dev->status==DEVICE_STATUS_ONLINE) //Device is already online, so do nothing to it { return DEVICE_STATUS_ONLINE; } klog(LOG_DEBUG,"device_start","Bringing up device %s... \n",dev->name); if(dev->driver == NULL) { return 0xFFFFFFFE; } //mutex_lock(dev->mutex); int ret = dev->driver->start(); if(ret == 0) { dev->status = DEVICE_STATUS_ONLINE; } else { klog(LOG_ERROR,"device_start","Could not bring up device %s (returned 0x%X)!\n",dev->name,ret); dev->status = DEVICE_STATUS_ABORTED; } //mutex_unlock(dev->mutex); return dev->status; }
// Copyright (c) 2011-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_WALLETVIEW_H #define BITCOIN_QT_WALLETVIEW_H #include "amount.h" #include "masternodelist.h" #include <QStackedWidget> class BitcoinGUI; class ClientModel; class OverviewPage; class PlatformStyle; class ReceiveCoinsDialog; class SendCoinsDialog; class GoodsDialog; class SendCoinsRecipient; class TransactionView; class WalletModel; class AddressBookPage; class SibModel; QT_BEGIN_NAMESPACE class QLabel; class QModelIndex; class QProgressDialog; QT_END_NAMESPACE /* WalletView class. This class represents the view to a single wallet. It was added to support multiple wallet functionality. Each wallet gets its own WalletView instance. It communicates with both the client and the wallet models to give the user an up-to-date view of the current core state. */ class WalletView : public QStackedWidget { Q_OBJECT public: explicit WalletView(const PlatformStyle *platformStyle, QWidget *parent); ~WalletView(); void setBitcoinGUI(BitcoinGUI *gui); /** Set the client model. The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic. */ void setClientModel(ClientModel *clientModel); void setSibModel(SibModel *sibModel); /** Set the wallet model. The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending functionality. */ void setWalletModel(WalletModel *walletModel); bool handlePaymentRequest(const SendCoinsRecipient& recipient); void showOutOfSyncWarning(bool fShow); private: ClientModel *clientModel; WalletModel *walletModel; SibModel *sibModel; OverviewPage *overviewPage; QWidget *transactionsPage; ReceiveCoinsDialog *receiveCoinsPage; SendCoinsDialog *sendCoinsPage; AddressBookPage *usedSendingAddressesPage; AddressBookPage *usedReceivingAddressesPage; MasternodeList *masternodeListPage; TransactionView *transactionView; GoodsDialog *goodsPage; QProgressDialog *progressDialog; QLabel *transactionSum; const PlatformStyle *platformStyle; public Q_SLOTS: /** Switch to overview (home) page */ void gotoOverviewPage(); /** Switch to history (transactions) page */ void gotoHistoryPage(); /** Switch to masternode page */ void gotoMasternodePage(); /** Switch to receive coins page */ void gotoReceiveCoinsPage(); /** Switch to send coins page */ void gotoSendCoinsPage(QString addr = ""); /** Switch to send coins page */ void gotoGoodsPage(); /** Show Sign/Verify Message dialog and switch to sign message tab */ void gotoSignMessageTab(QString addr = ""); /** Show Sign/Verify Message dialog and switch to verify message tab */ void gotoVerifyMessageTab(QString addr = ""); /** Show incoming transaction notification for new transactions. The new items are those between start and end inclusive, under the given parent item. */ void processNewTransaction(const QModelIndex& parent, int start, int /*end*/); /** Encrypt the wallet */ void encryptWallet(bool status); /** Backup the wallet */ void backupWallet(); /** Change encrypted wallet passphrase */ void changePassphrase(); /** Ask for passphrase to unlock wallet temporarily */ void unlockWallet(bool fAnonymizeOnly=false); /** Lock wallet */ void lockWallet(); /** Show used sending addresses */ void usedSendingAddresses(); /** Show used receiving addresses */ void usedReceivingAddresses(); /** Generate and print addresses */ void genAndPrintAddresses(); /** Load keys from QR code */ void loadFromPaper(); /** Re-emit encryption status signal */ void updateEncryptionStatus(); /** Show progress dialog e.g. for rescan */ void showProgress(const QString &title, int nProgress); /** User has requested more information about the out of sync state */ void requestedSyncWarningInfo(); /** Update selected SIB amount from transactionview */ void trxAmount(QString amount); Q_SIGNALS: /** Signal that we want to show the main window */ void showNormalIfMinimized(); /** Fired when a message should be reported to the user */ void message(const QString &title, const QString &message, unsigned int style); /** Encryption status of wallet changed */ void encryptionStatusChanged(int status); /** HD-Enabled status of wallet changed (only possible during startup) */ void hdEnabledStatusChanged(int hdEnabled); /** Notify that a new transaction appeared */ void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label); /** Notify that the out of sync warning icon has been pressed */ void outOfSyncWarningClicked(); /** Signal raised when a URI was entered or dragged to the GUI */ void receivedURI(const QString &uri); }; #endif // BITCOIN_QT_WALLETVIEW_H
// // NTDataNetwork.h // notes // // Created by Nate on 12/1/14. // Copyright (c) 2014 ifcantel. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIImage.h> NSString *const NTDataCollectorErrorRetrieveImage; NSString *const NTDataCollectorErrorDataType; NSString *const NTDataCollectorErrorNotFound; NSString *const NTDataCollectorDomain; typedef void(^NTNetworkRetrieveObject)(id obj, NSError *error); typedef void(^NTNetworkRetrieveDictionary)(NSDictionary *dictionary, NSError *error); typedef void(^NTNetworkRetrieveCollection)(NSArray *items, NSError *error); typedef void(^NTNetworkRetrieveImage)(UIImage *image, NSError *error); @protocol NTDataCollectorProtocol <NSObject> + (instancetype)sharedInstance; /** * Call to retrieve any object. */ - (void)retrieveObjectWithHandler:(NTNetworkRetrieveObject)handler atPath:(NSString *)path; /** * Call to retrieve collection of items. Must be array. */ - (void)retrieveCollectionWithHandler:(NTNetworkRetrieveCollection)handler atPath:(NSString *)path; /** * Call to retrieve dictionary object. */ - (void)retrieveDictionaryWithHandler:(NTNetworkRetrieveDictionary)handler atPath:(NSString *)path; @end /** * Common class for all data collectors. */ @interface NTDataCollector : NSObject + (instancetype)sharedInstance; /** * Call to retrieve an image from url path */ - (void)retrieveImageFromURLWithHandler:(NTNetworkRetrieveImage)handler atPath:(NSString *)path; @end /** * A class that receive json response from network. */ @interface NTJSONNetworkCollector : NTDataCollector<NTDataCollectorProtocol> @end /** * A class that receive json response from local storage */ @interface NTJSONLocalCollector : NTDataCollector<NTDataCollectorProtocol> @end
#include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include "parse.h" void debug_out(const char *msg, ...) { static FILE *logfile = NULL; if (logfile == NULL) { logfile = fopen("debug.log", "wt"); setvbuf(logfile, NULL, _IONBF, 0); } va_list args; va_start(args, msg); vfprintf(logfile, msg, args); va_end(args); } void text_out(const char *msg, ...) { va_list args; va_start(args, msg); vfprintf(stdout, msg, args); va_end(args); } char* read_line() { char *buffer = calloc(MAX_INPUT_LENGTH, 1); fgets(buffer, MAX_INPUT_LENGTH-1, stdin); return buffer; } char* read_file(const char *filename) { FILE *fp = fopen(filename, "rt"); if (!fp) { debug_out("read_file: Could not open file '%s'\n", filename); return NULL; } fseek(fp, 0, SEEK_END); size_t filesize = ftell(fp); fseek(fp, 0, SEEK_SET); char *file = malloc(filesize+1); fread(file, filesize, 1, fp); file[filesize] = 0; fclose(fp); return file; } void style_bold() { text_out("\x1b[1m"); } void style_normal() { text_out("\x1b[0m"); } void style_reverse() { text_out("\x1b[7m"); }
// // Identical.h // NSUnit // // Created by Jackson Harper on 8/21/12. // Copyright (c) 2012 Jackson Harper. All rights reserved. // #import <Foundation/Foundation.h> @protocol OperationProtocol; @interface TheSame : NSObject + (NSObject<OperationProtocol> *) as:(NSObject *) other; @end
/* ** mrb_sample.h - Sample class ** ** See Copyright Notice in LICENSE */ #ifndef MRB_SAMPLE_H #define MRB_SAMPLE_H void mrb_mruby_sample_gem_init(mrb_state *mrb); #endif
// // WHScrollAndPageView.h // ChatDemo-UI2.0 // // Created by Jason on 15-5-9. // Copyright (c) 2015年 Jason. All rights reserved. // #import <UIKit/UIKit.h> @protocol WHcrollViewViewDelegate; @interface WHScrollAndPageView : UIView <UIScrollViewDelegate> { __unsafe_unretained id <WHcrollViewViewDelegate> _delegate; } @property (nonatomic, assign) id <WHcrollViewViewDelegate> delegate; @property (nonatomic, assign) NSInteger currentPage; @property (nonatomic, strong) NSMutableArray *imageViewAry; @property (nonatomic, readonly) UIScrollView *scrollView; @property (nonatomic, readonly) UIPageControl *pageControl; @property (nonatomic, strong) NSMutableArray *messageImagesAry; -(void)shouldAutoShow:(BOOL)shouldStart; @end @protocol WHcrollViewViewDelegate <NSObject> @optional - (void)didClickPage:(WHScrollAndPageView *)view atIndex:(NSInteger)index; @end
// This file contains tests for the sizeof() function and operator. #include <stdio.h> #include "tests.h" #define check_sizes(type, size) \ is_eq(sizeof(type), size); \ is_eq(sizeof(unsigned type), size); \ is_eq(sizeof(signed type), size); \ is_eq(sizeof(const type), size); \ is_eq(sizeof(volatile type), size); #define FLOAT(type, size) \ is_eq(sizeof(type), size); #define OTHER(type, size) \ is_eq(sizeof(type), size); // We print the variable so that the compiler doesn't complain that the variable // is unused. #define VARIABLE(v, p) \ printf("%s = (%d) %d bytes\n", #v, p, sizeof(v)); struct MyStruct { double a; char b; char c; }; struct MyStruct2 { double a; char b; char c; char d[10]; }; struct MyStruct3 { double a; char b; char c; char d[20]; }; struct MyStruct4 { double a; char b; char c; char d[30]; }; union MyUnion { double a; char b; int c; }; short a; int b; int main() { plan(42); diag("Integer types"); check_sizes(char, 1); check_sizes(short, 2); check_sizes(int, 4); check_sizes(long, 8); diag("Floating-point types"); is_eq(sizeof(float), 4); is_eq(sizeof(double), 8); is_eq(sizeof(long double), 16); diag("Other types"); is_eq(sizeof(void), 1); diag("Pointers"); is_eq(sizeof(char *), 8); is_eq(sizeof(char *), 8); is_eq(sizeof(short **), 8); diag("Variables"); a = 123; b = 456; struct MyStruct s1; s1.b = 0; struct MyStruct2 s2; s2.b = 0; struct MyStruct3 s3; s3.b = 0; struct MyStruct4 s4; s4.b = 0; union MyUnion u1; u1.b = 0; is_eq(sizeof(a), 2); is_eq(sizeof(b), 4); is_eq(sizeof(s1), 16); is_eq(sizeof(s2), 24); is_eq(sizeof(s3), 32); is_eq(sizeof(s4), 40); is_eq(sizeof(u1), 8); diag("Structures"); is_eq(sizeof(struct MyStruct), 16); diag("Unions"); is_eq(sizeof(union MyUnion), 8); diag("Function pointers"); is_eq(sizeof(main), 1); diag("Arrays"); char c[3] = {'a', 'b', 'c'}; c[0] = 'a'; is_eq(sizeof(c), 3); int *d[3]; d[0] = &b; is_eq(sizeof(d), 24); int **e[4]; e[0] = d; is_eq(sizeof(e), 32); const char * const f[] = {"a", "b", "c", "d", "e", "f"}; is_eq(sizeof(f), 48); is_streq(f[1], "b"); done_testing(); }
// // FLGridlines.h // Fliegen // // Created by Abhishek Moothedath on 10/7/14. // Copyright (c) 2014 Abhishek Moothedath. All rights reserved. // #import <SceneKit/SceneKit.h> @interface FLGridlines : SCNNode @end
/* * Copyright (c) 2012 Mario Negro Martín * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import <Foundation/Foundation.h> /** * Constant that defines indeterminate progress */ extern const CGFloat MNMProgressBarIndeterminateProgress; /** * Custom progress bar view that shows a determinate progress and an indeterminate one */ @interface MNMProgressBar : UIView { @private /** * Background image view */ UIImageView *backgroundImageView_; /** * Progress image view */ UIImageView *progressImageView_; /** * Image of the progress. Grows depending on value of progress_ */ UIImage *progressImage_; /** * Array of images to animate the indeterminate progress */ NSMutableArray *indeterminateImages_; /** * Value of the progress. Takes values between 0.0f and 1.0f. * It can also takes ProgressBarViewIndeterminateProgress */ CGFloat progress_; } /** * Provides radwrite access to progress_ */ @property (nonatomic, readwrite, assign) CGFloat progress; @end
// // UIAlertView+BBUAdditions.h // SoundCloudChallenge // // Created by Boris Bügling on 26.06.13. // Copyright (c) 2013 Boris Bügling. All rights reserved. // #import <UIKit/UIKit.h> @interface UIAlertView (BBUAdditions) +(UIAlertView*)bbu_showAlertWithError:(NSError*)error; @end
#ifndef CGnuPlotTitle_H #define CGnuPlotTitle_H #include <CGnuPlotColorSpec.h> #include <CGnuPlotPosition.h> #include <CFont.h> class CGnuPlotGroup; class CGnuPlotRenderer; class CGnuPlotTitleData { public: CGnuPlotTitleData() { } const std::string &text() const { return text_; } void setText(const std::string &str) { text_ = str; } const CGnuPlotPosition &offset() const { return offset_; } void setOffset(const CGnuPlotPosition &o) { offset_ = o; } const CFontPtr &font() const { return font_; } void setFont(const CFontPtr &str) { font_ = str; } const CGnuPlotColorSpec &color() const { return color_; } void setColor(const CGnuPlotColorSpec &c) { color_ = c; } bool isEnhanced() const { return enhanced_; } void setEnhanced(bool b) { enhanced_ = b; } void unset() { setText(""); } void save(std::ostream &os) const { os << "set title \"" << text() << "\"" << std::endl; if (font().isValid()) os << "set title font \"\" norotate" << std::endl; else os << "set title font \" norotate" << font()->getFamily() << "\"" << std::endl; } void show(std::ostream &os) const { os << "title is \"" << text() << "\""; os << ", " << "offset at (" << offset() << ")"; if (font().isValid()) os << ", using font \"" << font() << "\""; if (color().isValid()) os << " textcolor " << color(); os << std::endl; } private: std::string text_; CGnuPlotPosition offset_; CFontPtr font_; CGnuPlotColorSpec color_; bool enhanced_ { true }; }; class CGnuPlotTitle { public: typedef std::pair<CHAlignType,double> HAlignPos; typedef std::pair<CVAlignType,double> VAlignPos; public: CGnuPlotTitle(CGnuPlotGroup *group=0); virtual ~CGnuPlotTitle() { } CGnuPlotGroup *group() const { return group_; } void setGroup(CGnuPlotGroup *group) { group_ = group; } const CGnuPlotTitleData &data() const { return data_; } void setData(const CGnuPlotTitleData &d) { data_ = d; } const std::string &text() const { return data_.text(); } void setText(const std::string &str) { data_.setText(str); } const CGnuPlotPosition &offset() const { return data_.offset(); } void setOffset(const CGnuPlotPosition &o) { data_.setOffset(o); } const CFontPtr &font() const { return data_.font(); } void setFont(const CFontPtr &f) { data_.setFont(f); } const CGnuPlotColorSpec &color() const { return data_.color(); } void setColor(const CGnuPlotColorSpec &c) { data_.setColor(c); } bool isEnhanced() const { return data_.isEnhanced(); } void setEnhanced(bool b) { data_.setEnhanced(b); } bool isDisplayed() const { return displayed_; } void setDisplayed(bool b) { displayed_ = b; } const CBBox2D &bbox() const { return bbox_; } void setBBox(const CBBox2D &v) { bbox_ = v; } const CPoint2D &lastOffset() const { return lastOffset_; } void setLastOffset(const CPoint2D &v) { lastOffset_ = v; } virtual void draw(CGnuPlotRenderer *renderer) const; private: CGnuPlotGroup* group_ { 0 }; CGnuPlotTitleData data_; bool displayed_ { true }; mutable CBBox2D bbox_; mutable CPoint2D lastOffset_; }; typedef std::shared_ptr<CGnuPlotTitle> CGnuPlotTitleP; #endif
// // DCHDribbbleShotCollectionViewCell.h // FireBalllooon // // Created by Derek Chen on 8/13/15. // Copyright (c) 2015 CHEN. All rights reserved. // #import <UIKit/UIKit.h> @class DCHShotUIModel; @interface DCHDribbbleShotCollectionViewCell : UICollectionViewCell - (void)updateWithUIModel:(DCHShotUIModel *)uiModel; @end
// // AppDelegate.h // Scorll // // Created by 鲍先生 on 15/5/18. // Copyright (c) 2015年 鲍先生. All rights reserved. // #import <UIKit/UIKit.h> #import <CoreData/CoreData.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; - (void)saveContext; - (NSURL *)applicationDocumentsDirectory; @end
// // AppDelegate.h // testTableView // // Created by ioszhe on 16/1/25. // Copyright © 2016年 ioszhe. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // EAAppDelegate.h // EAResistantScrollView // // Created by CocoaPods on 03/05/2015. // Copyright (c) 2014 Edgar Antunes. All rights reserved. // @interface EAAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/* * This file is part of Poedit (http://poedit.net) * * Copyright (C) 2000-2016 Vaclav Slavik * * 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 _PROPERTIESDLG_H_ #define _PROPERTIESDLG_H_ #include <wx/dialog.h> #include <wx/notebook.h> #include <memory> #include "catalog.h" #include "languagectrl.h" class WXDLLIMPEXP_FWD_ADV wxEditableListBox; class WXDLLIMPEXP_FWD_CORE wxTextCtrl; class WXDLLIMPEXP_FWD_CORE wxRadioButton; class WXDLLIMPEXP_FWD_CORE wxComboBox; /// Dialog setting various catalog parameters. class PropertiesDialog : public wxDialog { public: PropertiesDialog(wxWindow *parent, CatalogPtr cat, bool fileExistsOnDisk, int initialPage = 0); /// Reads data from the catalog and fill dialog's controls. void TransferTo(const CatalogPtr& cat); /// Saves data from the dialog to the catalog. void TransferFrom(const CatalogPtr& cat); virtual bool Validate(); private: void DisableSourcesControls(); void OnLanguageChanged(wxCommandEvent& event); void OnLanguageValueChanged(const wxString& langstr); void OnPluralFormsDefault(wxCommandEvent& event); void OnPluralFormsCustom(wxCommandEvent& event); struct PathsData; class BasePathCtrl; class PathsList; class SourcePathsList; class ExcludedPathsList; wxTextCtrl *m_team, *m_teamEmail, *m_project; LanguageCtrl *m_language; wxComboBox *m_charset, *m_sourceCodeCharset; wxRadioButton *m_pluralFormsDefault, *m_pluralFormsCustom; wxTextCtrl *m_pluralFormsExpr; BasePathCtrl *m_basePath; std::shared_ptr<PathsData> m_pathsData; PathsList *m_paths, *m_excludedPaths; wxEditableListBox *m_keywords; wxString m_rememberedPluralForm; bool m_hasLang; int m_validatedPlural, m_validatedLang; }; #endif // _PROPERTIESDLG_H_
#pragma once #include <node.h> class Contracts { public: static bool RequireNumberOfArguments(const v8::FunctionCallbackInfo<v8::Value>& args, int requiredNumberOfArguments); static bool RequireObjectArgument(const v8::FunctionCallbackInfo<v8::Value>& args, int argumentIndex); static bool RequireNumberArgument(const v8::FunctionCallbackInfo<v8::Value>& args, int argumentIndex); static bool RequireFunctionArgument(const v8::FunctionCallbackInfo<v8::Value>& args, int argumentIndex); static bool OptionalFunctionArgument(const v8::FunctionCallbackInfo<v8::Value>& args, int argumentIndex); }; #define REQUIRE_NUMBER_OF_ARGUMENTS(args, requiredNumberOfArguments) \ if (!Contracts::RequireNumberOfArguments(args, requiredNumberOfArguments)) \ { \ return; \ } #define REQUIRE_OBJECT(args, argumentIndex) \ if (!Contracts::RequireObjectArgument(args, argumentIndex)) \ { \ return; \ } #define REQUIRE_NUMBER(args, argumentIndex) \ if (!Contracts::RequireNumberArgument(args, argumentIndex)) \ { \ return; \ } #define REQUIRE_FUNCTION(args, argumentIndex) \ if (!Contracts::RequireFunctionArgument(args, argumentIndex)) \ { \ return; \ } #define OPTIONAL_FUNCTION(args, argumentIndex) \ if (!Contracts::OptionalFunctionArgument(args, argumentIndex)) \ { \ return; \ }
#include <csv.h> #include "../rt.h" #include "module.h" #define BUFFER_SIZE 1024 enum { PARSE_OP_THIS = 2, PARSE_OP_ENTRY = 4, PARSE_OP_END, PARSE_OP_BEGIN }; typedef struct { int col; int row; int status; /* GLA_SUCCESS, GLA_VM (error in cb handler), GLA_END (parsing aborted by handler) */ HSQUIRRELVM vm; } context_t; static void cb_col(void *data, size_t size, void *ctx_) { SQBool resume; context_t *ctx = ctx_; if(ctx->status == GLA_SUCCESS && ctx->col == 0) { sq_push(ctx->vm, PARSE_OP_BEGIN); sq_push(ctx->vm, PARSE_OP_THIS); sq_pushinteger(ctx->vm, ctx->row); if(SQ_FAILED(sq_call(ctx->vm, 2, true, true))) { sq_pushnull(ctx->vm); ctx->status = GLA_VM; } else if(!SQ_FAILED(sq_getbool(ctx->vm, -1, &resume)) && !resume) ctx->status = GLA_END; sq_pop(ctx->vm, 2); } if(ctx->status == GLA_SUCCESS) { sq_push(ctx->vm, PARSE_OP_ENTRY); sq_push(ctx->vm, PARSE_OP_THIS); sq_pushinteger(ctx->vm, ctx->col++); sq_pushstring(ctx->vm, data, size); if(SQ_FAILED(sq_call(ctx->vm, 3, true, true))) { sq_pushnull(ctx->vm); ctx->status = GLA_VM; } else if(!SQ_FAILED(sq_getbool(ctx->vm, -1, &resume)) && !resume) ctx->status = GLA_END; sq_pop(ctx->vm, 2); } } static void cb_endrow(int unknown, void *ctx_) { SQBool resume; context_t *ctx = ctx_; if(ctx->status == GLA_SUCCESS) { sq_push(ctx->vm, PARSE_OP_END); sq_push(ctx->vm, PARSE_OP_THIS); sq_pushinteger(ctx->vm, ctx->row++); sq_pushinteger(ctx->vm, ctx->col); if(SQ_FAILED(sq_call(ctx->vm, 3, true, true))) { sq_pushnull(ctx->vm); ctx->status = GLA_VM; } else if(!SQ_FAILED(sq_getbool(ctx->vm, -1, &resume)) && !resume) ctx->status = GLA_END; sq_pop(ctx->vm, 2); } ctx->col = 0; } static apr_status_t cleanup_csv( void *parser_) { struct csv_parser *parser = parser_; csv_free(parser); return APR_SUCCESS; } static SQInteger fn_parse( HSQUIRRELVM vm) { SQInteger delim; SQInteger quote; int ret; gla_path_t path; gla_mount_t *mnt; gla_io_t *io; int shifted; int bytes; char buffer[BUFFER_SIZE]; struct csv_parser parser; context_t ctx; gla_rt_t *rt = gla_rt_vmbegin(vm); if(sq_gettop(vm) != 5) return gla_rt_vmthrow(rt, "Invalid argument count"); else if(SQ_FAILED(sq_getinteger(vm, 4, &delim))) return gla_rt_vmthrow(rt, "Invalid argument 3: expected integer"); else if(SQ_FAILED(sq_getinteger(vm, 5, &quote))) return gla_rt_vmthrow(rt, "Invalid argument 4: expected integer"); else if(csv_init(&parser, CSV_STRICT | CSV_STRICT_FINI) != 0) return gla_rt_vmthrow(rt, "Error initializing csv parser"); sq_pop(vm, 2); /* delim and strict */ apr_pool_cleanup_register(rt->mpstack, &parser, cleanup_csv, apr_pool_cleanup_null); sq_pushstring(vm, "entry", -1); if(SQ_FAILED(sq_get(vm, 2))) return gla_rt_vmthrow(rt, "Invalid argument 1: missing member 'entry'"); sq_pushstring(vm, "end", -1); if(SQ_FAILED(sq_get(vm, 2))) return gla_rt_vmthrow(rt, "Invalid argument 1: missing member 'end'"); sq_pushstring(vm, "begin", -1); if(SQ_FAILED(sq_get(vm, 2))) return gla_rt_vmthrow(rt, "Invalid argument 1: missing member 'begin'"); ret = gla_path_get_entity(&path, false, rt, 3, rt->mpstack); if(ret != GLA_SUCCESS) return gla_rt_vmthrow(rt, "Invalid entity given"); if(path.extension == NULL) path.extension = "csv"; mnt = gla_rt_resolve(rt, &path, GLA_MOUNT_SOURCE, &shifted, rt->mpstack); if(mnt == NULL) return gla_rt_vmthrow(rt, "No such entity"); csv_set_delim(&parser, delim); csv_set_quote(&parser, quote); io = gla_mount_open(mnt, &path, GLA_MODE_READ, rt->mpstack); if(io == NULL) return gla_rt_vmthrow(rt, "Error opening entity"); ctx.vm = rt->vm; ctx.status = GLA_SUCCESS; ctx.col = 0; ctx.row = 0; while(gla_io_rstatus(io) == GLA_SUCCESS) { bytes = gla_io_read(io, buffer, BUFFER_SIZE); ret = csv_parse(&parser, buffer, bytes, cb_col, cb_endrow, &ctx); if(ret != bytes) return gla_rt_vmthrow(rt, "CSV error: %s", csv_strerror(csv_error(&parser))); else if(ctx.status == GLA_VM) return gla_rt_vmthrow(rt, "Error from callback"); } if(gla_io_rstatus(io) != GLA_END) return gla_rt_vmthrow(rt, "Error reading entity"); ret = csv_fini(&parser, cb_col, cb_endrow, &ctx); if(ret != 0) return gla_rt_vmthrow(rt, "CSV error: %s", csv_strerror(csv_error(&parser))); else if(ctx.status == GLA_VM) return gla_rt_vmthrow(rt, "Error from callback"); else return gla_rt_vmsuccess(rt, false); } int gla_mod_csv_cbparser_cbridge( gla_rt_t *rt) { HSQUIRRELVM vm = rt->vm; sq_pushstring(vm, "parse", -1); sq_newclosure(vm, fn_parse, 0); sq_newslot(vm, -3, false); return GLA_SUCCESS; }
#pragma once #include<vector> #include<string> #include<cstring> #include<climits> #include<algorithm> #include<cmath> #include<stack> #include <numeric> #include<unordered_map> #include<unordered_set> #include<sstream> using namespace std; class Solution { public: int f[1000] = {0}; int numTrees(int n) { if (n == 0 || n==1) return 1; if (f[n] != 0) { return f[n]; } int ans = 0; for (int i = 0; i < n; i++) { ans += numTrees(i)*numTrees(n - 1 - i); } f[n] = ans; return ans; } };
#include<stdio.h> void swapValue(int arr[], int i, int j) { int t = arr[i]; arr[i] = arr[j]; arr[j] = t; } void bubbleSort(int arr[], int arrLength) { int indexOfLastUnsortedElement = arrLength; int swapped = 0; while (swapped == 0) { swapped = 1; for (int i = 0; i < indexOfLastUnsortedElement - 1; i++) { if (arr[i] > arr[i + 1]) { swapValue(arr, i, i + 1); swapped = 0; } } indexOfLastUnsortedElement--; } } void selectionSort(int arr[], int arrLength) { for (int i = 0; i < arrLength - 1; i++) { int minIdx = i; for (int j = i + 1; j < arrLength; j++) if (arr[j] < arr[minIdx]) minIdx = j; if (i < minIdx) swapValue(arr, i, minIdx); } } void insertionSort(int arr[], int arrLength) { int j = 0; for (int i = 1; i < arrLength; ++i) { int tempValue = arr[i]; for (j = i - 1; j >= 0 && arr[j] > tempValue; --j) { swapValue(arr, j, j + 1); } arr[j + 1] = tempValue; } } void quickSort(int arr[], int left, int right) { int pivotidx = (left + right) / 2; int i = left; int j = right; int pivot = arr[pivotidx]; while (i <= j) { while (arr[i] < pivot) i++; while (arr[j] > pivot) j--; if (i <= j) { if (arr[i] > arr[j] && i < j) swapValue(arr, i, j); i++; j--; } } if (left < j) quickSort(arr, left, j); if (i < right) quickSort(arr, i, right); } void mergeSort(int arr[], int left, int right) { if (right > left) { int mid = left + ((right - left) / 2); mergeSort(arr, left, mid); mergeSort(arr, mid + 1, right); int subLeft[100]; int subRight[100]; for (int i = left; i <= mid; i++) subLeft[i - left] = arr[i]; for (int i = mid + 1; i <= right; i++) subRight[i - mid - 1] = arr[i]; int leftIndex = 0; int rightIndex = 0; for (int i = left; i <= right; i++) if (left + leftIndex <= mid && (mid + 1 + rightIndex > right || subLeft[leftIndex] < subRight[rightIndex])) { arr[i] = subLeft[leftIndex]; leftIndex++; } else { arr[i] = subRight[rightIndex]; rightIndex++; } } } int main() { int arr[]={5,4,9,6,8,3,2,0,7,1}; int len = sizeof (arr) / sizeof (arr[0]); //bubbleSort(arr, len); //selectionSort(arr, len); //insertionSort(arr, len); //quickSort(arr, 0, len - 1); mergeSort(arr, 0, len - 1); for (int i = 0; i < len; i++) printf("%d ", arr[i]); return 0; }
#ifndef _rpi_i2c_c #define _rpi_i2c_c #define byte unsigned char #ifdef __cplusplus extern "C" { #endif extern int openBus (char*); extern int closeBus (int); extern int writeBytes (int, int, byte*, int); extern int readBytes (int, int, byte*, int); extern int write_word_read_byte(int, int, byte*, int, byte*, int, int*, int*); #ifdef __cplusplus } #endif #endif
// // WSWebkitMicro.h // Pods // // Created by winter on 16/8/11. // // #ifndef WSWebkitMicro_h #define WSWebkitMicro_h #endif /* WSWebkitMicro_h */
#include "aligned_storer.h" #include <cstddef> template<typename T> class AB; ///// length and alignment information template <typename TT> class LenAlign { template<typename T> friend class AB; static const std::size_t len; static const std::size_t align; }; template<> class LenAlign<int> { template<typename T> friend class AB; static constexpr std::size_t len = 8; static constexpr std::size_t align = 4; }; template<> class LenAlign<long double> { template<typename T> friend class AB; static constexpr std::size_t len = 32; static constexpr std::size_t align = 16; }; ////// the actual class template<typename T> class AB { public: AB(T a, T b); ~AB(); T get_a() const; T get_b() const; T get_sum() const; void inc_a_b(); private: ///// Implementation (well hidden!) class AB_impl; Aligned_storer</*Len*/ LenAlign<T>::len, /*Align*/ LenAlign<T>::align> storage_; // this is the storage for AB_impl via placement new AB_impl &impl() { return reinterpret_cast<AB_impl &>(storage_); } AB_impl const &impl() const { return reinterpret_cast<AB_impl const &>(storage_); } };
#import <UIKit/UIKit.h> @interface DistributionDetailsViewController : UIViewController <UITableViewDataSource,UITableViewDelegate> @property (nonatomic, strong) NSMutableArray *dataSources; @property (nonatomic, strong) M2XDistribution *distribution; @property (weak, nonatomic) IBOutlet UITableView *tableViewDataSources; @property (weak, nonatomic) IBOutlet UILabel *lblDistributionID; @property (weak, nonatomic) IBOutlet UILabel *lblCreatedAt; @end
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSTextFieldCell.h" @class NSArray, NSButtonCell, NSString; @interface DVTFilePathFieldCell : NSTextFieldCell { NSButtonCell *_chooseButtonCell; NSButtonCell *_linkButtonCell; BOOL _alwaysShowChooser; BOOL _showLinkButton; BOOL _chooseFile; BOOL _chooseDir; BOOL _showChooserButton; NSString *_choosePathDefaultFilePath; NSString *_choosePathMessage; NSArray *_absoluteLinkPaths; id _delegate; unsigned long long _linkButtonBehavior; } @property unsigned long long linkButtonBehavior; // @synthesize linkButtonBehavior=_linkButtonBehavior; @property BOOL showChooserButton; // @synthesize showChooserButton=_showChooserButton; @property BOOL chooseDir; // @synthesize chooseDir=_chooseDir; @property BOOL chooseFile; // @synthesize chooseFile=_chooseFile; @property BOOL showLinkButton; // @synthesize showLinkButton=_showLinkButton; @property BOOL alwaysShowChooser; // @synthesize alwaysShowChooser=_alwaysShowChooser; @property(retain) id delegate; // @synthesize delegate=_delegate; @property(copy) NSArray *absoluteLinkPaths; // @synthesize absoluteLinkPaths=_absoluteLinkPaths; @property(copy) NSString *choosePathMessage; // @synthesize choosePathMessage=_choosePathMessage; @property(copy) NSString *choosePathDefaultFilePath; // @synthesize choosePathDefaultFilePath=_choosePathDefaultFilePath; - (void).cxx_destruct; - (BOOL)eventIsInSubCellArea:(id)arg1 ofView:(id)arg2; - (unsigned long long)hitTestForEvent:(id)arg1 inRect:(struct CGRect)arg2 ofView:(id)arg3; - (BOOL)trackMouse:(id)arg1 inRect:(struct CGRect)arg2 ofView:(id)arg3 untilMouseUp:(BOOL)arg4; - (void)resetCursorRect:(struct CGRect)arg1 inView:(id)arg2; - (void)drawInteriorWithFrame:(struct CGRect)arg1 inView:(id)arg2; - (void)setEnabled:(BOOL)arg1; - (void)_configureSubCells; - (void)_refreshEnabledStates; - (struct CGRect)_linkButtonFrameForCellFrame:(struct CGRect)arg1; - (struct CGRect)_chooserButtonFrameForCellFrame:(struct CGRect)arg1; - (void)selectWithFrame:(struct CGRect)arg1 inView:(id)arg2 editor:(id)arg3 delegate:(id)arg4 start:(long long)arg5 length:(long long)arg6; - (void)editWithFrame:(struct CGRect)arg1 inView:(id)arg2 editor:(id)arg3 delegate:(id)arg4 event:(id)arg5; - (struct CGSize)cellSizeForBounds:(struct CGRect)arg1; - (struct CGRect)titleRectForBounds:(struct CGRect)arg1; - (struct CGRect)textBoundingRectForBounds:(struct CGRect)arg1; - (struct CGRect)_maximumTextBoundsForBounds:(struct CGRect)arg1; - (double)_claimedWidthForBounds:(struct CGRect)arg1; - (BOOL)reserveSpaceForLinkButton; - (BOOL)effectiveShowLinkButton; - (id)copyWithZone:(struct _NSZone *)arg1; - (id)initWithCoder:(id)arg1; - (id)initImageCell:(id)arg1; - (id)initTextCell:(id)arg1; - (id)init; - (void)linkAction:(id)arg1; - (void)chooseAction:(id)arg1; - (BOOL)effectiveShowChooserButton; - (void)_commonInitForFilePathCell; @end
// // TLDDrawNode.h // TLGLDraw // // Created by Ruben Nine on 24/04/14. // Copyright (c) 2014 Ruben Nine. All rights reserved. // #import "TLDNode.h" @interface TLDDrawNode : TLDNode <TLDDrawableNode> @property (assign, nonatomic) TLDColor color; - (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)initWithColor:(TLDColor)color; - (void)clear; /*! Please note that the drawPoints methods must be called manually. */ - (void)drawPoints:(TLDPoint *)points amount:(GLsizei)amount; - (void)drawPoints:(TLDPoint *)points amount:(GLsizei)amount mode:(GLenum)mode; - (void)drawLineFromPoint:(TLDPoint)point1 toPoint:(TLDPoint)point2; - (void)drawLineWithCenter:(TLDPoint)center radius:(GLfloat)radius andAngle:(GLfloat)angle; - (void)drawRectangleWithRect:(TLDRect)rect; - (void)drawArcWithCenter:(TLDPoint)center radius:(GLfloat)radius angle:(GLfloat)angle arcLength:(GLfloat)arcLength numSegments:(GLsizei)numSegments shouldDrawLineToCenter:(BOOL)shouldDrawLineToCenter; @end
#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 LIHImageSliderVersionNumber; FOUNDATION_EXPORT const unsigned char LIHImageSliderVersionString[];
#ifndef _COMPUTE_RIGID_TRANSFORM_H_ #define _COMPUTE_RIGID_TRANSFORM_H_ #include <Eigen/Dense> #include <vector> //////////////////////////////////////////////////////////////////////////////////////////////////// /// @fn static bool ComputeRigidTransform(const std::vector<Eigen::Vector3d>& src, const std::vector<Eigen::Vector3d>& dst, Eigen::Matrix3d& R, Eigen::Vector3d& t); /// /// @brief Compute the rotation and translation that transform a source point set to a target point set /// /// @author Diego /// @date 07/10/2015 /// /// @param src The source point set. /// @param dst The target point set. /// @param [in,out] pts_dst The rotation matrix. /// @param [in,out] pts_dst The translation vector. /// @return True if found the transformation, false otherwise. //////////////////////////////////////////////////////////////////////////////////////////////////// template<typename Type> static bool ComputeRigidTransform(const std::vector<Eigen::Matrix<Type, 3, 1>>& src, const std::vector<Eigen::Matrix<Type, 3, 1>>& dst, Eigen::Matrix<Type, 3, 3>& R, Eigen::Matrix<Type, 3, 1>& t) { // // Verify if the sizes of point arrays are the same // assert(src.size() == dst.size()); int pairSize = (int)src.size(); Eigen::Matrix<Type, 3, 1> center_src(0, 0, 0), center_dst(0, 0, 0); // // Compute centroid // for (int i = 0; i<pairSize; ++i) { center_src += src[i]; center_dst += dst[i]; } center_src /= (Type)pairSize; center_dst /= (Type)pairSize; Eigen::Matrix<Type, Eigen::Dynamic, Eigen::Dynamic> S(pairSize, 3), D(pairSize, 3); for (int i = 0; i<pairSize; ++i) { S.row(i) = src[i] - center_src; D.row(i) = dst[i] - center_dst; } Eigen::Matrix<Type, Eigen::Dynamic, Eigen::Dynamic> Dt = D.transpose(); Eigen::Matrix<Type, 3, 3> H = Dt * S; Eigen::Matrix<Type, 3, 3> W, U, V; // // Compute SVD // Eigen::JacobiSVD<Eigen::Matrix<Type, Eigen::Dynamic, Eigen::Dynamic>> svd; svd.compute(H, Eigen::ComputeThinU | Eigen::ComputeThinV); if (!svd.computeU() || !svd.computeV()) { // std::cerr << "<Error> Decomposition error" << std::endl; return false; } // // Compute rotation matrix and translation vector // Eigen::Matrix<Type, 3, 3> Vt = svd.matrixV().transpose(); R = svd.matrixU() * Vt; t = center_dst - R * center_src; return true; } //////////////////////////////////////////////////////////////////////////////////////////////////// /// @fn static bool ComputeRigidTransform(const std::vector<Eigen::Vector3d>& src, const std::vector<Eigen::Vector3d>& dst, Eigen::Matrix3d& R, Eigen::Vector3d& t); /// /// @brief Compute the rotation and translation that transform a source point set to a target point set /// /// @author Diego /// @date 07/10/2015 /// /// @param src The source point set. /// @param dst The target point set. /// @param [in,out] pts_dst The rotation matrix. /// @param [in,out] pts_dst The translation vector. /// @return True if found the transformation, false otherwise. //////////////////////////////////////////////////////////////////////////////////////////////////// template<typename Type> static bool ComputeRigidTransform(const std::vector<Eigen::Matrix<Type, 4, 1>>& src, const std::vector<Eigen::Matrix<Type, 4, 1>>& dst, Eigen::Matrix<Type, 3, 3>& R, Eigen::Matrix<Type, 3, 1>& t) { // // Verify if the sizes of point arrays are the same // assert(src.size() == dst.size()); int pairSize = (int)src.size(); Eigen::Matrix<Type, 3, 1> center_src(0, 0, 0), center_dst(0, 0, 0); // // Compute centroid // for (int i = 0; i < pairSize; ++i) { center_src += (src[i] / src[i][3]).head<3>(); center_dst += (dst[i] / dst[i][3]).head<3>(); } center_src /= (Type)pairSize; center_dst /= (Type)pairSize; Eigen::Matrix<Type, Eigen::Dynamic, Eigen::Dynamic> S(pairSize, 3), D(pairSize, 3); for (int i = 0; i < pairSize; ++i) { S.row(i) = (src[i] / src[i][3]).head<3>() - center_src; D.row(i) = (dst[i] / dst[i][3]).head<3>() - center_dst; } Eigen::Matrix<Type, Eigen::Dynamic, Eigen::Dynamic> Dt = D.transpose(); Eigen::Matrix<Type, 3, 3> H = Dt * S; Eigen::Matrix<Type, 3, 3> W, U, V; // // Compute SVD // Eigen::JacobiSVD<Eigen::Matrix<Type, Eigen::Dynamic, Eigen::Dynamic>> svd; svd.compute(H, Eigen::ComputeThinU | Eigen::ComputeThinV); if (!svd.computeU() || !svd.computeV()) { // std::cerr << "<Error> Decomposition error" << std::endl; return false; } // // Compute rotation matrix and translation vector // Eigen::Matrix<Type, 3, 3> Vt = svd.matrixV().transpose(); R = svd.matrixU() * Vt; t = center_dst - R * center_src; return true; } template<typename Type, const int Rows> static bool ComputeRigidTransform(const std::vector<Eigen::Matrix<Type, Rows, 1>>& src, const std::vector<Eigen::Matrix<Type, Rows, 1>>& dst, Eigen::Matrix<Type, 4, 4>& mat) { Eigen::Matrix<Type, 3, 3> R; Eigen::Matrix<Type, 3, 1> t; if (ComputeRigidTransform(src, dst, R, t)) { mat.block(0, 0, 3, 3) = R; mat.row(3).setZero(); mat.col(3) = t.homogeneous(); return true; } return false; } template<typename Type> static Eigen::Matrix<Type, 4, 4> ComposeRigidTransform(const Eigen::Matrix<Type, 3, 3>& R, const Eigen::Matrix<Type, 3, 1>& t) { Eigen::Matrix<Type, 4, 4> rigidTransform; rigidTransform.block(0, 0, 3, 3) = R; rigidTransform.row(3).setZero(); rigidTransform.col(3) = t.homogeneous(); return rigidTransform; } #endif // _COMPUTE_RIGID_TRANSFORM_H_
/* * Node.h * * Created on: Nov 6, 2013 * Author: jasonr */ #ifndef CORE_PARTITION_NODE_H_ #define CORE_PARTITION_NODE_H_ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <vector> #include <sg/classPointers.h> #include <sg/node.h> #include "autoreg.h" #include "classPointers.h" #include "meshData.h" #include "visibleObject.h" namespace Core { class PartitionNode : public VisibleObject, public autoregister<PartitionNode> { public: using Indices = std::vector<MeshData::FaceSet>; PartitionNode(); virtual ~PartitionNode(); virtual std::string nodeType() const; static std::string nodetype; const std::vector<unsigned int> & indices() const; void setIndices(std::vector<unsigned int> &&indices); const Indices & faceSets() const; void setFaceSets(Indices &&facesets); unsigned int chunk() const; void setChunk(unsigned int chunk); Ut::Box3f globalBoundingBox() const; protected: virtual void initializeNode(); private: Indices m_faceSets; unsigned int m_chunk; using Super = VisibleObject; }; inline PartitionNodePtr asPartitionNode(Sg::NodePtr object) { return std::exempt_pointer_cast<PartitionNode>(object); } inline bool isPartitionNode(Sg::NodePtr object) { return std::exempt_pointer_cast<PartitionNode>(object) != nullptr; } } #endif // CORE_PARTITION_NODE_H_
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <quic/codec/PacketNumberCipher.h> #include <folly/ssl/OpenSSLPtrTypes.h> namespace quic { class Aes128PacketNumberCipher : public PacketNumberCipher { public: ~Aes128PacketNumberCipher() override = default; void setKey(folly::ByteRange key) override; const Buf& getKey() const override; HeaderProtectionMask mask(folly::ByteRange sample) const override; size_t keyLength() const override; private: folly::ssl::EvpCipherCtxUniquePtr encryptCtx_; Buf pnKey_; }; class Aes256PacketNumberCipher : public PacketNumberCipher { public: ~Aes256PacketNumberCipher() override = default; void setKey(folly::ByteRange key) override; const Buf& getKey() const override; HeaderProtectionMask mask(folly::ByteRange sample) const override; size_t keyLength() const override; private: folly::ssl::EvpCipherCtxUniquePtr encryptCtx_; Buf pnKey_; }; } // namespace quic
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "MMUIViewController.h" #import "UITableViewDataSource.h" #import "UITableViewDelegate.h" #import "WCFacadeExt.h" @class MMTableView, MMUIWindow, MMWebImageView, NSString, UILabel, UIView, WCMediaItem, WCNewYearHBDetailDataForSns; @interface WCNewYearHBDetailViewControllerForSns : MMUIViewController <WCFacadeExt, UITableViewDelegate, UITableViewDataSource> { WCMediaItem *_mediaItem; MMUIWindow *_fullScreenWindow; UIView *_bgView; UIView *_coverFrameView; MMWebImageView *_coverImgView; double _curProgress; UILabel *_moneyLabel; UILabel *_tipsLabel; MMTableView *m_tableView; UIView *m_oHeaderView; WCNewYearHBDetailDataForSns *_detailData; UILabel *_rmbUnitLabel; } - (void).cxx_destruct; - (double)tableView:(id)arg1 heightForRowAtIndexPath:(id)arg2; - (id)tableView:(id)arg1 cellForRowAtIndexPath:(id)arg2; - (void)makeCell:(id)arg1 cell:(id)arg2 row:(unsigned long long)arg3; - (long long)tableView:(id)arg1 numberOfRowsInSection:(long long)arg2; - (long long)numberOfSectionsInTableView:(id)arg1; - (id)getUsernameListFromMyContactList:(unsigned long long)arg1; - (void)onCancelDownloadSuccess:(id)arg1 downloadType:(int)arg2; - (void)setNaviBarTransparent:(_Bool)arg1; - (id)findBarButtonView:(id)arg1; - (id)getEnterpriseLogo:(unsigned int)arg1; - (id)getEnterpriseName:(unsigned int)arg1; - (void)updateWithDetailData:(id)arg1; - (void)setupSubviews; - (void)viewWillLayoutSubviews; - (void)viewWillDisappear:(_Bool)arg1; - (void)viewWillAppear:(_Bool)arg1; - (_Bool)shouldAutorotate; - (id)GetHeaderView:(id)arg1; - (void)setBorder:(id)arg1; - (void)initTableView; - (_Bool)useTransparentNavibar; - (void)initGradientBgView; - (void)onClose; - (void)initNavBar; - (void)viewDidLoad; - (void)dealloc; - (id)init; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "dbg.h" #include "stats.h" void usage() { fprintf(stderr, "usage: desc [-hs] DATAFILE\n\n" "desc analyse the data in DATAFILE and prints summary statistics\n" "that describe the data.\n\n" "The input must consist of one number per line. If no DATAFILE is\n" "provided, desc reads from standard input which means it can be\n" "used with pipes.\n\n" "Options\n" "-------\n" "-h Print this usage message and exit.\n\n" "-s Run in streaming mode. This uses almost no memory and run \n" " time scales linearly with input size. However, the percentiles\n" " are calculated approximately.\n\n" "Examples\n" "--------\n" "cat data/large.dat | desc\n" ); exit(1); } int main(int argc, char *argv[]) { int ch; bool streaming = false; while ((ch = getopt(argc, argv, "hs")) != -1) switch (ch) { case 'h': usage(); break; case 's': streaming = true; break; default: usage(); } argv += optind; dataset *ds = read_data_file(argv[0], streaming); if (!ds) { fprintf(stderr, "\n"); usage(); return 1; } printf("count %zu\n", ds->n); printf("min %.5g\n", min(ds)); printf("Q1 %.5g\n", first_quartile(ds)); printf("median %.5g\n", median(ds)); printf("Q3 %.5g\n", third_quartile(ds)); printf("max %.5g\n", max(ds)); printf("IQR %.5g\n", interquartile_range(ds)); printf("mean %.5g\n", mean(ds)); printf("var %.5g\n", var(ds)); printf("sd %.5g\n", sd(ds)); delete_dataset(ds); return 0; }
// // 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 NSString, UIImage; @protocol SightCaptureDelegate <NSObject> - (void)onRecorderFinished:(unsigned int)arg1 moviePath:(NSString *)arg2 withThumb:(UIImage *)arg3; - (void)onRecorderFailed:(unsigned int)arg1; - (void)onCameraStop; - (void)onCameraAudioReady; - (void)onCameraVideoReady; - (void)onCameraPreviewReady:(id <SightPreviewView>)arg1; @optional - (void)onCameraPreviewGap:(UIImage *)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 "CDStructures.h" @interface _IDEWorkspaceDocumentInternalContextWrapper : NSObject { id wrappedDelegate; SEL wrappedSelector; void *wrappedContextInfo; } @end
// // UIWebView+loadURL.h // TXCategories (https://github.com/tlsion/TXCategories) // // Created by 王-庭协 on 14/12/15. // Copyright (c) 2014年 www.skyfox.org. All rights reserved. // #import <UIKit/UIKit.h> @interface UIWebView (TXLoad) /** * @brief 读取一个网页地址 * * @param URLString 网页地址 */ - (void)tx_loadURL:(NSString*)URLString; /** * @brief 读取bundle中的webview * * @param htmlName 文件名称 xxx.html */ - (void)tx_loadLocalHtml:(NSString*)htmlName; /** * * 读取bundle中的webview * * @param htmlName htmlName 文件名称 xxx.html * @param inBundle bundle */ - (void)tx_loadLocalHtml:(NSString*)htmlName inBundle:(NSBundle*)inBundle; /** * @brief 清空cookie */ - (void)tx_clearCookies; @end
// // Created by Harrison on 9/8/2016. // #ifndef CS430_PROJ1_IMAGES_PPM3_H #define CS430_PROJ1_IMAGES_PPM3_H #include <stdio.h> #include "ppm_header.h" #include "helpers.h" /** * Provided a file stream, a loaded PpmHeader, and an allocated color grid of proper size, this function * parses the data from the file and loads it into the provided color grid. * @param filePointer - The file stream to read from * @param header - The header information * @param colorGrid - The allocated array of colors that the data will be stored to * @return 1 if success, 0 if failure */ int ppm3_parse_data(FILE* filePointer, PpmHeaderRef header, ColorRef colorGrid); /** * Provided a file stream, a PpmHeader, and a grid of colors, this function writes the color data to the file. * This function does not write the file headers * @param filePointer - The file stream to write to * @param header - The header information * @param colorGrid - The array of colors that will be written * @return 1 if success, 0 if failure */ int ppm3_write_data(FILE* filePointer, PpmHeaderRef header, ColorRef colorGrid); #endif //CS430_PROJ1_IMAGES_PPM3_H
/************************************************************************* > File Name: echoser.c > Author: Simba > Mail: dameng34@163.com > Created Time: Fri 01 Mar 2013 06:15:27 PM CST ************************************************************************/ #include<stdio.h> #include<sys/types.h> #include<sys/socket.h> #include<unistd.h> #include<stdlib.h> #include<errno.h> #include<arpa/inet.h> #include<netinet/in.h> #include<string.h> #include<netdb.h> #include<sys/time.h> #include<sys/resource.h> #define ERR_EXIT(m) \ do { \ perror(m); \ exit(EXIT_FAILURE); \ } while (0) int main(void) { struct rlimit rl; if (getrlimit(RLIMIT_NOFILE, &rl) < 0) ERR_EXIT("getrlimit error"); printf("%d\n", (int)rl.rlim_max); rl.rlim_cur = 2048; rl.rlim_max = 2048; if (setrlimit(RLIMIT_NOFILE, &rl) < 0) ERR_EXIT("setrlimit"); if (getrlimit(RLIMIT_NOFILE, &rl) <0) ERR_EXIT("getrlimit error"); printf("%d\n", (int)rl.rlim_max); return 0; }
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: android/libcore/luni/src/main/java/java/util/HugeEnumSet.java // #ifndef _JavaUtilHugeEnumSet_H_ #define _JavaUtilHugeEnumSet_H_ #include "J2ObjC_header.h" #include "java/util/EnumSet.h" @class IOSClass; @class IOSObjectArray; @class JavaLangEnum; @protocol JavaUtilCollection; @protocol JavaUtilIterator; /*! @brief A concrete EnumSet for enums with more than 64 elements. */ @interface JavaUtilHugeEnumSet : JavaUtilEnumSet #pragma mark Public - (jboolean)addWithId:(JavaLangEnum *)element; - (jboolean)addAllWithJavaUtilCollection:(id<JavaUtilCollection>)collection; - (void)clear; - (JavaUtilHugeEnumSet *)clone; - (jboolean)containsWithId:(id)object; - (jboolean)containsAllWithJavaUtilCollection:(id<JavaUtilCollection>)collection; - (jboolean)isEqual:(id)object; - (id<JavaUtilIterator>)iterator; - (jboolean)removeWithId:(id)object; - (jboolean)removeAllWithJavaUtilCollection:(id<JavaUtilCollection>)collection; - (jboolean)retainAllWithJavaUtilCollection:(id<JavaUtilCollection>)collection; - (jint)size; #pragma mark Protected - (void)complement; #pragma mark Package-Private /*! @brief Constructs an instance. @param elementType non-null; type of the elements @param enums non-null; pre-populated array of constants in ordinal order */ - (instancetype)initWithIOSClass:(IOSClass *)elementType withJavaLangEnumArray:(IOSObjectArray *)enums; - (void)setRangeWithJavaLangEnum:(JavaLangEnum *)start withJavaLangEnum:(JavaLangEnum *)end; @end J2OBJC_EMPTY_STATIC_INIT(JavaUtilHugeEnumSet) FOUNDATION_EXPORT void JavaUtilHugeEnumSet_initWithIOSClass_withJavaLangEnumArray_(JavaUtilHugeEnumSet *self, IOSClass *elementType, IOSObjectArray *enums); FOUNDATION_EXPORT JavaUtilHugeEnumSet *new_JavaUtilHugeEnumSet_initWithIOSClass_withJavaLangEnumArray_(IOSClass *elementType, IOSObjectArray *enums) NS_RETURNS_RETAINED; J2OBJC_TYPE_LITERAL_HEADER(JavaUtilHugeEnumSet) #endif // _JavaUtilHugeEnumSet_H_
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 6.00.0366 */ /* Compiler settings for mimeinfo.idl: Oicf, W1, Zp8, env=Win32 (32b run) protocol : dce , ms_ext, c_ext error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ //@@MIDL_FILE_HEADING( ) #pragma warning( disable: 4049 ) /* more than 64k source lines */ /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 440 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif // __RPCNDR_H_VERSION__ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __mimeinfo_h__ #define __mimeinfo_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ #ifndef __IMimeInfo_FWD_DEFINED__ #define __IMimeInfo_FWD_DEFINED__ typedef interface IMimeInfo IMimeInfo; #endif /* __IMimeInfo_FWD_DEFINED__ */ /* header files for imported files */ #include "objidl.h" #ifdef __cplusplus extern "C"{ #endif void * __RPC_USER MIDL_user_allocate(size_t); void __RPC_USER MIDL_user_free( void * ); /* interface __MIDL_itf_mimeinfo_0000 */ /* [local] */ //=--------------------------------------------------------------------------= // MimeInfo.h //=--------------------------------------------------------------------------= // (C) Copyright 1995-1998 Microsoft Corporation. All Rights Reserved. // // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. //=--------------------------------------------------------------------------= #pragma comment(lib,"uuid.lib") //-------------------------------------------------------------------------- // IMimeInfo Interfaces. extern RPC_IF_HANDLE __MIDL_itf_mimeinfo_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_mimeinfo_0000_v0_0_s_ifspec; #ifndef __IMimeInfo_INTERFACE_DEFINED__ #define __IMimeInfo_INTERFACE_DEFINED__ /* interface IMimeInfo */ /* [unique][uuid][object][local] */ typedef /* [unique] */ IMimeInfo *LPMIMEINFO; EXTERN_C const IID IID_IMimeInfo; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("F77459A0-BF9A-11cf-BA4E-00C04FD70816") IMimeInfo : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetMimeCLSIDMapping( /* [out] */ UINT *pcTypes, /* [out] */ LPCSTR **ppszTypes, /* [out] */ CLSID **ppclsID) = 0; }; #else /* C style interface */ typedef struct IMimeInfoVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IMimeInfo * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IMimeInfo * This); ULONG ( STDMETHODCALLTYPE *Release )( IMimeInfo * This); HRESULT ( STDMETHODCALLTYPE *GetMimeCLSIDMapping )( IMimeInfo * This, /* [out] */ UINT *pcTypes, /* [out] */ LPCSTR **ppszTypes, /* [out] */ CLSID **ppclsID); END_INTERFACE } IMimeInfoVtbl; interface IMimeInfo { CONST_VTBL struct IMimeInfoVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMimeInfo_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define IMimeInfo_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define IMimeInfo_Release(This) \ (This)->lpVtbl -> Release(This) #define IMimeInfo_GetMimeCLSIDMapping(This,pcTypes,ppszTypes,ppclsID) \ (This)->lpVtbl -> GetMimeCLSIDMapping(This,pcTypes,ppszTypes,ppclsID) #endif /* COBJMACROS */ #endif /* C style interface */ HRESULT STDMETHODCALLTYPE IMimeInfo_GetMimeCLSIDMapping_Proxy( IMimeInfo * This, /* [out] */ UINT *pcTypes, /* [out] */ LPCSTR **ppszTypes, /* [out] */ CLSID **ppclsID); void __RPC_STUB IMimeInfo_GetMimeCLSIDMapping_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __IMimeInfo_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_mimeinfo_0093 */ /* [local] */ #define SID_IMimeInfo IID_IMimeInfo extern RPC_IF_HANDLE __MIDL_itf_mimeinfo_0093_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_mimeinfo_0093_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
#pragma once #include <GL\glew.h> #include <glm/gtc/type_ptr.hpp> class LeapData { public: inline LeapData(){}; inline ~LeapData(){}; LeapData* ptr = this; glm::vec3 palmPosition = glm::vec3(0.0f, 0.0f, 0.0f); glm::vec3 tempPalmPosition = glm::vec3(0.0f, 0.0f, 0.0f); glm::vec3 palmNormal = glm::vec3(0.0f, 1.0f, 0.0f); glm::vec3 direction = glm::vec3(0.0f, 0.0f, 1.0f); bool isRight; float pitch, roll, yaw, handDifference; inline glm::vec3 getPointer() { return glm::vec3( rescale(palmPosition).x + direction.x * 5, rescale(palmPosition).y + direction.y * 5, rescale(palmPosition).z + direction.z * 5); } inline static glm::vec3 rescale(glm::vec3 v) { return glm::vec3((v.x / 16), (v.y / 16) - 10.0f, (v.z / 16) - 10.0f); } };
/* ** Copyright 2012 by Kvaser AB, Mölndal, Sweden ** http://www.kvaser.com ** ** This software is dual licensed under the following two licenses: ** BSD-new and GPLv2. You may use either one. See the included ** COPYING file for details. ** ** License: BSD-new ** =============================================================================== ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** * Neither the name of the <organization> 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 <COPYRIGHT HOLDER> 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. ** ** ** License: GPLv2 ** =============================================================================== ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License ** as published by the Free Software Foundation; either version 2 ** of the License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ** ** --------------------------------------------------------------------------- **/ #ifndef OBJBUF_H #define OBJBUF_H #include "vcanevt.h" #define MAX_OBJECT_BUFFERS 8 // Object buffer types. #define OBJBUF_TYPE_AUTO_RESPONSE 1 #define OBJBUF_TYPE_PERIODIC_TX 2 #define OBJBUF_AUTO_RESPONSE_RTR_ONLY 0x01 // Flag: respond to RTR's only #define OBJBUF_DRIVER_MARKER 0x40000000 // To make handles different #define OBJBUF_DRIVER_MASK 0x1f // Support up to 32 object buffers typedef struct { unsigned int acc_code; // For autoresponse bufs; filter code unsigned int acc_mask; // For autoresponse bufs; filter mask unsigned int period; // For auto tx buffers; interval in microseconds CAN_MSG msg; unsigned char in_use; unsigned char active; unsigned char type; unsigned char flags; } OBJECT_BUFFER; struct VCanOpenFileNode; unsigned int objbuf_filter_match(OBJECT_BUFFER *buf, unsigned int id, unsigned int flags); void objbuf_init(struct VCanOpenFileNode *fileNodePtr); void objbuf_shutdown(struct VCanOpenFileNode *fileNodePtr); #endif
// // FDPayParamsModel.h // FDSDK // // Created by 熙文 张 on 2017/01/11. // Copyright © 2017年 熙文 张. All rights reserved. // #import <UIKit/UIKit.h> @interface FDPayParamsModel : NSObject /** * 订单编号 */ @property (nonatomic, strong) NSString *orderId; /** * 订单金额(大于等于1的整数) */ @property (nonatomic, assign) int price; /** * 商品标识(互冠SDK需要与苹果后台的商品ID对应) */ @property (nonatomic, strong) NSString *productId; /** * 商品名称 */ @property (nonatomic, strong) NSString *productName; /** * 商品描述 */ @property (nonatomic, strong) NSString *productDesc; /** 举例:使用6元人民币购买了60钻石的档位,其中商品份量为1份,商品数量为60个(钻石) **/ /** * 商品份量(一般为1) */ @property (nonatomic) int productNumber; /** * 商品数量(一般为支付金额 * 兑换比) */ @property (nonatomic) int productCount; /** * 角色标识 */ @property (nonatomic, strong) NSString *roleId; /** * 角色名称 */ @property (nonatomic, strong) NSString *roleName; /** * 角色等级 */ @property (nonatomic, strong) NSString *roleLevel; /** * 区服标识 */ @property (nonatomic, strong) NSString *serverId; /** * 区服名称 */ @property (nonatomic, strong) NSString *serverName; /** * 拓展参数 */ @property (nonatomic, strong) NSString *extension; @property (nonatomic, strong) NSString *sign; - (NSString *)getSignWithDictory:(NSDictionary *)dictionary; @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" @interface BlueProfilePedometerInfo : NSObject { int _Step; int _Calorie; int _Distance; } @property int Distance; // @synthesize Distance=_Distance; @property int Calorie; // @synthesize Calorie=_Calorie; @property int Step; // @synthesize Step=_Step; @end
/* * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strtol.c 5.4 (Berkeley) 2/23/91"; #endif /* LIBC_SCCS and not lint */ #include "c.h" #include <limits.h> #include <ctype.h> #define const /* * Usage Tip: * * strtol() doesn't give a unique return value to indicate that errno * should be consulted, so in most cases it is best to set errno = 0 * before calling this function, and then errno != 0 can be tested * after the function completes. */ /* * Convert a string to a long integer. * * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ long strtol(nptr, endptr, base) const char *nptr; char **endptr; int base; { const char *s = nptr; unsigned long acc; unsigned char c; unsigned long cutoff; int neg = 0, any, cutlim; /* * Skip white space and pick up leading +/- sign if any. If base is 0, * allow 0x for hex and 0 for octal, else assume decimal; if base is * already 16, allow 0x. */ do { c = *s++; } while (isspace(c)); if (c == '-') { neg = 1; c = *s++; } else if (c == '+') c = *s++; if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) { c = s[1]; s += 2; base = 16; } if (base == 0) base = c == '0' ? 8 : 10; /* * Compute the cutoff value between legal numbers and illegal numbers. * That is the largest legal value, divided by the base. An input number * that is greater than this value, if followed by a legal input * character, is too big. One that is equal to this value may be valid or * not; the limit between valid and invalid numbers is then based on the * last digit. For instance, if the range for longs is * [-2147483648..2147483647] and the input base is 10, cutoff will be set * to 214748364 and cutlim to either 7 (neg==0) or 8 (neg==1), meaning * that if we have accumulated a value > 214748364, or equal but the next * digit is > 7 (or 8), the number is too big, and we will return a range * error. * * Set any if any `digits' consumed; make it negative to indicate * overflow. */ cutoff = neg ? -(unsigned long) LONG_MIN : LONG_MAX; cutlim = cutoff % (unsigned long) base; cutoff /= (unsigned long) base; for (acc = 0, any = 0;; c = *s++) { if (isdigit(c)) c -= '0'; else if (isalpha(c)) c -= isupper(c) ? 'A' - 10 : 'a' - 10; else break; if ((int) c >= base) break; if (any < 0 || acc > cutoff || acc == cutoff && (int) c > cutlim) any = -1; else { any = 1; acc *= base; acc += c; } } if (any < 0) { acc = neg ? LONG_MIN : LONG_MAX; errno = ERANGE; } else if (neg) acc = -acc; if (endptr != 0) *endptr = any ? s - 1 : (char *) nptr; return acc; }
#pragma once #ifndef H_DISTANCE #define H_DISTANCE #include "map.h" int get_crow_distance_between(Location from, Location to); int get_shortest_distance_between(Location from, Location to, int cutoff); MotionWord get_direction_from(Location from, Location to); bool is_adjacent_to(Location from, Location to); #endif // H_DISTANCE
#include <stdio.h> int main() { const long double PI = 3.141592653590L; const int DAYS_IN_WEEK = 7; const SUNDAY = 0; // by default int DAYS_IN_WEEK = 7; // error return 0; }
// // ZNGMockEventClient.h // ZingleSDK // // Created by Jason Neel on 3/7/17. // Copyright © 2017 Zingle. All rights reserved. // #import <ZingleSDK/ZNGEventClient.h> @class ZNGEvent; @interface ZNGMockEventClient : ZNGEventClient /** * Events to be returned by spoofed methods, ordered oldest to newest (i.e. opposite of normal ZNGConversation ordering) */ @property (nonatomic, strong, nullable) NSArray<ZNGEvent *> * events; @end
/* * A naive algorithm for circular string matching with k mismatches. */ #include <stddef.h> static unsigned char *P; static size_t m; void prep(unsigned char *P_, size_t m_, size_t k) { P = P_; m = m_; (void)k; } size_t exec(unsigned char *T, size_t n, size_t k) { size_t i, j, r, neq, occ = 0; for (i = 0; i <= n-m; i++) { for (r = 0; r < m; r++) { neq = 0; for (j = 0; j < m; j++) { if (P[(r+j) % m] != T[i+j] && ++neq > k) break; } if (j == m) { occ++; break; } } } return occ; }
#include "frameon.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <linux/fb.h> #include <sys/mman.h> #include <sys/ioctl.h> #include <errno.h> #define true 1 #define false 0 int frameon_putvinfo(struct fb_var_screeninfo *put){ int res = ioctl(frameon_fbfd, FBIOPUT_VSCREENINFO, put); //error handling/reporting return res; } int frameon_updateFBInfo(char remap){ int fres,vres,rres; fres = ioctl(frameon_fbfd, FBIOGET_FSCREENINFO, &frameon_finfo); vres = ioctl(frameon_fbfd, FBIOGET_VSCREENINFO, &frameon_vinfo); if(fres!=0) return fres; if(vres!=0) return vres; if(remap == 1){ if(frameon_fbp!=NULL) munmap(frameon_fbp, frameon_screensize); frameon_bytes_per_pixel = frameon_vinfo.bits_per_pixel/8; frameon_screensize = frameon_vinfo.xres *frameon_vinfo.yres *frameon_bytes_per_pixel; frameon_fbp = (char*)mmap(0, frameon_screensize, PROT_READ | PROT_WRITE, MAP_SHARED, frameon_fbfd, 0); rres = 0; if(frameon_fbp == NULL) rres = 1; } return 0; } int frameon_setVirtualResolution(int width, int height){ frameon_vinfo.xres_virtual = width; frameon_vinfo.yres_virtual = height; int setRes = frameon_putvinfo(&frameon_vinfo); frameon_updateFBInfo(1); return setRes; } int frameon_setScreenResolution(int width, int height){ frameon_vinfo.xres = width; frameon_vinfo.yres = height; int setRes = frameon_putvinfo(&frameon_vinfo); frameon_updateFBInfo(1); return setRes; } int frameon_loadFramebuffer(const char *fbuf, char useBackbuffer){ frameon_fbp = NULL; int fd = open(fbuf, O_RDWR); frameon_fbfd = fd; if(fd == -1) return 1; frameon_updateFBInfo(0); frameon_usebb = useBackbuffer; if(frameon_usebb == true){ //Setup double buffering... if(frameon_setVirtualResolution( frameon_vinfo.xres, frameon_vinfo.yres*2) == 0){ //use offset method frameon_tbuf = frameon_fbp; frameon_bbp = NULL; fprintf(stdout, "Double buffering method: 1\n"); }else{ //try to (m)allocate the back buffer frameon_bbp = (char*)malloc(frameon_screensize); if(frameon_bbp == NULL){ //Failed set up double buffering frameon_usebb = false; frameon_tbuf = frameon_fbp; fprintf(stdout, "Double buffering method: 0\n"); }else{ frameon_tbuf = frameon_bbp; fprintf(stdout, "Double buffering method: 2\n"); } } }else frameon_bbp = NULL; //Update fb with any double buffering changes, and mmap it if(frameon_updateFBInfo(1)!=0) return 4; if(frameon_bbp == NULL) frameon_tbuf = frameon_fbp; switch(frameon_vinfo.bits_per_pixel){ default: frameon_setPixel = frameon_sp_16bpp; break; case 32: frameon_setPixel = frameon_sp_32bpp; break; case 24: frameon_setPixel = frameon_sp_24bpp; break; } return 0; } long int frameon_getLocation(int x,int y){ int yoff = frameon_vinfo.yoffset; if(frameon_usebb == true && frameon_bbp == NULL){ if(yoff == 0) yoff = frameon_vinfo.yres; else yoff = 0; } //fprintf(stdout, "gloc:yoff = %i\n", yoff); return (x+frameon_vinfo.xoffset) * frameon_bytes_per_pixel + (y+yoff) * frameon_finfo.line_length; } int frameon_drawImage(int x, int y, foImage *img, char clip){ if(img == NULL) return 1; int hclip = img->height; if(clip == 1 && hclip+y>frameon_vinfo.yres) hclip = frameon_vinfo.yres - y; int wclip = img->width; if(clip == 1 && wclip+x>frameon_vinfo.xres) wclip = frameon_vinfo.xres - x; int linesize = wclip*4; int loc,ry; for(ry=0; ry<hclip; ry++){ loc = getLocation(x,y+ry); memcpy( frameon_tbuf+loc, img->data+(img->width*4*ry),linesize); } return 0; } void frameon_clearBufferColor(int r, int g, int b, int a){ int x, y; for(y = 0; y<frameon_vinfo.yres; y++) for(x=0; x<frameon_vinfo.xres; x++) setPixel(getLocation(x,y),r,g,b,a); } void frameon_clearBuffer(){ memset(frameon_tbuf, 0, frameon_screensize); } void frameon_swapBuffer(){ if(frameon_usebb == false) return; if(frameon_bbp==NULL){ if(frameon_vinfo.yoffset == 0) frameon_vinfo.yoffset = frameon_vinfo.yres; else frameon_vinfo.yoffset = 0; ioctl(frameon_fbfd, FBIOPAN_DISPLAY, &frameon_vinfo); }else{ memcpy(frameon_fbp, frameon_tbuf, frameon_screensize); } } void frameon_cleanUp(){ munmap(frameon_fbp, frameon_screensize); free(frameon_bbp); close(frameon_fbfd); } void frameon_sp_16bpp(long int l, int r, int g, int b, int a){ *((fu16*)(frameon_tbuf+l)) = 0<<r | 0<<g | b; } void frameon_sp_24bpp(long int l, int r, int g, int b, int a){ *((fu8*)(frameon_tbuf+l)) = b; *((fu8*)(frameon_tbuf+l+1)) = g; *((fu8*)(frameon_tbuf+l+2)) = r; } void frameon_sp_32bpp(long int l, int r, int g, int b, int a){ *((fu8*)(frameon_tbuf+l)) = b; *((fu8*)(frameon_tbuf+l+1)) = g; *((fu8*)(frameon_tbuf+l+2)) = r; *((fu8*)(frameon_tbuf+l+3)) = a; }
#include <stdio.h> #include <stdlib.h> #include <smack.h> struct str { int x ; int * y ; }; struct str* foo(int b, int* a) { if (b == 0) { return NULL; } struct str* s = malloc (sizeof(struct str)); (*s).x = b ; (*s).y = a ; return s; } void func(int* w) { struct str * s = foo(*w, w); (*s).x = 1; }
/* * grove_digital_light.h * * Copyright (c) 2012 seeed technology inc. * Website : www.seeed.cc * Author : Jacky Zhang * * The MIT License (MIT) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef __GROVE_DIGITAL_LIGHT_H__ #define __GROVE_DIGITAL_LIGHT_H__ //GROVE_NAME "Grove-Digital Light" //IF_TYPE I2C //IMAGE_URL http://www.seeedstudio.com/wiki/images/6/69/Digital_Light_Sensor.jpg #include "suli2.h" #define TSL2561_Address (0x29<<1) //device address #define TSL2561_Control 0x80 #define TSL2561_Timing 0x81 #define TSL2561_Interrupt 0x86 #define TSL2561_Channal0L 0x8C #define TSL2561_Channal0H 0x8D #define TSL2561_Channal1L 0x8E #define TSL2561_Channal1H 0x8F #define LUX_SCALE 14 // scale by 2^14 #define RATIO_SCALE 9 // scale ratio by 2^9 #define CH_SCALE 10 // scale channel values by 2^10 #define CHSCALE_TINT0 0x7517 // 322/11 * 2^CH_SCALE #define CHSCALE_TINT1 0x0fe7 // 322/81 * 2^CH_SCALE #define K1T 0x0040 // 0.125 * 2^RATIO_SCALE #define B1T 0x01f2 // 0.0304 * 2^LUX_SCALE #define M1T 0x01be // 0.0272 * 2^LUX_SCALE #define K2T 0x0080 // 0.250 * 2^RATIO_SCA #define B2T 0x0214 // 0.0325 * 2^LUX_SCALE #define M2T 0x02d1 // 0.0440 * 2^LUX_SCALE #define K3T 0x00c0 // 0.375 * 2^RATIO_SCALE #define B3T 0x023f // 0.0351 * 2^LUX_SCALE #define M3T 0x037b // 0.0544 * 2^LUX_SCALE #define K4T 0x0100 // 0.50 * 2^RATIO_SCALE #define B4T 0x0270 // 0.0381 * 2^LUX_SCALE #define M4T 0x03fe // 0.0624 * 2^LUX_SCALE #define K5T 0x0138 // 0.61 * 2^RATIO_SCALE #define B5T 0x016f // 0.0224 * 2^LUX_SCALE #define M5T 0x01fc // 0.0310 * 2^LUX_SCALE #define K6T 0x019a // 0.80 * 2^RATIO_SCALE #define B6T 0x00d2 // 0.0128 * 2^LUX_SCALE #define M6T 0x00fb // 0.0153 * 2^LUX_SCALE #define K7T 0x029a // 1.3 * 2^RATIO_SCALE #define B7T 0x0018 // 0.00146 * 2^LUX_SCALE #define M7T 0x0012 // 0.00112 * 2^LUX_SCALE #define K8T 0x029a // 1.3 * 2^RATIO_SCALE #define B8T 0x0000 // 0.000 * 2^LUX_SCALE #define M8T 0x0000 // 0.000 * 2^LUX_SCALE #define K1C 0x0043 // 0.130 * 2^RATIO_SCALE #define B1C 0x0204 // 0.0315 * 2^LUX_SCALE #define M1C 0x01ad // 0.0262 * 2^LUX_SCALE #define K2C 0x0085 // 0.260 * 2^RATIO_SCALE #define B2C 0x0228 // 0.0337 * 2^LUX_SCALE #define M2C 0x02c1 // 0.0430 * 2^LUX_SCALE #define K3C 0x00c8 // 0.390 * 2^RATIO_SCALE #define B3C 0x0253 // 0.0363 * 2^LUX_SCALE #define M3C 0x0363 // 0.0529 * 2^LUX_SCALE #define K4C 0x010a // 0.520 * 2^RATIO_SCALE #define B4C 0x0282 // 0.0392 * 2^LUX_SCALE #define M4C 0x03df // 0.0605 * 2^LUX_SCALE #define K5C 0x014d // 0.65 * 2^RATIO_SCALE #define B5C 0x0177 // 0.0229 * 2^LUX_SCALE #define M5C 0x01dd // 0.0291 * 2^LUX_SCALE #define K6C 0x019a // 0.80 * 2^RATIO_SCALE #define B6C 0x0101 // 0.0157 * 2^LUX_SCALE #define M6C 0x0127 // 0.0180 * 2^LUX_SCALE #define K7C 0x029a // 1.3 * 2^RATIO_SCALE #define B7C 0x0037 // 0.00338 * 2^LUX_SCALE #define M7C 0x002b // 0.00260 * 2^LUX_SCALE #define K8C 0x029a // 1.3 * 2^RATIO_SCALE #define B8C 0x0000 // 0.000 * 2^LUX_SCALE #define M8C 0x0000 // 0.000 * 2^LUX_SCALE class GroveDigitalLight { public: GroveDigitalLight(int pinsda, int pinscl); bool read_lux(uint32_t *lux); private: I2C_T *i2c; unsigned char cmdbuf[2]; uint16_t ch0, ch1; unsigned long chScale; unsigned long channel1; unsigned long channel0; unsigned long ratio1; unsigned int b; unsigned int m; unsigned long temp; unsigned long lux; void _getLux(I2C_T *i2c); unsigned long _calculateLux(unsigned int iGain, unsigned int tInt, int iType); }; #endif
#include "Performance.h" uint64 GetPerformanceCounter(void) { LARGE_INTEGER i; if(!QueryPerformanceCounter(&i)) { error(); } #if 0 if(i.QuadPart <= 0i64) { error(); } #endif return (uint64)i.QuadPart; } uint64 GetPerformanceFrequency(void) { static uint64 freq; if(freq == 0ui64) { LARGE_INTEGER i; if(!QueryPerformanceFrequency(&i)) { error(); } if(i.QuadPart <= 0i64) { error(); } freq = (uint64)i.QuadPart; } return freq; }
// // Created by azu on 2014/09/08. // #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> // fetch all -> filter by predicate @interface RequestInMemory : NSObject // initialize class + fetch data from CoreData + (instancetype)memoryEntityDescription:(NSEntityDescription *) entityDescription context:(NSManagedObjectContext *) managedObjectContext; + (instancetype)memoryEntityDescription:(NSEntityDescription *) entityDescription predicate:(NSPredicate *) predicate context:(NSManagedObjectContext *) managedObjectContext; #pragma mark - manually // manually update internal database // when initialize the class, automatically call this method. - (NSArray *)fetchAll; - (NSArray *)fetchWithPredicate:(NSPredicate *) predicate; #pragma mark - filter helper - (BOOL)testWithPredicate:(NSPredicate *) predicate; - (NSArray *)findWithFirstPredicate:(NSPredicate *) predicate; - (NSArray *)findWithAllPredicate:(NSPredicate *) predicate; @end
// // PJAppDelegate.h // ScrollViewerAutoLayout // // Created by Paul Jackson on 11/12/2013. // Copyright (c) 2013 PaulJ. All rights reserved. // #import <UIKit/UIKit.h> @interface PJAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // OCExampleResult.h // SpecRunner // // Created by John Clayton on 12/23/2008. // Copyright 2008 Fivesquare Software, LLC. All rights reserved. // /* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import <Foundation/Foundation.h> @interface OCExampleResult : NSObject { Class group; NSString *exampleName; BOOL success; long elapsed; NSException *error; } @property (nonatomic, retain) Class group; @property (nonatomic, retain) NSString *exampleName; @property (nonatomic, assign) BOOL success; @property (nonatomic, assign) long elapsed; @property (nonatomic, retain) NSException *error; - (id) initWithExampleName:(NSString *)anExampleName inGroup:(Class)aGroup; @end
/* Hello World program */ #include<stdio.h> /* void print_bits(unsigned int num) { unsigned int size = sizeof(unsigned int); unsigned int maxPow = 1<<(size*8-1); int i = 0; for(;i<size*8;++i){ // print last bit and shift left. printf("%u ",num&maxPow ? 1 : 0); num = num<<1; } } */ void print_bits_reverse(unsigned long n) { int i; unsigned long m; m = 0x8000000000000000; for(i = 0; i < 64; i++) { } } void print_bits(unsigned long n) { while (n) { if (n & 1) printf("1"); else printf("0"); n >>= 1; } printf("\n"); } void get_ports(unsigned long n) { int octet_count, port_number; for(octet_count = 1; octet_count < 9;octet_count++) { for(port_number = octet_count * 8; port_number > (octet_count -1) * 8; port_number--) { if(n & 1) printf("%d\n", port_number); n >>= 1; } } } static int get_shift_bits(int user_port) { return 8 * (user_port / 8) + (8 - (user_port % 8)); } #define IS_PORTS_OVERLAP(ports_1, ports_2) (int *)(ports_1 & ports_2) main() { unsigned long a, b, c, d; a = 0x80; b = 0x40; a |= b; c = a ^ b; printf("c: %lx, b: %lx\n", c, b); //a = 0xFFC0000000000000; a = 0x1; a <<= get_shift_bits(9); printf("%lx\n", a); get_ports(a); b = 0x1; b <<= get_shift_bits(8); a |= b; printf("%lx\n", a); get_ports(a); int i; //print_bits(a); /* print_bits(n); print_bits(0x1234567890ABCDEF); unsigned long i = 0xFEDCBA0987654321; printf("%lx\n", i); printf("%#010x\n", i); printf("0x%08x\n", i); // gives 0x00000007 printf("%#08x\n", i); // gives 0x000007 */ //print_bits(c); //long b = 0xFFFFFFFFFFFFFF; //a = a >> 1; //printf("size: %d\n", sizeof(unsigned long)); //printf("%x\n",a<<3); //printf("%u\n",a); /* char name[10]; char scan[10]; int port = 0; int ret = 0; ret = sscanf("br40", "swp%d", &port); printf("ret: %d, port: %d", ret, port); */ }
// 22 may 2015 #include "test.h" static void openFile(uiButton *b, void *data) { char *fn; fn = uiOpenFile(); if (fn == NULL) uiLabelSetText(uiLabel(data), "(cancelled)"); else { uiLabelSetText(uiLabel(data), fn); uiFreeText(fn); } } static void saveFile(uiButton *b, void *data) { char *fn; fn = uiSaveFile(); if (fn == NULL) uiLabelSetText(uiLabel(data), "(cancelled)"); else { uiLabelSetText(uiLabel(data), fn); uiFreeText(fn); } } static uiEntry *title, *description; static void msgBox(uiButton *b, void *data) { char *t, *d; t = uiEntryText(title); d = uiEntryText(description); uiMsgBox(t, d); uiFreeText(d); uiFreeText(t); } static void msgBoxError(uiButton *b, void *data) { char *t, *d; t = uiEntryText(title); d = uiEntryText(description); uiMsgBoxError(t, d); uiFreeText(d); uiFreeText(t); } uiBox *makePage5(void) { uiBox *page5; uiBox *hbox; uiButton *button; uiLabel *label; page5 = newVerticalBox(); #define D(n, f) \ hbox = newHorizontalBox(); \ button = uiNewButton(n); \ label = uiNewLabel(""); \ uiButtonOnClicked(button, f, label); \ uiBoxAppend(hbox, uiControl(button), 0); \ uiBoxAppend(hbox, uiControl(label), 0); \ uiBoxAppend(page5, uiControl(hbox), 0); D("Open File", openFile); D("Save File", saveFile); title = uiNewEntry(); uiEntrySetText(title, "Title"); description = uiNewEntry(); uiEntrySetText(description, "Description"); hbox = newHorizontalBox(); button = uiNewButton("Message Box"); uiButtonOnClicked(button, msgBox, NULL); uiBoxAppend(hbox, uiControl(button), 0); uiBoxAppend(hbox, uiControl(title), 0); uiBoxAppend(page5, uiControl(hbox), 0); hbox = newHorizontalBox(); button = uiNewButton("Error Box"); uiButtonOnClicked(button, msgBoxError, NULL); uiBoxAppend(hbox, uiControl(button), 0); uiBoxAppend(hbox, uiControl(description), 0); uiBoxAppend(page5, uiControl(hbox), 0); return page5; }