diff
stringlengths
41
2.03M
msg
stringlengths
1
1.5k
repo
stringlengths
5
40
sha
stringlengths
40
40
time
stringlengths
20
20
mmm a / test / SourceKit / Sema / educational_note_diags . swift <nl> ppp b / test / SourceKit / Sema / educational_note_diags . swift <nl> extension ( Int , Int ) { } <nl> <nl> / / DESCRIPTIVE : key . description : " non - nominal type <nl> / / DESCRIPTIVE : key . educational_note_paths : [ <nl> - / / DESCRIPTIVE - NEXT : " / educational / notes / path / prefix / nominal - types . md " <nl> + / / DESCRIPTIVE - NEXT : " { { / | \ \ } } educational { { / | \ \ } } notes { { / | \ \ } } path { { / | \ \ } } prefix { { / | \ \ } } nominal - types . md " <nl> / / DESCRIPTIVE - NEXT : ] <nl> <nl> / / RUN : % sourcekitd - test - req = sema % s - - % s | % FileCheck % s - check - prefix = DESCRIPTIVE - DISABLED <nl>
Update test for Windows path
apple/swift
eec814fa4f8a908f827eba7f14df406fc7059439
2020-02-28T16:48:48Z
mmm a / test / api - digester / Inputs / Foo - new - version / foo . h <nl> ppp b / test / api - digester / Inputs / Foo - new - version / foo . h <nl> <nl> - ( void ) someOptionalFunctionFromProt ; <nl> @ end <nl> <nl> + @ protocol AnotherObjcProt <nl> + - ( void ) anotherFunctionFromProt ; <nl> + - ( void ) anotherFunctionFromProt2 ; <nl> + @ end <nl> + <nl> @ interface ClangInterface : NSObject < ObjcProt > <nl> - ( void ) someFunction ; <nl> @ end <nl> new file mode 100644 <nl> index 000000000000 . . c13dcda03b2d <nl> mmm / dev / null <nl> ppp b / test / api - digester / Inputs / Foo - prot - whitelist . txt <nl> @ @ - 0 , 0 + 1 @ @ <nl> + AnotherObjcProt <nl> mmm a / test / api - digester / Inputs / Foo / foo . h <nl> ppp b / test / api - digester / Inputs / Foo / foo . h <nl> <nl> - ( void ) someFunctionFromProt ; <nl> @ end <nl> <nl> + @ protocol AnotherObjcProt <nl> + - ( void ) anotherFunctionFromProt ; <nl> + @ end <nl> + <nl> @ interface ClangInterface : NSObject < ObjcProt > <nl> - ( void ) someFunction ; <nl> @ end <nl> mmm a / test / api - digester / Outputs / clang - module - dump . txt <nl> ppp b / test / api - digester / Outputs / clang - module - dump . txt <nl> <nl> " name " : " TopLevel " , <nl> " printedName " : " TopLevel " , <nl> " children " : [ <nl> + { <nl> + " kind " : " TypeDecl " , <nl> + " name " : " AnotherObjcProt " , <nl> + " printedName " : " AnotherObjcProt " , <nl> + " children " : [ <nl> + { <nl> + " kind " : " Function " , <nl> + " name " : " anotherFunctionFromProt " , <nl> + " printedName " : " anotherFunctionFromProt ( ) " , <nl> + " children " : [ <nl> + { <nl> + " kind " : " TypeNameAlias " , <nl> + " name " : " Void " , <nl> + " printedName " : " Void " , <nl> + " children " : [ <nl> + { <nl> + " kind " : " TypeNominal " , <nl> + " name " : " Void " , <nl> + " printedName " : " ( ) " <nl> + } <nl> + ] <nl> + } <nl> + ] , <nl> + " declKind " : " Func " , <nl> + " usr " : " c : objc ( pl ) AnotherObjcProt ( im ) anotherFunctionFromProt " , <nl> + " moduleName " : " Foo " , <nl> + " genericSig " : " < Self where Self : AnotherObjcProt > " , <nl> + " protocolReq " : true , <nl> + " declAttributes " : [ <nl> + " ObjC " <nl> + ] , <nl> + " funcSelfKind " : " NonMutating " <nl> + } <nl> + ] , <nl> + " declKind " : " Protocol " , <nl> + " usr " : " c : objc ( pl ) AnotherObjcProt " , <nl> + " moduleName " : " Foo " , <nl> + " declAttributes " : [ <nl> + " ObjC " <nl> + ] <nl> + } , <nl> { <nl> " kind " : " TypeDecl " , <nl> " name " : " ClangInterface " , <nl> mmm a / test / api - digester / compare - clang - dump . swift <nl> ppp b / test / api - digester / compare - clang - dump . swift <nl> <nl> / / RUN : % empty - directory ( % t . module - cache ) <nl> / / RUN : % api - digester - dump - sdk - module Foo - o % t . dump1 . json - module - cache - path % t . module - cache % clang - importer - sdk - nosource - I % S / Inputs / Foo - avoid - location <nl> / / RUN : % api - digester - dump - sdk - module Foo - o % t . dump2 . json - module - cache - path % t . module - cache % clang - importer - sdk - nosource - I % S / Inputs / Foo - new - version - avoid - location <nl> - / / RUN : % api - digester - diagnose - sdk - print - module - - input - paths % t . dump1 . json - input - paths % t . dump2 . json - o % t . result <nl> + / / RUN : % api - digester - diagnose - sdk - protocol - requirement - white - list % S / Inputs / Foo - prot - whitelist . txt - print - module - - input - paths % t . dump1 . json - input - paths % t . dump2 . json - o % t . result <nl> <nl> / / RUN : % clang - E - P - x c % S / Outputs / Foo - diff . txt - o - | sed ' / ^ \ s * $ / d ' > % t . expected <nl> / / RUN : % clang - E - P - x c % t . result - o - | sed ' / ^ \ s * $ / d ' > % t . result . tmp <nl> mmm a / tools / swift - api - digester / swift - api - digester . cpp <nl> ppp b / tools / swift - api - digester / swift - api - digester . cpp <nl> static llvm : : cl : : opt < std : : string > <nl> ModuleList ( " module - list - file " , <nl> llvm : : cl : : desc ( " File containing a new - line separated list of modules " ) ) ; <nl> <nl> + static llvm : : cl : : opt < std : : string > <nl> + ProtReqWhiteList ( " protocol - requirement - white - list " , <nl> + llvm : : cl : : desc ( " File containing a new - line separated list of protocol names " ) ) ; <nl> + <nl> static llvm : : cl : : opt < std : : string > <nl> OutputFile ( " o " , llvm : : cl : : desc ( " Output file " ) ) ; <nl> <nl> class PrunePass : public MatchedNodeListener , public SDKTreeDiffPass { <nl> <nl> SDKContext & Ctx ; <nl> UpdatedNodesMap & UpdateMap ; <nl> + llvm : : StringSet < > ProtocolReqWhitelist ; <nl> <nl> static void printSpaces ( llvm : : raw_ostream & OS , SDKNode * N ) { <nl> assert ( N ) ; <nl> class PrunePass : public MatchedNodeListener , public SDKTreeDiffPass { <nl> <nl> public : <nl> PrunePass ( SDKContext & Ctx ) : Ctx ( Ctx ) , UpdateMap ( Ctx . getNodeUpdateMap ( ) ) { } <nl> + PrunePass ( SDKContext & Ctx , llvm : : StringSet < > prWhitelist ) : <nl> + Ctx ( Ctx ) , <nl> + UpdateMap ( Ctx . getNodeUpdateMap ( ) ) , <nl> + ProtocolReqWhitelist ( std : : move ( prWhitelist ) ) { } <nl> <nl> void foundMatch ( NodePtr Left , NodePtr Right , NodeMatchReason Reason ) override { <nl> if ( options : : Verbose ) <nl> class PrunePass : public MatchedNodeListener , public SDKTreeDiffPass { <nl> if ( ATD - > getDefault ( ) ) <nl> ShouldComplain = false ; <nl> } <nl> + if ( ShouldComplain & & <nl> + ProtocolReqWhitelist . count ( D - > getParent ( ) - > getAs < SDKNodeDecl > ( ) - > getFullyQualifiedName ( ) ) ) { <nl> + / / Ignore protocol requirement additions if the protocol has been added <nl> + / / to the whitelist . <nl> + ShouldComplain = false ; <nl> + } <nl> if ( ShouldComplain ) <nl> Ctx . getDiags ( ) . diagnose ( SourceLoc ( ) , diag : : protocol_req_added , <nl> D - > getScreenInfo ( ) ) ; <nl> static void findTypeMemberDiffs ( NodePtr leftSDKRoot , NodePtr rightSDKRoot , <nl> <nl> static int diagnoseModuleChange ( StringRef LeftPath , StringRef RightPath , <nl> StringRef OutputPath , <nl> - CheckerOptions Opts ) { <nl> + CheckerOptions Opts , <nl> + llvm : : StringSet < > ProtocolReqWhitelist ) { <nl> if ( ! fs : : exists ( LeftPath ) ) { <nl> llvm : : errs ( ) < < LeftPath < < " does not exist \ n " ; <nl> return 1 ; <nl> static int diagnoseModuleChange ( StringRef LeftPath , StringRef RightPath , <nl> auto RightModule = RightCollector . getSDKRoot ( ) ; <nl> TypeAliasDiffFinder ( LeftModule , RightModule , <nl> Ctx . getTypeAliasUpdateMap ( ) ) . search ( ) ; <nl> - PrunePass Prune ( Ctx ) ; <nl> + PrunePass Prune ( Ctx , std : : move ( ProtocolReqWhitelist ) ) ; <nl> Prune . pass ( LeftModule , RightModule ) ; <nl> ChangeRefinementPass RefinementPass ( Ctx . getNodeUpdateMap ( ) ) ; <nl> RefinementPass . pass ( LeftModule , RightModule ) ; <nl> static int compareSDKs ( StringRef LeftPath , StringRef RightPath , <nl> static int readFileLineByLine ( StringRef Path , llvm : : StringSet < > & Lines ) { <nl> auto FileBufOrErr = llvm : : MemoryBuffer : : getFile ( Path ) ; <nl> if ( ! FileBufOrErr ) { <nl> - llvm : : errs ( ) < < " error opening file : " <nl> + llvm : : errs ( ) < < " error opening file ' " < < Path < < " ' : " <nl> < < FileBufOrErr . getError ( ) . message ( ) < < ' \ n ' ; <nl> return 1 ; <nl> } <nl> int main ( int argc , char * argv [ ] ) { <nl> return ( prepareForDump ( argv [ 0 ] , InitInvok , Modules ) ) ? 1 : <nl> dumpSDKContent ( InitInvok , Modules , options : : OutputFile , Opts ) ; <nl> case ActionType : : CompareSDKs : <nl> - case ActionType : : DiagnoseSDKs : <nl> + case ActionType : : DiagnoseSDKs : { <nl> if ( options : : SDKJsonPaths . size ( ) ! = 2 ) { <nl> llvm : : errs ( ) < < " Only two SDK versions can be compared \ n " ; <nl> llvm : : cl : : PrintHelpMessage ( ) ; <nl> return 1 ; <nl> } <nl> + llvm : : StringSet < > protocolWhitelist ; <nl> + if ( ! options : : ProtReqWhiteList . empty ( ) ) { <nl> + if ( readFileLineByLine ( options : : ProtReqWhiteList , protocolWhitelist ) ) <nl> + return 1 ; <nl> + } <nl> if ( options : : Action = = ActionType : : CompareSDKs ) <nl> return compareSDKs ( options : : SDKJsonPaths [ 0 ] , options : : SDKJsonPaths [ 1 ] , <nl> options : : OutputFile , IgnoredUsrs , Opts ) ; <nl> else <nl> return diagnoseModuleChange ( options : : SDKJsonPaths [ 0 ] , <nl> options : : SDKJsonPaths [ 1 ] , <nl> - options : : OutputFile , Opts ) ; <nl> + options : : OutputFile , Opts , <nl> + std : : move ( protocolWhitelist ) ) ; <nl> + } <nl> case ActionType : : DeserializeSDK : <nl> case ActionType : : DeserializeDiffItems : { <nl> if ( options : : SDKJsonPaths . size ( ) ! = 1 ) { <nl>
Merge pull request from akyrtzi / api - checker - protocol - whitelist
apple/swift
7f121bf2f7651038dcefb8610f13b2f79c33d2a3
2018-11-28T23:57:10Z
mmm a / tensorflow / compiler / mlir / xla / transforms / legalize_to_standard . cc <nl> ppp b / tensorflow / compiler / mlir / xla / transforms / legalize_to_standard . cc <nl> class CompareFConvert : public OpRewritePattern < xla_hlo : : CompareOp > { <nl> return matchFailure ( ) ; <nl> <nl> auto comparison_direction = op . comparison_direction ( ) ; <nl> - CmpFPredicate compare_predicate = <nl> - llvm : : StringSwitch < CmpFPredicate > ( comparison_direction ) <nl> + auto compare_predicate = <nl> + llvm : : StringSwitch < Optional < CmpFPredicate > > ( comparison_direction ) <nl> . Case ( " EQ " , CmpFPredicate : : OEQ ) <nl> . Case ( " NE " , CmpFPredicate : : UNE ) <nl> . Case ( " LT " , CmpFPredicate : : OLT ) <nl> . Case ( " LE " , CmpFPredicate : : OLE ) <nl> . Case ( " GT " , CmpFPredicate : : OGT ) <nl> . Case ( " GE " , CmpFPredicate : : OGE ) <nl> - . Default ( CmpFPredicate : : NumPredicates ) ; <nl> + . Default ( llvm : : None ) ; <nl> <nl> - if ( compare_predicate = = CmpFPredicate : : NumPredicates ) <nl> - return matchFailure ( ) ; <nl> + if ( ! compare_predicate . hasValue ( ) ) return matchFailure ( ) ; <nl> <nl> - rewriter . replaceOpWithNewOp < CmpFOp > ( op , compare_predicate , lhs , rhs ) ; <nl> + rewriter . replaceOpWithNewOp < CmpFOp > ( op , compare_predicate . getValue ( ) , lhs , <nl> + rhs ) ; <nl> return matchSuccess ( ) ; <nl> } <nl> } ; <nl> mmm a / tensorflow / compiler / mlir / xla / transforms / map_xla_to_scalar_op . h <nl> ppp b / tensorflow / compiler / mlir / xla / transforms / map_xla_to_scalar_op . h <nl> inline Optional < PredicateType > getCmpPredicate ( <nl> template < > <nl> inline Optional < CmpFPredicate > getCmpPredicate < CmpFPredicate > ( <nl> StringRef xla_comparison_direction ) { <nl> - return llvm : : StringSwitch < CmpFPredicate > ( xla_comparison_direction ) <nl> + return llvm : : StringSwitch < Optional < CmpFPredicate > > ( xla_comparison_direction ) <nl> . Case ( " EQ " , CmpFPredicate : : OEQ ) <nl> . Case ( " NE " , CmpFPredicate : : ONE ) <nl> . Case ( " GE " , CmpFPredicate : : OGE ) <nl> . Case ( " GT " , CmpFPredicate : : OGT ) <nl> . Case ( " LE " , CmpFPredicate : : OLE ) <nl> . Case ( " LT " , CmpFPredicate : : OLT ) <nl> - . Default ( CmpFPredicate : : NumPredicates ) ; <nl> + . Default ( llvm : : None ) ; <nl> } <nl> <nl> template < > <nl> mmm a / tensorflow / workspace . bzl <nl> ppp b / tensorflow / workspace . bzl <nl> def tf_repositories ( path_prefix = " " , tf_repo_name = " " ) : <nl> ) <nl> <nl> # Check out LLVM and MLIR from llvm - project . <nl> - LLVM_COMMIT = " b917d5e1a4f73365dc3661495bb99280d80a9551 " <nl> - LLVM_SHA256 = " 4965cb2fb809e8b51b82f9398f159abc82995d7ff177ec83db31c68860be4a67 " <nl> + LLVM_COMMIT = " 8cf76e913b867a98a9843aa1b3d782632ed5d930 " <nl> + LLVM_SHA256 = " 575cd73df5775dbd95a6a58931212daa5a8a5590001388144726d97526118ccc " <nl> LLVM_URLS = [ <nl> " https : / / storage . googleapis . com / mirror . tensorflow . org / github . com / llvm / llvm - project / archive / { commit } . tar . gz " . format ( commit = LLVM_COMMIT ) , <nl> " https : / / github . com / llvm / llvm - project / archive / { commit } . tar . gz " . format ( commit = LLVM_COMMIT ) , <nl> mmm a / third_party / llvm / llvm . autogenerated . BUILD <nl> ppp b / third_party / llvm / llvm . autogenerated . BUILD <nl> cc_library ( <nl> " : aarch64_target_gen " , <nl> " : aarch64_utils " , <nl> " : attributes_gen " , <nl> + " : binary_format " , <nl> " : config " , <nl> " : intrinsic_enums_gen " , <nl> " : intrinsics_impl_gen " , <nl> " : mc " , <nl> - " : object " , <nl> " : support " , <nl> ] , <nl> ) <nl> cc_library ( <nl> " : arm_target_gen " , <nl> " : arm_utils " , <nl> " : attributes_gen " , <nl> + " : binary_format " , <nl> " : config " , <nl> " : intrinsic_enums_gen " , <nl> " : intrinsics_impl_gen " , <nl> " : mc " , <nl> " : mc_disassembler " , <nl> - " : object " , <nl> " : support " , <nl> ] , <nl> ) <nl> cc_library ( <nl> " : config " , <nl> " : debug_info_dwarf " , <nl> " : mc " , <nl> + " : object " , <nl> " : support " , <nl> ] , <nl> ) <nl> cc_library ( <nl> deps = [ <nl> " : aggressive_inst_combine " , <nl> " : analysis " , <nl> + " : binary_format " , <nl> " : bit_reader " , <nl> " : bit_writer " , <nl> " : code_gen " , <nl> cc_library ( <nl> copts = llvm_copts + [ " - Iexternal / llvm - project / llvm / lib / Target / PowerPC " ] , <nl> deps = [ <nl> " : attributes_gen " , <nl> + " : binary_format " , <nl> " : config " , <nl> " : intrinsic_enums_gen " , <nl> " : intrinsics_impl_gen " , <nl> " : mc " , <nl> - " : object " , <nl> " : powerpc_info " , <nl> " : powerpc_target_gen " , <nl> " : support " , <nl> cc_library ( <nl> ] ) , <nl> copts = llvm_copts + [ " - Iexternal / llvm - project / llvm / lib / Target / X86 " ] , <nl> deps = [ <nl> + " : binary_format " , <nl> " : config " , <nl> " : mc " , <nl> " : mc_disassembler " , <nl> - " : object " , <nl> " : support " , <nl> " : x86_info " , <nl> " : x86_utils " , <nl>
Update llvm version .
tensorflow/tensorflow
74b847140657b6aeaa7a282bde08d3f668cb4093
2020-03-05T12:52:50Z
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> include ( cmake / OpenCVDetectVTK . cmake ) <nl> # Package config in : OpenCV_HALConfig . cmake or opencv_hal - config . cmake <nl> # Use variables : OpenCV_HAL_LIBRARIES , OpenCV_HAL_HEADERS and OpenCV_HAL_INCLUDE_DIRS variables <nl> find_package ( OpenCV_HAL CONFIG QUIET ) <nl> + set ( _includes " " ) <nl> if ( OpenCV_HAL_FOUND ) <nl> # 1 . libraries <nl> foreach ( l $ { OpenCV_HAL_LIBRARIES } ) <nl> if ( OpenCV_HAL_FOUND ) <nl> set ( OPENCV_LINKER_LIBS $ { OPENCV_LINKER_LIBS } $ { l } ) <nl> endforeach ( ) <nl> # 2 . headers <nl> - set ( _includes " " ) <nl> foreach ( h $ { OpenCV_HAL_HEADERS } ) <nl> set ( _includes " $ { _includes } \ n # include \ " $ { h } \ " " ) <nl> endforeach ( ) <nl> - configure_file ( " $ { OpenCV_SOURCE_DIR } / cmake / templates / custom_hal . hpp . in " " $ { CMAKE_BINARY_DIR } / custom_hal . hpp " @ ONLY ) <nl> - unset ( _includes ) <nl> # 3 . include paths <nl> ocv_include_directories ( $ { OpenCV_HAL_INCLUDE_DIRS } ) <nl> endif ( ) <nl> + configure_file ( " $ { OpenCV_SOURCE_DIR } / cmake / templates / custom_hal . hpp . in " " $ { CMAKE_BINARY_DIR } / custom_hal . hpp " @ ONLY ) <nl> + unset ( _includes ) <nl> <nl> # mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> # Add CUDA libraries ( needed for apps / tools , samples ) <nl>
Fixed cutom_hal . hpp file generation
opencv/opencv
79ffaa8ce9bc527a99650d6c241a527f2d1d04b1
2016-03-24T14:39:16Z
mmm a / tests / integration / TARGETS <nl> ppp b / tests / integration / TARGETS <nl> python_unittest ( <nl> ' : testsupport ' , <nl> ' @ / watchman / python / pywatchman : pywatchman ' , <nl> ' @ / watchman : watchman ' , <nl> - ' @ / eden / fs / integration / lib : lib ' , <nl> + ' @ / eden / integration / lib : lib ' , <nl> ' @ / eden / fs / service : edenfs ' , <nl> ' @ / eden / fs / cli : cli ' , <nl> ] , <nl> mmm a / tests / integration / WatchmanEdenTestCase . py <nl> ppp b / tests / integration / WatchmanEdenTestCase . py <nl> <nl> <nl> TestParent = object <nl> try : <nl> - from eden . fs . integration . lib import ( edenclient , hgrepo ) <nl> + from eden . integration . lib import ( edenclient , hgrepo ) <nl> <nl> def is_sandcastle ( ) : <nl> return ' SANDCASTLE ' in os . environ <nl>
move integration tests to eden / integration
facebook/watchman
ae2adb8ea9c93005758e84c87ffa5af633e6c6c2
2017-01-31T22:48:23Z
mmm a / src / init . cpp <nl> ppp b / src / init . cpp <nl> std : : string LicenseInfo ( ) <nl> " \ n " ; <nl> } <nl> <nl> - static void BlockNotifyCallback ( const uint256 & hashNewTip ) <nl> + static void BlockNotifyCallback ( bool initialSync , const CBlockIndex * pBlockIndex ) <nl> { <nl> + if ( initialSync | | ! pBlockIndex ) <nl> + return ; <nl> + <nl> std : : string strCmd = GetArg ( " - blocknotify " , " " ) ; <nl> <nl> - boost : : replace_all ( strCmd , " % s " , hashNewTip . GetHex ( ) ) ; <nl> + boost : : replace_all ( strCmd , " % s " , pBlockIndex - > GetBlockHash ( ) . GetHex ( ) ) ; <nl> boost : : thread t ( runCommand , strCmd ) ; / / thread runs free <nl> } <nl> <nl> mmm a / src / main . cpp <nl> ppp b / src / main . cpp <nl> bool ActivateBestChain ( CValidationState & state , const CChainParams & chainparams , <nl> / / Notify external listeners about the new tip . <nl> if ( ! vHashes . empty ( ) ) { <nl> GetMainSignals ( ) . UpdatedBlockTip ( pindexNewTip ) ; <nl> - uiInterface . NotifyBlockTip ( vHashes . front ( ) ) ; <nl> } <nl> } <nl> + if ( ! vHashes . empty ( ) ) { <nl> + uiInterface . NotifyBlockTip ( fInitialDownload , pindexNewTip ) ; <nl> + } <nl> } while ( pindexMostWork ! = chainActive . Tip ( ) ) ; <nl> CheckBlockIndex ( chainparams . GetConsensus ( ) ) ; <nl> <nl> mmm a / src / ui_interface . h <nl> ppp b / src / ui_interface . h <nl> <nl> class CBasicKeyStore ; <nl> class CWallet ; <nl> class uint256 ; <nl> + class CBlockIndex ; <nl> <nl> / * * General change type ( added , updated , removed ) . * / <nl> enum ChangeType <nl> class CClientUIInterface <nl> boost : : signals2 : : signal < void ( const std : : string & title , int nProgress ) > ShowProgress ; <nl> <nl> / * * New block has been accepted * / <nl> - boost : : signals2 : : signal < void ( const uint256 & hash ) > NotifyBlockTip ; <nl> + boost : : signals2 : : signal < void ( bool , const CBlockIndex * ) > NotifyBlockTip ; <nl> <nl> / * * Banlist did change . * / <nl> boost : : signals2 : : signal < void ( void ) > BannedListChanged ; <nl>
NotifyBlockTip signal : switch from hash ( uint256 ) to CBlockIndex *
bitcoin/bitcoin
012fc91511b153ce3fd3e9fb7bbed8f85fb1690e
2015-11-30T07:50:59Z
mmm a / hphp / hack / src / server / serverExtractStandalone . ml <nl> ppp b / hphp / hack / src / server / serverExtractStandalone . ml <nl> let construct_type_declaration tcopt t ? ( full_method = None ) fields = <nl> | None - > construct_typedef tcopt t <nl> <nl> let rec do_add_dep deps dep = <nl> - if ( not ( HashSet . mem deps dep ) ) & & not ( is_builtin_dep dep ) then ( <nl> + if <nl> + dep < > Typing_deps . Dep . Class SN . Typehints . wildcard <nl> + & & ( not ( HashSet . mem deps dep ) ) <nl> + & & not ( is_builtin_dep dep ) <nl> + then ( <nl> HashSet . add deps dep ; <nl> add_signature_dependencies deps dep ; <nl> Option . iter ( get_class_name dep ) ~ f : ( fun name - > <nl> mmm a / hphp / hack / test / integration / data / dependencies / classes - generic . php <nl> ppp b / hphp / hack / test / integration / data / dependencies / classes - generic . php <nl> public function __construct ( Tfirst $ first , Mode $ second ) { <nl> } <nl> <nl> protected int $ property ; <nl> + <nl> + public function foo ( ) : void { } <nl> } <nl> <nl> class First { } <nl> function with_generic_method ( int $ arg ) : void { <nl> $ r - > generic_method ( $ arg ) ; <nl> } <nl> <nl> + function with_generic_method_with_wildcard_tparam ( int $ arg ) : void { <nl> + $ r = new Regular ( ) ; <nl> + $ r - > generic_method < _ > ( $ arg ) ; <nl> + } <nl> + <nl> function with_properties < T > ( GenericDerived < T > $ arg ) : Mode { <nl> $ x = new GenericDerived < int > ( 1 , Mode : : Two ) ; <nl> return $ arg - > second ; <nl> interface IGenericDerived < T > extends GenericInterface < T , int > { <nl> } <nl> <nl> function with_generic_interface < T > ( IGenericDerived < T > $ arg ) : void { } <nl> + <nl> + function with_is_refinement < Tfirst , Tsecond > ( <nl> + GenericBase < Tfirst , Tsecond > $ x , <nl> + ) : void { <nl> + if ( $ x is GenericDerived < _ > ) { <nl> + $ x - > foo ( ) ; <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . a80e9647b9d <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / integration / data / dependencies / expected / __with_generic_method_with_wildcard_tparam . php . exp <nl> <nl> + < ? hh <nl> + class Regular { <nl> + public function generic_method < T > ( T $ arg ) : void { <nl> + throw new Exception ( ) ; <nl> + } <nl> + } <nl> + function with_generic_method_with_wildcard_tparam ( int $ arg ) : void { <nl> + $ r = new Regular ( ) ; <nl> + $ r - > generic_method < _ > ( $ arg ) ; <nl> + } <nl> + function extract_standalone_make_default ( ) : nothing { <nl> + throw new Exception ( ) ; <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . c9b165a5720 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / integration / data / dependencies / expected / __with_is_refinement . php . exp <nl> <nl> + < ? hh <nl> + class GenericDerived < Tfirst > extends \ GenericBase < Tfirst , \ Mode > { <nl> + public function foo ( ) : void { <nl> + throw new Exception ( ) ; <nl> + } <nl> + } <nl> + function with_is_refinement < Tfirst , Tsecond > ( <nl> + GenericBase < Tfirst , Tsecond > $ x , <nl> + ) : void { <nl> + if ( $ x is GenericDerived < _ > ) { <nl> + $ x - > foo ( ) ; <nl> + } <nl> + } <nl> + class GenericBase < Tfirst , Tsecond > { } <nl> + enum Mode : int as int { } <nl> + function extract_standalone_make_default ( ) : nothing { <nl> + throw new Exception ( ) ; <nl> + } <nl> mmm a / hphp / hack / test / integration / test_extract_standalone . py <nl> ppp b / hphp / hack / test / integration / test_extract_standalone . py <nl> def test_extract ( self ) - > None : <nl> " \ \ with_non_generic_type " , <nl> " \ \ with_mapped_namespace " , <nl> " \ \ WithNameMatchingClassName " , <nl> + " \ \ with_generic_method_with_wildcard_tparam " , <nl> + " \ \ with_is_refinement " , <nl> ] <nl> <nl> for path in paths : <nl>
Don ' t add the wildcard generic type parameter as a dependency
facebook/hhvm
0c5a1ed930add8b1f5d5dd9998b188baaf73e4e2
2019-10-09T11:45:06Z
mmm a / tensorflow / c / eager / c_api . cc <nl> ppp b / tensorflow / c / eager / c_api . cc <nl> tensorflow : : Status CreateRemoteContexts ( <nl> } ) ; <nl> } <nl> counter . Wait ( ) ; <nl> + tensorflow : : StatusGroup sg ; <nl> for ( int i = 0 ; i < num_remote_workers ; i + + ) { <nl> - TF_RETURN_IF_ERROR ( statuses [ i ] ) ; <nl> + if ( TF_PREDICT_FALSE ( ! statuses [ i ] . ok ( ) ) ) { <nl> + sg . Update ( statuses [ i ] ) ; <nl> + } <nl> } <nl> - return tensorflow : : Status : : OK ( ) ; <nl> + return sg . as_summary_status ( ) ; <nl> } <nl> <nl> tensorflow : : Status UpdateRemoteContexts ( <nl> tensorflow : : Status UpdateTFE_ContextWithServerDef ( <nl> <nl> / / Initialize remote eager workers . <nl> if ( reset_context ) { <nl> - LOG_AND_RETURN_IF_ERROR ( CreateRemoteContexts ( <nl> + const tensorflow : : Status s = CreateRemoteContexts ( <nl> ctx , remote_workers , context_id , context_view_id , keep_alive_secs , <nl> server_def , remote_eager_workers . get ( ) , context - > Executor ( ) . Async ( ) , <nl> - context - > LazyCopyFunctionRemoteInputs ( ) , base_request ) ) ; <nl> + context - > LazyCopyFunctionRemoteInputs ( ) , base_request ) ; <nl> + / / NOTE : the remote tasks could fail after ` GetAllRemoteDevices ` and cause <nl> + / / the CreateRemoteContexts to fail . We currently only log instead of <nl> + / / directly returning the error , since returning here will cause the server <nl> + / / object to be destroyed ( which currently CHECK - fails ) . The client will <nl> + / / see additional errors if ops are subsequently sent to the failed workers . <nl> + if ( TF_PREDICT_FALSE ( ! s . ok ( ) ) ) { <nl> + LOG ( ERROR ) < < " Error when creating contexts on remote targets : " <nl> + < < s . error_message ( ) <nl> + < < " \ nExecuting remote ops or functions on these remote " <nl> + " targets will fail . " ; <nl> + } <nl> } else { <nl> / / The master ' s context_view_id will be incremented by one <nl> / / the UpdateRemoteMaster call later . We want all new workers and <nl> tensorflow : : Status UpdateTFE_ContextWithServerDef ( <nl> grpc_server - > worker_env ( ) - > rendezvous_mgr - > Find ( context_id ) ; <nl> auto * device_mgr = grpc_server - > worker_env ( ) - > device_mgr ; <nl> std : : shared_ptr < tensorflow : : WorkerSession > worker_session ; <nl> - TF_RETURN_IF_ERROR ( grpc_server - > worker_env ( ) - > session_mgr - > CreateSession ( <nl> - session_name , server_def , base_request . cluster_device_attributes ( ) , <nl> - true ) ) ; <nl> - TF_RETURN_IF_ERROR ( <nl> + LOG_AND_RETURN_IF_ERROR ( <nl> + grpc_server - > worker_env ( ) - > session_mgr - > CreateSession ( <nl> + session_name , server_def , base_request . cluster_device_attributes ( ) , <nl> + true ) ) ; <nl> + LOG_AND_RETURN_IF_ERROR ( <nl> grpc_server - > worker_env ( ) - > session_mgr - > WorkerSessionForSession ( <nl> session_name , & worker_session ) ) ; <nl> <nl> / / Initialize remote tensor communication based on worker session . <nl> - TF_RETURN_IF_ERROR ( r - > Initialize ( worker_session . get ( ) ) ) ; <nl> + LOG_AND_RETURN_IF_ERROR ( r - > Initialize ( worker_session . get ( ) ) ) ; <nl> <nl> tensorflow : : DistributedFunctionLibraryRuntime * cluster_flr = <nl> tensorflow : : eager : : CreateClusterFLR ( context_id , context , <nl> mmm a / tensorflow / core / common_runtime / eager / context . cc <nl> ppp b / tensorflow / core / common_runtime / eager / context . cc <nl> Status EagerContext : : MaybeRegisterFunctionRemotely ( const FunctionDef & fdef ) { <nl> if ( ! status . ok ( ) ) { <nl> LOG ( ERROR ) < < " Failed to register function remotely due to " <nl> < < status . error_message ( ) <nl> - < < " \ nThis shouldn ' t happen , please file a bug to " <nl> - " tensorflow team . " ; <nl> + < < " \ nThis could happen if the remote target has been " <nl> + " disconnected from the client . " ; <nl> } <nl> delete response ; <nl> } ) ; <nl> Status EagerContext : : RegisterExistingFunctionsOnRemoteWorkers ( <nl> if ( ! s . ok ( ) ) { <nl> LOG ( ERROR ) < < " Failed to register function remotely due to " <nl> < < s . error_message ( ) <nl> - < < " \ nThis shouldn ' t happen , please file a bug to " <nl> - " tensorflow team . " ; <nl> + < < " \ nThis could happen if the remote target has been " <nl> + " disconnected from the client . " ; <nl> } <nl> } ) ; <nl> } <nl>
Adjust error reporting and messages with remote targets .
tensorflow/tensorflow
69ea5a77f97380f6796c20a41df4b00c847db01a
2020-07-08T17:46:01Z
mmm a / hphp / hack / src / options / globalOptions . ml <nl> ppp b / hphp / hack / src / options / globalOptions . ml <nl> type t = { <nl> tco_enable_sound_dynamic : bool ; <nl> po_disallow_hash_comments : bool ; <nl> po_disallow_fun_and_cls_meth_pseudo_funcs : bool ; <nl> + tco_use_direct_decl_parser : bool ; <nl> } <nl> [ @ @ deriving eq , show ] <nl> <nl> let default = <nl> tco_enable_sound_dynamic = false ; <nl> po_disallow_hash_comments = false ; <nl> po_disallow_fun_and_cls_meth_pseudo_funcs = false ; <nl> + tco_use_direct_decl_parser = false ; <nl> } <nl> <nl> let make <nl> let make <nl> ? ( po_disallow_hash_comments = default . po_disallow_hash_comments ) <nl> ? ( po_disallow_fun_and_cls_meth_pseudo_funcs = <nl> default . po_disallow_fun_and_cls_meth_pseudo_funcs ) <nl> + ? ( tco_use_direct_decl_parser = default . tco_use_direct_decl_parser ) <nl> ( ) = <nl> { <nl> tco_experimental_features ; <nl> let make <nl> tco_enable_sound_dynamic ; <nl> po_disallow_hash_comments ; <nl> po_disallow_fun_and_cls_meth_pseudo_funcs ; <nl> + tco_use_direct_decl_parser ; <nl> } <nl> <nl> let tco_experimental_feature_enabled t s = <nl> let po_disallow_hash_comments t = t . po_disallow_hash_comments <nl> <nl> let po_disallow_fun_and_cls_meth_pseudo_funcs t = <nl> t . po_disallow_fun_and_cls_meth_pseudo_funcs <nl> + <nl> + let tco_use_direct_decl_parser t = t . tco_use_direct_decl_parser <nl> mmm a / hphp / hack / src / options / globalOptions . mli <nl> ppp b / hphp / hack / src / options / globalOptions . mli <nl> type t = { <nl> po_disallow_hash_comments : bool ; <nl> ( * Disable parsing of fun ( ) and class_meth ( ) * ) <nl> po_disallow_fun_and_cls_meth_pseudo_funcs : bool ; <nl> + ( * Enable use of the direct decl parser for parsing type signatures . * ) <nl> + tco_use_direct_decl_parser : bool ; <nl> } <nl> [ @ @ deriving eq , show ] <nl> <nl> val make : <nl> ? tco_enable_sound_dynamic : bool - > <nl> ? po_disallow_hash_comments : bool - > <nl> ? po_disallow_fun_and_cls_meth_pseudo_funcs : bool - > <nl> + ? tco_use_direct_decl_parser : bool - > <nl> unit - > <nl> t <nl> <nl> val tco_enable_sound_dynamic : t - > bool <nl> val po_disallow_hash_comments : t - > bool <nl> <nl> val po_disallow_fun_and_cls_meth_pseudo_funcs : t - > bool <nl> + <nl> + val tco_use_direct_decl_parser : t - > bool <nl> mmm a / hphp / hack / src / options / typecheckerOptions . ml <nl> ppp b / hphp / hack / src / options / typecheckerOptions . ml <nl> let method_call_inference = GlobalOptions . tco_method_call_inference <nl> let report_pos_from_reason = GlobalOptions . tco_report_pos_from_reason <nl> <nl> let enable_sound_dynamic = GlobalOptions . tco_enable_sound_dynamic <nl> + <nl> + let use_direct_decl_parser = GlobalOptions . tco_use_direct_decl_parser <nl> mmm a / hphp / hack / src / oxidized / gen / global_options . rs <nl> ppp b / hphp / hack / src / oxidized / gen / global_options . rs <nl> <nl> / / This source code is licensed under the MIT license found in the <nl> / / LICENSE file in the " hack " directory of this source tree . <nl> / / <nl> - / / @ generated SignedSource < < 236b8d5f02c52caa7e17c8d0398e3cca > > <nl> + / / @ generated SignedSource < < be2cd44e5beab8f16a8d6d745428b19f > > <nl> / / <nl> / / To regenerate this file , run : <nl> / / hphp / hack / src / oxidized / regen . sh <nl> pub struct GlobalOptions { <nl> pub tco_enable_sound_dynamic : bool , <nl> pub po_disallow_hash_comments : bool , <nl> pub po_disallow_fun_and_cls_meth_pseudo_funcs : bool , <nl> + pub tco_use_direct_decl_parser : bool , <nl> } <nl> mmm a / hphp / hack / src / oxidized / manual / global_options_impl . rs <nl> ppp b / hphp / hack / src / oxidized / manual / global_options_impl . rs <nl> impl Default for GlobalOptions { <nl> tco_enable_sound_dynamic : false , <nl> po_disallow_hash_comments : false , <nl> po_disallow_fun_and_cls_meth_pseudo_funcs : false , <nl> + tco_use_direct_decl_parser : false , <nl> } <nl> } <nl> } <nl> mmm a / hphp / hack / src / oxidized_by_ref / gen / global_options . rs <nl> ppp b / hphp / hack / src / oxidized_by_ref / gen / global_options . rs <nl> <nl> / / This source code is licensed under the MIT license found in the <nl> / / LICENSE file in the " hack " directory of this source tree . <nl> / / <nl> - / / @ generated SignedSource < < b9770a07a0394f89d0bbd0cc0480876c > > <nl> + / / @ generated SignedSource < < da37ce5b022b5f3a9caec013cbd05a6c > > <nl> / / <nl> / / To regenerate this file , run : <nl> / / hphp / hack / src / oxidized_by_ref / regen . sh <nl> pub struct GlobalOptions < ' a > { <nl> pub tco_enable_sound_dynamic : bool , <nl> pub po_disallow_hash_comments : bool , <nl> pub po_disallow_fun_and_cls_meth_pseudo_funcs : bool , <nl> + pub tco_use_direct_decl_parser : bool , <nl> } <nl> impl < ' a > TrivialDrop for GlobalOptions < ' a > { } <nl> mmm a / hphp / hack / src / oxidized_by_ref / manual / global_options_impl . rs <nl> ppp b / hphp / hack / src / oxidized_by_ref / manual / global_options_impl . rs <nl> const DEFAULT : GlobalOptions < ' _ > = GlobalOptions { <nl> tco_enable_sound_dynamic : false , <nl> po_disallow_hash_comments : false , <nl> po_disallow_fun_and_cls_meth_pseudo_funcs : false , <nl> + tco_use_direct_decl_parser : false , <nl> } ; <nl> <nl> impl GlobalOptions < ' static > { <nl> mmm a / hphp / hack / src / server / serverConfig . ml <nl> ppp b / hphp / hack / src / server / serverConfig . ml <nl> let load ~ silent config_filename options : t * ServerLocalConfig . t = <nl> ? po_disallow_hash_comments : ( bool_opt " disallow_hash_comments " config ) <nl> ? po_disallow_fun_and_cls_meth_pseudo_funcs : <nl> ( bool_opt " disallow_fun_and_cls_meth_pseudo_funcs " config ) <nl> + ~ tco_use_direct_decl_parser : <nl> + local_config . ServerLocalConfig . use_direct_decl_parser <nl> ( ) <nl> in <nl> Errors . allowed_fixme_codes_strict : = <nl> mmm a / hphp / hack / src / server / serverLocalConfig . ml <nl> ppp b / hphp / hack / src / server / serverLocalConfig . ml <nl> type t = { <nl> tico_invalidate_files : bool ; <nl> ( * Use finer grain hh_server dependencies * ) <nl> tico_invalidate_smart : bool ; <nl> + ( * Enable use of the direct decl parser for parsing type signatures . * ) <nl> + use_direct_decl_parser : bool ; <nl> ( * If - - profile - log , we ' ll record telemetry on typechecks that took longer than the threshold . In case of profile_type_check_twice we judge by the second type check . * ) <nl> profile_type_check_duration_threshold : float ; <nl> ( * The flag " - - config profile_type_check_twice = true " causes each file to be typechecked twice in succession . If - - profile - log then both times are logged . * ) <nl> let default = <nl> symbolindex_file = None ; <nl> tico_invalidate_files = false ; <nl> tico_invalidate_smart = false ; <nl> + use_direct_decl_parser = false ; <nl> profile_type_check_duration_threshold = 0 . 05 ; <nl> profile_type_check_twice = false ; <nl> profile_decling = Typing_service_types . DeclingOff ; <nl> let load_ fn ~ silent ~ current_version overrides = <nl> ~ default : default . tico_invalidate_smart <nl> config <nl> in <nl> + let use_direct_decl_parser = <nl> + bool_if_version <nl> + " use_direct_decl_parser " <nl> + ~ default : default . use_direct_decl_parser <nl> + config <nl> + in <nl> let profile_type_check_duration_threshold = <nl> float_ <nl> " profile_type_check_duration_threshold " <nl> let load_ fn ~ silent ~ current_version overrides = <nl> symbolindex_file ; <nl> tico_invalidate_files ; <nl> tico_invalidate_smart ; <nl> + use_direct_decl_parser ; <nl> profile_type_check_duration_threshold ; <nl> profile_type_check_twice ; <nl> profile_decling ; <nl>
Add use_direct_decl_parser flag to TypecheckerOptions and ServerLocalConfig
facebook/hhvm
17bbf0a76a7b7d5da4aeba7870d1240b01d4acb1
2020-11-11T18:43:06Z
mmm a / tools / CMakeLists . txt <nl> ppp b / tools / CMakeLists . txt <nl> include_directories ( $ { CMAKE_SOURCE_DIR } / src ) <nl> add_executable ( ncnn2mem ncnn2mem . cpp ) <nl> <nl> target_link_libraries ( ncnn2mem ncnn ) <nl> + <nl> + if ( COVERAGE ) <nl> + target_link_libraries ( ncnn2mem PRIVATE - - coverage ) <nl> + endif ( ) <nl>
enable coverage
Tencent/ncnn
c33641c378c8a374d63da71c94d05f934f0e5323
2018-10-17T09:47:50Z
mmm a / tensorflow / contrib / learn / python / learn / estimators / kmeans . py <nl> ppp b / tensorflow / contrib / learn / python / learn / estimators / kmeans . py <nl> <nl> <nl> # TODO ( agarwal , ands ) : support sharded input . <nl> class KMeansClustering ( estimator . Estimator ) : <nl> - " " " An Estimator fo rK - Means clustering . " " " <nl> + " " " An Estimator for K - Means clustering . " " " <nl> SCORES = ' scores ' <nl> CLUSTER_IDX = ' cluster_idx ' <nl> CLUSTERS = ' clusters ' <nl>
Fix typo in documentation of KMeansClustering .
tensorflow/tensorflow
6bb3d98fe7218fac10eff360f242fde7e389c391
2017-02-06T10:09:28Z
mmm a / tensorflow / lite / kernels / activations . cc <nl> ppp b / tensorflow / lite / kernels / activations . cc <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> # include < cassert > <nl> # include < cmath > <nl> + # include < cstdint > <nl> # include < cstdio > <nl> # include < cstdlib > <nl> # include < iostream > <nl> struct OpData { <nl> int input_left_shift = 0 ; <nl> int32_t input_range_radius = 0 ; <nl> int diff_min = 0 ; <nl> + uint8_t table [ 256 ] = { 0 } ; <nl> + uint8_t * table_zero = nullptr ; <nl> } ; <nl> <nl> struct LogSoftmaxOpData : public OpData { <nl> TfLiteStatus CheckOutputQuantParams ( TfLiteContext * context , <nl> } <nl> return kTfLiteOk ; <nl> } <nl> + <nl> + template < typename T > <nl> + void PopulateLookupTable ( struct OpData * data , const TfLiteTensor * input , <nl> + TfLiteTensor * output , <nl> + const std : : function < float ( float ) > & transform ) { <nl> + static_assert ( sizeof ( T ) = = 1 , " Lookup table valid only for 8bit " ) ; <nl> + const float inverse_scale = 1 / output - > params . scale ; <nl> + int32_t maxval = std : : numeric_limits < T > : : max ( ) ; <nl> + int32_t minval = std : : numeric_limits < T > : : min ( ) ; <nl> + data - > table_zero = & data - > table [ - minval ] ; <nl> + for ( int32_t val = minval ; val < = maxval ; + + val ) { <nl> + const float dequantized = <nl> + input - > params . scale * ( val - input - > params . zero_point ) ; <nl> + const float transformed = transform ( dequantized ) ; <nl> + const float rescaled = std : : round ( transformed * inverse_scale ) ; <nl> + const int32_t quantized = <nl> + static_cast < int32_t > ( rescaled + output - > params . zero_point ) ; <nl> + data - > table_zero [ val ] = <nl> + static_cast < uint8_t > ( std : : max ( std : : min ( maxval , quantized ) , minval ) ) ; <nl> + } <nl> + } <nl> + <nl> + template < typename T > <nl> + void EvalUsingLookupTable ( struct OpData * data , const TfLiteTensor * input , <nl> + TfLiteTensor * output ) { <nl> + static_assert ( sizeof ( T ) = = 1 , " Lookup table valid only for 8bit " ) ; <nl> + const int size = <nl> + MatchingFlatSize ( GetTensorShape ( input ) , GetTensorShape ( output ) ) ; <nl> + T * output_data = GetTensorData < T > ( output ) ; <nl> + const T * input_data = GetTensorData < T > ( input ) ; <nl> + for ( int i = 0 ; i < size ; + + i ) { <nl> + * output_data + + = static_cast < T > ( data - > table_zero [ * input_data + + ] ) ; <nl> + } <nl> + } <nl> + <nl> } / / namespace <nl> <nl> void * Init ( TfLiteContext * context , const char * buffer , size_t length ) { <nl> TfLiteStatus TanhPrepare ( TfLiteContext * context , TfLiteNode * node ) { <nl> TfLiteTensor * output = GetOutput ( context , node , 0 ) ; <nl> TF_LITE_ENSURE_EQ ( context , input - > type , output - > type ) ; <nl> <nl> - if ( input - > type = = kTfLiteUInt8 | | input - > type = = kTfLiteInt8 ) { <nl> - static constexpr int kInputIntegerBits = 4 ; <nl> - <nl> - const double input_real_multiplier = <nl> - input - > params . scale * <nl> - static_cast < double > ( 1 < < ( 31 - kInputIntegerBits ) ) ; <nl> - <nl> - QuantizeMultiplierGreaterThanOne ( input_real_multiplier , <nl> - & data - > input_multiplier , <nl> - & data - > input_left_shift ) ; <nl> - data - > input_range_radius = <nl> - CalculateInputRadius ( kInputIntegerBits , data - > input_left_shift ) ; <nl> + if ( input - > type = = kTfLiteUInt8 ) { <nl> + PopulateLookupTable < uint8_t > ( data , input , output , <nl> + [ ] ( float value ) { return std : : tanh ( value ) ; } ) ; <nl> + } else if ( input - > type = = kTfLiteInt8 ) { <nl> + PopulateLookupTable < int8_t > ( data , input , output , <nl> + [ ] ( float value ) { return std : : tanh ( value ) ; } ) ; <nl> } else if ( input - > type = = kTfLiteInt16 ) { <nl> static constexpr int kInputIntegerBits = 3 ; <nl> static constexpr int kOutputFractionalBits = 15 ; <nl> TfLiteStatus SigmoidPrepare ( TfLiteContext * context , TfLiteNode * node ) { <nl> TfLiteTensor * output = GetOutput ( context , node , 0 ) ; <nl> TF_LITE_ENSURE_EQ ( context , input - > type , output - > type ) ; <nl> <nl> - if ( input - > type = = kTfLiteUInt8 | | input - > type = = kTfLiteInt8 ) { <nl> - if ( input - > type = = kTfLiteUInt8 ) { <nl> - TF_LITE_ENSURE_EQ ( context , output - > params . zero_point , <nl> - std : : numeric_limits < uint8_t > : : min ( ) ) ; <nl> - } <nl> - if ( input - > type = = kTfLiteInt8 ) { <nl> - TF_LITE_ENSURE_EQ ( context , output - > params . zero_point , <nl> - std : : numeric_limits < int8_t > : : min ( ) ) ; <nl> - } <nl> + if ( input - > type = = kTfLiteUInt8 ) { <nl> TF_LITE_ENSURE ( context , output - > params . scale = = 1 . / 256 ) ; <nl> - <nl> - static constexpr int kInputIntegerBits = 4 ; <nl> - <nl> - const double input_real_multiplier = <nl> - input - > params . scale * <nl> - static_cast < double > ( 1 < < ( 31 - kInputIntegerBits ) ) ; <nl> - <nl> - QuantizeMultiplierGreaterThanOne ( input_real_multiplier , <nl> - & data - > input_multiplier , <nl> - & data - > input_left_shift ) ; <nl> - data - > input_range_radius = <nl> - CalculateInputRadius ( kInputIntegerBits , data - > input_left_shift ) ; <nl> + PopulateLookupTable < uint8_t > ( data , input , output , [ ] ( float value ) { <nl> + return 1 . 0f / ( 1 . 0f + std : : exp ( - value ) ) ; <nl> + } ) ; <nl> + } else if ( input - > type = = kTfLiteInt8 ) { <nl> + TF_LITE_ENSURE ( context , output - > params . scale = = 1 . / 256 ) ; <nl> + PopulateLookupTable < int8_t > ( data , input , output , [ ] ( float value ) { <nl> + return 1 . 0f / ( 1 . 0f + std : : exp ( - value ) ) ; <nl> + } ) ; <nl> } else if ( input - > type = = kTfLiteInt16 ) { <nl> static constexpr int kInputIntegerBits = 3 ; <nl> static constexpr int kOutputFractionalBits = 15 ; <nl> TfLiteStatus TanhEval ( TfLiteContext * context , TfLiteNode * node ) { <nl> return kTfLiteOk ; <nl> } break ; <nl> case kTfLiteUInt8 : { <nl> - TanhParams params ; <nl> - params . input_zero_point = input - > params . zero_point ; <nl> - params . input_range_radius = data - > input_range_radius ; <nl> - params . input_multiplier = data - > input_multiplier ; <nl> - params . input_left_shift = data - > input_left_shift ; <nl> - if ( kernel_type = = kGenericOptimized ) { <nl> - optimized_ops : : Tanh ( <nl> - params , GetTensorShape ( input ) , GetTensorData < uint8_t > ( input ) , <nl> - GetTensorShape ( output ) , GetTensorData < uint8_t > ( output ) ) ; <nl> - } else { <nl> - reference_ops : : Tanh ( <nl> - params , GetTensorShape ( input ) , GetTensorData < uint8_t > ( input ) , <nl> - GetTensorShape ( output ) , GetTensorData < uint8_t > ( output ) ) ; <nl> - } <nl> + EvalUsingLookupTable < uint8_t > ( data , input , output ) ; <nl> return kTfLiteOk ; <nl> } break ; <nl> case kTfLiteInt8 : { <nl> - const auto input_shape = GetTensorShape ( input ) ; <nl> - const auto output_shape = GetTensorShape ( output ) ; <nl> - const int size = MatchingFlatSize ( input_shape , output_shape ) ; <nl> - reference_integer_ops : : Tanh ( <nl> - input - > params . zero_point , data - > input_range_radius , <nl> - data - > input_multiplier , data - > input_left_shift , size , <nl> - GetTensorData < int8_t > ( input ) , GetTensorData < int8_t > ( output ) ) ; <nl> + EvalUsingLookupTable < int8_t > ( data , input , output ) ; <nl> return kTfLiteOk ; <nl> } break ; <nl> default : <nl> TfLiteStatus SigmoidEval ( TfLiteContext * context , TfLiteNode * node ) { <nl> break ; <nl> } <nl> case kTfLiteUInt8 : { <nl> - LogisticParams params ; <nl> - params . input_zero_point = input - > params . zero_point ; <nl> - params . input_range_radius = data - > input_range_radius ; <nl> - params . input_multiplier = data - > input_multiplier ; <nl> - params . input_left_shift = data - > input_left_shift ; <nl> - if ( kernel_type = = kGenericOptimized ) { <nl> - optimized_ops : : Logistic ( <nl> - params , GetTensorShape ( input ) , GetTensorData < uint8_t > ( input ) , <nl> - GetTensorShape ( output ) , GetTensorData < uint8_t > ( output ) ) ; <nl> - } else { <nl> - reference_ops : : Logistic ( <nl> - params , GetTensorShape ( input ) , GetTensorData < uint8_t > ( input ) , <nl> - GetTensorShape ( output ) , GetTensorData < uint8_t > ( output ) ) ; <nl> - } <nl> + EvalUsingLookupTable < uint8_t > ( data , input , output ) ; <nl> break ; <nl> } <nl> case kTfLiteInt8 : { <nl> - const int input_size = <nl> - MatchingFlatSize ( GetTensorShape ( input ) , GetTensorShape ( output ) ) ; <nl> - reference_integer_ops : : Logistic ( <nl> - input - > params . zero_point , data - > input_range_radius , <nl> - data - > input_multiplier , data - > input_left_shift , input_size , <nl> - GetTensorData < int8_t > ( input ) , GetTensorData < int8_t > ( output ) ) ; <nl> + EvalUsingLookupTable < int8_t > ( data , input , output ) ; <nl> break ; <nl> } <nl> default : <nl> mmm a / tensorflow / lite / kernels / internal / optimized / legacy_optimized_ops . h <nl> ppp b / tensorflow / lite / kernels / internal / optimized / legacy_optimized_ops . h <nl> inline void LogSoftmax ( const uint8 * input_data , const Dims < 4 > & input_dims , <nl> DimsToShape ( output_dims ) ) ; <nl> } <nl> <nl> + inline void Logistic ( const LogisticParams & params , <nl> + const RuntimeShape & input_shape , const uint8 * input_data , <nl> + const RuntimeShape & output_shape , uint8 * output_data ) { <nl> + gemmlowp : : ScopedProfilingLabel label ( " Logistic / Uint8 " ) ; <nl> + const int32 input_zero_point = params . input_zero_point ; <nl> + const int32 input_range_radius = params . input_range_radius ; <nl> + const int32 input_multiplier = params . input_multiplier ; <nl> + const int input_left_shift = params . input_left_shift ; <nl> + const int size = MatchingFlatSize ( input_shape , output_shape ) ; <nl> + <nl> + int c = 0 ; <nl> + # ifdef USE_NEON <nl> + / / Handle 16 values at a time <nl> + for ( ; c < = size - 16 ; c + = 16 ) { <nl> + / / Read input uint8 values , cast to int16 and subtract input_zero_point <nl> + uint8x16_t input_val_u8 = vld1q_u8 ( input_data + c ) ; <nl> + int16x8_t input_val_centered_0 = <nl> + vsubq_s16 ( vreinterpretq_s16_u16 ( vmovl_u8 ( vget_low_u8 ( input_val_u8 ) ) ) , <nl> + vdupq_n_s16 ( input_zero_point ) ) ; <nl> + int16x8_t input_val_centered_1 = <nl> + vsubq_s16 ( vreinterpretq_s16_u16 ( vmovl_u8 ( vget_high_u8 ( input_val_u8 ) ) ) , <nl> + vdupq_n_s16 ( input_zero_point ) ) ; <nl> + <nl> + / / Prepare the bit masks that we will use at the end to implement the logic <nl> + / / that was expressed in the scalar code with branching : <nl> + / / if ( input_val_centered < - input_range_radius ) { <nl> + / / output_val = 0 ; <nl> + / / } else if ( input_val_centered > input_range_radius ) { <nl> + / / output_val = 255 ; <nl> + / / } else { <nl> + / / . . . <nl> + uint16x8_t mask_rightclamp_0 = <nl> + vcgtq_s16 ( input_val_centered_0 , vdupq_n_s16 ( input_range_radius ) ) ; <nl> + uint16x8_t mask_rightclamp_1 = <nl> + vcgtq_s16 ( input_val_centered_1 , vdupq_n_s16 ( input_range_radius ) ) ; <nl> + uint16x8_t mask_leftclamp_0 = <nl> + vcgeq_s16 ( input_val_centered_0 , vdupq_n_s16 ( - input_range_radius ) ) ; <nl> + uint16x8_t mask_leftclamp_1 = <nl> + vcgeq_s16 ( input_val_centered_1 , vdupq_n_s16 ( - input_range_radius ) ) ; <nl> + uint8x16_t mask_rightclamp = vcombine_u8 ( vshrn_n_u16 ( mask_rightclamp_0 , 8 ) , <nl> + vshrn_n_u16 ( mask_rightclamp_1 , 8 ) ) ; <nl> + uint8x16_t mask_leftclamp = vcombine_u8 ( vshrn_n_u16 ( mask_leftclamp_0 , 8 ) , <nl> + vshrn_n_u16 ( mask_leftclamp_1 , 8 ) ) ; <nl> + <nl> + / / This performs what is expressed in the scalar code as <nl> + / / const int32 input_val_rescaled = <nl> + / / MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> + / / input_val_centered , input_multiplier , input_left_shift ) ; <nl> + int32x4_t input_val_rescaled_0 = <nl> + vshlq_s32 ( vmovl_s16 ( vget_low_s16 ( input_val_centered_0 ) ) , <nl> + vdupq_n_s32 ( input_left_shift ) ) ; <nl> + int32x4_t input_val_rescaled_1 = <nl> + vshlq_s32 ( vmovl_s16 ( vget_high_s16 ( input_val_centered_0 ) ) , <nl> + vdupq_n_s32 ( input_left_shift ) ) ; <nl> + int32x4_t input_val_rescaled_2 = <nl> + vshlq_s32 ( vmovl_s16 ( vget_low_s16 ( input_val_centered_1 ) ) , <nl> + vdupq_n_s32 ( input_left_shift ) ) ; <nl> + int32x4_t input_val_rescaled_3 = <nl> + vshlq_s32 ( vmovl_s16 ( vget_high_s16 ( input_val_centered_1 ) ) , <nl> + vdupq_n_s32 ( input_left_shift ) ) ; <nl> + input_val_rescaled_0 = <nl> + vqrdmulhq_n_s32 ( input_val_rescaled_0 , input_multiplier ) ; <nl> + input_val_rescaled_1 = <nl> + vqrdmulhq_n_s32 ( input_val_rescaled_1 , input_multiplier ) ; <nl> + input_val_rescaled_2 = <nl> + vqrdmulhq_n_s32 ( input_val_rescaled_2 , input_multiplier ) ; <nl> + input_val_rescaled_3 = <nl> + vqrdmulhq_n_s32 ( input_val_rescaled_3 , input_multiplier ) ; <nl> + <nl> + / / Invoke gemmlowp : : logistic on FixedPoint wrapping int32x4_t <nl> + using FixedPoint4 = gemmlowp : : FixedPoint < int32x4_t , 4 > ; <nl> + using FixedPoint0 = gemmlowp : : FixedPoint < int32x4_t , 0 > ; <nl> + const FixedPoint4 input_val_f4_0 = <nl> + FixedPoint4 : : FromRaw ( input_val_rescaled_0 ) ; <nl> + const FixedPoint4 input_val_f4_1 = <nl> + FixedPoint4 : : FromRaw ( input_val_rescaled_1 ) ; <nl> + const FixedPoint4 input_val_f4_2 = <nl> + FixedPoint4 : : FromRaw ( input_val_rescaled_2 ) ; <nl> + const FixedPoint4 input_val_f4_3 = <nl> + FixedPoint4 : : FromRaw ( input_val_rescaled_3 ) ; <nl> + const FixedPoint0 output_val_f0_0 = gemmlowp : : logistic ( input_val_f4_0 ) ; <nl> + const FixedPoint0 output_val_f0_1 = gemmlowp : : logistic ( input_val_f4_1 ) ; <nl> + const FixedPoint0 output_val_f0_2 = gemmlowp : : logistic ( input_val_f4_2 ) ; <nl> + const FixedPoint0 output_val_f0_3 = gemmlowp : : logistic ( input_val_f4_3 ) ; <nl> + <nl> + / / Divide by 2 ^ 23 as in the scalar code <nl> + using gemmlowp : : RoundingDivideByPOT ; <nl> + int32x4_t output_val_s32_0 = RoundingDivideByPOT ( output_val_f0_0 . raw ( ) , 23 ) ; <nl> + int32x4_t output_val_s32_1 = RoundingDivideByPOT ( output_val_f0_1 . raw ( ) , 23 ) ; <nl> + int32x4_t output_val_s32_2 = RoundingDivideByPOT ( output_val_f0_2 . raw ( ) , 23 ) ; <nl> + int32x4_t output_val_s32_3 = RoundingDivideByPOT ( output_val_f0_3 . raw ( ) , 23 ) ; <nl> + <nl> + / / Cast output values to uint8 , saturating <nl> + int16x8_t output_val_s16_0 = vcombine_s16 ( vqmovn_s32 ( output_val_s32_0 ) , <nl> + vqmovn_s32 ( output_val_s32_1 ) ) ; <nl> + int16x8_t output_val_s16_1 = vcombine_s16 ( vqmovn_s32 ( output_val_s32_2 ) , <nl> + vqmovn_s32 ( output_val_s32_3 ) ) ; <nl> + uint8x16_t output_val_u8 = vcombine_u8 ( vqmovun_s16 ( output_val_s16_0 ) , <nl> + vqmovun_s16 ( output_val_s16_1 ) ) ; <nl> + <nl> + / / Perform the bit - masking with the bit masks computed at the beginning , <nl> + / / see the comment there . <nl> + output_val_u8 = vorrq_u8 ( output_val_u8 , mask_rightclamp ) ; <nl> + output_val_u8 = vandq_u8 ( output_val_u8 , mask_leftclamp ) ; <nl> + <nl> + / / Store back to memory <nl> + vst1q_u8 ( output_data + c , output_val_u8 ) ; <nl> + } <nl> + # endif <nl> + / / Leftover loop : handle one value at a time with scalar code . <nl> + for ( ; c < size ; + + c ) { <nl> + const uint8 input_val_u8 = input_data [ c ] ; <nl> + const int32 input_val_centered = <nl> + static_cast < int32 > ( input_val_u8 ) - input_zero_point ; <nl> + uint8 output_val ; <nl> + if ( input_val_centered < - input_range_radius ) { <nl> + output_val = 0 ; <nl> + } else if ( input_val_centered > input_range_radius ) { <nl> + output_val = 255 ; <nl> + } else { <nl> + const int32 input_val_rescaled = <nl> + MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> + input_val_centered , input_multiplier , input_left_shift ) ; <nl> + using FixedPoint4 = gemmlowp : : FixedPoint < int32 , 4 > ; <nl> + using FixedPoint0 = gemmlowp : : FixedPoint < int32 , 0 > ; <nl> + const FixedPoint4 input_val_f4 = FixedPoint4 : : FromRaw ( input_val_rescaled ) ; <nl> + const FixedPoint0 output_val_f0 = gemmlowp : : logistic ( input_val_f4 ) ; <nl> + using gemmlowp : : RoundingDivideByPOT ; <nl> + int32 output_val_s32 = RoundingDivideByPOT ( output_val_f0 . raw ( ) , 23 ) ; <nl> + if ( output_val_s32 = = 256 ) { <nl> + output_val_s32 = 255 ; <nl> + } <nl> + TFLITE_DCHECK_GE ( output_val_s32 , 0 ) ; <nl> + TFLITE_DCHECK_LE ( output_val_s32 , 255 ) ; <nl> + output_val = static_cast < uint8 > ( output_val_s32 ) ; <nl> + } <nl> + output_data [ c ] = output_val ; <nl> + } <nl> + } <nl> + <nl> inline void Logistic ( const uint8 * input_data , const RuntimeShape & input_shape , <nl> int32 input_zero_point , int32 input_range_radius , <nl> int32 input_multiplier , int input_left_shift , <nl> inline void Tanh ( const float * input_data , const Dims < 4 > & input_dims , <nl> output_data ) ; <nl> } <nl> <nl> + inline void Tanh ( const TanhParams & params , const RuntimeShape & input_shape , <nl> + const uint8 * input_data , const RuntimeShape & output_shape , <nl> + uint8 * output_data ) { <nl> + / / Note that this is almost the exact same code as in Logistic ( ) . <nl> + gemmlowp : : ScopedProfilingLabel label ( " Tanh " ) ; <nl> + const int32 input_zero_point = params . input_zero_point ; <nl> + const int32 input_range_radius = params . input_range_radius ; <nl> + const int32 input_multiplier = params . input_multiplier ; <nl> + const int input_left_shift = params . input_left_shift ; <nl> + const int size = MatchingFlatSize ( input_shape , output_shape ) ; <nl> + <nl> + int c = 0 ; <nl> + int32_t output_zero_point = 128 ; <nl> + # ifdef USE_NEON <nl> + / / Handle 16 values at a time <nl> + for ( ; c < = size - 16 ; c + = 16 ) { <nl> + / / Read input uint8 values , cast to int16 and subtract input_zero_point <nl> + uint8x16_t input_val_u8 = vld1q_u8 ( input_data + c ) ; <nl> + int16x8_t input_val_centered_0 = <nl> + vsubq_s16 ( vreinterpretq_s16_u16 ( vmovl_u8 ( vget_low_u8 ( input_val_u8 ) ) ) , <nl> + vdupq_n_s16 ( input_zero_point ) ) ; <nl> + int16x8_t input_val_centered_1 = <nl> + vsubq_s16 ( vreinterpretq_s16_u16 ( vmovl_u8 ( vget_high_u8 ( input_val_u8 ) ) ) , <nl> + vdupq_n_s16 ( input_zero_point ) ) ; <nl> + <nl> + / / Prepare the bit masks that we will use at the end to implement the logic <nl> + / / that was expressed in the scalar code with branching : <nl> + / / if ( input_val_centered < - input_range_radius ) { <nl> + / / output_val = 0 ; <nl> + / / } else if ( input_val_centered > input_range_radius ) { <nl> + / / output_val = 255 ; <nl> + / / } else { <nl> + / / . . . <nl> + uint16x8_t mask_rightclamp_0 = <nl> + vcgtq_s16 ( input_val_centered_0 , vdupq_n_s16 ( input_range_radius ) ) ; <nl> + uint16x8_t mask_rightclamp_1 = <nl> + vcgtq_s16 ( input_val_centered_1 , vdupq_n_s16 ( input_range_radius ) ) ; <nl> + uint16x8_t mask_leftclamp_0 = <nl> + vcgeq_s16 ( input_val_centered_0 , vdupq_n_s16 ( - input_range_radius ) ) ; <nl> + uint16x8_t mask_leftclamp_1 = <nl> + vcgeq_s16 ( input_val_centered_1 , vdupq_n_s16 ( - input_range_radius ) ) ; <nl> + uint8x16_t mask_rightclamp = vcombine_u8 ( vshrn_n_u16 ( mask_rightclamp_0 , 8 ) , <nl> + vshrn_n_u16 ( mask_rightclamp_1 , 8 ) ) ; <nl> + uint8x16_t mask_leftclamp = vcombine_u8 ( vshrn_n_u16 ( mask_leftclamp_0 , 8 ) , <nl> + vshrn_n_u16 ( mask_leftclamp_1 , 8 ) ) ; <nl> + <nl> + / / This performs what is expressed in the scalar code as <nl> + / / const int32 input_val_rescaled = <nl> + / / MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> + / / input_val_centered , input_multiplier , input_left_shift ) ; <nl> + int32x4_t input_val_rescaled_0 = <nl> + vshlq_s32 ( vmovl_s16 ( vget_low_s16 ( input_val_centered_0 ) ) , <nl> + vdupq_n_s32 ( input_left_shift ) ) ; <nl> + int32x4_t input_val_rescaled_1 = <nl> + vshlq_s32 ( vmovl_s16 ( vget_high_s16 ( input_val_centered_0 ) ) , <nl> + vdupq_n_s32 ( input_left_shift ) ) ; <nl> + int32x4_t input_val_rescaled_2 = <nl> + vshlq_s32 ( vmovl_s16 ( vget_low_s16 ( input_val_centered_1 ) ) , <nl> + vdupq_n_s32 ( input_left_shift ) ) ; <nl> + int32x4_t input_val_rescaled_3 = <nl> + vshlq_s32 ( vmovl_s16 ( vget_high_s16 ( input_val_centered_1 ) ) , <nl> + vdupq_n_s32 ( input_left_shift ) ) ; <nl> + input_val_rescaled_0 = <nl> + vqrdmulhq_n_s32 ( input_val_rescaled_0 , input_multiplier ) ; <nl> + input_val_rescaled_1 = <nl> + vqrdmulhq_n_s32 ( input_val_rescaled_1 , input_multiplier ) ; <nl> + input_val_rescaled_2 = <nl> + vqrdmulhq_n_s32 ( input_val_rescaled_2 , input_multiplier ) ; <nl> + input_val_rescaled_3 = <nl> + vqrdmulhq_n_s32 ( input_val_rescaled_3 , input_multiplier ) ; <nl> + <nl> + / / Invoke gemmlowp : : tanh on FixedPoint wrapping int32x4_t <nl> + using FixedPoint4 = gemmlowp : : FixedPoint < int32x4_t , 4 > ; <nl> + using FixedPoint0 = gemmlowp : : FixedPoint < int32x4_t , 0 > ; <nl> + const FixedPoint4 input_val_f4_0 = <nl> + FixedPoint4 : : FromRaw ( input_val_rescaled_0 ) ; <nl> + const FixedPoint4 input_val_f4_1 = <nl> + FixedPoint4 : : FromRaw ( input_val_rescaled_1 ) ; <nl> + const FixedPoint4 input_val_f4_2 = <nl> + FixedPoint4 : : FromRaw ( input_val_rescaled_2 ) ; <nl> + const FixedPoint4 input_val_f4_3 = <nl> + FixedPoint4 : : FromRaw ( input_val_rescaled_3 ) ; <nl> + const FixedPoint0 output_val_f0_0 = gemmlowp : : tanh ( input_val_f4_0 ) ; <nl> + const FixedPoint0 output_val_f0_1 = gemmlowp : : tanh ( input_val_f4_1 ) ; <nl> + const FixedPoint0 output_val_f0_2 = gemmlowp : : tanh ( input_val_f4_2 ) ; <nl> + const FixedPoint0 output_val_f0_3 = gemmlowp : : tanh ( input_val_f4_3 ) ; <nl> + <nl> + / / Divide by 2 ^ 24 as in the scalar code <nl> + using gemmlowp : : RoundingDivideByPOT ; <nl> + int32x4_t output_val_s32_0 = RoundingDivideByPOT ( output_val_f0_0 . raw ( ) , 24 ) ; <nl> + int32x4_t output_val_s32_1 = RoundingDivideByPOT ( output_val_f0_1 . raw ( ) , 24 ) ; <nl> + int32x4_t output_val_s32_2 = RoundingDivideByPOT ( output_val_f0_2 . raw ( ) , 24 ) ; <nl> + int32x4_t output_val_s32_3 = RoundingDivideByPOT ( output_val_f0_3 . raw ( ) , 24 ) ; <nl> + <nl> + / / Add the output zero point <nl> + int32x4_t output_zero_point_s32 = vdupq_n_s32 ( output_zero_point ) ; <nl> + output_val_s32_0 = vaddq_s32 ( output_val_s32_0 , output_zero_point_s32 ) ; <nl> + output_val_s32_1 = vaddq_s32 ( output_val_s32_1 , output_zero_point_s32 ) ; <nl> + output_val_s32_2 = vaddq_s32 ( output_val_s32_2 , output_zero_point_s32 ) ; <nl> + output_val_s32_3 = vaddq_s32 ( output_val_s32_3 , output_zero_point_s32 ) ; <nl> + <nl> + / / Cast output values to uint8 , saturating <nl> + int16x8_t output_val_s16_0 = vcombine_s16 ( vqmovn_s32 ( output_val_s32_0 ) , <nl> + vqmovn_s32 ( output_val_s32_1 ) ) ; <nl> + int16x8_t output_val_s16_1 = vcombine_s16 ( vqmovn_s32 ( output_val_s32_2 ) , <nl> + vqmovn_s32 ( output_val_s32_3 ) ) ; <nl> + uint8x16_t output_val_u8 = vcombine_u8 ( vqmovun_s16 ( output_val_s16_0 ) , <nl> + vqmovun_s16 ( output_val_s16_1 ) ) ; <nl> + <nl> + / / Perform the bit - masking with the bit masks computed at the beginning , <nl> + / / see the comment there . <nl> + output_val_u8 = vorrq_u8 ( output_val_u8 , mask_rightclamp ) ; <nl> + output_val_u8 = vandq_u8 ( output_val_u8 , mask_leftclamp ) ; <nl> + <nl> + / / Store back to memory <nl> + vst1q_u8 ( output_data + c , output_val_u8 ) ; <nl> + } <nl> + # endif <nl> + / / Leftover loop : handle one value at a time with scalar code . <nl> + for ( ; c < size ; + + c ) { <nl> + const uint8 input_val_u8 = input_data [ c ] ; <nl> + const int32 input_val_centered = <nl> + static_cast < int32 > ( input_val_u8 ) - input_zero_point ; <nl> + uint8 output_val ; <nl> + if ( input_val_centered < - input_range_radius ) { <nl> + output_val = 0 ; <nl> + } else if ( input_val_centered > input_range_radius ) { <nl> + output_val = 255 ; <nl> + } else { <nl> + const int32 input_val_rescaled = <nl> + MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> + input_val_centered , input_multiplier , input_left_shift ) ; <nl> + using FixedPoint4 = gemmlowp : : FixedPoint < int32 , 4 > ; <nl> + using FixedPoint0 = gemmlowp : : FixedPoint < int32 , 0 > ; <nl> + const FixedPoint4 input_val_f4 = FixedPoint4 : : FromRaw ( input_val_rescaled ) ; <nl> + const FixedPoint0 output_val_f0 = gemmlowp : : tanh ( input_val_f4 ) ; <nl> + using gemmlowp : : RoundingDivideByPOT ; <nl> + int32 output_val_s32 = RoundingDivideByPOT ( output_val_f0 . raw ( ) , 24 ) ; <nl> + output_val_s32 + = output_zero_point ; <nl> + if ( output_val_s32 = = 256 ) { <nl> + output_val_s32 = 255 ; <nl> + } <nl> + TFLITE_DCHECK_GE ( output_val_s32 , 0 ) ; <nl> + TFLITE_DCHECK_LE ( output_val_s32 , 255 ) ; <nl> + output_val = static_cast < uint8 > ( output_val_s32 ) ; <nl> + } <nl> + output_data [ c ] = output_val ; <nl> + } <nl> + } <nl> + <nl> inline void Tanh ( const uint8 * input_data , const RuntimeShape & input_shape , <nl> int32 input_zero_point , int32 input_range_radius , <nl> int32 input_multiplier , int input_left_shift , <nl> mmm a / tensorflow / lite / kernels / internal / optimized / optimized_ops . h <nl> ppp b / tensorflow / lite / kernels / internal / optimized / optimized_ops . h <nl> inline void Logistic ( const LogisticParams & , const RuntimeShape & input_shape , <nl> Logistic ( input_shape , input_data , output_shape , output_data ) ; <nl> } <nl> <nl> - inline void Logistic ( const LogisticParams & params , <nl> - const RuntimeShape & input_shape , const uint8 * input_data , <nl> - const RuntimeShape & output_shape , uint8 * output_data ) { <nl> - gemmlowp : : ScopedProfilingLabel label ( " Logistic / Uint8 " ) ; <nl> - const int32 input_zero_point = params . input_zero_point ; <nl> - const int32 input_range_radius = params . input_range_radius ; <nl> - const int32 input_multiplier = params . input_multiplier ; <nl> - const int input_left_shift = params . input_left_shift ; <nl> - const int size = MatchingFlatSize ( input_shape , output_shape ) ; <nl> - <nl> - int c = 0 ; <nl> - # ifdef USE_NEON <nl> - / / Handle 16 values at a time <nl> - for ( ; c < = size - 16 ; c + = 16 ) { <nl> - / / Read input uint8 values , cast to int16 and subtract input_zero_point <nl> - uint8x16_t input_val_u8 = vld1q_u8 ( input_data + c ) ; <nl> - int16x8_t input_val_centered_0 = <nl> - vsubq_s16 ( vreinterpretq_s16_u16 ( vmovl_u8 ( vget_low_u8 ( input_val_u8 ) ) ) , <nl> - vdupq_n_s16 ( input_zero_point ) ) ; <nl> - int16x8_t input_val_centered_1 = <nl> - vsubq_s16 ( vreinterpretq_s16_u16 ( vmovl_u8 ( vget_high_u8 ( input_val_u8 ) ) ) , <nl> - vdupq_n_s16 ( input_zero_point ) ) ; <nl> - <nl> - / / Prepare the bit masks that we will use at the end to implement the logic <nl> - / / that was expressed in the scalar code with branching : <nl> - / / if ( input_val_centered < - input_range_radius ) { <nl> - / / output_val = 0 ; <nl> - / / } else if ( input_val_centered > input_range_radius ) { <nl> - / / output_val = 255 ; <nl> - / / } else { <nl> - / / . . . <nl> - uint16x8_t mask_rightclamp_0 = <nl> - vcgtq_s16 ( input_val_centered_0 , vdupq_n_s16 ( input_range_radius ) ) ; <nl> - uint16x8_t mask_rightclamp_1 = <nl> - vcgtq_s16 ( input_val_centered_1 , vdupq_n_s16 ( input_range_radius ) ) ; <nl> - uint16x8_t mask_leftclamp_0 = <nl> - vcgeq_s16 ( input_val_centered_0 , vdupq_n_s16 ( - input_range_radius ) ) ; <nl> - uint16x8_t mask_leftclamp_1 = <nl> - vcgeq_s16 ( input_val_centered_1 , vdupq_n_s16 ( - input_range_radius ) ) ; <nl> - uint8x16_t mask_rightclamp = vcombine_u8 ( vshrn_n_u16 ( mask_rightclamp_0 , 8 ) , <nl> - vshrn_n_u16 ( mask_rightclamp_1 , 8 ) ) ; <nl> - uint8x16_t mask_leftclamp = vcombine_u8 ( vshrn_n_u16 ( mask_leftclamp_0 , 8 ) , <nl> - vshrn_n_u16 ( mask_leftclamp_1 , 8 ) ) ; <nl> - <nl> - / / This performs what is expressed in the scalar code as <nl> - / / const int32 input_val_rescaled = <nl> - / / MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> - / / input_val_centered , input_multiplier , input_left_shift ) ; <nl> - int32x4_t input_val_rescaled_0 = <nl> - vshlq_s32 ( vmovl_s16 ( vget_low_s16 ( input_val_centered_0 ) ) , <nl> - vdupq_n_s32 ( input_left_shift ) ) ; <nl> - int32x4_t input_val_rescaled_1 = <nl> - vshlq_s32 ( vmovl_s16 ( vget_high_s16 ( input_val_centered_0 ) ) , <nl> - vdupq_n_s32 ( input_left_shift ) ) ; <nl> - int32x4_t input_val_rescaled_2 = <nl> - vshlq_s32 ( vmovl_s16 ( vget_low_s16 ( input_val_centered_1 ) ) , <nl> - vdupq_n_s32 ( input_left_shift ) ) ; <nl> - int32x4_t input_val_rescaled_3 = <nl> - vshlq_s32 ( vmovl_s16 ( vget_high_s16 ( input_val_centered_1 ) ) , <nl> - vdupq_n_s32 ( input_left_shift ) ) ; <nl> - input_val_rescaled_0 = <nl> - vqrdmulhq_n_s32 ( input_val_rescaled_0 , input_multiplier ) ; <nl> - input_val_rescaled_1 = <nl> - vqrdmulhq_n_s32 ( input_val_rescaled_1 , input_multiplier ) ; <nl> - input_val_rescaled_2 = <nl> - vqrdmulhq_n_s32 ( input_val_rescaled_2 , input_multiplier ) ; <nl> - input_val_rescaled_3 = <nl> - vqrdmulhq_n_s32 ( input_val_rescaled_3 , input_multiplier ) ; <nl> - <nl> - / / Invoke gemmlowp : : logistic on FixedPoint wrapping int32x4_t <nl> - using FixedPoint4 = gemmlowp : : FixedPoint < int32x4_t , 4 > ; <nl> - using FixedPoint0 = gemmlowp : : FixedPoint < int32x4_t , 0 > ; <nl> - const FixedPoint4 input_val_f4_0 = <nl> - FixedPoint4 : : FromRaw ( input_val_rescaled_0 ) ; <nl> - const FixedPoint4 input_val_f4_1 = <nl> - FixedPoint4 : : FromRaw ( input_val_rescaled_1 ) ; <nl> - const FixedPoint4 input_val_f4_2 = <nl> - FixedPoint4 : : FromRaw ( input_val_rescaled_2 ) ; <nl> - const FixedPoint4 input_val_f4_3 = <nl> - FixedPoint4 : : FromRaw ( input_val_rescaled_3 ) ; <nl> - const FixedPoint0 output_val_f0_0 = gemmlowp : : logistic ( input_val_f4_0 ) ; <nl> - const FixedPoint0 output_val_f0_1 = gemmlowp : : logistic ( input_val_f4_1 ) ; <nl> - const FixedPoint0 output_val_f0_2 = gemmlowp : : logistic ( input_val_f4_2 ) ; <nl> - const FixedPoint0 output_val_f0_3 = gemmlowp : : logistic ( input_val_f4_3 ) ; <nl> - <nl> - / / Divide by 2 ^ 23 as in the scalar code <nl> - using gemmlowp : : RoundingDivideByPOT ; <nl> - int32x4_t output_val_s32_0 = RoundingDivideByPOT ( output_val_f0_0 . raw ( ) , 23 ) ; <nl> - int32x4_t output_val_s32_1 = RoundingDivideByPOT ( output_val_f0_1 . raw ( ) , 23 ) ; <nl> - int32x4_t output_val_s32_2 = RoundingDivideByPOT ( output_val_f0_2 . raw ( ) , 23 ) ; <nl> - int32x4_t output_val_s32_3 = RoundingDivideByPOT ( output_val_f0_3 . raw ( ) , 23 ) ; <nl> - <nl> - / / Cast output values to uint8 , saturating <nl> - int16x8_t output_val_s16_0 = vcombine_s16 ( vqmovn_s32 ( output_val_s32_0 ) , <nl> - vqmovn_s32 ( output_val_s32_1 ) ) ; <nl> - int16x8_t output_val_s16_1 = vcombine_s16 ( vqmovn_s32 ( output_val_s32_2 ) , <nl> - vqmovn_s32 ( output_val_s32_3 ) ) ; <nl> - uint8x16_t output_val_u8 = vcombine_u8 ( vqmovun_s16 ( output_val_s16_0 ) , <nl> - vqmovun_s16 ( output_val_s16_1 ) ) ; <nl> - <nl> - / / Perform the bit - masking with the bit masks computed at the beginning , <nl> - / / see the comment there . <nl> - output_val_u8 = vorrq_u8 ( output_val_u8 , mask_rightclamp ) ; <nl> - output_val_u8 = vandq_u8 ( output_val_u8 , mask_leftclamp ) ; <nl> - <nl> - / / Store back to memory <nl> - vst1q_u8 ( output_data + c , output_val_u8 ) ; <nl> - } <nl> - # endif <nl> - / / Leftover loop : handle one value at a time with scalar code . <nl> - for ( ; c < size ; + + c ) { <nl> - const uint8 input_val_u8 = input_data [ c ] ; <nl> - const int32 input_val_centered = <nl> - static_cast < int32 > ( input_val_u8 ) - input_zero_point ; <nl> - uint8 output_val ; <nl> - if ( input_val_centered < - input_range_radius ) { <nl> - output_val = 0 ; <nl> - } else if ( input_val_centered > input_range_radius ) { <nl> - output_val = 255 ; <nl> - } else { <nl> - const int32 input_val_rescaled = <nl> - MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> - input_val_centered , input_multiplier , input_left_shift ) ; <nl> - using FixedPoint4 = gemmlowp : : FixedPoint < int32 , 4 > ; <nl> - using FixedPoint0 = gemmlowp : : FixedPoint < int32 , 0 > ; <nl> - const FixedPoint4 input_val_f4 = FixedPoint4 : : FromRaw ( input_val_rescaled ) ; <nl> - const FixedPoint0 output_val_f0 = gemmlowp : : logistic ( input_val_f4 ) ; <nl> - using gemmlowp : : RoundingDivideByPOT ; <nl> - int32 output_val_s32 = RoundingDivideByPOT ( output_val_f0 . raw ( ) , 23 ) ; <nl> - if ( output_val_s32 = = 256 ) { <nl> - output_val_s32 = 255 ; <nl> - } <nl> - TFLITE_DCHECK_GE ( output_val_s32 , 0 ) ; <nl> - TFLITE_DCHECK_LE ( output_val_s32 , 255 ) ; <nl> - output_val = static_cast < uint8 > ( output_val_s32 ) ; <nl> - } <nl> - output_data [ c ] = output_val ; <nl> - } <nl> - } <nl> - <nl> inline void Logistic ( const LogisticParams & params , <nl> const RuntimeShape & input_shape , const int16 * input_data , <nl> const RuntimeShape & output_shape , int16 * output_data ) { <nl> inline void Tanh ( const TanhParams & , const RuntimeShape & input_shape , <nl> Tanh ( input_shape , input_data , output_shape , output_data ) ; <nl> } <nl> <nl> - inline void Tanh ( const TanhParams & params , const RuntimeShape & input_shape , <nl> - const uint8 * input_data , const RuntimeShape & output_shape , <nl> - uint8 * output_data ) { <nl> - / / Note that this is almost the exact same code as in Logistic ( ) . <nl> - gemmlowp : : ScopedProfilingLabel label ( " Tanh " ) ; <nl> - const int32 input_zero_point = params . input_zero_point ; <nl> - const int32 input_range_radius = params . input_range_radius ; <nl> - const int32 input_multiplier = params . input_multiplier ; <nl> - const int input_left_shift = params . input_left_shift ; <nl> - const int size = MatchingFlatSize ( input_shape , output_shape ) ; <nl> - <nl> - int c = 0 ; <nl> - int32_t output_zero_point = 128 ; <nl> - # ifdef USE_NEON <nl> - / / Handle 16 values at a time <nl> - for ( ; c < = size - 16 ; c + = 16 ) { <nl> - / / Read input uint8 values , cast to int16 and subtract input_zero_point <nl> - uint8x16_t input_val_u8 = vld1q_u8 ( input_data + c ) ; <nl> - int16x8_t input_val_centered_0 = <nl> - vsubq_s16 ( vreinterpretq_s16_u16 ( vmovl_u8 ( vget_low_u8 ( input_val_u8 ) ) ) , <nl> - vdupq_n_s16 ( input_zero_point ) ) ; <nl> - int16x8_t input_val_centered_1 = <nl> - vsubq_s16 ( vreinterpretq_s16_u16 ( vmovl_u8 ( vget_high_u8 ( input_val_u8 ) ) ) , <nl> - vdupq_n_s16 ( input_zero_point ) ) ; <nl> - <nl> - / / Prepare the bit masks that we will use at the end to implement the logic <nl> - / / that was expressed in the scalar code with branching : <nl> - / / if ( input_val_centered < - input_range_radius ) { <nl> - / / output_val = 0 ; <nl> - / / } else if ( input_val_centered > input_range_radius ) { <nl> - / / output_val = 255 ; <nl> - / / } else { <nl> - / / . . . <nl> - uint16x8_t mask_rightclamp_0 = <nl> - vcgtq_s16 ( input_val_centered_0 , vdupq_n_s16 ( input_range_radius ) ) ; <nl> - uint16x8_t mask_rightclamp_1 = <nl> - vcgtq_s16 ( input_val_centered_1 , vdupq_n_s16 ( input_range_radius ) ) ; <nl> - uint16x8_t mask_leftclamp_0 = <nl> - vcgeq_s16 ( input_val_centered_0 , vdupq_n_s16 ( - input_range_radius ) ) ; <nl> - uint16x8_t mask_leftclamp_1 = <nl> - vcgeq_s16 ( input_val_centered_1 , vdupq_n_s16 ( - input_range_radius ) ) ; <nl> - uint8x16_t mask_rightclamp = vcombine_u8 ( vshrn_n_u16 ( mask_rightclamp_0 , 8 ) , <nl> - vshrn_n_u16 ( mask_rightclamp_1 , 8 ) ) ; <nl> - uint8x16_t mask_leftclamp = vcombine_u8 ( vshrn_n_u16 ( mask_leftclamp_0 , 8 ) , <nl> - vshrn_n_u16 ( mask_leftclamp_1 , 8 ) ) ; <nl> - <nl> - / / This performs what is expressed in the scalar code as <nl> - / / const int32 input_val_rescaled = <nl> - / / MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> - / / input_val_centered , input_multiplier , input_left_shift ) ; <nl> - int32x4_t input_val_rescaled_0 = <nl> - vshlq_s32 ( vmovl_s16 ( vget_low_s16 ( input_val_centered_0 ) ) , <nl> - vdupq_n_s32 ( input_left_shift ) ) ; <nl> - int32x4_t input_val_rescaled_1 = <nl> - vshlq_s32 ( vmovl_s16 ( vget_high_s16 ( input_val_centered_0 ) ) , <nl> - vdupq_n_s32 ( input_left_shift ) ) ; <nl> - int32x4_t input_val_rescaled_2 = <nl> - vshlq_s32 ( vmovl_s16 ( vget_low_s16 ( input_val_centered_1 ) ) , <nl> - vdupq_n_s32 ( input_left_shift ) ) ; <nl> - int32x4_t input_val_rescaled_3 = <nl> - vshlq_s32 ( vmovl_s16 ( vget_high_s16 ( input_val_centered_1 ) ) , <nl> - vdupq_n_s32 ( input_left_shift ) ) ; <nl> - input_val_rescaled_0 = <nl> - vqrdmulhq_n_s32 ( input_val_rescaled_0 , input_multiplier ) ; <nl> - input_val_rescaled_1 = <nl> - vqrdmulhq_n_s32 ( input_val_rescaled_1 , input_multiplier ) ; <nl> - input_val_rescaled_2 = <nl> - vqrdmulhq_n_s32 ( input_val_rescaled_2 , input_multiplier ) ; <nl> - input_val_rescaled_3 = <nl> - vqrdmulhq_n_s32 ( input_val_rescaled_3 , input_multiplier ) ; <nl> - <nl> - / / Invoke gemmlowp : : tanh on FixedPoint wrapping int32x4_t <nl> - using FixedPoint4 = gemmlowp : : FixedPoint < int32x4_t , 4 > ; <nl> - using FixedPoint0 = gemmlowp : : FixedPoint < int32x4_t , 0 > ; <nl> - const FixedPoint4 input_val_f4_0 = <nl> - FixedPoint4 : : FromRaw ( input_val_rescaled_0 ) ; <nl> - const FixedPoint4 input_val_f4_1 = <nl> - FixedPoint4 : : FromRaw ( input_val_rescaled_1 ) ; <nl> - const FixedPoint4 input_val_f4_2 = <nl> - FixedPoint4 : : FromRaw ( input_val_rescaled_2 ) ; <nl> - const FixedPoint4 input_val_f4_3 = <nl> - FixedPoint4 : : FromRaw ( input_val_rescaled_3 ) ; <nl> - const FixedPoint0 output_val_f0_0 = gemmlowp : : tanh ( input_val_f4_0 ) ; <nl> - const FixedPoint0 output_val_f0_1 = gemmlowp : : tanh ( input_val_f4_1 ) ; <nl> - const FixedPoint0 output_val_f0_2 = gemmlowp : : tanh ( input_val_f4_2 ) ; <nl> - const FixedPoint0 output_val_f0_3 = gemmlowp : : tanh ( input_val_f4_3 ) ; <nl> - <nl> - / / Divide by 2 ^ 24 as in the scalar code <nl> - using gemmlowp : : RoundingDivideByPOT ; <nl> - int32x4_t output_val_s32_0 = RoundingDivideByPOT ( output_val_f0_0 . raw ( ) , 24 ) ; <nl> - int32x4_t output_val_s32_1 = RoundingDivideByPOT ( output_val_f0_1 . raw ( ) , 24 ) ; <nl> - int32x4_t output_val_s32_2 = RoundingDivideByPOT ( output_val_f0_2 . raw ( ) , 24 ) ; <nl> - int32x4_t output_val_s32_3 = RoundingDivideByPOT ( output_val_f0_3 . raw ( ) , 24 ) ; <nl> - <nl> - / / Add the output zero point <nl> - int32x4_t output_zero_point_s32 = vdupq_n_s32 ( output_zero_point ) ; <nl> - output_val_s32_0 = vaddq_s32 ( output_val_s32_0 , output_zero_point_s32 ) ; <nl> - output_val_s32_1 = vaddq_s32 ( output_val_s32_1 , output_zero_point_s32 ) ; <nl> - output_val_s32_2 = vaddq_s32 ( output_val_s32_2 , output_zero_point_s32 ) ; <nl> - output_val_s32_3 = vaddq_s32 ( output_val_s32_3 , output_zero_point_s32 ) ; <nl> - <nl> - / / Cast output values to uint8 , saturating <nl> - int16x8_t output_val_s16_0 = vcombine_s16 ( vqmovn_s32 ( output_val_s32_0 ) , <nl> - vqmovn_s32 ( output_val_s32_1 ) ) ; <nl> - int16x8_t output_val_s16_1 = vcombine_s16 ( vqmovn_s32 ( output_val_s32_2 ) , <nl> - vqmovn_s32 ( output_val_s32_3 ) ) ; <nl> - uint8x16_t output_val_u8 = vcombine_u8 ( vqmovun_s16 ( output_val_s16_0 ) , <nl> - vqmovun_s16 ( output_val_s16_1 ) ) ; <nl> - <nl> - / / Perform the bit - masking with the bit masks computed at the beginning , <nl> - / / see the comment there . <nl> - output_val_u8 = vorrq_u8 ( output_val_u8 , mask_rightclamp ) ; <nl> - output_val_u8 = vandq_u8 ( output_val_u8 , mask_leftclamp ) ; <nl> - <nl> - / / Store back to memory <nl> - vst1q_u8 ( output_data + c , output_val_u8 ) ; <nl> - } <nl> - # endif <nl> - / / Leftover loop : handle one value at a time with scalar code . <nl> - for ( ; c < size ; + + c ) { <nl> - const uint8 input_val_u8 = input_data [ c ] ; <nl> - const int32 input_val_centered = <nl> - static_cast < int32 > ( input_val_u8 ) - input_zero_point ; <nl> - uint8 output_val ; <nl> - if ( input_val_centered < - input_range_radius ) { <nl> - output_val = 0 ; <nl> - } else if ( input_val_centered > input_range_radius ) { <nl> - output_val = 255 ; <nl> - } else { <nl> - const int32 input_val_rescaled = <nl> - MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> - input_val_centered , input_multiplier , input_left_shift ) ; <nl> - using FixedPoint4 = gemmlowp : : FixedPoint < int32 , 4 > ; <nl> - using FixedPoint0 = gemmlowp : : FixedPoint < int32 , 0 > ; <nl> - const FixedPoint4 input_val_f4 = FixedPoint4 : : FromRaw ( input_val_rescaled ) ; <nl> - const FixedPoint0 output_val_f0 = gemmlowp : : tanh ( input_val_f4 ) ; <nl> - using gemmlowp : : RoundingDivideByPOT ; <nl> - int32 output_val_s32 = RoundingDivideByPOT ( output_val_f0 . raw ( ) , 24 ) ; <nl> - output_val_s32 + = output_zero_point ; <nl> - if ( output_val_s32 = = 256 ) { <nl> - output_val_s32 = 255 ; <nl> - } <nl> - TFLITE_DCHECK_GE ( output_val_s32 , 0 ) ; <nl> - TFLITE_DCHECK_LE ( output_val_s32 , 255 ) ; <nl> - output_val = static_cast < uint8 > ( output_val_s32 ) ; <nl> - } <nl> - output_data [ c ] = output_val ; <nl> - } <nl> - } <nl> - <nl> inline void Tanh ( const TanhParams & params , const RuntimeShape & input_shape , <nl> const int16 * input_data , const RuntimeShape & output_shape , <nl> int16 * output_data ) { <nl> mmm a / tensorflow / lite / kernels / internal / reference / legacy_reference_ops . h <nl> ppp b / tensorflow / lite / kernels / internal / reference / legacy_reference_ops . h <nl> inline void LogSoftmax ( const uint8 * input_data , const RuntimeShape & input_shape , <nl> LogSoftmax ( params , input_shape , input_data , output_shape , output_data ) ; <nl> } <nl> <nl> + inline void Logistic ( const LogisticParams & params , <nl> + const RuntimeShape & input_shape , const uint8 * input_data , <nl> + const RuntimeShape & output_shape , uint8 * output_data ) { <nl> + const int32 input_zero_point = params . input_zero_point ; <nl> + const int32 input_range_radius = params . input_range_radius ; <nl> + const int32 input_multiplier = params . input_multiplier ; <nl> + const int input_left_shift = params . input_left_shift ; <nl> + const int flat_size = MatchingFlatSize ( input_shape , output_shape ) ; <nl> + <nl> + for ( int i = 0 ; i < flat_size ; i + + ) { <nl> + const uint8 input_val_u8 = input_data [ i ] ; <nl> + const int32 input_val_centered = <nl> + static_cast < int32 > ( input_val_u8 ) - input_zero_point ; <nl> + uint8 output_val ; <nl> + if ( input_val_centered < = - input_range_radius ) { <nl> + output_val = 0 ; <nl> + } else if ( input_val_centered > = input_range_radius ) { <nl> + output_val = 255 ; <nl> + } else { <nl> + const int32 input_val_rescaled = <nl> + MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> + input_val_centered , input_multiplier , input_left_shift ) ; <nl> + using FixedPoint4 = gemmlowp : : FixedPoint < int32 , 4 > ; <nl> + using FixedPoint0 = gemmlowp : : FixedPoint < int32 , 0 > ; <nl> + const FixedPoint4 input_val_f4 = FixedPoint4 : : FromRaw ( input_val_rescaled ) ; <nl> + const FixedPoint0 output_val_f0 = gemmlowp : : logistic ( input_val_f4 ) ; <nl> + / / Convert from Q0 . 31 to Q23 . 8 . <nl> + using gemmlowp : : RoundingDivideByPOT ; <nl> + int32 output_val_s32 = RoundingDivideByPOT ( output_val_f0 . raw ( ) , 23 ) ; <nl> + if ( output_val_s32 = = 256 ) { <nl> + output_val_s32 = 255 ; <nl> + } <nl> + / / Reinterpret as U0 . 8 . <nl> + TFLITE_DCHECK_GE ( output_val_s32 , 0 ) ; <nl> + TFLITE_DCHECK_LE ( output_val_s32 , 255 ) ; <nl> + output_val = static_cast < uint8 > ( output_val_s32 ) ; <nl> + } <nl> + output_data [ i ] = output_val ; <nl> + } <nl> + } <nl> + <nl> inline void Logistic ( const uint8 * input_data , const RuntimeShape & input_shape , <nl> int32 input_zero_point , int32 input_range_radius , <nl> int32 input_multiplier , int input_left_shift , <nl> inline void Logistic ( const RuntimeShape & input_shape , const int16 * input_data , <nl> Logistic ( params , input_shape , input_data , output_shape , output_data ) ; <nl> } <nl> <nl> + inline void Tanh ( const TanhParams & params , const RuntimeShape & input_shape , <nl> + const uint8 * input_data , const RuntimeShape & output_shape , <nl> + uint8 * output_data ) { <nl> + const int32 input_zero_point = params . input_zero_point ; <nl> + const int32 input_range_radius = params . input_range_radius ; <nl> + const int32 input_multiplier = params . input_multiplier ; <nl> + const int input_left_shift = params . input_left_shift ; <nl> + const int32 output_zero_point = 128 ; <nl> + const int flat_size = MatchingFlatSize ( input_shape , output_shape ) ; <nl> + <nl> + for ( int i = 0 ; i < flat_size ; i + + ) { <nl> + const uint8 input_val_u8 = input_data [ i ] ; <nl> + const int32 input_val_centered = <nl> + static_cast < int32 > ( input_val_u8 ) - input_zero_point ; <nl> + uint8 output_val ; <nl> + if ( input_val_centered < = - input_range_radius ) { <nl> + output_val = 0 ; <nl> + } else if ( input_val_centered > = input_range_radius ) { <nl> + output_val = 255 ; <nl> + } else { <nl> + const int32 input_val_rescaled = <nl> + MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> + input_val_centered , input_multiplier , input_left_shift ) ; <nl> + using FixedPoint4 = gemmlowp : : FixedPoint < int32 , 4 > ; <nl> + using FixedPoint0 = gemmlowp : : FixedPoint < int32 , 0 > ; <nl> + const FixedPoint4 input_val_f4 = FixedPoint4 : : FromRaw ( input_val_rescaled ) ; <nl> + const FixedPoint0 output_val_f0 = gemmlowp : : tanh ( input_val_f4 ) ; <nl> + / / Convert from Q0 . 31 to Q24 . 7 . <nl> + using gemmlowp : : RoundingDivideByPOT ; <nl> + int32 output_val_s32 = RoundingDivideByPOT ( output_val_f0 . raw ( ) , 24 ) ; <nl> + output_val_s32 + = output_zero_point ; <nl> + if ( output_val_s32 = = 256 ) { <nl> + output_val_s32 = 255 ; <nl> + } <nl> + / / Reinterpret as Q0 . 7 , encoded in uint8 . <nl> + TFLITE_DCHECK_GE ( output_val_s32 , 0 ) ; <nl> + TFLITE_DCHECK_LE ( output_val_s32 , 255 ) ; <nl> + output_val = static_cast < uint8 > ( output_val_s32 ) ; <nl> + } <nl> + output_data [ i ] = output_val ; <nl> + } <nl> + } <nl> + <nl> inline void Tanh ( const uint8 * input_data , const RuntimeShape & input_shape , <nl> int32 input_zero_point , int32 input_range_radius , <nl> int32 input_multiplier , int input_left_shift , <nl> mmm a / tensorflow / lite / kernels / internal / reference / reference_ops . h <nl> ppp b / tensorflow / lite / kernels / internal / reference / reference_ops . h <nl> inline void Logistic ( const LogisticParams & , const RuntimeShape & input_shape , <nl> Logistic ( input_shape , input_data , output_shape , output_data ) ; <nl> } <nl> <nl> - inline void Logistic ( const LogisticParams & params , <nl> - const RuntimeShape & input_shape , const uint8 * input_data , <nl> - const RuntimeShape & output_shape , uint8 * output_data ) { <nl> - const int32 input_zero_point = params . input_zero_point ; <nl> - const int32 input_range_radius = params . input_range_radius ; <nl> - const int32 input_multiplier = params . input_multiplier ; <nl> - const int input_left_shift = params . input_left_shift ; <nl> - const int flat_size = MatchingFlatSize ( input_shape , output_shape ) ; <nl> - <nl> - for ( int i = 0 ; i < flat_size ; i + + ) { <nl> - const uint8 input_val_u8 = input_data [ i ] ; <nl> - const int32 input_val_centered = <nl> - static_cast < int32 > ( input_val_u8 ) - input_zero_point ; <nl> - uint8 output_val ; <nl> - if ( input_val_centered < = - input_range_radius ) { <nl> - output_val = 0 ; <nl> - } else if ( input_val_centered > = input_range_radius ) { <nl> - output_val = 255 ; <nl> - } else { <nl> - const int32 input_val_rescaled = <nl> - MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> - input_val_centered , input_multiplier , input_left_shift ) ; <nl> - using FixedPoint4 = gemmlowp : : FixedPoint < int32 , 4 > ; <nl> - using FixedPoint0 = gemmlowp : : FixedPoint < int32 , 0 > ; <nl> - const FixedPoint4 input_val_f4 = FixedPoint4 : : FromRaw ( input_val_rescaled ) ; <nl> - const FixedPoint0 output_val_f0 = gemmlowp : : logistic ( input_val_f4 ) ; <nl> - / / Convert from Q0 . 31 to Q23 . 8 . <nl> - using gemmlowp : : RoundingDivideByPOT ; <nl> - int32 output_val_s32 = RoundingDivideByPOT ( output_val_f0 . raw ( ) , 23 ) ; <nl> - if ( output_val_s32 = = 256 ) { <nl> - output_val_s32 = 255 ; <nl> - } <nl> - / / Reinterpret as U0 . 8 . <nl> - TFLITE_DCHECK_GE ( output_val_s32 , 0 ) ; <nl> - TFLITE_DCHECK_LE ( output_val_s32 , 255 ) ; <nl> - output_val = static_cast < uint8 > ( output_val_s32 ) ; <nl> - } <nl> - output_data [ i ] = output_val ; <nl> - } <nl> - } <nl> - <nl> inline void Logistic ( const LogisticParams & params , <nl> const RuntimeShape & input_shape , const int16 * input_data , <nl> const RuntimeShape & output_shape , int16 * output_data ) { <nl> inline void Tanh ( const TanhParams & , const RuntimeShape & input_shape , <nl> Tanh ( input_shape , input_data , output_shape , output_data ) ; <nl> } <nl> <nl> - inline void Tanh ( const TanhParams & params , const RuntimeShape & input_shape , <nl> - const uint8 * input_data , const RuntimeShape & output_shape , <nl> - uint8 * output_data ) { <nl> - const int32 input_zero_point = params . input_zero_point ; <nl> - const int32 input_range_radius = params . input_range_radius ; <nl> - const int32 input_multiplier = params . input_multiplier ; <nl> - const int input_left_shift = params . input_left_shift ; <nl> - const int32 output_zero_point = 128 ; <nl> - const int flat_size = MatchingFlatSize ( input_shape , output_shape ) ; <nl> - <nl> - for ( int i = 0 ; i < flat_size ; i + + ) { <nl> - const uint8 input_val_u8 = input_data [ i ] ; <nl> - const int32 input_val_centered = <nl> - static_cast < int32 > ( input_val_u8 ) - input_zero_point ; <nl> - uint8 output_val ; <nl> - if ( input_val_centered < = - input_range_radius ) { <nl> - output_val = 0 ; <nl> - } else if ( input_val_centered > = input_range_radius ) { <nl> - output_val = 255 ; <nl> - } else { <nl> - const int32 input_val_rescaled = <nl> - MultiplyByQuantizedMultiplierGreaterThanOne ( <nl> - input_val_centered , input_multiplier , input_left_shift ) ; <nl> - using FixedPoint4 = gemmlowp : : FixedPoint < int32 , 4 > ; <nl> - using FixedPoint0 = gemmlowp : : FixedPoint < int32 , 0 > ; <nl> - const FixedPoint4 input_val_f4 = FixedPoint4 : : FromRaw ( input_val_rescaled ) ; <nl> - const FixedPoint0 output_val_f0 = gemmlowp : : tanh ( input_val_f4 ) ; <nl> - / / Convert from Q0 . 31 to Q24 . 7 . <nl> - using gemmlowp : : RoundingDivideByPOT ; <nl> - int32 output_val_s32 = RoundingDivideByPOT ( output_val_f0 . raw ( ) , 24 ) ; <nl> - output_val_s32 + = output_zero_point ; <nl> - if ( output_val_s32 = = 256 ) { <nl> - output_val_s32 = 255 ; <nl> - } <nl> - / / Reinterpret as Q0 . 7 , encoded in uint8 . <nl> - TFLITE_DCHECK_GE ( output_val_s32 , 0 ) ; <nl> - TFLITE_DCHECK_LE ( output_val_s32 , 255 ) ; <nl> - output_val = static_cast < uint8 > ( output_val_s32 ) ; <nl> - } <nl> - output_data [ i ] = output_val ; <nl> - } <nl> - } <nl> <nl> inline void Tanh ( const TanhParams & params , const RuntimeShape & input_shape , <nl> const int16 * input_data , const RuntimeShape & output_shape , <nl>
Switch 8bit Tanh and Logisitic to use lookuptables
tensorflow/tensorflow
5916195ac87f3ce0716f7f69a275d7b075d5ae70
2019-06-19T00:44:14Z
mmm a / lib / Sema / PlaygroundTransform . cpp <nl> ppp b / lib / Sema / PlaygroundTransform . cpp <nl> class Instrumenter { <nl> if ( FnD & & FnD - > getModuleContext ( ) = = Context . TheStdlibModule ) { <nl> StringRef FnName = FnD - > getNameStr ( ) ; <nl> if ( FnName . equals ( " print " ) | | FnName . equals ( " debugPrint " ) ) { <nl> - Expr * S = nullptr ; <nl> - Expr * B = nullptr ; / / FIXME pass B to the logger when it supports it <nl> + const bool isDebugPrint = FnName . equals ( " debugPrint " ) ; <nl> + Expr * object = nullptr ; <nl> + Expr * appendNewline = nullptr ; <nl> if ( ParenExpr * PE = llvm : : dyn_cast < ParenExpr > ( AE - > getArg ( ) ) ) { <nl> - S = PE - > getSubExpr ( ) ; <nl> - } else if ( TupleExpr * TE = llvm : : dyn_cast < TupleExpr > ( AE - > getArg ( ) ) ) { <nl> + object = PE - > getSubExpr ( ) ; <nl> + appendNewline = <nl> + new ( Context ) BooleanLiteralExpr ( true , SourceLoc ( ) , true ) ; <nl> + typeCheckContextExpr ( Context , TypeCheckDC , appendNewline ) ; <nl> + } else if ( TupleExpr * TE = <nl> + llvm : : dyn_cast < TupleExpr > ( AE - > getArg ( ) ) ) { <nl> if ( TE - > getNumElements ( ) = = 2 ) { <nl> - S = TE - > getElement ( 0 ) ; <nl> - B = TE - > getElement ( 1 ) ; <nl> + object = TE - > getElement ( 0 ) ; <nl> + appendNewline = TE - > getElement ( 1 ) ; <nl> } <nl> } <nl> - if ( S ) { <nl> - std : : pair < PatternBindingDecl * , VarDecl * > PV = <nl> - buildPatternAndVariable ( S ) ; <nl> - Expr * Log = logPrint ( PV . second , AE - > getSourceRange ( ) ) ; <nl> - Elements [ EI ] = PV . first ; <nl> - Elements . insert ( Elements . begin ( ) + ( EI + 1 ) , PV . second ) ; <nl> - Elements . insert ( Elements . begin ( ) + ( EI + 2 ) , Log ) ; <nl> - EI + = 2 ; <nl> + if ( object & & appendNewline ) { <nl> + std : : pair < PatternBindingDecl * , VarDecl * > objectPV = <nl> + buildPatternAndVariable ( object ) ; <nl> + std : : pair < PatternBindingDecl * , VarDecl * > appendNewlinePV = <nl> + buildPatternAndVariable ( appendNewline ) ; <nl> + Expr * Log = logPrint ( isDebugPrint , <nl> + objectPV . second , appendNewlinePV . second , <nl> + AE - > getSourceRange ( ) ) ; <nl> + Elements [ EI ] = objectPV . first ; <nl> + Elements . insert ( Elements . begin ( ) + ( EI + 1 ) , <nl> + objectPV . second ) ; <nl> + Elements . insert ( Elements . begin ( ) + ( EI + 2 ) , <nl> + appendNewlinePV . first ) ; <nl> + Elements . insert ( Elements . begin ( ) + ( EI + 3 ) , <nl> + appendNewlinePV . second ) ; <nl> + Elements . insert ( Elements . begin ( ) + ( EI + 4 ) , <nl> + Log ) ; <nl> + EI + = 4 ; <nl> } <nl> Handled = true ; <nl> } <nl> class Instrumenter { <nl> } <nl> } <nl> <nl> - Expr * logPrint ( VarDecl * VD , SourceRange SR ) { <nl> - const char * LoggerName = " $ builtin_print " ; <nl> - DeclRefExpr * DRE = <nl> - new ( Context ) DeclRefExpr ( ConcreteDeclRef ( VD ) , <nl> + Expr * logPrint ( bool isDebugPrint , VarDecl * object , VarDecl * appendNewline , <nl> + SourceRange SR ) { <nl> + const char * LoggerName = isDebugPrint ? " $ builtin_debugPrint " : <nl> + " $ builtin_print " ; <nl> + DeclRefExpr * object_DRE = <nl> + new ( Context ) DeclRefExpr ( ConcreteDeclRef ( object ) , <nl> + SourceLoc ( ) , <nl> + true , / / implicit <nl> + AccessSemantics : : Ordinary , <nl> + Type ( ) ) ; <nl> + DeclRefExpr * appendNewline_DRE = <nl> + new ( Context ) DeclRefExpr ( ConcreteDeclRef ( appendNewline ) , <nl> SourceLoc ( ) , <nl> true , / / implicit <nl> AccessSemantics : : Ordinary , <nl> Type ( ) ) ; <nl> - Expr * Args [ ] = { DRE } ; <nl> + Expr * Args [ ] = { object_DRE , appendNewline_DRE } ; <nl> return buildLoggerCallWithArgs ( LoggerName , Args , SR ) ; <nl> } <nl> <nl> mmm a / test / PlaygroundTransform / Inputs / PlaygroundsRuntime . swift <nl> ppp b / test / PlaygroundTransform / Inputs / PlaygroundsRuntime . swift <nl> func $ builtin_log_scope_exit ( ) - > AnyObject ? { <nl> return LogRecord ( api : " $ builtin_log_scope_exit " ) <nl> } <nl> <nl> - func $ builtin_print < T > ( object : T ) - > AnyObject ? { <nl> - return LogRecord ( api : " $ builtin_print " , object : object ) <nl> + func $ builtin_print < T > ( object : T , _ appendNewline : Bool ) - > AnyObject ? { <nl> + if ( appendNewline ) { <nl> + return LogRecord ( api : " $ builtin_print < appendNewline = true > " , object : object ) <nl> + } else { <nl> + return LogRecord ( api : " $ builtin_print < appendNewline = false > " , object : object ) <nl> + } <nl> + } <nl> + <nl> + func $ builtin_debugPrint < T > ( object : T , _ appendNewline : Bool ) - > AnyObject ? { <nl> + if ( appendNewline ) { <nl> + return LogRecord ( api : " $ builtin_debugPrint < appendNewline = true > " , object : object ) <nl> + } else { <nl> + return LogRecord ( api : " $ builtin_debugPrint < appendNewline = false > " , object : object ) <nl> + } <nl> } <nl> <nl> func $ builtin_send_data ( object : AnyObject ? , _ sl : Int , _ el : Int , _ sc : Int , _ ec : Int ) { <nl> mmm a / test / PlaygroundTransform / print . swift <nl> ppp b / test / PlaygroundTransform / print . swift <nl> debugPrint ( b + 1 ) / / with newline <nl> debugPrint ( b + 1 , appendNewline : true ) / / with newline <nl> debugPrint ( b + 1 , appendNewline : false ) / / no newline <nl> <nl> + debugPrint ( b + 1 , appendNewline : { false } ( ) ) <nl> + <nl> / / CHECK : [ { { . * } } ] $ builtin_log [ a = ' 2 ' ] <nl> - / / CHECK - NEXT : [ { { . * } } ] $ builtin_print [ ' 2 ' ] <nl> - / / CHECK - NEXT : [ { { . * } } ] $ builtin_print [ ' 2 ' ] <nl> - / / CHECK - NEXT : [ { { . * } } ] $ builtin_print [ ' 2 ' ] <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_print < appendNewline = true > [ ' 2 ' ] <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_print < appendNewline = true > [ ' 2 ' ] <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_print < appendNewline = false > [ ' 2 ' ] <nl> / / CHECK - NEXT : [ { { . * } } ] $ builtin_log [ b = ' 3 ' ] <nl> - / / CHECK - NEXT : [ { { . * } } ] $ builtin_print [ ' 4 ' ] <nl> - / / CHECK - NEXT : [ { { . * } } ] $ builtin_print [ ' 4 ' ] <nl> - / / CHECK - NEXT : [ { { . * } } ] $ builtin_print [ ' 4 ' ] <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_debugPrint < appendNewline = true > [ ' 4 ' ] <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_debugPrint < appendNewline = true > [ ' 4 ' ] <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_debugPrint < appendNewline = false > [ ' 4 ' ] <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_log_scope_entry <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_log [ = ' false ' ] <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_log_scope_exit <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_log_scope_exit <nl> + / / CHECK - NEXT : [ { { . * } } ] $ builtin_debugPrint < appendNewline = false > [ ' 4 ' ] <nl> + <nl>
Made the PlaygroundTransform instrument the print ( ) /
apple/swift
33b0079a9507df656ea8426a6d2c0b95ab818583
2015-05-23T02:07:25Z
mmm a / utils / build - windows . bat <nl> ppp b / utils / build - windows . bat <nl> <nl> <nl> setlocal enableextensions enabledelayedexpansion <nl> <nl> - set icu_version = 63_1 <nl> + set icu_version_major = 64 <nl> + set icu_version_minor = 2 <nl> + set icu_version = % icu_version_major % _ % icu_version_minor % <nl> + set icu_version_dotted = % icu_version_major % . % icu_version_minor % <nl> <nl> set " exitOnError = | | ( exit / b ) " <nl> set current_directory = % ~ dp0 <nl> endlocal <nl> setlocal enableextensions enabledelayedexpansion <nl> <nl> set file_name = icu4c - % icu_version % - Win64 - MSVC2017 . zip <nl> - curl - L - O - z % file_name % " http : / / download . icu - project . org / files / icu4c / 63 . 1 / % file_name % " % exitOnError % <nl> + curl - L - O - z % file_name % " http : / / download . icu - project . org / files / icu4c / % icu_version_dotted % / % file_name % " % exitOnError % <nl> : : unzip warns about the paths in the zip using slashes , which raises the <nl> : : errorLevel to 1 . We cannot use exitOnError , and have to ignore errors . <nl> unzip - o % file_name % - d " % source_root % \ icu - % icu_version % " <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
bf915a604a942258b845af26d7ce6800448b942f
2019-06-10T23:09:38Z
mmm a / ports / winpcap / CONTROL <nl> ppp b / ports / winpcap / CONTROL <nl> <nl> Source : winpcap <nl> - Version : 4 . 1 . 3 <nl> + Version : 4 . 1 . 3 - 1 <nl> Description : WinPcap is the industry - standard tool for link - layer network access in Windows environments . <nl> mmm a / ports / winpcap / portfile . cmake <nl> ppp b / ports / winpcap / portfile . cmake <nl> file ( <nl> " $ { SOURCE_PATH } / WpdPack / Include / pcap . h " <nl> " $ { SOURCE_PATH } / WpdPack / Include / pcap - bpf . h " <nl> " $ { SOURCE_PATH } / WpdPack / Include / pcap - namedb . h " <nl> + " $ { SOURCE_PATH } / WpdPack / Include / pcap - stdinc . h " <nl> " $ { SOURCE_PATH } / WpdPack / Include / remote - ext . h " <nl> " $ { SOURCE_PATH } / WpdPack / Include / Win32 - Extensions . h " <nl> DESTINATION <nl>
Add install pcap_stdinc . h file
microsoft/vcpkg
d0c33b4aa60b1698e8cb027d8df5b25c65efb0e1
2017-09-22T14:57:54Z
mmm a / src / harmony - spread . js <nl> ppp b / src / harmony - spread . js <nl> function SpreadArguments ( ) { <nl> <nl> function SpreadIterable ( collection ) { <nl> if ( IS_NULL_OR_UNDEFINED ( collection ) ) { <nl> - throw MakeTypeError ( " not_iterable " , [ collection ] ) ; <nl> + throw MakeTypeError ( kNotIterable , collection ) ; <nl> } <nl> <nl> var args = new InternalArray ( ) ; <nl> mmm a / src / messages . cc <nl> ppp b / src / messages . cc <nl> MaybeHandle < String > MessageTemplate : : FormatMessage ( int template_index , <nl> Handle < String > args [ ] = { arg0 , arg1 , arg2 } ; <nl> for ( const char * c = template_string ; * c ! = ' \ 0 ' ; c + + ) { <nl> if ( * c = = ' % ' ) { <nl> - builder . AppendString ( args [ i + + ] ) ; <nl> DCHECK ( i < arraysize ( args ) ) ; <nl> + builder . AppendString ( args [ i + + ] ) ; <nl> } else { <nl> builder . AppendCharacter ( * c ) ; <nl> } <nl> mmm a / src / messages . h <nl> ppp b / src / messages . h <nl> class MessageHandler { <nl> } ; <nl> <nl> <nl> - # define MESSAGE_TEMPLATES ( T ) \ <nl> - / * Error * / \ <nl> - T ( CyclicProto , " Cyclic __proto__ value " ) \ <nl> - / * TypeError * / \ <nl> - T ( ApplyNonFunction , \ <nl> - " Function . prototype . apply was called on % , which is a % and not a " \ <nl> - " function " ) \ <nl> - T ( CalledNonCallable , " % is not a function " ) \ <nl> - T ( CannotConvertToPrimitive , " Cannot convert object to primitive value " ) \ <nl> - T ( GeneratorRunning , " Generator is already running " ) \ <nl> - T ( IncompatibleMethodReceiver , " Method % called on incompatible receiver % " ) \ <nl> - T ( InstanceofFunctionExpected , \ <nl> - " Expecting a function in instanceof check , but got % " ) \ <nl> - T ( InstanceofNonobjectProto , \ <nl> - " Function has non - object prototype ' % ' in instanceof check " ) \ <nl> - T ( InvalidInOperatorUse , " Cannot use ' in ' operator to search for ' % ' in % " ) \ <nl> - T ( NotConstructor , " % is not a constructor " ) \ <nl> - T ( PropertyNotFunction , " Property ' % ' of object % is not a function " ) \ <nl> - T ( SymbolToPrimitive , \ <nl> - " Cannot convert a Symbol wrapper object to a primitive value " ) \ <nl> - T ( SymbolToNumber , " Cannot convert a Symbol value to a number " ) \ <nl> - T ( SymbolToString , " Cannot convert a Symbol value to a string " ) \ <nl> - T ( UndefinedOrNullToObject , " Cannot convert undefined or null to object " ) \ <nl> - T ( WithExpression , " % has no properties " ) \ <nl> - T ( WrongArgs , " % : Arguments list has wrong type " ) \ <nl> - / * RangeError * / \ <nl> - T ( StackOverflow , " Maximum call stack size exceeded " ) \ <nl> - / * EvalError * / \ <nl> + # define MESSAGE_TEMPLATES ( T ) \ <nl> + / * Error * / \ <nl> + T ( CyclicProto , " Cyclic __proto__ value " ) \ <nl> + / * TypeError * / \ <nl> + T ( ApplyNonFunction , \ <nl> + " Function . prototype . apply was called on % , which is a % and not a " \ <nl> + " function " ) \ <nl> + T ( CalledNonCallable , " % is not a function " ) \ <nl> + T ( CalledOnNonObject , " % called on non - object " ) \ <nl> + T ( CannotConvertToPrimitive , " Cannot convert object to primitive value " ) \ <nl> + T ( DefineDisallowed , " Cannot define property : % , object is not extensible . " ) \ <nl> + T ( GeneratorRunning , " Generator is already running " ) \ <nl> + T ( FunctionBind , " Bind must be called on a function " ) \ <nl> + T ( IncompatibleMethodReceiver , " Method % called on incompatible receiver % " ) \ <nl> + T ( InstanceofFunctionExpected , \ <nl> + " Expecting a function in instanceof check , but got % " ) \ <nl> + T ( InstanceofNonobjectProto , \ <nl> + " Function has non - object prototype ' % ' in instanceof check " ) \ <nl> + T ( InvalidInOperatorUse , " Cannot use ' in ' operator to search for ' % ' in % " ) \ <nl> + T ( NotAnIterator , " % is not an iterator " ) \ <nl> + T ( NotConstructor , " % is not a constructor " ) \ <nl> + T ( NotGeneric , " % is not generic " ) \ <nl> + T ( NotIterable , " % is not iterable " ) \ <nl> + T ( ObjectGetterExpectingFunction , \ <nl> + " Object . prototype . __defineGetter__ : Expecting function " ) \ <nl> + T ( ObjectGetterCallable , " Getter must be a function : % " ) \ <nl> + T ( ObjectSetterExpectingFunction , \ <nl> + " Object . prototype . __defineSetter__ : Expecting function " ) \ <nl> + T ( ObjectSetterCallable , " Setter must be a function : % " ) \ <nl> + T ( PropertyDescObject , " Property description must be an object : % " ) \ <nl> + T ( PropertyNotFunction , " Property ' % ' of object % is not a function " ) \ <nl> + T ( ProtoObjectOrNull , " Object prototype may only be an Object or null : % " ) \ <nl> + T ( ProxyHandlerReturned , " Proxy handler % returned % from ' % ' trap " ) \ <nl> + T ( ProxyHandlerTrapMissing , " Proxy handler % has no ' % ' trap " ) \ <nl> + T ( ProxyHandlerTrapMustBeCallable , \ <nl> + " Proxy handler % 0 has non - callable ' % ' trap " ) \ <nl> + T ( ProxyNonObjectPropNames , " Trap ' % ' returned non - object % " ) \ <nl> + T ( ProxyRepeatedPropName , " Trap ' % ' returned repeated property name ' % ' " ) \ <nl> + T ( ProxyPropNotConfigurable , \ <nl> + " Proxy handler % returned non - configurable descriptor for property ' % ' " \ <nl> + " from ' % ' trap " ) \ <nl> + T ( RedefineDisallowed , " Cannot redefine property : % " ) \ <nl> + T ( SymbolToPrimitive , \ <nl> + " Cannot convert a Symbol wrapper object to a primitive value " ) \ <nl> + T ( SymbolToNumber , " Cannot convert a Symbol value to a number " ) \ <nl> + T ( SymbolToString , " Cannot convert a Symbol value to a string " ) \ <nl> + T ( UndefinedOrNullToObject , " Cannot convert undefined or null to object " ) \ <nl> + T ( ValueAndAccessor , \ <nl> + " Invalid property . A property cannot both have accessors and be " \ <nl> + " writable or have a value , % " ) \ <nl> + T ( WithExpression , " % has no properties " ) \ <nl> + T ( WrongArgs , " % : Arguments list has wrong type " ) \ <nl> + / * RangeError * / \ <nl> + T ( ArrayLengthOutOfRange , " defineProperty ( ) array length out of range " ) \ <nl> + T ( NumberFormatRange , " % argument must be between 0 and 20 " ) \ <nl> + T ( StackOverflow , " Maximum call stack size exceeded " ) \ <nl> + T ( ToPrecisionFormatRange , " toPrecision ( ) argument must be between 1 and 21 " ) \ <nl> + / * SyntaxError * / \ <nl> + T ( ParenthesisInArgString , " Function arg string contains parenthesis " ) \ <nl> + / * EvalError * / \ <nl> T ( CodeGenFromStrings , " % " ) <nl> <nl> class MessageTemplate { <nl> mmm a / src / messages . js <nl> ppp b / src / messages . js <nl> var kMessages = { <nl> no_setter_in_callback : [ " Cannot set property " , " % 0 " , " of " , " % 1 " , " which has only a getter " ] , <nl> flags_getter_non_object : [ " RegExp . prototype . flags getter called on non - object " , " % 0 " ] , <nl> reduce_no_initial : [ " Reduce of empty array with no initial value " ] , <nl> - getter_must_be_callable : [ " Getter must be a function : " , " % 0 " ] , <nl> - setter_must_be_callable : [ " Setter must be a function : " , " % 0 " ] , <nl> value_and_accessor : [ " Invalid property . A property cannot both have accessors and be writable or have a value , " , " % 0 " ] , <nl> proto_object_or_null : [ " Object prototype may only be an Object or null : " , " % 0 " ] , <nl> - property_desc_object : [ " Property description must be an object : " , " % 0 " ] , <nl> - redefine_disallowed : [ " Cannot redefine property : " , " % 0 " ] , <nl> - define_disallowed : [ " Cannot define property : " , " % 0 " , " , object is not extensible . " ] , <nl> non_extensible_proto : [ " % 0 " , " is not extensible " ] , <nl> handler_non_object : [ " Proxy . " , " % 0 " , " called with non - object as handler " ] , <nl> proto_non_object : [ " Proxy . " , " % 0 " , " called with non - object as prototype " ] , <nl> trap_function_expected : [ " Proxy . " , " % 0 " , " called with non - function for ' " , " % 1 " , " ' trap " ] , <nl> - handler_trap_missing : [ " Proxy handler " , " % 0 " , " has no ' " , " % 1 " , " ' trap " ] , <nl> - handler_trap_must_be_callable : [ " Proxy handler " , " % 0 " , " has non - callable ' " , " % 1 " , " ' trap " ] , <nl> - handler_returned_false : [ " Proxy handler " , " % 0 " , " returned false from ' " , " % 1 " , " ' trap " ] , <nl> - handler_returned_undefined : [ " Proxy handler " , " % 0 " , " returned undefined from ' " , " % 1 " , " ' trap " ] , <nl> - proxy_prop_not_configurable : [ " Proxy handler " , " % 0 " , " returned non - configurable descriptor for property ' " , " % 2 " , " ' from ' " , " % 1 " , " ' trap " ] , <nl> - proxy_non_object_prop_names : [ " Trap ' " , " % 1 " , " ' returned non - object " , " % 0 " ] , <nl> proxy_repeated_prop_name : [ " Trap ' " , " % 1 " , " ' returned repeated property name ' " , " % 2 " , " ' " ] , <nl> invalid_weakmap_key : [ " Invalid value used as weak map key " ] , <nl> invalid_weakset_value : [ " Invalid value used in weak set " ] , <nl> var kMessages = { <nl> array_functions_on_frozen : [ " Cannot modify frozen array elements " ] , <nl> array_functions_change_sealed : [ " Cannot add / remove sealed array elements " ] , <nl> first_argument_not_regexp : [ " First argument to " , " % 0 " , " must not be a regular expression " ] , <nl> - not_iterable : [ " % 0 " , " is not iterable " ] , <nl> - not_an_iterator : [ " % 0 " , " is not an iterator " ] , <nl> iterator_result_not_an_object : [ " Iterator result " , " % 0 " , " is not an object " ] , <nl> iterator_value_not_an_object : [ " Iterator value " , " % 0 " , " is not an entry object " ] , <nl> / / RangeError <nl> var kMessages = { <nl> invalid_lhs_in_postfix_op : [ " Invalid left - hand side expression in postfix operation " ] , <nl> invalid_lhs_in_prefix_op : [ " Invalid left - hand side expression in prefix operation " ] , <nl> / / SyntaxError <nl> - paren_in_arg_string : [ " Function arg string contains parenthesis " ] , <nl> not_isvar : [ " builtin % IS_VAR : not a variable " ] , <nl> single_function_literal : [ " Single function literal required " ] , <nl> invalid_regexp_flags : [ " Invalid flags supplied to RegExp constructor ' " , " % 0 " , " ' " ] , <nl> var kMessages = { <nl> illegal_continue : [ " Illegal continue statement " ] , <nl> illegal_return : [ " Illegal return statement " ] , <nl> error_loading_debugger : [ " Error loading debugger " ] , <nl> - no_input_to_regexp : [ " No input to " , " % 0 " ] , <nl> - invalid_json : [ " String ' " , " % 0 " , " ' is not valid JSON " ] , <nl> circular_structure : [ " Converting circular structure to JSON " ] , <nl> - called_on_non_object : [ " % 0 " , " called on non - object " ] , <nl> called_on_null_or_undefined : [ " % 0 " , " called on null or undefined " ] , <nl> array_indexof_not_defined : [ " Array . getIndexOf : Argument undefined " ] , <nl> object_not_extensible : [ " Can ' t add property " , " % 0 " , " , object is not extensible " ] , <nl> function ErrorToStringDetectCycle ( error ) { <nl> <nl> function ErrorToString ( ) { <nl> if ( ! IS_SPEC_OBJECT ( this ) ) { <nl> - throw MakeTypeError ( " called_on_non_object " , [ " Error . prototype . toString " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " Error . prototype . toString " ) ; <nl> } <nl> <nl> try { <nl> mmm a / src / object - observe . js <nl> ppp b / src / object - observe . js <nl> function NotifyChange ( type , object , name , oldValue ) { <nl> <nl> function ObjectNotifierNotify ( changeRecord ) { <nl> if ( ! IS_SPEC_OBJECT ( this ) ) <nl> - throw MakeTypeError ( " called_on_non_object " , [ " notify " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " notify " ) ; <nl> <nl> var objectInfo = ObjectInfoGetFromNotifier ( this ) ; <nl> if ( IS_UNDEFINED ( objectInfo ) ) <nl> function ObjectNotifierNotify ( changeRecord ) { <nl> <nl> function ObjectNotifierPerformChange ( changeType , changeFn ) { <nl> if ( ! IS_SPEC_OBJECT ( this ) ) <nl> - throw MakeTypeError ( " called_on_non_object " , [ " performChange " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " performChange " ) ; <nl> <nl> var objectInfo = ObjectInfoGetFromNotifier ( this ) ; <nl> if ( IS_UNDEFINED ( objectInfo ) ) <nl> mmm a / src / objects . cc <nl> ppp b / src / objects . cc <nl> MaybeHandle < Object > Object : : RedefineNonconfigurableProperty ( <nl> Isolate * isolate , Handle < Object > name , Handle < Object > value , <nl> LanguageMode language_mode ) { <nl> if ( is_sloppy ( language_mode ) ) return value ; <nl> - Handle < Object > args [ ] = { name } ; <nl> - THROW_NEW_ERROR ( isolate , NewTypeError ( " redefine_disallowed " , <nl> - HandleVector ( args , arraysize ( args ) ) ) , <nl> + THROW_NEW_ERROR ( isolate , <nl> + NewTypeError ( MessageTemplate : : kRedefineDisallowed , name ) , <nl> Object ) ; <nl> } <nl> <nl> MaybeHandle < Object > JSProxy : : SetPropertyViaPrototypesWithHandler ( <nl> if ( configurable - > IsFalse ( ) ) { <nl> Handle < String > trap = isolate - > factory ( ) - > InternalizeOneByteString ( <nl> STATIC_CHAR_VECTOR ( " getPropertyDescriptor " ) ) ; <nl> - Handle < Object > args [ ] = { handler , trap , name } ; <nl> - THROW_NEW_ERROR ( isolate , NewTypeError ( " proxy_prop_not_configurable " , <nl> - HandleVector ( args , arraysize ( args ) ) ) , <nl> + THROW_NEW_ERROR ( isolate , <nl> + NewTypeError ( MessageTemplate : : kProxyPropNotConfigurable , <nl> + handler , name , trap ) , <nl> Object ) ; <nl> } <nl> DCHECK ( configurable - > IsTrue ( ) ) ; <nl> Maybe < PropertyAttributes > JSProxy : : GetPropertyAttributesWithHandler ( <nl> Handle < Object > handler ( proxy - > handler ( ) , isolate ) ; <nl> Handle < String > trap = isolate - > factory ( ) - > InternalizeOneByteString ( <nl> STATIC_CHAR_VECTOR ( " getPropertyDescriptor " ) ) ; <nl> - Handle < Object > args [ ] = { handler , trap , name } ; <nl> Handle < Object > error = isolate - > factory ( ) - > NewTypeError ( <nl> - " proxy_prop_not_configurable " , HandleVector ( args , arraysize ( args ) ) ) ; <nl> + MessageTemplate : : kProxyPropNotConfigurable , handler , name , trap ) ; <nl> isolate - > Throw ( * error ) ; <nl> return Just ( NONE ) ; <nl> } <nl> MaybeHandle < Object > JSProxy : : CallTrap ( Handle < JSProxy > proxy , <nl> <nl> if ( trap - > IsUndefined ( ) ) { <nl> if ( derived . is_null ( ) ) { <nl> - Handle < Object > args [ ] = { handler , trap_name } ; <nl> THROW_NEW_ERROR ( isolate , <nl> - NewTypeError ( " handler_trap_missing " , <nl> - HandleVector ( args , arraysize ( args ) ) ) , <nl> + NewTypeError ( MessageTemplate : : kProxyHandlerTrapMissing , <nl> + handler , trap_name ) , <nl> Object ) ; <nl> } <nl> trap = Handle < Object > ( derived ) ; <nl> mmm a / src / proxy . js <nl> ppp b / src / proxy . js <nl> function DerivedEnumerateTrap ( ) { <nl> var desc = this . getPropertyDescriptor ( TO_STRING_INLINE ( name ) ) <nl> if ( ! IS_UNDEFINED ( desc ) ) { <nl> if ( ! desc . configurable ) { <nl> - throw MakeTypeError ( " proxy_prop_not_configurable " , <nl> - [ this , " getPropertyDescriptor " , name ] ) <nl> + throw MakeTypeError ( kProxyPropNotConfigurable , <nl> + this , name , " getPropertyDescriptor " ) <nl> } <nl> if ( desc . enumerable ) enumerableNames [ count + + ] = names [ i ] <nl> } <nl> mmm a / src / string . js <nl> ppp b / src / string . js <nl> function StringConstructor ( x ) { <nl> / / ECMA - 262 section 15 . 5 . 4 . 2 <nl> function StringToString ( ) { <nl> if ( ! IS_STRING ( this ) & & ! IS_STRING_WRAPPER ( this ) ) { <nl> - throw new $ TypeError ( ' String . prototype . toString is not generic ' ) ; <nl> + throw MakeTypeError ( kNotGeneric , ' String . prototype . toString ' ) ; <nl> } <nl> return % _ValueOf ( this ) ; <nl> } <nl> function StringToString ( ) { <nl> / / ECMA - 262 section 15 . 5 . 4 . 3 <nl> function StringValueOf ( ) { <nl> if ( ! IS_STRING ( this ) & & ! IS_STRING_WRAPPER ( this ) ) { <nl> - throw new $ TypeError ( ' String . prototype . valueOf is not generic ' ) ; <nl> + throw MakeTypeError ( kNotGeneric , ' String . prototype . valueOf ' ) ; <nl> } <nl> return % _ValueOf ( this ) ; <nl> } <nl> mmm a / src / v8natives . js <nl> ppp b / src / v8natives . js <nl> function ObjectDefineGetter ( name , fun ) { <nl> receiver = % GlobalProxy ( global ) ; <nl> } <nl> if ( ! IS_SPEC_FUNCTION ( fun ) ) { <nl> - throw new $ TypeError ( <nl> - ' Object . prototype . __defineGetter__ : Expecting function ' ) ; <nl> + throw MakeTypeError ( kObjectGetterExpectingFunction ) ; <nl> } <nl> var desc = new PropertyDescriptor ( ) ; <nl> desc . setGet ( fun ) ; <nl> function ObjectDefineSetter ( name , fun ) { <nl> receiver = % GlobalProxy ( global ) ; <nl> } <nl> if ( ! IS_SPEC_FUNCTION ( fun ) ) { <nl> - throw new $ TypeError ( <nl> - ' Object . prototype . __defineSetter__ : Expecting function ' ) ; <nl> + throw MakeTypeError ( kObjectSetterExpectingFunction ) ; <nl> } <nl> var desc = new PropertyDescriptor ( ) ; <nl> desc . setSet ( fun ) ; <nl> function FromGenericPropertyDescriptor ( desc ) { <nl> <nl> / / ES5 8 . 10 . 5 . <nl> function ToPropertyDescriptor ( obj ) { <nl> - if ( ! IS_SPEC_OBJECT ( obj ) ) { <nl> - throw MakeTypeError ( " property_desc_object " , [ obj ] ) ; <nl> - } <nl> + if ( ! IS_SPEC_OBJECT ( obj ) ) throw MakeTypeError ( kPropertyDescObject , obj ) ; <nl> + <nl> var desc = new PropertyDescriptor ( ) ; <nl> <nl> if ( " enumerable " in obj ) { <nl> function ToPropertyDescriptor ( obj ) { <nl> if ( " get " in obj ) { <nl> var get = obj . get ; <nl> if ( ! IS_UNDEFINED ( get ) & & ! IS_SPEC_FUNCTION ( get ) ) { <nl> - throw MakeTypeError ( " getter_must_be_callable " , [ get ] ) ; <nl> + throw MakeTypeError ( kObjectGetterCallable , get ) ; <nl> } <nl> desc . setGet ( get ) ; <nl> } <nl> function ToPropertyDescriptor ( obj ) { <nl> if ( " set " in obj ) { <nl> var set = obj . set ; <nl> if ( ! IS_UNDEFINED ( set ) & & ! IS_SPEC_FUNCTION ( set ) ) { <nl> - throw MakeTypeError ( " setter_must_be_callable " , [ set ] ) ; <nl> + throw MakeTypeError ( kObjectSetterCallable , set ) ; <nl> } <nl> desc . setSet ( set ) ; <nl> } <nl> <nl> if ( IsInconsistentDescriptor ( desc ) ) { <nl> - throw MakeTypeError ( " value_and_accessor " , [ obj ] ) ; <nl> + throw MakeTypeError ( kValueAndAccessor , obj ) ; <nl> } <nl> return desc ; <nl> } <nl> function GetTrap ( handler , name , defaultTrap ) { <nl> var trap = handler [ name ] ; <nl> if ( IS_UNDEFINED ( trap ) ) { <nl> if ( IS_UNDEFINED ( defaultTrap ) ) { <nl> - throw MakeTypeError ( " handler_trap_missing " , [ handler , name ] ) ; <nl> + throw MakeTypeError ( kProxyHandlerTrapMissing , handler , name ) ; <nl> } <nl> trap = defaultTrap ; <nl> } else if ( ! IS_SPEC_FUNCTION ( trap ) ) { <nl> - throw MakeTypeError ( " handler_trap_must_be_callable " , [ handler , name ] ) ; <nl> + throw MakeTypeError ( kProxyHandlerTrapMustBeCallable , handler , name ) ; <nl> } <nl> return trap ; <nl> } <nl> function GetOwnPropertyJS ( obj , v ) { <nl> if ( IS_UNDEFINED ( descriptor ) ) return descriptor ; <nl> var desc = ToCompletePropertyDescriptor ( descriptor ) ; <nl> if ( ! desc . isConfigurable ( ) ) { <nl> - throw MakeTypeError ( " proxy_prop_not_configurable " , <nl> - [ handler , " getOwnPropertyDescriptor " , p , descriptor ] ) ; <nl> + throw MakeTypeError ( kProxyPropNotConfigurable , <nl> + handler , p , " getOwnPropertyDescriptor " ) ; <nl> } <nl> return desc ; <nl> } <nl> function Delete ( obj , p , should_throw ) { <nl> % DeleteProperty ( obj , p , 0 ) ; <nl> return true ; <nl> } else if ( should_throw ) { <nl> - throw MakeTypeError ( " define_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kDefineDisallowed , p ) ; <nl> } else { <nl> return ; <nl> } <nl> function DefineProxyProperty ( obj , p , attributes , should_throw ) { <nl> var result = CallTrap2 ( handler , " defineProperty " , UNDEFINED , p , attributes ) ; <nl> if ( ! ToBoolean ( result ) ) { <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " handler_returned_false " , <nl> - [ handler , " defineProperty " ] ) ; <nl> + throw MakeTypeError ( kProxyHandlerReturned , <nl> + handler , " false " , " defineProperty " ) ; <nl> } else { <nl> return false ; <nl> } <nl> function DefineObjectProperty ( obj , p , desc , should_throw ) { <nl> / / Step 3 <nl> if ( IS_UNDEFINED ( current ) & & ! extensible ) { <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " define_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kDefineDisallowed , p ) ; <nl> } else { <nl> return false ; <nl> } <nl> function DefineObjectProperty ( obj , p , desc , should_throw ) { <nl> ( desc . hasEnumerable ( ) & & <nl> desc . isEnumerable ( ) ! = current . isEnumerable ( ) ) ) { <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " redefine_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kRedefineDisallowed , p ) ; <nl> } else { <nl> return false ; <nl> } <nl> function DefineObjectProperty ( obj , p , desc , should_throw ) { <nl> / / Step 9a <nl> if ( IsDataDescriptor ( current ) ! = IsDataDescriptor ( desc ) ) { <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " redefine_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kRedefineDisallowed , p ) ; <nl> } else { <nl> return false ; <nl> } <nl> function DefineObjectProperty ( obj , p , desc , should_throw ) { <nl> if ( IsDataDescriptor ( current ) & & IsDataDescriptor ( desc ) ) { <nl> if ( ! current . isWritable ( ) & & desc . isWritable ( ) ) { <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " redefine_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kRedefineDisallowed , p ) ; <nl> } else { <nl> return false ; <nl> } <nl> function DefineObjectProperty ( obj , p , desc , should_throw ) { <nl> if ( ! current . isWritable ( ) & & desc . hasValue ( ) & & <nl> ! SameValue ( desc . getValue ( ) , current . getValue ( ) ) ) { <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " redefine_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kRedefineDisallowed , p ) ; <nl> } else { <nl> return false ; <nl> } <nl> function DefineObjectProperty ( obj , p , desc , should_throw ) { <nl> if ( IsAccessorDescriptor ( desc ) & & IsAccessorDescriptor ( current ) ) { <nl> if ( desc . hasSetter ( ) & & ! SameValue ( desc . getSet ( ) , current . getSet ( ) ) ) { <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " redefine_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kRedefineDisallowed , p ) ; <nl> } else { <nl> return false ; <nl> } <nl> } <nl> if ( desc . hasGetter ( ) & & ! SameValue ( desc . getGet ( ) , current . getGet ( ) ) ) { <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " redefine_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kRedefineDisallowed , p ) ; <nl> } else { <nl> return false ; <nl> } <nl> function DefineArrayProperty ( obj , p , desc , should_throw ) { <nl> } <nl> var new_length = ToUint32 ( desc . getValue ( ) ) ; <nl> if ( new_length ! = ToNumber ( desc . getValue ( ) ) ) { <nl> - throw new $ RangeError ( ' defineProperty ( ) array length out of range ' ) ; <nl> + throw MakeRangeError ( kArrayLengthOutOfRange ) ; <nl> } <nl> var length_desc = GetOwnPropertyJS ( obj , " length " ) ; <nl> if ( new_length ! = length & & ! length_desc . isWritable ( ) ) { <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " redefine_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kRedefineDisallowed , p ) ; <nl> } else { <nl> return false ; <nl> } <nl> function DefineArrayProperty ( obj , p , desc , should_throw ) { <nl> } <nl> if ( threw ) { <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " redefine_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kRedefineDisallowed , p ) ; <nl> } else { <nl> return false ; <nl> } <nl> function DefineArrayProperty ( obj , p , desc , should_throw ) { <nl> if ( emit_splice ) <nl> $ observeEndPerformSplice ( obj ) ; <nl> if ( should_throw ) { <nl> - throw MakeTypeError ( " define_disallowed " , [ p ] ) ; <nl> + throw MakeTypeError ( kDefineDisallowed , p ) ; <nl> } else { <nl> return false ; <nl> } <nl> function ObjectSetPrototypeOf ( obj , proto ) { <nl> CHECK_OBJECT_COERCIBLE ( obj , " Object . setPrototypeOf " ) ; <nl> <nl> if ( proto ! = = null & & ! IS_SPEC_OBJECT ( proto ) ) { <nl> - throw MakeTypeError ( " proto_object_or_null " , [ proto ] ) ; <nl> + throw MakeTypeError ( kProtoObjectOrNull , proto ) ; <nl> } <nl> <nl> if ( IS_SPEC_OBJECT ( obj ) ) { <nl> function ObjectGetOwnPropertyDescriptor ( obj , p ) { <nl> / / For Harmony proxies <nl> function ToNameArray ( obj , trap , includeSymbols ) { <nl> if ( ! IS_SPEC_OBJECT ( obj ) ) { <nl> - throw MakeTypeError ( " proxy_non_object_prop_names " , [ obj , trap ] ) ; <nl> + throw MakeTypeError ( kProxyNonObjectPropNames , trap , obj ) ; <nl> } <nl> var n = ToUint32 ( obj . length ) ; <nl> var array = new $ Array ( n ) ; <nl> function ToNameArray ( obj , trap , includeSymbols ) { <nl> / / TODO ( rossberg ) : adjust once there is a story for symbols vs proxies . <nl> if ( IS_SYMBOL ( s ) & & ! includeSymbols ) continue ; <nl> if ( % HasOwnProperty ( names , s ) ) { <nl> - throw MakeTypeError ( " proxy_repeated_prop_name " , [ obj , trap , s ] ) ; <nl> + throw MakeTypeError ( kProxyRepeatedPropName , trap , s ) ; <nl> } <nl> array [ index ] = s ; <nl> + + realLength ; <nl> function ObjectGetOwnPropertyNames ( obj ) { <nl> / / ES5 section 15 . 2 . 3 . 5 . <nl> function ObjectCreate ( proto , properties ) { <nl> if ( ! IS_SPEC_OBJECT ( proto ) & & proto ! = = null ) { <nl> - throw MakeTypeError ( " proto_object_or_null " , [ proto ] ) ; <nl> + throw MakeTypeError ( kProtoObjectOrNull , proto ) ; <nl> } <nl> var obj = { } ; <nl> % InternalSetPrototype ( obj , proto ) ; <nl> function ObjectCreate ( proto , properties ) { <nl> / / ES5 section 15 . 2 . 3 . 6 . <nl> function ObjectDefineProperty ( obj , p , attributes ) { <nl> if ( ! IS_SPEC_OBJECT ( obj ) ) { <nl> - throw MakeTypeError ( " called_on_non_object " , [ " Object . defineProperty " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " Object . defineProperty " ) ; <nl> } <nl> var name = ToName ( p ) ; <nl> if ( % _IsJSProxy ( obj ) ) { <nl> function GetOwnEnumerablePropertyNames ( object ) { <nl> / / ES5 section 15 . 2 . 3 . 7 . <nl> function ObjectDefineProperties ( obj , properties ) { <nl> if ( ! IS_SPEC_OBJECT ( obj ) ) { <nl> - throw MakeTypeError ( " called_on_non_object " , [ " Object . defineProperties " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " Object . defineProperties " ) ; <nl> } <nl> var props = TO_OBJECT_INLINE ( properties ) ; <nl> var names = GetOwnEnumerablePropertyNames ( props ) ; <nl> function ProxyFix ( obj ) { <nl> var handler = % GetHandler ( obj ) ; <nl> var props = CallTrap0 ( handler , " fix " , UNDEFINED ) ; <nl> if ( IS_UNDEFINED ( props ) ) { <nl> - throw MakeTypeError ( " handler_returned_undefined " , [ handler , " fix " ] ) ; <nl> + throw MakeTypeError ( kProxyHandlerReturned , handler , " undefined " , " fix " ) ; <nl> } <nl> <nl> if ( % IsJSFunctionProxy ( obj ) ) { <nl> function ProxyFix ( obj ) { <nl> / / ES5 section 15 . 2 . 3 . 8 . <nl> function ObjectSealJS ( obj ) { <nl> if ( ! IS_SPEC_OBJECT ( obj ) ) { <nl> - throw MakeTypeError ( " called_on_non_object " , [ " Object . seal " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " Object . seal " ) ; <nl> } <nl> var isProxy = % _IsJSProxy ( obj ) ; <nl> if ( isProxy | | % HasSloppyArgumentsElements ( obj ) | | % IsObserved ( obj ) ) { <nl> function ObjectSealJS ( obj ) { <nl> / / ES5 section 15 . 2 . 3 . 9 . <nl> function ObjectFreezeJS ( obj ) { <nl> if ( ! IS_SPEC_OBJECT ( obj ) ) { <nl> - throw MakeTypeError ( " called_on_non_object " , [ " Object . freeze " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " Object . freeze " ) ; <nl> } <nl> var isProxy = % _IsJSProxy ( obj ) ; <nl> if ( isProxy | | % HasSloppyArgumentsElements ( obj ) | | % IsObserved ( obj ) ) { <nl> function ObjectFreezeJS ( obj ) { <nl> / / ES5 section 15 . 2 . 3 . 10 <nl> function ObjectPreventExtension ( obj ) { <nl> if ( ! IS_SPEC_OBJECT ( obj ) ) { <nl> - throw MakeTypeError ( " called_on_non_object " , [ " Object . preventExtension " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " Object . preventExtension " ) ; <nl> } <nl> if ( % _IsJSProxy ( obj ) ) { <nl> ProxyFix ( obj ) ; <nl> function ObjectPreventExtension ( obj ) { <nl> / / ES5 section 15 . 2 . 3 . 11 <nl> function ObjectIsSealed ( obj ) { <nl> if ( ! IS_SPEC_OBJECT ( obj ) ) { <nl> - throw MakeTypeError ( " called_on_non_object " , [ " Object . isSealed " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " Object . isSealed " ) ; <nl> } <nl> if ( % _IsJSProxy ( obj ) ) { <nl> return false ; <nl> function ObjectIsSealed ( obj ) { <nl> / / ES5 section 15 . 2 . 3 . 12 <nl> function ObjectIsFrozen ( obj ) { <nl> if ( ! IS_SPEC_OBJECT ( obj ) ) { <nl> - throw MakeTypeError ( " called_on_non_object " , [ " Object . isFrozen " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " Object . isFrozen " ) ; <nl> } <nl> if ( % _IsJSProxy ( obj ) ) { <nl> return false ; <nl> function ObjectIsFrozen ( obj ) { <nl> / / ES5 section 15 . 2 . 3 . 13 <nl> function ObjectIsExtensible ( obj ) { <nl> if ( ! IS_SPEC_OBJECT ( obj ) ) { <nl> - throw MakeTypeError ( " called_on_non_object " , [ " Object . isExtensible " ] ) ; <nl> + throw MakeTypeError ( kCalledOnNonObject , " Object . isExtensible " ) ; <nl> } <nl> if ( % _IsJSProxy ( obj ) ) { <nl> return true ; <nl> function BooleanToString ( ) { <nl> var b = this ; <nl> if ( ! IS_BOOLEAN ( b ) ) { <nl> if ( ! IS_BOOLEAN_WRAPPER ( b ) ) { <nl> - throw new $ TypeError ( ' Boolean . prototype . toString is not generic ' ) ; <nl> + throw MakeTypeError ( kNotGeneric , ' Boolean . prototype . toString ' ) ; <nl> } <nl> b = % _ValueOf ( b ) ; <nl> } <nl> function BooleanValueOf ( ) { <nl> / / NOTE : Both Boolean objects and values can enter here as <nl> / / ' this ' . This is not as dictated by ECMA - 262 . <nl> if ( ! IS_BOOLEAN ( this ) & & ! IS_BOOLEAN_WRAPPER ( this ) ) { <nl> - throw new $ TypeError ( ' Boolean . prototype . valueOf is not generic ' ) ; <nl> + throw MakeTypeError ( kNotGeneric , ' Boolean . prototype . valueOf ' ) ; <nl> } <nl> return % _ValueOf ( this ) ; <nl> } <nl> function NumberToStringJS ( radix ) { <nl> var number = this ; <nl> if ( ! IS_NUMBER ( this ) ) { <nl> if ( ! IS_NUMBER_WRAPPER ( this ) ) { <nl> - throw new $ TypeError ( ' Number . prototype . toString is not generic ' ) ; <nl> + throw MakeTypeError ( kNotGeneric , ' Number . prototype . toString ' ) ; <nl> } <nl> / / Get the value of this number in case it ' s an object . <nl> number = % _ValueOf ( this ) ; <nl> function NumberValueOf ( ) { <nl> / / NOTE : Both Number objects and values can enter here as <nl> / / ' this ' . This is not as dictated by ECMA - 262 . <nl> if ( ! IS_NUMBER ( this ) & & ! IS_NUMBER_WRAPPER ( this ) ) { <nl> - throw new $ TypeError ( ' Number . prototype . valueOf is not generic ' ) ; <nl> + throw MakeTypeError ( kNotGeneric , ' Number . prototype . valueOf ' ) ; <nl> } <nl> return % _ValueOf ( this ) ; <nl> } <nl> function NumberToFixedJS ( fractionDigits ) { <nl> var f = TO_INTEGER ( fractionDigits ) ; <nl> <nl> if ( f < 0 | | f > 20 ) { <nl> - throw new $ RangeError ( " toFixed ( ) digits argument must be between 0 and 20 " ) ; <nl> + throw MakeRangeError ( kNumberFormatRange , " toFixed ( ) digits " ) ; <nl> } <nl> <nl> if ( NUMBER_IS_NAN ( x ) ) return " NaN " ; <nl> function NumberToExponentialJS ( fractionDigits ) { <nl> if ( IS_UNDEFINED ( f ) ) { <nl> f = - 1 ; / / Signal for runtime function that f is not defined . <nl> } else if ( f < 0 | | f > 20 ) { <nl> - throw new $ RangeError ( " toExponential ( ) argument must be between 0 and 20 " ) ; <nl> + throw MakeRangeError ( kNumberFormatRange , " toExponential ( ) " ) ; <nl> } <nl> return % NumberToExponential ( x , f ) ; <nl> } <nl> function NumberToPrecisionJS ( precision ) { <nl> if ( x = = - INFINITY ) return " - Infinity " ; <nl> <nl> if ( p < 1 | | p > 21 ) { <nl> - throw new $ RangeError ( " toPrecision ( ) argument must be between 1 and 21 " ) ; <nl> + throw MakeRangeError ( kToPrecisionFormatRange ) ; <nl> } <nl> return % NumberToPrecision ( x , p ) ; <nl> } <nl> function FunctionSourceString ( func ) { <nl> } <nl> <nl> if ( ! IS_FUNCTION ( func ) ) { <nl> - throw new $ TypeError ( ' Function . prototype . toString is not generic ' ) ; <nl> + throw MakeTypeError ( kNotGeneric , ' Function . prototype . toString ' ) ; <nl> } <nl> <nl> var classSource = % ClassGetSourceCode ( func ) ; <nl> function FunctionToString ( ) { <nl> <nl> / / ES5 15 . 3 . 4 . 5 <nl> function FunctionBind ( this_arg ) { / / Length is 1 . <nl> - if ( ! IS_SPEC_FUNCTION ( this ) ) { <nl> - throw new $ TypeError ( ' Bind must be called on a function ' ) ; <nl> - } <nl> + if ( ! IS_SPEC_FUNCTION ( this ) ) throw MakeTypeError ( kFunctionBind ) ; <nl> + <nl> var boundFunction = function ( ) { <nl> / / Poison . arguments and . caller , but is otherwise not detectable . <nl> " use strict " ; <nl> function NewFunctionString ( arguments , function_token ) { <nl> / / character - it may make the combined function expression <nl> / / compile . We avoid this problem by checking for this early on . <nl> if ( % _CallFunction ( p , ' ) ' , $ stringIndexOf ) ! = - 1 ) { <nl> - throw MakeSyntaxError ( ' paren_in_arg_string ' , [ ] ) ; <nl> + throw MakeSyntaxError ( kParenthesisInArgString ) ; <nl> } <nl> / / If the formal parameters include an unbalanced block comment , the <nl> / / function must be rejected . Since JavaScript does not allow nested <nl> function GetIterator ( obj , method ) { <nl> method = obj [ symbolIterator ] ; <nl> } <nl> if ( ! IS_SPEC_FUNCTION ( method ) ) { <nl> - throw MakeTypeError ( ' not_iterable ' , [ obj ] ) ; <nl> + throw MakeTypeError ( kNotIterable , obj ) ; <nl> } <nl> var iterator = % _CallFunction ( obj , method ) ; <nl> if ( ! IS_SPEC_OBJECT ( iterator ) ) { <nl> - throw MakeTypeError ( ' not_an_iterator ' , [ iterator ] ) ; <nl> + throw MakeTypeError ( kNotAnIterator , iterator ) ; <nl> } <nl> return iterator ; <nl> } <nl> mmm a / test / mjsunit / messages . js <nl> ppp b / test / mjsunit / messages . js <nl> function test ( f , expected , type ) { <nl> assertEquals ( expected , e . message ) ; <nl> return ; <nl> } <nl> - assertUnreachable ( ) ; <nl> + assertUnreachable ( " Exception expected " ) ; <nl> } <nl> <nl> / / = = = Error = = = <nl> test ( function ( ) { <nl> } , " Function . prototype . apply was called on 1 , which is a number " + <nl> " and not a function " , TypeError ) ; <nl> <nl> + / / kCalledNonCallable <nl> + test ( function ( ) { <nl> + [ ] . forEach ( 1 ) ; <nl> + } , " 1 is not a function " , TypeError ) ; <nl> + <nl> + / / kCalledOnNonObject <nl> + test ( function ( ) { <nl> + Object . freeze ( 1 ) <nl> + } , " Object . freeze called on non - object " , TypeError ) ; <nl> + <nl> / / kCannotConvertToPrimitive <nl> test ( function ( ) { <nl> [ ] . join ( Object ( Symbol ( 1 ) ) ) ; <nl> } , " Cannot convert object to primitive value " , TypeError ) ; <nl> <nl> + / / kDefineDisallowed <nl> + test ( function ( ) { <nl> + " use strict " ; <nl> + var o = { } ; <nl> + Object . preventExtensions ( o ) ; <nl> + Object . defineProperty ( o , " x " , { value : 1 } ) ; <nl> + } , " Cannot define property : x , object is not extensible . " , TypeError ) ; <nl> + <nl> / / kGeneratorRunning <nl> test ( function ( ) { <nl> var iter ; <nl> test ( function ( ) { <nl> iter . next ( ) ; <nl> } , " Generator is already running " , TypeError ) ; <nl> <nl> - / / kCalledNonCallable <nl> + / / kFunctionBind <nl> test ( function ( ) { <nl> - [ ] . forEach ( 1 ) ; <nl> - } , " 1 is not a function " , TypeError ) ; <nl> + Function . prototype . bind . call ( 1 ) ; <nl> + } , " Bind must be called on a function " , TypeError ) ; <nl> <nl> / / kIncompatibleMethodReceiver <nl> test ( function ( ) { <nl> test ( function ( ) { <nl> new Symbol ( ) ; <nl> } , " Symbol is not a constructor " , TypeError ) ; <nl> <nl> + / / kNotGeneric <nl> + test ( function ( ) { <nl> + String . prototype . toString . call ( 1 ) ; <nl> + } , " String . prototype . toString is not generic " , TypeError ) ; <nl> + <nl> + test ( function ( ) { <nl> + String . prototype . valueOf . call ( 1 ) ; <nl> + } , " String . prototype . valueOf is not generic " , TypeError ) ; <nl> + <nl> + test ( function ( ) { <nl> + Boolean . prototype . toString . call ( 1 ) ; <nl> + } , " Boolean . prototype . toString is not generic " , TypeError ) ; <nl> + <nl> + test ( function ( ) { <nl> + Boolean . prototype . valueOf . call ( 1 ) ; <nl> + } , " Boolean . prototype . valueOf is not generic " , TypeError ) ; <nl> + <nl> + test ( function ( ) { <nl> + Number . prototype . toString . call ( { } ) ; <nl> + } , " Number . prototype . toString is not generic " , TypeError ) ; <nl> + <nl> + test ( function ( ) { <nl> + Number . prototype . valueOf . call ( { } ) ; <nl> + } , " Number . prototype . valueOf is not generic " , TypeError ) ; <nl> + <nl> + test ( function ( ) { <nl> + Function . prototype . toString . call ( 1 ) ; <nl> + } , " Function . prototype . toString is not generic " , TypeError ) ; <nl> + <nl> + <nl> + / / kObjectGetterExpectingFunction <nl> + test ( function ( ) { <nl> + ( { } ) . __defineGetter__ ( " x " , 0 ) ; <nl> + } , " Object . prototype . __defineGetter__ : Expecting function " , TypeError ) ; <nl> + <nl> + / / kObjectGetterCallable <nl> + test ( function ( ) { <nl> + Object . defineProperty ( { } , " x " , { get : 1 } ) ; <nl> + } , " Getter must be a function : 1 " , TypeError ) ; <nl> + <nl> + / / kObjectSetterExpectingFunction <nl> + test ( function ( ) { <nl> + ( { } ) . __defineSetter__ ( " x " , 0 ) ; <nl> + } , " Object . prototype . __defineSetter__ : Expecting function " , TypeError ) ; <nl> + <nl> + / / kObjectSetterCallable <nl> + test ( function ( ) { <nl> + Object . defineProperty ( { } , " x " , { set : 1 } ) ; <nl> + } , " Setter must be a function : 1 " , TypeError ) ; <nl> + <nl> + / / kPropertyDescObject <nl> + test ( function ( ) { <nl> + Object . defineProperty ( { } , " x " , 1 ) ; <nl> + } , " Property description must be an object : 1 " , TypeError ) ; <nl> + <nl> / / kPropertyNotFunction <nl> test ( function ( ) { <nl> Set . prototype . add = 0 ; <nl> new Set ( 1 ) ; <nl> } , " Property ' add ' of object # < Set > is not a function " , TypeError ) ; <nl> <nl> + / / kProtoObjectOrNull <nl> + test ( function ( ) { <nl> + Object . setPrototypeOf ( { } , 1 ) ; <nl> + } , " Object prototype may only be an Object or null : 1 " , TypeError ) ; <nl> + <nl> + / / kRedefineDisallowed <nl> + test ( function ( ) { <nl> + " use strict " ; <nl> + var o = { } ; <nl> + Object . defineProperty ( o , " x " , { value : 1 , configurable : false } ) ; <nl> + Object . defineProperty ( o , " x " , { value : 2 } ) ; <nl> + } , " Cannot redefine property : x " , TypeError ) ; <nl> + <nl> / / kSymbolToPrimitive <nl> test ( function ( ) { <nl> 1 + Object ( Symbol ( ) ) ; <nl> test ( function ( ) { <nl> Array . prototype . toString . call ( null ) ; <nl> } , " Cannot convert undefined or null to object " , TypeError ) ; <nl> <nl> + / / kValueAndAccessor <nl> + test ( function ( ) { <nl> + Object . defineProperty ( { } , " x " , { get : function ( ) { } , value : 1 } ) ; <nl> + } , " Invalid property . A property cannot both have accessors and be " + <nl> + " writable or have a value , # < Object > " , TypeError ) ; <nl> + <nl> / / kWithExpression <nl> test ( function ( ) { <nl> with ( null ) { } <nl> test ( function ( ) { <nl> } , " Reflect . construct : Arguments list has wrong type " , TypeError ) ; <nl> <nl> <nl> + / / = = = SyntaxError = = = <nl> + <nl> + test ( function ( ) { <nl> + new Function ( " ) " , " " ) ; <nl> + } , " Function arg string contains parenthesis " , SyntaxError ) ; <nl> + <nl> + <nl> / / = = = RangeError = = = <nl> <nl> + / / kArrayLengthOutOfRange <nl> + test ( function ( ) { <nl> + " use strict " ; <nl> + Object . defineProperty ( [ ] , " length " , { value : 1E100 } ) ; <nl> + } , " defineProperty ( ) array length out of range " , RangeError ) ; <nl> + <nl> + / / kNumberFormatRange <nl> + test ( function ( ) { <nl> + Number ( 1 ) . toFixed ( 100 ) ; <nl> + } , " toFixed ( ) digits argument must be between 0 and 20 " , RangeError ) ; <nl> + <nl> + test ( function ( ) { <nl> + Number ( 1 ) . toExponential ( 100 ) ; <nl> + } , " toExponential ( ) argument must be between 0 and 20 " , RangeError ) ; <nl> + <nl> / / kStackOverflow <nl> test ( function ( ) { <nl> function f ( ) { f ( Array ( 1000 ) ) ; } <nl> f ( ) ; <nl> } , " Maximum call stack size exceeded " , RangeError ) ; <nl> + <nl> + / / kToPrecisionFormatRange <nl> + test ( function ( ) { <nl> + Number ( 1 ) . toPrecision ( 100 ) ; <nl> + } , " toPrecision ( ) argument must be between 1 and 21 " , RangeError ) ; <nl>
Migrate error messages , part 4 ( v8natives . js ) .
v8/v8
9b2fe70d93d5956c5731b6c84f65ad8bc0077a77
2015-04-21T09:03:09Z
mmm a / arangod / Indexes / SkiplistIndex . cpp <nl> ppp b / arangod / Indexes / SkiplistIndex . cpp <nl> IndexIterator * SkiplistIndex : : iteratorForCondition ( <nl> if ( needNormalize ) { <nl> VPackBuilder expandedSearchValues ; <nl> expandInSearchValues ( searchValues . slice ( ) , expandedSearchValues ) ; <nl> - / / TODO create Multi search iterator <nl> + VPackSlice expandedSlice = expandedSearchValues . slice ( ) ; <nl> + std : : vector < IndexIterator * > iterators ; <nl> + for ( auto const & val : VPackArrayIterator ( expandedSlice ) ) { <nl> + auto iterator = lookup ( trx , val , reverse ) ; <nl> + iterators . push_back ( iterator ) ; <nl> + } <nl> + if ( reverse ) { <nl> + std : : reverse ( iterators . begin ( ) , iterators . end ( ) ) ; <nl> + } <nl> + return new MultiIndexIterator ( iterators ) ; <nl> } <nl> return lookup ( trx , searchValues . slice ( ) , reverse ) ; <nl> } <nl>
Used the new MultiIndex iterator for AQL = > Skiplist iterator , if there is an IN used
arangodb/arangodb
09933bea412195868fd1e9a8986ef3f12629be33
2016-02-29T14:32:23Z
mmm a / stdlib / public / core / Collection . swift <nl> ppp b / stdlib / public / core / Collection . swift <nl> extension CollectionType { <nl> while subSequenceEnd ! = cachedEndIndex { <nl> if try isSeparator ( self [ subSequenceEnd ] ) { <nl> let didAppend = appendSubsequence ( end : subSequenceEnd ) <nl> - + + subSequenceEnd <nl> + subSequenceEnd . _successorInPlace ( ) <nl> subSequenceStart = subSequenceEnd <nl> if didAppend & & result . count = = maxSplit { <nl> break <nl> } <nl> continue <nl> } <nl> - + + subSequenceEnd <nl> + subSequenceEnd . _successorInPlace ( ) <nl> } <nl> <nl> if subSequenceStart ! = cachedEndIndex | | allowEmptySlices { <nl>
Update CollectionType . split ( _ : _ : _ : ) for removal of + + operator
apple/swift
380c4e53c8e8b1473bf9659a0ca7ffccbf3a8376
2015-12-15T00:51:55Z
mmm a / scripts / ubuntu / install_cuda . sh <nl> ppp b / scripts / ubuntu / install_cuda . sh <nl> if [ [ $ ubuntu_version = = * " 14 . " * ] ] ; then <nl> elif [ [ $ ubuntu_version = = * " 16 . " * ] ] ; then <nl> wget - c " https : / / developer . nvidia . com / compute / cuda / 8 . 0 / Prod2 / local_installers / cuda - repo - ubuntu1604 - 8 - 0 - local - ga2_8 . 0 . 61 - 1_amd64 - deb " <nl> sudo dpkg - - install cuda - repo - ubuntu1604 - 8 - 0 - local - ga2_8 . 0 . 61 - 1_amd64 - deb <nl> + elif [ [ $ ubuntu_version = = * " 18 . " * ] ] ; then <nl> + wget https : / / developer . download . nvidia . com / compute / cuda / repos / ubuntu1804 / x86_64 / cuda - ubuntu1804 . pin <nl> + sudo mv cuda - ubuntu1804 . pin / etc / apt / preferences . d / cuda - repository - pin - 600 <nl> + wget http : / / developer . download . nvidia . com / compute / cuda / 10 . 2 / Prod / local_installers / cuda - repo - ubuntu1804 - 10 - 2 - local - 10 . 2 . 89 - 440 . 33 . 01_1 . 0 - 1_amd64 . deb <nl> + sudo dpkg - i cuda - repo - ubuntu1804 - 10 - 2 - local - 10 . 2 . 89 - 440 . 33 . 01_1 . 0 - 1_amd64 . deb <nl> + sudo apt - key add / var / cuda - repo - 10 - 2 - local - 10 . 2 . 89 - 440 . 33 . 01 / 7fa2af80 . pub <nl> + sudo apt - get update <nl> + sudo apt - get - y install cuda <nl> fi <nl> sudo apt - get update <nl> sudo apt - get install cuda - 8 - 0 <nl>
Update install_cuda . sh for Ubuntu 18 . 04 ( )
CMU-Perceptual-Computing-Lab/openpose
28d140698ab40c722ac96daa8f0681c84b337dae
2020-04-04T18:25:40Z
mmm a / include / grpc + + / server_builder . h <nl> ppp b / include / grpc + + / server_builder . h <nl> <nl> # ifndef GRPCXX_SERVER_BUILDER_H <nl> # define GRPCXX_SERVER_BUILDER_H <nl> <nl> + # include < climits > <nl> # include < map > <nl> # include < memory > <nl> # include < vector > <nl> <nl> # include < grpc + + / impl / server_builder_plugin . h > <nl> # include < grpc + + / support / config . h > <nl> # include < grpc / compression . h > <nl> + # include < grpc / support / cpu . h > <nl> + # include < grpc / support / useful . h > <nl> <nl> namespace grpc { <nl> <nl> class ServerBuilder { <nl> public : <nl> ServerBuilder ( ) ; <nl> <nl> - struct SyncServerSettings { <nl> - / / Number of server completion queues to create to listen to incoming RPCs . <nl> - int num_cqs ; <nl> - <nl> - / / Minimum number of threads per completion queue that should be listening <nl> - / / to incoming RPCs . <nl> - int min_pollers ; <nl> - <nl> - / / Maximum number of threads per completion queue that can be listening to <nl> - / / incoming RPCs . <nl> - int max_pollers ; <nl> - <nl> - / / The timeout for server completion queue ' s AsyncNext call . <nl> - int cq_timeout_msec ; <nl> - } ; <nl> + enum SyncServerOption { NUM_CQS , MIN_POLLERS , MAX_POLLERS , CQ_TIMEOUT_MSEC } ; <nl> <nl> / / / Register a service . This call does not take ownership of the service . <nl> / / / The service must exist for the lifetime of the \ a Server instance returned <nl> class ServerBuilder { <nl> <nl> ServerBuilder & SetOption ( std : : unique_ptr < ServerBuilderOption > option ) ; <nl> <nl> - / / / Note : Only useful if this is a Synchronous server . <nl> - void SetSyncServerSettings ( SyncServerSettings settings ) ; <nl> + / / / Only useful if this is a Synchronous server . <nl> + ServerBuilder & SetSyncServerOption ( SyncServerOption option , int value ) ; <nl> <nl> / / / Tries to bind \ a server to the given \ a addr . <nl> / / / <nl> class ServerBuilder { <nl> int * selected_port ; <nl> } ; <nl> <nl> - / / Sync server settings . If this is not set via SetSyncServerSettings ( ) , the <nl> - / / following default values are used : <nl> - / / sync_server_settings_ . num_cqs = Number of CPUs <nl> - / / sync_server_settings_ . min_pollers = 1 <nl> - / / sync_server_settings_ . max_pollers = INT_MAX <nl> - / / sync_server_settings_ . cq_timeout_msec = 1000 <nl> - struct SyncServerSettings sync_server_settings_ ; <nl> + struct SyncServerSettings { <nl> + SyncServerSettings ( ) <nl> + : num_cqs ( GPR_MAX ( gpr_cpu_num_cores ( ) , 4 ) ) , <nl> + min_pollers ( 1 ) , <nl> + max_pollers ( INT_MAX ) , <nl> + cq_timeout_msec ( 100 ) { } <nl> + <nl> + / / Number of server completion queues to create to listen to incoming RPCs . <nl> + int num_cqs ; <nl> + <nl> + / / Minimum number of threads per completion queue that should be listening <nl> + / / to incoming RPCs . <nl> + int min_pollers ; <nl> + <nl> + / / Maximum number of threads per completion queue that can be listening to <nl> + / / incoming RPCs . <nl> + int max_pollers ; <nl> + <nl> + / / The timeout for server completion queue ' s AsyncNext call . <nl> + int cq_timeout_msec ; <nl> + } ; <nl> <nl> typedef std : : unique_ptr < grpc : : string > HostString ; <nl> struct NamedService { <nl> class ServerBuilder { <nl> std : : vector < std : : unique_ptr < NamedService > > services_ ; <nl> std : : vector < Port > ports_ ; <nl> <nl> + SyncServerSettings sync_server_settings_ ; <nl> + <nl> / * List of completion queues added via AddCompletionQueue ( ) method * / <nl> std : : vector < ServerCompletionQueue * > cqs_ ; <nl> <nl> mmm a / src / cpp / server / server_builder . cc <nl> ppp b / src / cpp / server / server_builder . cc <nl> static void do_plugin_list_init ( void ) { <nl> ServerBuilder : : ServerBuilder ( ) <nl> : max_receive_message_size_ ( - 1 ) , <nl> max_send_message_size_ ( - 1 ) , <nl> + sync_server_settings_ ( SyncServerSettings ( ) ) , <nl> generic_service_ ( nullptr ) { <nl> gpr_once_init ( & once_init_plugin_list , do_plugin_list_init ) ; <nl> for ( auto it = g_plugin_factory_list - > begin ( ) ; <nl> ServerBuilder : : ServerBuilder ( ) <nl> sizeof ( maybe_default_compression_level_ ) ) ; <nl> memset ( & maybe_default_compression_algorithm_ , 0 , <nl> sizeof ( maybe_default_compression_algorithm_ ) ) ; <nl> - <nl> - / / Sync server setting defaults <nl> - sync_server_settings_ . min_pollers = 1 ; <nl> - sync_server_settings_ . max_pollers = INT_MAX ; <nl> - <nl> - int num_cpus = gpr_cpu_num_cores ( ) ; <nl> - num_cpus = GPR_MAX ( num_cpus , 4 ) ; <nl> - sync_server_settings_ . num_cqs = num_cpus ; <nl> - <nl> - sync_server_settings_ . cq_timeout_msec = 1000 ; <nl> } <nl> <nl> std : : unique_ptr < ServerCompletionQueue > ServerBuilder : : AddCompletionQueue ( <nl> ServerBuilder & ServerBuilder : : SetOption ( <nl> return * this ; <nl> } <nl> <nl> + ServerBuilder & ServerBuilder : : SetSyncServerOption ( <nl> + ServerBuilder : : SyncServerOption option , int val ) { <nl> + switch ( option ) { <nl> + case NUM_CQS : <nl> + sync_server_settings_ . num_cqs = val ; <nl> + break ; <nl> + <nl> + case MIN_POLLERS : <nl> + sync_server_settings_ . min_pollers = val ; <nl> + break ; <nl> + case MAX_POLLERS : <nl> + sync_server_settings_ . max_pollers = val ; <nl> + break ; <nl> + case CQ_TIMEOUT_MSEC : <nl> + sync_server_settings_ . cq_timeout_msec = val ; <nl> + break ; <nl> + } <nl> + return * this ; <nl> + } <nl> + <nl> ServerBuilder & ServerBuilder : : SetCompressionAlgorithmSupportStatus ( <nl> grpc_compression_algorithm algorithm , bool enabled ) { <nl> if ( enabled ) { <nl> ServerBuilder & ServerBuilder : : SetDefaultCompressionAlgorithm ( <nl> return * this ; <nl> } <nl> <nl> - void ServerBuilder : : SetSyncServerSettings ( SyncServerSettings settings ) { <nl> - sync_server_settings_ = settings ; / / copy the settings <nl> - } <nl> - <nl> ServerBuilder & ServerBuilder : : AddListeningPort ( <nl> const grpc : : string & addr , std : : shared_ptr < ServerCredentials > creds , <nl> int * selected_port ) { <nl>
Refactor SyncServerSettings code
grpc/grpc
96766195a6ed083e5fc239755aa76a2138cd1d7a
2016-10-13T19:42:54Z
new file mode 100644 <nl> index 0000000000 . . fde783d9c3 <nl> mmm / dev / null <nl> ppp b / change / react - native - windows - 2020 - 05 - 20 - 12 - 14 - 56 - certVS . json <nl> <nl> + { <nl> + " type " : " prerelease " , <nl> + " comment " : " Work around regression in app packaging in VS 16 . 5 - 16 . 6 " , <nl> + " packageName " : " react - native - windows " , <nl> + " email " : " asklar @ microsoft . com " , <nl> + " dependentChangeType " : " patch " , <nl> + " date " : " 2020 - 05 - 20T19 : 14 : 55 . 769Z " <nl> + } <nl> new file mode 100644 <nl> index 0000000000 . . 170514e95c <nl> mmm / dev / null <nl> ppp b / vnext / local - cli / runWindows / utils / Add - AppDevPackage . ps1 <nl> <nl> + # <nl> + # Add - AppxDevPackage . ps1 is a PowerShell script designed to install app <nl> + # packages created by Visual Studio for developers . To run this script from <nl> + # Explorer , right - click on its icon and choose " Run with PowerShell " . <nl> + # <nl> + # Visual Studio supplies this script in the folder generated with its <nl> + # " Prepare Package " command . The same folder will also contain the app <nl> + # package ( a . appx file ) , the signing certificate ( a . cer file ) , and a <nl> + # " Dependencies " subfolder containing all the framework packages used by the <nl> + # app . <nl> + # <nl> + # This script simplifies installing these packages by automating the <nl> + # following functions : <nl> + # 1 . Find the app package and signing certificate in the script directory <nl> + # 2 . Prompt the user to acquire a developer license and to install the <nl> + # certificate if necessary <nl> + # 3 . Find dependency packages that are applicable to the operating system ' s <nl> + # CPU architecture <nl> + # 4 . Install the package along with all applicable dependencies <nl> + # <nl> + # All command line parameters are reserved for use internally by the script . <nl> + # Users should launch this script from Explorer . <nl> + # <nl> + <nl> + # . Link <nl> + # http : / / go . microsoft . com / fwlink / ? LinkId = 243053 <nl> + <nl> + param ( <nl> + [ switch ] $ Force = $ false , <nl> + [ switch ] $ GetDeveloperLicense = $ false , <nl> + [ switch ] $ SkipLoggingTelemetry = $ false , <nl> + [ string ] $ CertificatePath = $ null <nl> + ) <nl> + <nl> + $ ErrorActionPreference = " Stop " <nl> + <nl> + # The language resources for this script are placed in the <nl> + # " Add - AppDevPackage . resources " subfolder alongside the script . Since the <nl> + # current working directory might not be the directory that contains the <nl> + # script , we need to create the full path of the resources directory to <nl> + # pass into Import - LocalizedData <nl> + $ ScriptPath = $ null <nl> + try <nl> + { <nl> + $ ScriptPath = ( Get - Variable MyInvocation ) . Value . MyCommand . Path <nl> + $ ScriptDir = Split - Path - Parent $ ScriptPath <nl> + } <nl> + catch { } <nl> + <nl> + if ( ! $ ScriptPath ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorNoScriptPath $ ErrorCodes . NoScriptPath <nl> + } <nl> + <nl> + $ LocalizedResourcePath = Join - Path $ ScriptDir " Add - AppDevPackage . resources " <nl> + Import - LocalizedData - BindingVariable UiStrings - BaseDirectory $ LocalizedResourcePath <nl> + <nl> + $ ErrorCodes = Data { <nl> + ConvertFrom - StringData @ ' <nl> + Success = 0 <nl> + NoScriptPath = 1 <nl> + NoPackageFound = 2 <nl> + ManyPackagesFound = 3 <nl> + NoCertificateFound = 4 <nl> + ManyCertificatesFound = 5 <nl> + BadCertificate = 6 <nl> + PackageUnsigned = 7 <nl> + CertificateMismatch = 8 <nl> + ForceElevate = 9 <nl> + LaunchAdminFailed = 10 <nl> + GetDeveloperLicenseFailed = 11 <nl> + InstallCertificateFailed = 12 <nl> + AddPackageFailed = 13 <nl> + ForceDeveloperLicense = 14 <nl> + CertUtilInstallFailed = 17 <nl> + CertIsCA = 18 <nl> + BannedEKU = 19 <nl> + NoBasicConstraints = 20 <nl> + NoCodeSigningEku = 21 <nl> + InstallCertificateCancelled = 22 <nl> + BannedKeyUsage = 23 <nl> + ExpiredCertificate = 24 <nl> + ' @ <nl> + } <nl> + <nl> + $ ProcessorArchitecture = $ Env : Processor_Architecture <nl> + <nl> + # Getting $ Env : Processor_Architecture on arm64 machines will return x86 . So check if the environment <nl> + # variable " ProgramFiles ( Arm ) " is also set , if it is we know the actual processor architecture is arm64 . <nl> + # The value will also be x86 on amd64 machines when running the x86 version of PowerShell . <nl> + if ( $ ProcessorArchitecture - eq " x86 " ) <nl> + { <nl> + if ( $ null - ne $ { Env : ProgramFiles ( Arm ) } ) <nl> + { <nl> + $ ProcessorArchitecture = " arm64 " <nl> + } <nl> + elseif ( $ null - ne $ { Env : ProgramFiles ( x86 ) } ) <nl> + { <nl> + $ ProcessorArchitecture = " amd64 " <nl> + } <nl> + } <nl> + <nl> + function PrintMessageAndExit ( $ ErrorMessage , $ ReturnCode ) <nl> + { <nl> + Write - Host $ ErrorMessage <nl> + try <nl> + { <nl> + # Log telemetry data regarding the use of the script if possible . <nl> + # There are three ways that this can be disabled : <nl> + # 1 . If the " TelemetryDependencies " folder isn ' t present . This can be excluded at build time by setting the MSBuild property AppxLogTelemetryFromSideloadingScript to false <nl> + # 2 . If the SkipLoggingTelemetry switch is passed to this script . <nl> + # 3 . If Visual Studio telemetry is disabled via the registry . <nl> + $ TelemetryAssembliesFolder = ( Join - Path $ PSScriptRoot " TelemetryDependencies " ) <nl> + if ( ! $ SkipLoggingTelemetry - And ( Test - Path $ TelemetryAssembliesFolder ) ) <nl> + { <nl> + $ job = Start - Job - FilePath ( Join - Path $ TelemetryAssembliesFolder " LogSideloadingTelemetry . ps1 " ) - ArgumentList $ TelemetryAssembliesFolder , " VS / DesignTools / SideLoadingScript / AddAppDevPackage " , $ ReturnCode , $ ProcessorArchitecture <nl> + Wait - Job - Job $ job - Timeout 60 | Out - Null <nl> + } <nl> + } <nl> + catch <nl> + { <nl> + # Ignore telemetry errors <nl> + } <nl> + <nl> + if ( ! $ Force ) <nl> + { <nl> + Pause <nl> + } <nl> + <nl> + exit $ ReturnCode <nl> + } <nl> + <nl> + # <nl> + # Warns the user about installing certificates , and presents a Yes / No prompt <nl> + # to confirm the action . The default is set to No . <nl> + # <nl> + function ConfirmCertificateInstall <nl> + { <nl> + $ Answer = $ host . UI . PromptForChoice ( <nl> + " " , <nl> + $ UiStrings . WarningInstallCert , <nl> + [ System . Management . Automation . Host . ChoiceDescription [ ] ] @ ( $ UiStrings . PromptYesString , $ UiStrings . PromptNoString ) , <nl> + 1 ) <nl> + <nl> + return $ Answer - eq 0 <nl> + } <nl> + <nl> + # <nl> + # Validates whether a file is a valid certificate using CertUtil . <nl> + # This needs to be done before calling Get - PfxCertificate on the file , otherwise <nl> + # the user will get a cryptic " Password : " prompt for invalid certs . <nl> + # <nl> + function ValidateCertificateFormat ( $ FilePath ) <nl> + { <nl> + # certutil - verify prints a lot of text that we don ' t need , so it ' s redirected to $ null here <nl> + certutil . exe - verify $ FilePath > $ null <nl> + if ( $ LastExitCode - lt 0 ) <nl> + { <nl> + PrintMessageAndExit ( $ UiStrings . ErrorBadCertificate - f $ FilePath , $ LastExitCode ) $ ErrorCodes . BadCertificate <nl> + } <nl> + <nl> + # Check if certificate is expired <nl> + $ cert = Get - PfxCertificate $ FilePath <nl> + if ( ( $ cert . NotBefore - gt ( Get - Date ) ) - or ( $ cert . NotAfter - lt ( Get - Date ) ) ) <nl> + { <nl> + PrintMessageAndExit ( $ UiStrings . ErrorExpiredCertificate - f $ FilePath ) $ ErrorCodes . ExpiredCertificate <nl> + } <nl> + } <nl> + <nl> + # <nl> + # Verify that the developer certificate meets the following restrictions : <nl> + # - The certificate must contain a Basic Constraints extension , and its <nl> + # Certificate Authority ( CA ) property must be false . <nl> + # - The certificate ' s Key Usage extension must be either absent , or set to <nl> + # only DigitalSignature . <nl> + # - The certificate must contain an Extended Key Usage ( EKU ) extension with <nl> + # Code Signing usage . <nl> + # - The certificate must NOT contain any other EKU except Code Signing and <nl> + # Lifetime Signing . <nl> + # <nl> + # These restrictions are enforced to decrease security risks that arise from <nl> + # trusting digital certificates . <nl> + # <nl> + function CheckCertificateRestrictions <nl> + { <nl> + Set - Variable - Name BasicConstraintsExtensionOid - Value " 2 . 5 . 29 . 19 " - Option Constant <nl> + Set - Variable - Name KeyUsageExtensionOid - Value " 2 . 5 . 29 . 15 " - Option Constant <nl> + Set - Variable - Name EkuExtensionOid - Value " 2 . 5 . 29 . 37 " - Option Constant <nl> + Set - Variable - Name CodeSigningEkuOid - Value " 1 . 3 . 6 . 1 . 5 . 5 . 7 . 3 . 3 " - Option Constant <nl> + Set - Variable - Name LifetimeSigningEkuOid - Value " 1 . 3 . 6 . 1 . 4 . 1 . 311 . 10 . 3 . 13 " - Option Constant <nl> + Set - Variable - Name UwpSigningEkuOid - Value " 1 . 3 . 6 . 1 . 4 . 1 . 311 . 84 . 3 . 1 " - Option Constant <nl> + Set - Variable - Name DisposableSigningEkuOid - Value " 1 . 3 . 6 . 1 . 4 . 1 . 311 . 84 . 3 . 2 " - Option Constant <nl> + <nl> + $ CertificateExtensions = ( Get - PfxCertificate $ CertificatePath ) . Extensions <nl> + $ HasBasicConstraints = $ false <nl> + $ HasCodeSigningEku = $ false <nl> + <nl> + foreach ( $ Extension in $ CertificateExtensions ) <nl> + { <nl> + # Certificate must contain the Basic Constraints extension <nl> + if ( $ Extension . oid . value - eq $ BasicConstraintsExtensionOid ) <nl> + { <nl> + # CA property must be false <nl> + if ( $ Extension . CertificateAuthority ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorCertIsCA $ ErrorCodes . CertIsCA <nl> + } <nl> + $ HasBasicConstraints = $ true <nl> + } <nl> + <nl> + # If key usage is present , it must be set to digital signature <nl> + elseif ( $ Extension . oid . value - eq $ KeyUsageExtensionOid ) <nl> + { <nl> + if ( $ Extension . KeyUsages - ne " DigitalSignature " ) <nl> + { <nl> + PrintMessageAndExit ( $ UiStrings . ErrorBannedKeyUsage - f $ Extension . KeyUsages ) $ ErrorCodes . BannedKeyUsage <nl> + } <nl> + } <nl> + <nl> + elseif ( $ Extension . oid . value - eq $ EkuExtensionOid ) <nl> + { <nl> + # Certificate must contain the Code Signing EKU <nl> + $ EKUs = $ Extension . EnhancedKeyUsages . Value <nl> + if ( $ EKUs - contains $ CodeSigningEkuOid ) <nl> + { <nl> + $ HasCodeSigningEKU = $ True <nl> + } <nl> + <nl> + # EKUs other than code signing and lifetime signing are not allowed <nl> + foreach ( $ EKU in $ EKUs ) <nl> + { <nl> + if ( $ EKU - ne $ CodeSigningEkuOid - and $ EKU - ne $ LifetimeSigningEkuOid - and $ EKU - ne $ UwpSigningEkuOid - and $ EKU - ne $ DisposableSigningEkuOid ) <nl> + { <nl> + PrintMessageAndExit ( $ UiStrings . ErrorBannedEKU - f $ EKU ) $ ErrorCodes . BannedEKU <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( ! $ HasBasicConstraints ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorNoBasicConstraints $ ErrorCodes . NoBasicConstraints <nl> + } <nl> + if ( ! $ HasCodeSigningEKU ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorNoCodeSigningEku $ ErrorCodes . NoCodeSigningEku <nl> + } <nl> + } <nl> + <nl> + # <nl> + # Performs operations that require administrative privileges : <nl> + # - Prompt the user to obtain a developer license <nl> + # - Install the developer certificate ( if - Force is not specified , also prompts the user to confirm ) <nl> + # <nl> + function DoElevatedOperations <nl> + { <nl> + if ( $ GetDeveloperLicense ) <nl> + { <nl> + Write - Host $ UiStrings . GettingDeveloperLicense <nl> + <nl> + if ( $ Force ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorForceDeveloperLicense $ ErrorCodes . ForceDeveloperLicense <nl> + } <nl> + try <nl> + { <nl> + Show - WindowsDeveloperLicenseRegistration <nl> + } <nl> + catch <nl> + { <nl> + $ Error [ 0 ] # Dump details about the last error <nl> + PrintMessageAndExit $ UiStrings . ErrorGetDeveloperLicenseFailed $ ErrorCodes . GetDeveloperLicenseFailed <nl> + } <nl> + } <nl> + <nl> + if ( $ CertificatePath ) <nl> + { <nl> + Write - Host $ UiStrings . InstallingCertificate <nl> + <nl> + # Make sure certificate format is valid and usage constraints are followed <nl> + ValidateCertificateFormat $ CertificatePath <nl> + CheckCertificateRestrictions <nl> + <nl> + # If - Force is not specified , warn the user and get consent <nl> + if ( $ Force - or ( ConfirmCertificateInstall ) ) <nl> + { <nl> + # Add cert to store <nl> + certutil . exe - addstore TrustedPeople $ CertificatePath <nl> + if ( $ LastExitCode - lt 0 ) <nl> + { <nl> + PrintMessageAndExit ( $ UiStrings . ErrorCertUtilInstallFailed - f $ LastExitCode ) $ ErrorCodes . CertUtilInstallFailed <nl> + } <nl> + } <nl> + else <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorInstallCertificateCancelled $ ErrorCodes . InstallCertificateCancelled <nl> + } <nl> + } <nl> + } <nl> + <nl> + # <nl> + # Checks whether the machine is missing a valid developer license . <nl> + # <nl> + function CheckIfNeedDeveloperLicense <nl> + { <nl> + $ Result = $ true <nl> + try <nl> + { <nl> + $ Result = ( Get - WindowsDeveloperLicense | Where - Object { $ _ . IsValid } | Measure - Object ) . Count - eq 0 <nl> + } <nl> + catch { } <nl> + <nl> + return $ Result <nl> + } <nl> + <nl> + # <nl> + # Launches an elevated process running the current script to perform tasks <nl> + # that require administrative privileges . This function waits until the <nl> + # elevated process terminates , and checks whether those tasks were successful . <nl> + # <nl> + function LaunchElevated <nl> + { <nl> + # Set up command line arguments to the elevated process <nl> + $ RelaunchArgs = ' - ExecutionPolicy Unrestricted - file " ' + $ ScriptPath + ' " ' <nl> + <nl> + if ( $ Force ) <nl> + { <nl> + $ RelaunchArgs + = ' - Force ' <nl> + } <nl> + if ( $ NeedDeveloperLicense ) <nl> + { <nl> + $ RelaunchArgs + = ' - GetDeveloperLicense ' <nl> + } <nl> + if ( $ SkipLoggingTelemetry ) <nl> + { <nl> + $ RelaunchArgs + = ' - SkipLoggingTelemetry ' <nl> + } <nl> + if ( $ NeedInstallCertificate ) <nl> + { <nl> + $ RelaunchArgs + = ' - CertificatePath " ' + $ DeveloperCertificatePath . FullName + ' " ' <nl> + } <nl> + <nl> + # Launch the process and wait for it to finish <nl> + try <nl> + { <nl> + $ AdminProcess = Start - Process " $ PsHome \ PowerShell . exe " - Verb RunAs - ArgumentList $ RelaunchArgs - PassThru <nl> + } <nl> + catch <nl> + { <nl> + $ Error [ 0 ] # Dump details about the last error <nl> + PrintMessageAndExit $ UiStrings . ErrorLaunchAdminFailed $ ErrorCodes . LaunchAdminFailed <nl> + } <nl> + <nl> + while ( ! ( $ AdminProcess . HasExited ) ) <nl> + { <nl> + Start - Sleep - Seconds 2 <nl> + } <nl> + <nl> + # Check if all elevated operations were successful <nl> + if ( $ NeedDeveloperLicense ) <nl> + { <nl> + if ( CheckIfNeedDeveloperLicense ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorGetDeveloperLicenseFailed $ ErrorCodes . GetDeveloperLicenseFailed <nl> + } <nl> + else <nl> + { <nl> + Write - Host $ UiStrings . AcquireLicenseSuccessful <nl> + } <nl> + } <nl> + if ( $ NeedInstallCertificate ) <nl> + { <nl> + $ Signature = Get - AuthenticodeSignature $ DeveloperPackagePath - Verbose <nl> + if ( $ Signature . Status - ne " Valid " ) <nl> + { <nl> + PrintMessageAndExit ( $ UiStrings . ErrorInstallCertificateFailed - f $ Signature . Status ) $ ErrorCodes . InstallCertificateFailed <nl> + } <nl> + else <nl> + { <nl> + Write - Host $ UiStrings . InstallCertificateSuccessful <nl> + } <nl> + } <nl> + } <nl> + <nl> + # <nl> + # Finds all applicable dependency packages according to OS architecture , and <nl> + # installs the developer package with its dependencies . The expected layout <nl> + # of dependencies is : <nl> + # <nl> + # < current dir > <nl> + # \ Dependencies <nl> + # < Architecture neutral dependencies > . appx \ . msix <nl> + # \ x86 <nl> + # < x86 dependencies > . appx \ . msix <nl> + # \ x64 <nl> + # < x64 dependencies > . appx \ . msix <nl> + # \ arm <nl> + # < arm dependencies > . appx \ . msix <nl> + # \ arm64 <nl> + # < arm64 dependencies > . appx \ . msix <nl> + # <nl> + function InstallPackageWithDependencies <nl> + { <nl> + $ DependencyPackagesDir = ( Join - Path $ ScriptDir " Dependencies " ) <nl> + $ DependencyPackages = @ ( ) <nl> + if ( Test - Path $ DependencyPackagesDir ) <nl> + { <nl> + # Get architecture - neutral dependencies <nl> + $ DependencyPackages + = Get - ChildItem ( Join - Path $ DependencyPackagesDir " * . appx " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + $ DependencyPackages + = Get - ChildItem ( Join - Path $ DependencyPackagesDir " * . msix " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + <nl> + # Get architecture - specific dependencies <nl> + if ( ( $ ProcessorArchitecture - eq " x86 " - or $ ProcessorArchitecture - eq " amd64 " - or $ ProcessorArchitecture - eq " arm64 " ) - and ( Test - Path ( Join - Path $ DependencyPackagesDir " x86 " ) ) ) <nl> + { <nl> + $ DependencyPackages + = Get - ChildItem ( Join - Path $ DependencyPackagesDir " x86 \ * . appx " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + $ DependencyPackages + = Get - ChildItem ( Join - Path $ DependencyPackagesDir " x86 \ * . msix " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + } <nl> + if ( ( $ ProcessorArchitecture - eq " amd64 " ) - and ( Test - Path ( Join - Path $ DependencyPackagesDir " x64 " ) ) ) <nl> + { <nl> + $ DependencyPackages + = Get - ChildItem ( Join - Path $ DependencyPackagesDir " x64 \ * . appx " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + $ DependencyPackages + = Get - ChildItem ( Join - Path $ DependencyPackagesDir " x64 \ * . msix " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + } <nl> + if ( ( $ ProcessorArchitecture - eq " arm " - or $ ProcessorArchitecture - eq " arm64 " ) - and ( Test - Path ( Join - Path $ DependencyPackagesDir " arm " ) ) ) <nl> + { <nl> + $ DependencyPackages + = Get - ChildItem ( Join - Path $ DependencyPackagesDir " arm \ * . appx " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + $ DependencyPackages + = Get - ChildItem ( Join - Path $ DependencyPackagesDir " arm \ * . msix " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + } <nl> + if ( ( $ ProcessorArchitecture - eq " arm64 " ) - and ( Test - Path ( Join - Path $ DependencyPackagesDir " arm64 " ) ) ) <nl> + { <nl> + $ DependencyPackages + = Get - ChildItem ( Join - Path $ DependencyPackagesDir " arm64 \ * . appx " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + $ DependencyPackages + = Get - ChildItem ( Join - Path $ DependencyPackagesDir " arm64 \ * . msix " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + } <nl> + } <nl> + Write - Host $ UiStrings . InstallingPackage <nl> + <nl> + $ AddPackageSucceeded = $ False <nl> + try <nl> + { <nl> + if ( $ DependencyPackages . FullName . Count - gt 0 ) <nl> + { <nl> + Write - Host $ UiStrings . DependenciesFound <nl> + $ DependencyPackages . FullName <nl> + Add - AppxPackage - Path $ DeveloperPackagePath . FullName - DependencyPath $ DependencyPackages . FullName - ForceApplicationShutdown <nl> + } <nl> + else <nl> + { <nl> + Add - AppxPackage - Path $ DeveloperPackagePath . FullName - ForceApplicationShutdown <nl> + } <nl> + $ AddPackageSucceeded = $ ? <nl> + } <nl> + catch <nl> + { <nl> + $ Error [ 0 ] # Dump details about the last error <nl> + } <nl> + <nl> + if ( ! $ AddPackageSucceeded ) <nl> + { <nl> + if ( $ NeedInstallCertificate ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorAddPackageFailedWithCert $ ErrorCodes . AddPackageFailed <nl> + } <nl> + else <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorAddPackageFailed $ ErrorCodes . AddPackageFailed <nl> + } <nl> + } <nl> + } <nl> + <nl> + # <nl> + # Main script logic when the user launches the script without parameters . <nl> + # <nl> + function DoStandardOperations <nl> + { <nl> + # Check for an . appx or . msix file in the script directory <nl> + $ PackagePath = Get - ChildItem ( Join - Path $ ScriptDir " * . appx " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + if ( $ PackagePath - eq $ null ) <nl> + { <nl> + $ PackagePath = Get - ChildItem ( Join - Path $ ScriptDir " * . msix " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + } <nl> + $ PackageCount = ( $ PackagePath | Measure - Object ) . Count <nl> + <nl> + # Check for an . appxbundle or . msixbundle file in the script directory <nl> + $ BundlePath = Get - ChildItem ( Join - Path $ ScriptDir " * . appxbundle " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + if ( $ BundlePath - eq $ null ) <nl> + { <nl> + $ BundlePath = Get - ChildItem ( Join - Path $ ScriptDir " * . msixbundle " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + } <nl> + $ BundleCount = ( $ BundlePath | Measure - Object ) . Count <nl> + <nl> + # Check for an . eappx or . emsix file in the script directory <nl> + $ EncryptedPackagePath = Get - ChildItem ( Join - Path $ ScriptDir " * . eappx " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + if ( $ EncryptedPackagePath - eq $ null ) <nl> + { <nl> + $ EncryptedPackagePath = Get - ChildItem ( Join - Path $ ScriptDir " * . emsix " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + } <nl> + $ EncryptedPackageCount = ( $ EncryptedPackagePath | Measure - Object ) . Count <nl> + <nl> + # Check for an . eappxbundle or . emsixbundle file in the script directory <nl> + $ EncryptedBundlePath = Get - ChildItem ( Join - Path $ ScriptDir " * . eappxbundle " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + if ( $ EncryptedBundlePath - eq $ null ) <nl> + { <nl> + $ EncryptedBundlePath = Get - ChildItem ( Join - Path $ ScriptDir " * . emsixbundle " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + } <nl> + $ EncryptedBundleCount = ( $ EncryptedBundlePath | Measure - Object ) . Count <nl> + <nl> + $ NumberOfPackages = $ PackageCount + $ EncryptedPackageCount <nl> + $ NumberOfBundles = $ BundleCount + $ EncryptedBundleCount <nl> + <nl> + # There must be at least one package or bundle <nl> + if ( $ NumberOfPackages + $ NumberOfBundles - lt 1 ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorNoPackageFound $ ErrorCodes . NoPackageFound <nl> + } <nl> + # We must have exactly one bundle OR no bundle and exactly one package <nl> + elseif ( $ NumberOfBundles - gt 1 - or <nl> + ( $ NumberOfBundles - eq 0 - and $ NumberOfpackages - gt 1 ) ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorManyPackagesFound $ ErrorCodes . ManyPackagesFound <nl> + } <nl> + <nl> + # First attempt to install a bundle or encrypted bundle . If neither exists , fall back to packages and then encrypted packages <nl> + if ( $ BundleCount - eq 1 ) <nl> + { <nl> + $ DeveloperPackagePath = $ BundlePath <nl> + Write - Host ( $ UiStrings . BundleFound - f $ DeveloperPackagePath . FullName ) <nl> + } <nl> + elseif ( $ EncryptedBundleCount - eq 1 ) <nl> + { <nl> + $ DeveloperPackagePath = $ EncryptedBundlePath <nl> + Write - Host ( $ UiStrings . EncryptedBundleFound - f $ DeveloperPackagePath . FullName ) <nl> + } <nl> + elseif ( $ PackageCount - eq 1 ) <nl> + { <nl> + $ DeveloperPackagePath = $ PackagePath <nl> + Write - Host ( $ UiStrings . PackageFound - f $ DeveloperPackagePath . FullName ) <nl> + } <nl> + elseif ( $ EncryptedPackageCount - eq 1 ) <nl> + { <nl> + $ DeveloperPackagePath = $ EncryptedPackagePath <nl> + Write - Host ( $ UiStrings . EncryptedPackageFound - f $ DeveloperPackagePath . FullName ) <nl> + } <nl> + <nl> + # The package must be signed <nl> + $ PackageSignature = Get - AuthenticodeSignature $ DeveloperPackagePath <nl> + $ PackageCertificate = $ PackageSignature . SignerCertificate <nl> + if ( ! $ PackageCertificate ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorPackageUnsigned $ ErrorCodes . PackageUnsigned <nl> + } <nl> + <nl> + # Test if the package signature is trusted . If not , the corresponding certificate <nl> + # needs to be present in the current directory and needs to be installed . <nl> + $ NeedInstallCertificate = ( $ PackageSignature . Status - ne " Valid " ) <nl> + <nl> + if ( $ NeedInstallCertificate ) <nl> + { <nl> + # List all . cer files in the script directory <nl> + $ DeveloperCertificatePath = Get - ChildItem ( Join - Path $ ScriptDir " * . cer " ) | Where - Object { $ _ . Mode - NotMatch " d " } <nl> + $ DeveloperCertificateCount = ( $ DeveloperCertificatePath | Measure - Object ) . Count <nl> + <nl> + # There must be exactly 1 certificate <nl> + if ( $ DeveloperCertificateCount - lt 1 ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorNoCertificateFound $ ErrorCodes . NoCertificateFound <nl> + } <nl> + elseif ( $ DeveloperCertificateCount - gt 1 ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorManyCertificatesFound $ ErrorCodes . ManyCertificatesFound <nl> + } <nl> + <nl> + Write - Host ( $ UiStrings . CertificateFound - f $ DeveloperCertificatePath . FullName ) <nl> + <nl> + # The . cer file must have the format of a valid certificate <nl> + ValidateCertificateFormat $ DeveloperCertificatePath <nl> + <nl> + # The package signature must match the certificate file <nl> + if ( $ PackageCertificate - ne ( Get - PfxCertificate $ DeveloperCertificatePath ) ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorCertificateMismatch $ ErrorCodes . CertificateMismatch <nl> + } <nl> + } <nl> + <nl> + $ NeedDeveloperLicense = CheckIfNeedDeveloperLicense <nl> + <nl> + # Relaunch the script elevated with the necessary parameters if needed <nl> + if ( $ NeedDeveloperLicense - or $ NeedInstallCertificate ) <nl> + { <nl> + Write - Host $ UiStrings . ElevateActions <nl> + if ( $ NeedDeveloperLicense ) <nl> + { <nl> + Write - Host $ UiStrings . ElevateActionDevLicense <nl> + } <nl> + if ( $ NeedInstallCertificate ) <nl> + { <nl> + Write - Host $ UiStrings . ElevateActionCertificate <nl> + } <nl> + <nl> + $ IsAlreadyElevated = ( [ Security . Principal . WindowsIdentity ] : : GetCurrent ( ) . Groups . Value - contains " S - 1 - 5 - 32 - 544 " ) <nl> + if ( $ IsAlreadyElevated ) <nl> + { <nl> + if ( $ Force - and $ NeedDeveloperLicense ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorForceDeveloperLicense $ ErrorCodes . ForceDeveloperLicense <nl> + } <nl> + if ( $ Force - and $ NeedInstallCertificate ) <nl> + { <nl> + Write - Warning $ UiStrings . WarningInstallCert <nl> + } <nl> + } <nl> + else <nl> + { <nl> + if ( $ Force ) <nl> + { <nl> + PrintMessageAndExit $ UiStrings . ErrorForceElevate $ ErrorCodes . ForceElevate <nl> + } <nl> + else <nl> + { <nl> + Write - Host $ UiStrings . ElevateActionsContinue <nl> + Pause <nl> + } <nl> + } <nl> + <nl> + LaunchElevated <nl> + } <nl> + <nl> + InstallPackageWithDependencies <nl> + } <nl> + <nl> + # <nl> + # Main script entry point <nl> + # <nl> + if ( $ GetDeveloperLicense - or $ CertificatePath ) <nl> + { <nl> + DoElevatedOperations <nl> + } <nl> + else <nl> + { <nl> + DoStandardOperations <nl> + PrintMessageAndExit $ UiStrings . Success $ ErrorCodes . Success <nl> + } <nl> mmm a / vnext / local - cli / runWindows / utils / deploy . js <nl> ppp b / vnext / local - cli / runWindows / utils / deploy . js <nl> const http = require ( ' http ' ) ; <nl> const path = require ( ' path ' ) ; <nl> const glob = require ( ' glob ' ) ; <nl> const parse = require ( ' xml - parser ' ) ; <nl> + const child_process = require ( ' child_process ' ) ; <nl> + const EOL = require ( ' os ' ) . EOL ; <nl> const WinAppDeployTool = require ( ' . / winappdeploytool ' ) ; <nl> const { <nl> newInfo , <nl> function getAppPackage ( options ) { <nl> if ( ! appPackage & & options . release ) { <nl> / / in the latest vs , Release is removed <nl> newWarn ( <nl> - ' No package found in * _Release_ * folder , remove _Release_ and check again ' , <nl> + ' No package found in * _Release_ * folder , removing the _Release_ prefix and checking again ' , <nl> ) ; <nl> <nl> - appPackage = glob . sync ( <nl> - ` $ { options . root } / windows / { * / AppPackages , AppPackages / * } / * _ $ { <nl> - options . arch <nl> - } _ * ` , <nl> - ) [ 0 ] ; <nl> + const rootGlob = ` $ { options . root } / windows / { * / AppPackages , AppPackages / * } ` ; <nl> + const newGlob = ` $ { rootGlob } / * _ $ { <nl> + options . arch = = = ' x86 ' ? ' Win32 ' : options . arch <nl> + } _ $ { options . release ? ' ' : ' Debug_ ' } Test ` ; <nl> + <nl> + const result = glob . sync ( newGlob ) ; <nl> + if ( result . length > 1 ) { <nl> + newWarn ( ` More than one app package found : $ { result } ` ) ; <nl> + } else if ( result . length = = = 1 ) { <nl> + / / we ' re good <nl> + } <nl> + appPackage = glob . sync ( newGlob ) [ 0 ] ; <nl> } <nl> <nl> if ( ! appPackage ) { <nl> async function deployToDesktop ( options , verbose , slnFile ) { <nl> path . join ( appPackageFolder , ' Add - AppDevPackage . ps1 ' ) , <nl> ) [ 0 ] ; <nl> <nl> + / / This path is maintained and VS has promised to keep it valid . <nl> + const vsWherePath = path . join ( <nl> + process . env [ ' ProgramFiles ( x86 ) ' ] | | process . env . ProgramFiles , <nl> + ' / Microsoft Visual Studio / Installer / vswhere . exe ' , <nl> + ) ; <nl> + <nl> + const vsVersion = child_process <nl> + . execSync ( <nl> + ` " $ { vsWherePath } " - version 16 - property catalog_productDisplayVersion ` , <nl> + ) <nl> + . toString ( ) <nl> + . split ( EOL ) [ 0 ] ; <nl> + <nl> + if ( vsVersion . startsWith ( ' 16 . 5 ' ) | | vsVersion . startsWith ( ' 16 . 6 ' ) ) { <nl> + / / VS 16 . 5 and 16 . 6 introduced a regression in packaging where the certificates created in the UI will render the package uninstallable . <nl> + / / This will be fixed in 16 . 7 . In the meantime we need to copy the Add - AppDevPackage that has the fix for this EKU issue : <nl> + / / https : / / developercommunity . visualstudio . com / content / problem / 1012921 / uwp - packaging - generates - incompatible - certificate . html <nl> + if ( verbose ) { <nl> + newWarn ( <nl> + ' Applying Add - AppDevPackage . ps1 workaround for VS 16 . 5 - 16 . 6 bug - see https : / / developercommunity . visualstudio . com / content / problem / 1012921 / uwp - packaging - generates - incompatible - certificate . html ' , <nl> + ) ; <nl> + } <nl> + fs . copyFileSync ( <nl> + path . join ( path . resolve ( __dirname ) , ' Add - AppDevPackage . ps1 ' ) , <nl> + script , <nl> + ) ; <nl> + } <nl> + <nl> let args = [ ' - - remote - debugging ' , options . proxy ? ' true ' : ' false ' ] ; <nl> <nl> if ( options . directDebugging ) { <nl> async function deployToDesktop ( options , verbose , slnFile ) { <nl> await runPowerShellScriptFunction ( <nl> ' Enabling Developer Mode ' , <nl> windowsStoreAppUtils , <nl> - ` EnableDevMode " $ { script } " ` , <nl> + ' EnableDevMode ' , <nl> verbose , <nl> ) ; <nl> <nl>
Work around regression in UWP app packaging in VS 16 . 5 - 16 . 6 ( )
microsoft/react-native-windows
8253a685dec0915fd60f169975be45891df00660
2020-05-21T03:13:24Z
mmm a / ChangeLog <nl> ppp b / ChangeLog <nl> <nl> + 2009 - 12 - 05 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> + <nl> + Added - - disable - ipv6 option to disable IPv6 . <nl> + * doc / aria2c . 1 . txt <nl> + * src / InitiateConnectionCommand . cc <nl> + * src / NameResolver . cc <nl> + * src / NameResolver . h <nl> + * src / OptionHandlerFactory . cc <nl> + * src / main . cc <nl> + * src / prefs . cc <nl> + * src / prefs . h <nl> + * src / usage_text . h <nl> + <nl> 2009 - 12 - 05 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> <nl> Updated usage text for - - bt - prioritize - piece option . <nl> mmm a / doc / aria2c . 1 <nl> ppp b / doc / aria2c . 1 <nl> and standard input , standard output and standard error will be redirected to <nl> \ fIfalse \ fR <nl> . RE <nl> . PP <nl> + \ fB \ - \ - disable \ - ipv6 \ fR [ = \ fItrue \ fR | \ fIfalse \ fR ] <nl> + . RS 4 <nl> + Disable IPv6 \ & . This is useful if you have to use broken DNS and want to avoid terribly slow AAAA record lookup \ & . Default : <nl> + \ fIfalse \ fR <nl> + . RE <nl> + . PP <nl> \ fB \ - \ - enable \ - direct \ - io \ fR [ = \ fItrue \ fR | \ fIfalse \ fR ] <nl> . RS 4 <nl> Enable directI / O , which lowers cpu usage while allocating / checking files \ & . Turn off if you encounter any error \ & . Default : <nl> Bind sockets to given interface \ & . You can specify interface name , IP address an <nl> . ps - 1 <nl> . br <nl> . sp <nl> - If an interface has multiple addresses , it is highly recommended to specify IP address explicitly \ & . <nl> + If an interface has multiple addresses , it is highly recommended to specify IP address explicitly \ & . See also \ fB \ - \ - disable \ - ipv6 \ fR \ & . <nl> . sp . 5v <nl> . RE <nl> . PP <nl> mmm a / doc / aria2c . 1 . html <nl> ppp b / doc / aria2c . 1 . html <nl> < h3 id = " _advanced_options " > Advanced Options < / h3 > < div style = " clear : left " > < / div > <nl> < / p > <nl> < / dd > <nl> < dt class = " hdlist1 " > <nl> + < strong > - - disable - ipv6 < / strong > [ = < em > true < / em > | < em > false < / em > ] <nl> + < / dt > <nl> + < dd > <nl> + < p > <nl> + Disable IPv6 . This is useful if you have to use broken DNS and want <nl> + to avoid terribly slow AAAA record lookup . Default : < em > false < / em > <nl> + < / p > <nl> + < / dd > <nl> + < dt class = " hdlist1 " > <nl> < strong > - - enable - direct - io < / strong > [ = < em > true < / em > | < em > false < / em > ] <nl> < / dt > <nl> < dd > <nl> < h3 id = " _advanced_options " > Advanced Options < / h3 > < div style = " clear : left " > < / div > <nl> < div class = " title " > Note < / div > <nl> < / td > <nl> < td class = " content " > If an interface has multiple addresses , it is highly recommended to specify <nl> - IP address explicitly . < / td > <nl> + IP address explicitly . See also < strong > - - disable - ipv6 < / strong > . < / td > <nl> < / tr > < / table > <nl> < / div > <nl> < div class = " dlist " > < dl > <nl> < h2 id = " _copyright " > COPYRIGHT < / h2 > <nl> < div id = " footnotes " > < hr / > < / div > <nl> < div id = " footer " > <nl> < div id = " footer - text " > <nl> - Last updated 2009 - 12 - 05 15 : 42 : 10 JST <nl> + Last updated 2009 - 12 - 05 16 : 08 : 32 JST <nl> < / div > <nl> < / div > <nl> < / body > <nl> mmm a / doc / aria2c . 1 . txt <nl> ppp b / doc / aria2c . 1 . txt <nl> Advanced Options <nl> and standard input , standard output and standard error will be <nl> redirected to ' / dev / null ' . Default : ' false ' <nl> <nl> + * - - disable - ipv6 * [ = ' true ' | ' false ' ] : : <nl> + <nl> + Disable IPv6 . This is useful if you have to use broken DNS and want <nl> + to avoid terribly slow AAAA record lookup . Default : ' false ' <nl> + <nl> * - - enable - direct - io * [ = ' true ' | ' false ' ] : : <nl> Enable directI / O , which lowers cpu usage while allocating / checking files . <nl> Turn off if you encounter any error . <nl> Advanced Options <nl> <nl> [ NOTE ] <nl> If an interface has multiple addresses , it is highly recommended to specify <nl> - IP address explicitly . <nl> + IP address explicitly . See also * - - disable - ipv6 * . <nl> <nl> * - - log - level * = LEVEL : : <nl> Set log level to output . <nl> mmm a / src / InitiateConnectionCommand . cc <nl> ppp b / src / InitiateConnectionCommand . cc <nl> bool InitiateConnectionCommand : : executeInternal ( ) { <nl> { <nl> NameResolver res ; <nl> res . setSocktype ( SOCK_STREAM ) ; <nl> + if ( e - > option - > getAsBool ( PREF_DISABLE_IPV6 ) ) { <nl> + res . setFamily ( AF_INET ) ; <nl> + } <nl> res . resolve ( addrs , hostname ) ; <nl> } <nl> logger - > info ( MSG_NAME_RESOLUTION_COMPLETE , cuid , <nl> mmm a / src / NameResolver . cc <nl> ppp b / src / NameResolver . cc <nl> <nl> * / <nl> / * copyright - - > * / <nl> # include " NameResolver . h " <nl> + <nl> + # include < cstring > <nl> + <nl> # include " DlAbortEx . h " <nl> # include " message . h " <nl> # include " StringFormat . h " <nl> # include " util . h " <nl> - # include < cstring > <nl> <nl> namespace aria2 { <nl> <nl> - NameResolver : : NameResolver ( ) : _socktype ( 0 ) { } <nl> + NameResolver : : NameResolver ( ) : _socktype ( 0 ) , _family ( AF_UNSPEC ) { } <nl> <nl> void NameResolver : : resolve ( std : : deque < std : : string > & resolvedAddresses , <nl> const std : : string & hostname ) <nl> void NameResolver : : resolve ( std : : deque < std : : string > & resolvedAddresses , <nl> struct addrinfo hints ; <nl> struct addrinfo * res ; <nl> memset ( & hints , 0 , sizeof ( hints ) ) ; <nl> - hints . ai_family = AF_UNSPEC ; <nl> + hints . ai_family = _family ; <nl> hints . ai_socktype = _socktype ; <nl> hints . ai_flags = 0 ; <nl> hints . ai_protocol = 0 ; <nl> mmm a / src / NameResolver . h <nl> ppp b / src / NameResolver . h <nl> namespace aria2 { <nl> class NameResolver { <nl> private : <nl> int _socktype ; <nl> + int _family ; <nl> public : <nl> NameResolver ( ) ; <nl> <nl> class NameResolver { <nl> <nl> / / specify SOCK_STREAM or SOCK_DGRAM <nl> void setSocktype ( int socktype ) ; <nl> + <nl> + / / specify protocol family <nl> + void setFamily ( int family ) <nl> + { <nl> + _family = family ; <nl> + } <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / OptionHandlerFactory . cc <nl> ppp b / src / OptionHandlerFactory . cc <nl> OptionHandlers OptionHandlerFactory : : createOptionHandlers ( ) <nl> op - > addTag ( TAG_FILE ) ; <nl> handlers . push_back ( op ) ; <nl> } <nl> + { <nl> + SharedHandle < OptionHandler > op ( new BooleanOptionHandler <nl> + ( PREF_DISABLE_IPV6 , <nl> + TEXT_DISABLE_IPV6 , <nl> + V_FALSE , <nl> + OptionHandler : : OPT_ARG ) ) ; <nl> + op - > addTag ( TAG_ADVANCED ) ; <nl> + handlers . push_back ( op ) ; <nl> + } <nl> { <nl> SharedHandle < NumberOptionHandler > op ( new NumberOptionHandler <nl> ( PREF_DNS_TIMEOUT , <nl> mmm a / src / main . cc <nl> ppp b / src / main . cc <nl> downloadresultcode : : RESULT main ( int argc , char * argv [ ] ) <nl> MessageDigestHelper : : staticSHA1DigestInit ( ) ; <nl> # endif / / ENABLE_MESSAGE_DIGEST <nl> <nl> + if ( op - > getAsBool ( PREF_DISABLE_IPV6 ) ) { <nl> + SocketCore : : setProtocolFamily ( AF_INET ) ; <nl> + } <nl> / / Bind interface <nl> if ( ! op - > get ( PREF_INTERFACE ) . empty ( ) ) { <nl> std : : string interface = op - > get ( PREF_INTERFACE ) ; <nl> mmm a / src / prefs . cc <nl> ppp b / src / prefs . cc <nl> const std : : string PREF_ON_DOWNLOAD_ERROR ( " on - download - error " ) ; <nl> const std : : string PREF_XML_RPC_LISTEN_ALL ( " xml - rpc - listen - all " ) ; <nl> / / value : string <nl> const std : : string PREF_INTERFACE ( " interface " ) ; <nl> + / / value : true | false <nl> + const std : : string PREF_DISABLE_IPV6 ( " disable - ipv6 " ) ; <nl> <nl> / * * <nl> * FTP related preferences <nl> mmm a / src / prefs . h <nl> ppp b / src / prefs . h <nl> extern const std : : string PREF_ON_DOWNLOAD_ERROR ; <nl> extern const std : : string PREF_XML_RPC_LISTEN_ALL ; <nl> / / value : string <nl> extern const std : : string PREF_INTERFACE ; <nl> + / / value : true | false <nl> + extern const std : : string PREF_DISABLE_IPV6 ; <nl> <nl> / * * <nl> * FTP related preferences <nl> mmm a / src / usage_text . h <nl> ppp b / src / usage_text . h <nl> _ ( " - - bt - prioritize - piece = head [ = SIZE ] , tail [ = SIZE ] Try to download first and last <nl> # define TEXT_INTERFACE \ <nl> _ ( " - - interface = INTERFACE Bind sockets to given interface . You can specify \ n " \ <nl> " interface name , IP address and hostname . " ) <nl> + # define TEXT_DISABLE_IPV6 \ <nl> + _ ( " - - disable - ipv6 [ = true | false ] Disable IPv6 . " ) <nl>
2009 - 12 - 05 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net >
aria2/aria2
4100ba77c3fef3581ffd570a58185b867c80b29c
2009-12-05T07:10:23Z
mmm a / test / api - digester / source - stability . swift <nl> ppp b / test / api - digester / source - stability . swift <nl> <nl> / / REQUIRES : OS = macosx <nl> / / RUN : % empty - directory ( % t . tmp ) <nl> / / mkdir % t . tmp / module - cache & & mkdir % t . tmp / dummy . sdk <nl> - / / RUN : % api - digester - dump - sdk - module Swift - o % t . tmp / current - stdlib . json - module - cache - path % t . tmp / module - cache - sdk % t . tmp / dummy . sdk - swift - version 3 <nl> + / / RUN : % api - digester - dump - sdk - module Swift - o % t . tmp / current - stdlib . json - module - cache - path % t . tmp / module - cache - sdk % t . tmp / dummy . sdk <nl> / / RUN : % api - digester - diagnose - sdk - input - paths % S / stdlib - stable . json - input - paths % t . tmp / current - stdlib . json > > % t . tmp / changes . txt <nl> / / RUN : % clang - E - P - x c % S / source - stability . swift . expected - o - | sed ' / ^ \ s * $ / d ' > % t . tmp / source - stability . swift . expected <nl> / / RUN : % clang - E - P - x c % t . tmp / changes . txt - o - | sed ' / ^ \ s * $ / d ' > % t . tmp / changes . txt . tmp <nl> / / RUN : diff - u % t . tmp / source - stability . swift . expected % t . tmp / changes . txt . tmp <nl> <nl> - / / REQUIRES : rdar_43425867 <nl> mmm a / test / api - digester / source - stability . swift . expected <nl> ppp b / test / api - digester / source - stability . swift . expected <nl> <nl> - / * FIXME : Bogus * / <nl> - TypeAlias DictionaryIterator . Element has been removed <nl> - TypeAlias SetIterator . Element has been removed <nl> - Var DictionaryIterator . customMirror has been removed <nl> - Var SetIterator . customMirror has been removed <nl> - Func DictionaryIterator . next ( ) has been removed <nl> - Func SetIterator . next ( ) has been removed <nl> - <nl> - / * Renamed Decls ( FIXME : Targets are Dictionary . Iterator & Set . Iterator ) * / <nl> - Struct DictionaryIterator has been renamed to Struct Iterator <nl> - Struct SetIterator has been renamed to Struct Iterator <nl> - <nl> - / * FIXME : Bogus * / <nl> + <nl> + / * Generic Signature Changes * / <nl> + <nl> + / * RawRepresentable Changes * / <nl> + <nl> + / * Removed Decls * / <nl> + TypeAlias AbsoluteValuable has been removed <nl> + TypeAlias BitwiseOperations has been removed ( deprecated ) <nl> + TypeAlias IntMax has been removed <nl> + TypeAlias Integer has been removed <nl> + TypeAlias IntegerArithmetic has been removed <nl> + TypeAlias SignedNumber has been removed <nl> + TypeAlias StringProtocol . UTF16Index has been removed ( deprecated ) <nl> + TypeAlias StringProtocol . UTF8Index has been removed ( deprecated ) <nl> + TypeAlias StringProtocol . UnicodeScalarIndex has been removed ( deprecated ) <nl> + TypeAlias UIntMax has been removed <nl> + Var FixedWidthInteger . allZeros has been removed ( deprecated ) <nl> + Constructor Int . init ( truncatingBitPattern : ) has been removed <nl> + Constructor Int16 . init ( truncatingBitPattern : ) has been removed <nl> + Constructor Int32 . init ( truncatingBitPattern : ) has been removed <nl> + Constructor Int8 . init ( truncatingBitPattern : ) has been removed <nl> + Constructor String . init ( _ : obsoletedInSwift4 : ) has been removed <nl> + Constructor UInt . init ( truncatingBitPattern : ) has been removed <nl> + Constructor UInt16 . init ( truncatingBitPattern : ) has been removed <nl> + Constructor UInt32 . init ( truncatingBitPattern : ) has been removed <nl> + Constructor UInt8 . init ( truncatingBitPattern : ) has been removed <nl> + Func BinaryInteger . toIntMax ( ) has been removed <nl> + Func FixedWidthInteger . addWithOverflow ( _ : _ : ) has been removed <nl> + Func FixedWidthInteger . divideWithOverflow ( _ : _ : ) has been removed <nl> + Func FixedWidthInteger . multiplyWithOverflow ( _ : _ : ) has been removed <nl> + Func FixedWidthInteger . remainderWithOverflow ( _ : _ : ) has been removed <nl> + Func FixedWidthInteger . subtractWithOverflow ( _ : _ : ) has been removed <nl> + Func FloatingPoint . abs ( _ : ) has been removed ( deprecated ) <nl> + Func FloatingPoint . add ( _ : ) has been removed <nl> + Func FloatingPoint . adding ( _ : ) has been removed <nl> + Func FloatingPoint . divide ( by : ) has been removed <nl> + Func FloatingPoint . divided ( by : ) has been removed <nl> + Func FloatingPoint . multiplied ( by : ) has been removed <nl> + Func FloatingPoint . multiply ( by : ) has been removed <nl> + Func FloatingPoint . negated ( ) has been removed <nl> + Func FloatingPoint . subtract ( _ : ) has been removed <nl> + Func FloatingPoint . subtracting ( _ : ) has been removed <nl> + Func Int . toUIntMax ( ) has been removed <nl> + Func Int16 . toUIntMax ( ) has been removed <nl> + Func Int32 . toUIntMax ( ) has been removed <nl> + Func Int64 . toUIntMax ( ) has been removed <nl> + Func Int8 . toUIntMax ( ) has been removed <nl> + Func Sequence . flatMap ( _ : ) has been removed <nl> + Func SignedNumeric . abs ( _ : ) has been removed <nl> + Func String . UTF16View . distance ( from : to : ) has been removed <nl> + Func String . UTF16View . index ( _ : offsetBy : ) has been removed <nl> + Func String . UTF16View . index ( after : ) has been removed <nl> + Func String . UTF8View . distance ( from : to : ) has been removed <nl> + Func String . UTF8View . index ( _ : offsetBy : ) has been removed <nl> + Func String . UTF8View . index ( after : ) has been removed <nl> + Func String . UnicodeScalarView . distance ( from : to : ) has been removed <nl> + Func String . UnicodeScalarView . index ( _ : offsetBy : ) has been removed <nl> + Func String . UnicodeScalarView . index ( after : ) has been removed <nl> + Func String . UnicodeScalarView . popFirst ( ) has been removed ( deprecated ) <nl> + Func String . popFirst ( ) has been removed ( deprecated ) <nl> + Func UInt . toIntMax ( ) has been removed <nl> + Func UInt16 . toIntMax ( ) has been removed <nl> + Func UInt32 . toIntMax ( ) has been removed <nl> + Func UInt64 . toIntMax ( ) has been removed <nl> + Func UInt8 . toIntMax ( ) has been removed <nl> + Func UnsignedInteger . toUIntMax ( ) has been removed <nl> + <nl> + / * Moved Decls * / <nl> + <nl> + / * Renamed Decls * / <nl> + Func Dictionary . filter ( _ : obsoletedInSwift4 : ) has been renamed to Func Dictionary . filter ( _ : ) <nl> + Func Set . filter ( _ : obsoletedInSwift4 : ) has been renamed to Func Set . filter ( _ : ) <nl> + <nl> + / * Type Changes * / <nl> + Var Dictionary . keys has declared type change from LazyMapCollection < [ Key : Value ] , Key > to Dictionary < Key , Value > . Keys <nl> + Var Dictionary . values has declared type change from LazyMapCollection < [ Key : Value ] , Value > to Dictionary < Key , Value > . Values <nl> + Constructor String . init ( _ : ) has return type change from String ? to String <nl> + Func Dictionary . filter ( _ : obsoletedInSwift4 : ) has return type change from [ Dictionary < Key , Value > . Element ] to [ Dictionary < Key , Value > . Key : Dictionary < Key , Value > . Value ] <nl> Func Dictionary . makeIterator ( ) has return type change from DictionaryIterator < Dictionary < Key , Value > . Key , Dictionary < Key , Value > . Value > to Dictionary < Key , Value > . Iterator <nl> + Func Set . filter ( _ : obsoletedInSwift4 : ) has return type change from [ Set < Element > . Element ] to Set < Element > <nl> Func Set . makeIterator ( ) has return type change from SetIterator < Element > to Set < Element > . Iterator <nl> + <nl> + / * Decl Attribute changes * / <nl> mmm a / tools / swift - api - digester / swift - api - digester . cpp <nl> ppp b / tools / swift - api - digester / swift - api - digester . cpp <nl> class SDKNodeVisitor { <nl> virtual ~ SDKNodeVisitor ( ) = default ; <nl> } ; <nl> <nl> + enum class NodeMatchReason : uint8_t { <nl> + <nl> + / / Two nodes are matched because they ' re both roots . <nl> + Root , <nl> + <nl> + / / The first node is missing . <nl> + Added , <nl> + <nl> + / / The second node is missing . <nl> + Removed , <nl> + <nl> + / / The nodes are considered a pair becuase they have same / similar name . <nl> + Name , <nl> + <nl> + / / The nodes are matched because they ' re in the same order , e . g . ith child of <nl> + / / a type declaration . <nl> + Sequential , <nl> + <nl> + / / The first node is a function and it chanaged to a propery as the second <nl> + / / node . <nl> + FuncToProperty , <nl> + <nl> + / / The first node is a global variable and the second node is an enum element . <nl> + ModernizeEnum , <nl> + <nl> + / / The first node is a type declaration and the second node is a type alias <nl> + / / of another type declaration . <nl> + TypeToTypeAlias , <nl> + } ; <nl> + <nl> / / During the matching phase , any matched node will be reported using this API . <nl> / / For update Node left = { Node before change } Right = { Node after change } ; <nl> / / For added Node left = { NilNode } Right = { Node after change } ; <nl> / / For removed Node left = { Node before change } Right = { NilNode } <nl> struct MatchedNodeListener { <nl> - virtual void foundMatch ( NodePtr Left , NodePtr Right ) = 0 ; <nl> - virtual void foundRemoveAddMatch ( NodePtr Removed , NodePtr Added ) { } <nl> + virtual void foundMatch ( NodePtr Left , NodePtr Right , NodeMatchReason Reason ) = 0 ; <nl> virtual ~ MatchedNodeListener ( ) = default ; <nl> } ; <nl> <nl> using NodePairVector = llvm : : MapVector < NodePtr , NodePtr > ; <nl> <nl> / / This map keeps track of updated nodes ; thus we can conveniently find out what <nl> / / is the counterpart of a node before or after being updated . <nl> - class UpdatedNodesMap : public MatchedNodeListener { <nl> + class UpdatedNodesMap { <nl> NodePairVector MapImpl ; <nl> UpdatedNodesMap ( const UpdatedNodesMap & that ) = delete ; <nl> public : <nl> UpdatedNodesMap ( ) = default ; <nl> NodePtr findUpdateCounterpart ( const SDKNode * Node ) const ; <nl> - void foundMatch ( NodePtr Left , NodePtr Right ) override { <nl> + void insert ( NodePtr Left , NodePtr Right ) { <nl> assert ( Left & & Right & & " Not update operation . " ) ; <nl> MapImpl . insert ( { Left , Right } ) ; <nl> } <nl> static raw_ostream & operator < < ( raw_ostream & Out , const DeclKind Value ) { <nl> llvm_unreachable ( " Unhandled DeclKind in switch . " ) ; <nl> } <nl> <nl> - / / / We don ' t dump individual extension declaration in the digester . However , <nl> - / / / we still want to detect whether an extension ' s applicability changes . Therefore , <nl> - / / / by using ParentExtensionInfo , we keep track of extension ' s information in <nl> - / / / each member of the extension . <nl> - class ParentExtensionInfo { <nl> - friend struct SDKNodeInitInfo ; <nl> - friend class SDKNode ; <nl> - std : : vector < StringRef > Requirements ; <nl> - <nl> - void * operator new ( size_t Bytes , SDKContext & C ) { <nl> - return C . allocator ( ) . Allocate < ParentExtensionInfo > ( ) ; <nl> - } <nl> - public : <nl> - ArrayRef < StringRef > getGenericRequirements ( ) const { return Requirements ; } <nl> - } ; <nl> - <nl> / / / The additional information we need to create a type node . <nl> struct TypeInitInfo { <nl> bool IsImplicitlyUnwrappedOptional = false ; <nl> class SequentialNodeMatcher : public NodeMatcher { <nl> if ( L & & R & & * L = = * R ) <nl> continue ; <nl> if ( ! L | | ! R ) <nl> - Listener . foundRemoveAddMatch ( L , R ) ; <nl> + Listener . foundMatch ( L , R , <nl> + L ? NodeMatchReason : : Removed : NodeMatchReason : : Added ) ; <nl> else <nl> - Listener . foundMatch ( L , R ) ; <nl> + Listener . foundMatch ( L , R , NodeMatchReason : : Sequential ) ; <nl> } <nl> } <nl> } ; <nl> class BestMatchMatcher : public NodeMatcher { <nl> NodeVector & Right ; <nl> llvm : : function_ref < bool ( NodePtr , NodePtr ) > CanMatch ; <nl> llvm : : function_ref < bool ( NodeMatch , NodeMatch ) > IsFirstMatchBetter ; <nl> + NodeMatchReason Reason ; <nl> MatchedNodeListener & Listener ; <nl> llvm : : SmallPtrSet < NodePtr , 16 > MatchedRight ; <nl> <nl> class BestMatchMatcher : public NodeMatcher { <nl> BestMatchMatcher ( NodeVector & Left , NodeVector & Right , <nl> llvm : : function_ref < bool ( NodePtr , NodePtr ) > CanMatch , <nl> llvm : : function_ref < bool ( NodeMatch , NodeMatch ) > IsFirstMatchBetter , <nl> + NodeMatchReason Reason , <nl> MatchedNodeListener & Listener ) : Left ( Left ) , Right ( Right ) , <nl> CanMatch ( CanMatch ) , <nl> - IsFirstMatchBetter ( IsFirstMatchBetter ) , <nl> + IsFirstMatchBetter ( IsFirstMatchBetter ) , Reason ( Reason ) , <nl> Listener ( Listener ) { } <nl> <nl> void match ( ) override { <nl> for ( auto L : Left ) { <nl> if ( auto Best = findBestMatch ( L , Right ) ) { <nl> MatchedRight . insert ( Best . getValue ( ) ) ; <nl> - Listener . foundMatch ( L , Best . getValue ( ) ) ; <nl> + Listener . foundMatch ( L , Best . getValue ( ) , Reason ) ; <nl> } <nl> } <nl> } <nl> class RemovedAddedNodeMatcher : public NodeMatcher , public MatchedNodeListener { <nl> if ( contains ( Matched , A ) ) <nl> continue ; <nl> if ( Left ) <nl> - Listener . foundRemoveAddMatch ( A , nullptr ) ; <nl> + Listener . foundMatch ( A , nullptr , NodeMatchReason : : Removed ) ; <nl> else <nl> - Listener . foundRemoveAddMatch ( nullptr , A ) ; <nl> + Listener . foundMatch ( nullptr , A , NodeMatchReason : : Added ) ; <nl> } <nl> } <nl> <nl> class RemovedAddedNodeMatcher : public NodeMatcher , public MatchedNodeListener { <nl> return false ; <nl> } <nl> R - > annotate ( NodeAnnotation : : PropertyName , A - > getPrintedName ( ) ) ; <nl> - foundMatch ( R , A ) ; <nl> + foundMatch ( R , A , NodeMatchReason : : FuncToProperty ) ; <nl> return true ; <nl> } <nl> } <nl> class RemovedAddedNodeMatcher : public NodeMatcher , public MatchedNodeListener { <nl> return N - > getUsr ( ) . substr ( LastPartIndex + 1 ) ; <nl> } <nl> <nl> + bool detectTypeAliasChange ( SDKNodeDecl * R , SDKNodeDecl * A ) { <nl> + if ( R - > getPrintedName ( ) ! = A - > getPrintedName ( ) ) <nl> + return false ; <nl> + if ( R - > getKind ( ) = = SDKNodeKind : : DeclType & & <nl> + A - > getKind ( ) = = SDKNodeKind : : DeclTypeAlias ) { <nl> + foundMatch ( R , A , NodeMatchReason : : TypeToTypeAlias ) ; <nl> + return true ; <nl> + } else { <nl> + return false ; <nl> + } <nl> + } <nl> + <nl> bool detectModernizeEnum ( SDKNodeDecl * R , SDKNodeDecl * A ) { <nl> if ( ! isAnonymousEnum ( R ) | | ! isNominalEnum ( A ) ) <nl> return false ; <nl> class RemovedAddedNodeMatcher : public NodeMatcher , public MatchedNodeListener { <nl> Child - > getName ( ) ) . str ( ) ; <nl> R - > annotate ( NodeAnnotation : : ModernizeEnum , <nl> R - > getSDKContext ( ) . buffer ( FullName ) ) ; <nl> - foundMatch ( R , A ) ; <nl> + foundMatch ( R , A , NodeMatchReason : : ModernizeEnum ) ; <nl> return true ; <nl> } <nl> } <nl> class RemovedAddedNodeMatcher : public NodeMatcher , public MatchedNodeListener { <nl> auto LastR = getLastPartOfUsr ( R ) ; <nl> auto LastA = getLastPartOfUsr ( A ) ; <nl> if ( LastR & & LastA & & LastR . getValue ( ) = = LastA . getValue ( ) ) { <nl> - foundMatch ( R , A ) ; <nl> + foundMatch ( R , A , NodeMatchReason : : Name ) ; <nl> return true ; <nl> } <nl> return false ; <nl> class RemovedAddedNodeMatcher : public NodeMatcher , public MatchedNodeListener { <nl> # undef DIST <nl> } <nl> <nl> - void foundMatch ( NodePtr R , NodePtr A ) override { <nl> - Listener . foundRemoveAddMatch ( R , A ) ; <nl> + void foundMatch ( NodePtr R , NodePtr A , NodeMatchReason Reason ) override { <nl> + Listener . foundMatch ( R , A , Reason ) ; <nl> RemovedMatched . push_back ( R ) ; <nl> AddedMatched . push_back ( A ) ; <nl> } <nl> class RemovedAddedNodeMatcher : public NodeMatcher , public MatchedNodeListener { <nl> auto RD = R - > getAs < SDKNodeDecl > ( ) ; <nl> auto AD = A - > getAs < SDKNodeDecl > ( ) ; <nl> if ( detectFuncToProperty ( RD , AD ) | | detectModernizeEnum ( RD , AD ) | | <nl> - detectSameAnonymousEnum ( RD , AD ) ) { <nl> + detectSameAnonymousEnum ( RD , AD ) | | detectTypeAliasChange ( RD , AD ) ) { <nl> break ; <nl> } <nl> } <nl> class RemovedAddedNodeMatcher : public NodeMatcher , public MatchedNodeListener { <nl> NodeVector RenameLeft ; <nl> NodeVector RenameRight ; <nl> <nl> - <nl> for ( auto Remain : Removed ) { <nl> if ( ! contains ( RemovedMatched , Remain ) ) <nl> RenameLeft . push_back ( Remain ) ; <nl> class RemovedAddedNodeMatcher : public NodeMatcher , public MatchedNodeListener { <nl> } <nl> <nl> BestMatchMatcher RenameMatcher ( RenameLeft , RenameRight , isRename , <nl> - isBetterMatch , * this ) ; <nl> + isBetterMatch , NodeMatchReason : : Name , * this ) ; <nl> RenameMatcher . match ( ) ; <nl> / / Rename detection ends . <nl> <nl> void SameNameNodeMatcher : : match ( ) { <nl> / / match kind list . <nl> if ( auto Match = findBestNameMatch ( Candidates , <nl> getNameMatchKindPriority ( LN - > getKind ( ) ) ) ) { <nl> - Listener . foundMatch ( LN , Match ) ; <nl> + Listener . foundMatch ( LN , Match , NodeMatchReason : : Name ) ; <nl> MatchedRight . push_back ( Match ) ; <nl> } else { <nl> Removed . push_back ( LN ) ; <nl> class SequentialRecursiveMatcher : public NodeMatcher { <nl> MatchedNodeListener & Listener ; <nl> <nl> void matchInternal ( NodePtr L , NodePtr R ) { <nl> - Listener . foundMatch ( L , R ) ; <nl> + Listener . foundMatch ( L , R , NodeMatchReason : : Sequential ) ; <nl> if ( ! L | | ! R ) <nl> return ; <nl> for ( unsigned I = 0 ; I < std : : max ( L - > getChildrenCount ( ) , <nl> class PrunePass : public MatchedNodeListener , public SDKTreeDiffPass { <nl> public : <nl> PrunePass ( UpdatedNodesMap & UpdateMap ) : UpdateMap ( UpdateMap ) { } <nl> <nl> - void foundRemoveAddMatch ( NodePtr Left , NodePtr Right ) override { <nl> - if ( ! Left ) <nl> + void foundMatch ( NodePtr Left , NodePtr Right , NodeMatchReason Reason ) override { <nl> + switch ( Reason ) { <nl> + case NodeMatchReason : : Added : <nl> + assert ( ! Left ) ; <nl> Right - > annotate ( NodeAnnotation : : Added ) ; <nl> - else if ( ! Right ) { <nl> + return ; <nl> + case NodeMatchReason : : Removed : <nl> + assert ( ! Right ) ; <nl> Left - > annotate ( NodeAnnotation : : Removed ) ; <nl> - } else if ( Right - > getKind ( ) = = Left - > getKind ( ) ) { <nl> - foundMatch ( Left , Right ) ; <nl> - } else { <nl> + return ; <nl> + case NodeMatchReason : : FuncToProperty : <nl> + case NodeMatchReason : : ModernizeEnum : <nl> + case NodeMatchReason : : TypeToTypeAlias : <nl> Left - > annotate ( NodeAnnotation : : Removed ) ; <nl> Right - > annotate ( NodeAnnotation : : Added ) ; <nl> + return ; <nl> + case NodeMatchReason : : Root : <nl> + case NodeMatchReason : : Name : <nl> + case NodeMatchReason : : Sequential : <nl> + break ; <nl> } <nl> - } <nl> - <nl> - void foundMatch ( NodePtr Left , NodePtr Right ) override { <nl> assert ( Left & & Right ) ; <nl> Left - > annotate ( NodeAnnotation : : Updated ) ; <nl> Right - > annotate ( NodeAnnotation : : Updated ) ; <nl> / / Push the updated node to the map for future reference . <nl> - UpdateMap . foundMatch ( Left , Right ) ; <nl> + UpdateMap . insert ( Left , Right ) ; <nl> <nl> if ( Left - > getKind ( ) ! = Right - > getKind ( ) ) { <nl> assert ( isa < SDKNodeType > ( Left ) & & isa < SDKNodeType > ( Right ) & & <nl> class PrunePass : public MatchedNodeListener , public SDKTreeDiffPass { <nl> auto LC = Left - > getChildren ( ) [ 0 ] ; <nl> auto RC = Right - > getChildren ( ) [ 0 ] ; <nl> if ( ! ( * LC = = * RC ) ) <nl> - foundMatch ( LC , RC ) ; <nl> + foundMatch ( LC , RC , NodeMatchReason : : Sequential ) ; <nl> break ; <nl> } <nl> } <nl> } <nl> <nl> void pass ( NodePtr Left , NodePtr Right ) override { <nl> - foundMatch ( Left , Right ) ; <nl> + foundMatch ( Left , Right , NodeMatchReason : : Root ) ; <nl> } <nl> } ; <nl> <nl> class RenameDetectorForMemberDiff : public MatchedNodeListener { <nl> InterfaceTypeChangeDetector RightDetector ; <nl> public : <nl> RenameDetectorForMemberDiff ( ) : LeftDetector ( true ) , RightDetector ( false ) { } <nl> - void foundMatch ( NodePtr Left , NodePtr Right ) override { <nl> + void foundMatch ( NodePtr Left , NodePtr Right , NodeMatchReason Reason ) override { <nl> detectRename ( Left , Right ) ; <nl> LeftDetector . detect ( Left , Right ) ; <nl> RightDetector . detect ( Right , Left ) ; <nl>
Merge pull request from nkcsgexi / api - digester - match - kind
apple/swift
a779a164fe888c7986461568a1d08916bd176591
2018-08-18T06:23:01Z
mmm a / ports / ngspice / CONTROL <nl> ppp b / ports / ngspice / CONTROL <nl> <nl> Source : ngspice <nl> Version : 32 <nl> + Port - Version : 1 <nl> Homepage : http : / / ngspice . sourceforge . net / <nl> Description : Ngspice is a mixed - level / mixed - signal electronic circuit simulator . It is a successor of the latest stable release of Berkeley SPICE <nl> Supports : ! ( linux | osx | arm | uwp ) <nl> mmm a / ports / ngspice / portfile . cmake <nl> ppp b / ports / ngspice / portfile . cmake <nl> vcpkg_fail_port_install ( ON_TARGET " Linux " " OSX " " UWP " ON_ARCH " arm " " arm64 " ) <nl> <nl> vcpkg_check_linkage ( ONLY_DYNAMIC_LIBRARY ) <nl> <nl> + # ngspice produces self - contained DLLs <nl> + set ( VCPKG_CRT_LINKAGE static ) <nl> + <nl> vcpkg_from_sourceforge ( <nl> OUT_SOURCE_PATH SOURCE_PATH <nl> REPO ngspice / ng - spice - rework <nl> if ( VCPKG_TARGET_IS_WINDOWS ) <nl> file ( REMOVE_RECURSE $ { SOURCE_PATH } / man ) <nl> file ( REMOVE_RECURSE $ { SOURCE_PATH } / tests ) <nl> <nl> - # We use build_msbuild because install_msbuild is incompatible due to SPICE using . lib for the last 47 years . . . . <nl> vcpkg_install_msbuild ( <nl> - USE_VCPKG_INTEGRATION <nl> SOURCE_PATH $ { SOURCE_PATH } <nl> INCLUDES_SUBPATH / src / include <nl> LICENSE_SUBPATH COPYING <nl> - PLATFORM $ { TRIPLET_SYSTEM_ARCH } # install_msbuild swaps x86 for win32 ( bad ) if we dont force our own setting <nl> + # install_msbuild swaps x86 for win32 ( bad ) if we dont force our own setting <nl> + PLATFORM $ { TRIPLET_SYSTEM_ARCH } <nl> PROJECT_SUBPATH visualc / sharedspice . sln <nl> TARGET Build <nl> ) <nl>
[ ngspice ] Disable USE_VCPKG_INTEGRATION ( )
microsoft/vcpkg
b31c6fd3895b274d0bcbc8e1c57ef730e8f8bd20
2020-10-02T23:47:14Z
mmm a / torch / nn / modules / module . py <nl> ppp b / torch / nn / modules / module . py <nl> def cuda ( self , device_id = None ) : <nl> " " " <nl> return self . _apply ( lambda t : t . cuda ( device_id ) ) <nl> <nl> - def cpu ( self , device_id = None ) : <nl> + def cpu ( self ) : <nl> " " " Moves all model parameters and buffers to the CPU . " " " <nl> return self . _apply ( lambda t : t . cpu ( ) ) <nl> <nl>
resolves ( )
pytorch/pytorch
c011d4f3d605199f06a063d69b43a1fa98fb1d23
2017-07-13T13:57:33Z
mmm a / jstests / libs / global_snapshot_reads_util . js <nl> ppp b / jstests / libs / global_snapshot_reads_util . js <nl> function snapshotReadsTest ( testScenarioName , db , collName ) { <nl> ` $ { collName } with read preference $ { readPreferenceMode } and causal ` + <nl> ` consistency $ { useCausalConsistency } ` ) ; <nl> <nl> - let causalDb ; <nl> - <nl> - if ( useCausalConsistency ) { <nl> - let session = db . getMongo ( ) . startSession ( { causalConsistency : true } ) ; <nl> - causalDb = session . getDatabase ( db . getName ( ) ) ; <nl> - / / Establish timestamp . <nl> - causalDb [ collName ] . findOne ( { } ) ; <nl> - } else { <nl> - causalDb = db ; <nl> - } <nl> - <nl> for ( let commandKey in commands ) { <nl> assert ( commandKey ) ; <nl> jsTestLog ( " Testing the " + commandKey + " command . " ) ; <nl> function snapshotReadsTest ( testScenarioName , db , collName ) { <nl> <nl> jsTestLog ( ` Inserted 10 documents at timestamp $ { insertTimestamp } ` ) ; <nl> <nl> + / / Create a session if useCausalConsistency is true . <nl> + let causalDb , sessionTimestamp ; <nl> + <nl> + if ( useCausalConsistency ) { <nl> + let session = db . getMongo ( ) . startSession ( { causalConsistency : true } ) ; <nl> + causalDb = session . getDatabase ( db . getName ( ) ) ; <nl> + / / Establish timestamp . <nl> + causalDb [ " otherCollection " ] . insertOne ( { } ) ; <nl> + sessionTimestamp = session . getOperationTime ( ) ; <nl> + } else { <nl> + causalDb = db ; <nl> + } <nl> + <nl> / / Establish a snapshot cursor , fetching the first 5 documents . <nl> res = assert . commandWorked ( causalDb . runCommand ( command ( 5 , readPreferenceMode ) ) ) ; <nl> - <nl> - / / TODO ( SERVER - 47576 ) : Check atClusterTime is present , and > = findOne ' s timestamp if <nl> - / / causal . <nl> assert . sameMembers ( res . cursor . firstBatch , docs . slice ( 0 , 5 ) , res ) ; <nl> assert ( res . cursor . hasOwnProperty ( " id " ) ) ; <nl> const cursorId = res . cursor . id ; <nl> assert . neq ( cursorId , 0 ) ; <nl> + assert ( res . cursor . hasOwnProperty ( " atClusterTime " ) ) ; <nl> + let atClusterTime = res . cursor . atClusterTime ; <nl> + assert . neq ( atClusterTime , Timestamp ( 0 , 0 ) ) ; <nl> + if ( useCausalConsistency ) { <nl> + assert . gte ( atClusterTime , sessionTimestamp ) ; <nl> + } else { <nl> + assert . gte ( atClusterTime , insertTimestamp ) ; <nl> + } <nl> <nl> / / This update is not visible to reads at insertTimestamp . <nl> res = assert . commandWorked ( causalDb . runCommand ( { <nl> function snapshotReadsTest ( testScenarioName , db , collName ) { <nl> <nl> / / The cursor has been exhausted . The remaining docs don ' t show updated field . <nl> assert . eq ( 0 , res . cursor . id ) ; <nl> + assert . eq ( atClusterTime , res . cursor . atClusterTime ) ; <nl> assert . sameMembers ( res . cursor . nextBatch , docs . slice ( 5 ) , res ) ; <nl> <nl> jsTestLog ( ` Starting new snapshot read ` ) ; <nl> function snapshotReadsTest ( testScenarioName , db , collName ) { <nl> / / This read shows the updated docs . <nl> res = assert . commandWorked ( causalDb . runCommand ( command ( 20 , readPreferenceMode ) ) ) ; <nl> assert . eq ( 0 , res . cursor . id ) ; <nl> + assert ( res . cursor . hasOwnProperty ( " atClusterTime " ) ) ; <nl> + / / Selected atClusterTime at or after first cursor ' s atClusterTime . <nl> + assert . gte ( res . cursor . atClusterTime , atClusterTime ) ; <nl> assert . sameMembers ( res . cursor . firstBatch , <nl> [ . . . Array ( 10 ) . keys ( ) ] . map ( ( i ) = > ( { " _id " : i , " x " : true } ) ) , <nl> res ) ; <nl> function snapshotReadsTest ( testScenarioName , db , collName ) { <nl> db . runCommand ( command ( 20 , readPreferenceMode , insertTimestamp ) ) ) ; <nl> <nl> assert . sameMembers ( res . cursor . firstBatch , docs , res ) ; <nl> + assert . eq ( 0 , res . cursor . id ) ; <nl> + assert ( res . cursor . hasOwnProperty ( " atClusterTime " ) ) ; <nl> + assert . eq ( res . cursor . atClusterTime , insertTimestamp ) ; <nl> <nl> / / Reset . <nl> assert . commandWorked ( db [ collName ] . remove ( { } , { writeConcern : { w : " majority " } } ) ) ; <nl> mmm a / jstests / replsets / non_transaction_snapshot_reads . js <nl> ppp b / jstests / replsets / non_transaction_snapshot_reads . js <nl> replSet . initiateWithHighElectionTimeout ( ) ; <nl> const primary = replSet . getPrimary ( ) ; <nl> const testDB = primary . getDB ( ' test ' ) ; <nl> snapshotReadsTest ( jsTestName ( ) , testDB , " test " ) ; <nl> + <nl> + / / Ensure " atClusterTime " is omitted from a regular ( non - snapshot ) cursor . <nl> + testDB [ " collection " ] . insertOne ( { } ) ; <nl> + const cursor = assert . commandWorked ( testDB . runCommand ( { find : " collection " } ) ) . cursor ; <nl> + assert ( ! cursor . hasOwnProperty ( " atClusterTime " ) ) ; <nl> + <nl> replSet . stopSet ( ) ; <nl> } ) ( ) ; <nl> mmm a / src / mongo / db / commands / find_cmd . cpp <nl> ppp b / src / mongo / db / commands / find_cmd . cpp <nl> class FindCmd final : public Command { <nl> / / Stream query results , adding them to a BSONArray as we go . <nl> CursorResponseBuilder : : Options options ; <nl> options . isInitialResponse = true ; <nl> + options . atClusterTime = repl : : ReadConcernArgs : : get ( opCtx ) . getArgsAtClusterTime ( ) ; <nl> CursorResponseBuilder firstBatch ( result , options ) ; <nl> Document doc ; <nl> PlanExecutor : : ExecState state = PlanExecutor : : ADVANCED ; <nl> mmm a / src / mongo / db / commands / getmore_cmd . cpp <nl> ppp b / src / mongo / db / commands / getmore_cmd . cpp <nl> class GetMoreCmd final : public Command { <nl> } ) ; <nl> <nl> CursorId respondWithId = 0 ; <nl> - <nl> - CursorResponseBuilder nextBatch ( reply , CursorResponseBuilder : : Options ( ) ) ; <nl> + CursorResponseBuilder : : Options options ; <nl> + options . atClusterTime = repl : : ReadConcernArgs : : get ( opCtx ) . getArgsAtClusterTime ( ) ; <nl> + CursorResponseBuilder nextBatch ( reply , options ) ; <nl> BSONObj obj ; <nl> PlanExecutor : : ExecState state = PlanExecutor : : ADVANCED ; <nl> std : : uint64_t numResults = 0 ; <nl> mmm a / src / mongo / db / commands / run_aggregate . cpp <nl> ppp b / src / mongo / db / commands / run_aggregate . cpp <nl> bool handleCursorCommand ( OperationContext * opCtx , <nl> <nl> CursorResponseBuilder : : Options options ; <nl> options . isInitialResponse = true ; <nl> + options . atClusterTime = repl : : ReadConcernArgs : : get ( opCtx ) . getArgsAtClusterTime ( ) ; <nl> CursorResponseBuilder responseBuilder ( result , options ) ; <nl> <nl> auto curOp = CurOp : : get ( opCtx ) ; <nl> mmm a / src / mongo / db / query / cursor_response . cpp <nl> ppp b / src / mongo / db / query / cursor_response . cpp <nl> const char kCursorsField [ ] = " cursors " ; <nl> const char kCursorField [ ] = " cursor " ; <nl> const char kIdField [ ] = " id " ; <nl> const char kNsField [ ] = " ns " ; <nl> + const char kAtClusterTimeField [ ] = " atClusterTime " ; <nl> const char kBatchField [ ] = " nextBatch " ; <nl> const char kBatchFieldInitial [ ] = " firstBatch " ; <nl> const char kBatchDocSequenceField [ ] = " cursor . nextBatch " ; <nl> void CursorResponseBuilder : : done ( CursorId cursorId , StringData cursorNamespace ) <nl> } <nl> _cursorObject - > append ( kIdField , cursorId ) ; <nl> _cursorObject - > append ( kNsField , cursorNamespace ) ; <nl> + if ( _options . atClusterTime ) { <nl> + _cursorObject - > append ( kAtClusterTimeField , _options . atClusterTime - > asTimestamp ( ) ) ; <nl> + } <nl> _cursorObject . reset ( ) ; <nl> <nl> _bodyBuilder . reset ( ) ; <nl> mmm a / src / mongo / db / query / cursor_response . h <nl> ppp b / src / mongo / db / query / cursor_response . h <nl> class CursorResponseBuilder { <nl> struct Options { <nl> bool isInitialResponse = false ; <nl> bool useDocumentSequences = false ; <nl> + boost : : optional < LogicalTime > atClusterTime = boost : : none ; <nl> } ; <nl> <nl> / * * <nl>
SERVER - 47576 Include atClusterTime in snapshot read reply
mongodb/mongo
846cd7c189350edffecfe260e149571927d19d95
2020-04-28T17:00:52Z
mmm a / tools / db_stress . cc <nl> ppp b / tools / db_stress . cc <nl> class StressTest { <nl> } <nl> } <nl> <nl> + # ifndef ROCKSDB_LITE / / Lite does not support GetColumnFamilyMetaData <nl> if ( FLAGS_compact_files_one_in > 0 & & <nl> thread - > rand . Uniform ( FLAGS_compact_files_one_in ) = = 0 ) { <nl> auto * random_cf = <nl> class StressTest { <nl> } <nl> } <nl> } <nl> + # endif / / ! ROCKSDB_LITE <nl> <nl> long rand_key = thread - > rand . Next ( ) % max_key ; <nl> int rand_column_family = thread - > rand . Next ( ) % FLAGS_column_families ; <nl>
Fix RocksDB Lite build in db_stress
facebook/rocksdb
644f978c18278e3013a2d4725867905268b651cc
2016-04-21T21:47:23Z
mmm a / V8 / v8 - vocbase . cpp <nl> ppp b / V8 / v8 - vocbase . cpp <nl> static v8 : : Handle < v8 : : Value > DeleteVocbaseCol ( TRI_vocbase_t * vocbase , <nl> / / check the arguments <nl> if ( argv . Length ( ) < 1 ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " usage : delete ( < document > , < overwrite > ) " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( CreateErrorObject ( TRI_ERROR_BAD_PARAMETER , <nl> + " usage : delete ( < document > , < overwrite > ) " ) ) ) ; <nl> } <nl> <nl> TRI_voc_did_t did ; <nl> static v8 : : Handle < v8 : : Value > EdgesQuery ( TRI_edge_direction_e direction , v8 : : Arg <nl> <nl> if ( doc - > base . _type ! = TRI_COL_TYPE_SIMPLE_DOCUMENT ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " unknown collection type " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( CreateErrorObject ( TRI_ERROR_INTERNAL , " unknown collection type " ) ) ) ; <nl> } <nl> <nl> TRI_sim_collection_t * sim = ( TRI_sim_collection_t * ) doc ; <nl> static v8 : : Handle < v8 : : Value > EdgesQuery ( TRI_edge_direction_e direction , v8 : : Arg <nl> <nl> switch ( direction ) { <nl> case TRI_EDGE_UNUSED : <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " usage : edge ( < vertices > ) " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( <nl> + CreateErrorObject ( TRI_ERROR_BAD_PARAMETER , <nl> + " usage : edge ( < vertices > ) " ) ) ) ; <nl> <nl> case TRI_EDGE_IN : <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " usage : inEdge ( < vertices > ) " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( <nl> + CreateErrorObject ( TRI_ERROR_BAD_PARAMETER , <nl> + " usage : inEdge ( < vertices > ) " ) ) ) ; <nl> <nl> case TRI_EDGE_OUT : <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " usage : outEdge ( < vertices > ) " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( <nl> + CreateErrorObject ( TRI_ERROR_BAD_PARAMETER , <nl> + " usage : outEdge ( < vertices > ) " ) ) ) ; <nl> <nl> case TRI_EDGE_ANY : <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " usage : edge ( < vertices > ) " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( <nl> + CreateErrorObject ( TRI_ERROR_BAD_PARAMETER , <nl> + " usage : edge ( < vertices > ) " ) ) ) ; <nl> } <nl> } <nl> <nl> static v8 : : Handle < v8 : : Value > EdgesQuery ( TRI_edge_direction_e direction , v8 : : Arg <nl> <nl> for ( uint32_t i = 0 ; i < len ; + + i ) { <nl> TRI_vector_pointer_t edges ; <nl> - / / v8 : : Handle < v8 : : Value > val = vertices - > Get ( i ) ; <nl> - <nl> TRI_voc_cid_t cid ; <nl> TRI_voc_did_t did ; <nl> - bool ok ; <nl> + TRI_voc_rid_t rid ; <nl> <nl> - ok = TRI_IdentifiersObjectReference ( vertices - > Get ( i ) , cid , did ) ; <nl> + TRI_vocbase_col_t const * vertexCollection = 0 ; <nl> + v8 : : Handle < v8 : : Value > errMsg = ParseDocumentOrDocumentHandle ( collection - > _vocbase , vertexCollection , did , rid , vertices - > Get ( i ) ) ; <nl> <nl> - if ( ! ok | | cid = = 0 ) { <nl> + if ( ! errMsg . IsEmpty ( ) ) { <nl> + if ( vertexCollection ! = 0 ) { <nl> + ReleaseCollection ( vertexCollection ) ; <nl> + } <nl> + <nl> continue ; <nl> } <nl> + <nl> + cid = vertexCollection - > _cid ; <nl> + ReleaseCollection ( vertexCollection ) ; <nl> <nl> edges = TRI_LookupEdgesSimCollection ( sim , direction , cid , did ) ; <nl> <nl> static v8 : : Handle < v8 : : Value > EdgesQuery ( TRI_edge_direction_e direction , v8 : : Arg <nl> TRI_vector_pointer_t edges ; <nl> TRI_voc_cid_t cid ; <nl> TRI_voc_did_t did ; <nl> - bool ok ; <nl> + TRI_voc_rid_t rid ; <nl> <nl> - ok = TRI_IdentifiersObjectReference ( argv [ 0 ] , cid , did ) ; <nl> - <nl> - if ( ! ok ) { <nl> + TRI_vocbase_col_t const * vertexCollection = 0 ; <nl> + v8 : : Handle < v8 : : Value > errMsg = ParseDocumentOrDocumentHandle ( collection - > _vocbase , vertexCollection , did , rid , argv [ 0 ] ) ; <nl> + <nl> + if ( ! errMsg . IsEmpty ( ) ) { <nl> collection - > _collection - > endRead ( collection - > _collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " < vertices > must be an array or a single object - reference " ) ) ) ; <nl> + <nl> + if ( vertexCollection ! = 0 ) { <nl> + ReleaseCollection ( vertexCollection ) ; <nl> + } <nl> + <nl> + return scope . Close ( v8 : : ThrowException ( errMsg ) ) ; <nl> } <nl> <nl> + cid = vertexCollection - > _cid ; <nl> + ReleaseCollection ( vertexCollection ) ; <nl> + <nl> edges = TRI_LookupEdgesSimCollection ( sim , direction , cid , did ) ; <nl> <nl> for ( size_t j = 0 ; j < edges . _length ; + + j ) { <nl> static v8 : : Handle < v8 : : Value > JS_AllQuery ( v8 : : Arguments const & argv ) { <nl> <nl> if ( doc - > base . _type ! = TRI_COL_TYPE_SIMPLE_DOCUMENT ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " unknown collection type " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( CreateErrorObject ( TRI_ERROR_INTERNAL , " unknown collection type " ) ) ) ; <nl> } <nl> <nl> TRI_sim_collection_t * sim = ( TRI_sim_collection_t * ) doc ; <nl> static v8 : : Handle < v8 : : Value > JS_AllQuery ( v8 : : Arguments const & argv ) { <nl> / / expecting two arguments <nl> if ( argv . Length ( ) ! = 2 ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " usage : ALL ( < skip > , < limit > ) " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( <nl> + CreateErrorObject ( TRI_ERROR_BAD_PARAMETER , <nl> + " usage : ALL ( < skip > , < limit > ) " ) ) ) ; <nl> } <nl> <nl> TRI_voc_size_t skip = TRI_QRY_NO_SKIP ; <nl> static v8 : : Handle < v8 : : Value > JS_NearQuery ( v8 : : Arguments const & argv ) { <nl> <nl> if ( doc - > base . _type ! = TRI_COL_TYPE_SIMPLE_DOCUMENT ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " unknown collection type " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( CreateErrorObject ( TRI_ERROR_INTERNAL , " unknown collection type " ) ) ) ; <nl> } <nl> <nl> / / expect : NEAR ( < index - id > , < latitude > , < longitude > , < limit > ) <nl> if ( argv . Length ( ) ! = 4 ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " usage : NEAR ( < index - id > , < latitude > , < longitude > , < limit > ) " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( <nl> + CreateErrorObject ( TRI_ERROR_BAD_PARAMETER , <nl> + " usage : NEAR ( < index - id > , < latitude > , < longitude > , < limit > ) " ) ) ) ; <nl> } <nl> <nl> / / extract the index <nl> static v8 : : Handle < v8 : : Value > JS_NearQuery ( v8 : : Arguments const & argv ) { <nl> <nl> if ( idx = = 0 ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " unknown index identifier " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( CreateErrorObject ( TRI_ERROR_AVOCADO_INDEX_NOT_FOUND , " unknown index identifier " ) ) ) ; <nl> } <nl> <nl> if ( idx - > _type ! = TRI_IDX_TYPE_GEO_INDEX ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " index must be a geo - index " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( CreateErrorObject ( TRI_ERROR_BAD_PARAMETER , " index must be a geo - index " ) ) ) ; <nl> } <nl> <nl> / / extract latitude and longitude <nl> static v8 : : Handle < v8 : : Value > JS_WithinQuery ( v8 : : Arguments const & argv ) { <nl> <nl> if ( doc - > base . _type ! = TRI_COL_TYPE_SIMPLE_DOCUMENT ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " unknown collection type " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( CreateErrorObject ( TRI_ERROR_INTERNAL , " unknown collection type " ) ) ) ; <nl> } <nl> <nl> / / expect : NEAR ( < index - id > , < latitude > , < longitude > , < limit > ) <nl> if ( argv . Length ( ) ! = 4 ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " usage : NEAR ( < index - id > , < latitude > , < longitude > , < limit > ) " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( <nl> + CreateErrorObject ( TRI_ERROR_BAD_PARAMETER , <nl> + " usage : WITHIN ( < index - id > , < latitude > , < longitude > , < radius > ) " ) ) ) ; <nl> } <nl> <nl> / / extract the index <nl> static v8 : : Handle < v8 : : Value > JS_WithinQuery ( v8 : : Arguments const & argv ) { <nl> <nl> if ( idx = = 0 ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " unknown index identifier " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( CreateErrorObject ( TRI_ERROR_AVOCADO_INDEX_NOT_FOUND , " unknown index identifier " ) ) ) ; <nl> } <nl> <nl> if ( idx - > _type ! = TRI_IDX_TYPE_GEO_INDEX ) { <nl> ReleaseCollection ( collection ) ; <nl> - return scope . Close ( v8 : : ThrowException ( v8 : : String : : New ( " index must be a geo - index " ) ) ) ; <nl> + return scope . Close ( v8 : : ThrowException ( CreateErrorObject ( TRI_ERROR_BAD_PARAMETER , " index must be a geo - index " ) ) ) ; <nl> } <nl> <nl> / / extract latitude and longitude <nl> static v8 : : Handle < v8 : : Value > JS_SaveEdgesCol ( v8 : : Arguments const & argv ) { <nl> <nl> if ( ! errMsg . IsEmpty ( ) ) { <nl> ReleaseCollection ( collection ) ; <nl> + <nl> + if ( fromCollection ! = 0 ) { <nl> + ReleaseCollection ( fromCollection ) ; <nl> + } <nl> + <nl> return scope . Close ( v8 : : ThrowException ( errMsg ) ) ; <nl> } <nl> <nl> edge . _fromCid = fromCollection - > _cid ; <nl> + ReleaseCollection ( fromCollection ) ; <nl> <nl> / / extract to <nl> TRI_vocbase_col_t const * toCollection = 0 ; <nl> static v8 : : Handle < v8 : : Value > JS_SaveEdgesCol ( v8 : : Arguments const & argv ) { <nl> <nl> if ( ! errMsg . IsEmpty ( ) ) { <nl> ReleaseCollection ( collection ) ; <nl> + <nl> + if ( toCollection ! = 0 ) { <nl> + ReleaseCollection ( toCollection ) ; <nl> + } <nl> + <nl> return scope . Close ( v8 : : ThrowException ( errMsg ) ) ; <nl> } <nl> <nl> edge . _toCid = toCollection - > _cid ; <nl> + ReleaseCollection ( toCollection ) ; <nl> <nl> / / extract shaped data <nl> TRI_shaped_json_t * shaped = TRI_ShapedJsonV8Object ( argv [ 2 ] , doc - > _shaper ) ; <nl>
fixed edges
arangodb/arangodb
63f7974d2de96194745f40073594b3b502519a55
2012-04-10T10:06:47Z
mmm a / api / bazel / repositories . bzl <nl> ppp b / api / bazel / repositories . bzl <nl> <nl> - BAZEL_SKYLIB_RELEASE = " 0 . 5 . 0 " <nl> - BAZEL_SKYLIB_SHA256 = " b5f6abe419da897b7901f90cbab08af958b97a8f3575b0d3dd062ac7ce78541f " <nl> + BAZEL_SKYLIB_RELEASE = " 0 . 6 . 0 " <nl> + BAZEL_SKYLIB_SHA256 = " eb5c57e4c12e68c0c20bc774bfbc60a568e800d025557bc4ea022c6479acc867 " <nl> <nl> GOGOPROTO_RELEASE = " 1 . 2 . 0 " <nl> GOGOPROTO_SHA256 = " 957c8f03cf595525d2a667035d9865a0930b3d446be0ab6eb76972934f925b00 " <nl> <nl> + OPENCENSUS_RELEASE = " 0 . 1 . 0 " <nl> + OPENCENSUS_SHA256 = " 4fd21cc6de63d7cb979fd749d8101ff425905aa0826fed26019d1c311fcf19a7 " <nl> + <nl> PGV_RELEASE = " 0 . 0 . 12 " <nl> PGV_SHA256 = " 3be735345d1953d6d4c1cb89ace739cd6c98873d08b11218e181b0d3b0441627 " <nl> <nl> GOOGLEAPIS_SHA = " 16f5b2e8bf1e747a32f9a62e211f8f33c94645492e9bbd72458061d9a9de1f <nl> PROMETHEUS_GIT_SHA = " 99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c " # Nov 17 , 2017 <nl> PROMETHEUS_SHA = " 783bdaf8ee0464b35ec0c8704871e1e72afa0005c3f3587f65d9d6694bf3911b " <nl> <nl> - OPENCENSUS_GIT_SHA = " 7f2434bc10da710debe5c4315ed6d4df454b4024 " # Nov 3 , 2018 ( tag v0 . 1 . 0 ) <nl> - OPENCENSUS_SHA = " 6f67ee4d5f4208f9711573423ae30860d6a7e66e9e150f97dda9d0e0665a34df " <nl> - <nl> load ( " @ bazel_tools / / tools / build_defs / repo : http . bzl " , " http_archive " ) <nl> <nl> def api_dependencies ( ) : <nl> go_proto_library ( <nl> <nl> http_archive ( <nl> name = " io_opencensus_trace " , <nl> - strip_prefix = " opencensus - proto - " + OPENCENSUS_GIT_SHA + " / src / opencensus / proto / trace / v1 " , <nl> - url = " https : / / github . com / census - instrumentation / opencensus - proto / archive / " + OPENCENSUS_GIT_SHA + " . tar . gz " , <nl> - sha256 = OPENCENSUS_SHA , <nl> + sha256 = OPENCENSUS_SHA256 , <nl> + strip_prefix = " opencensus - proto - " + OPENCENSUS_RELEASE + " / src / opencensus / proto / trace / v1 " , <nl> + url = " https : / / github . com / census - instrumentation / opencensus - proto / archive / v " + OPENCENSUS_RELEASE + " . tar . gz " , <nl> build_file_content = " " " <nl> load ( " @ envoy_api / / bazel : api_build_system . bzl " , " api_proto_library " ) <nl> load ( " @ io_bazel_rules_go / / proto : def . bzl " , " go_proto_library " ) <nl> mmm a / bazel / repository_locations . bzl <nl> ppp b / bazel / repository_locations . bzl <nl> <nl> REPOSITORY_LOCATIONS = dict ( <nl> bazel_gazelle = dict ( <nl> - sha256 = " 6e875ab4b6bf64a38c352887760f21203ab054676d9c1b274963907e0768740d " , <nl> - urls = [ " https : / / github . com / bazelbuild / bazel - gazelle / releases / download / 0 . 15 . 0 / bazel - gazelle - 0 . 15 . 0 . tar . gz " ] , <nl> + sha256 = " 7949fc6cc17b5b191103e97481cf8889217263acf52e00b560683413af204fcb " , <nl> + urls = [ " https : / / github . com / bazelbuild / bazel - gazelle / releases / download / 0 . 16 . 0 / bazel - gazelle - 0 . 16 . 0 . tar . gz " ] , <nl> ) , <nl> boringssl = dict ( <nl> # Use commits from branch " chromium - stable - with - bazel " <nl>
Dependencies : Update bazel - skylib and bazel - gazelle ( )
envoyproxy/envoy
284769e833cc7752812f076a8b7a12e79c948df9
2019-01-05T03:33:12Z
mmm a / cocos2dx / menu_nodes / CCMenuItem . cpp <nl> ppp b / cocos2dx / menu_nodes / CCMenuItem . cpp <nl> const unsigned int kDisableTag = 0x3 ; <nl> / / <nl> / / CCMenuItem <nl> / / <nl> - CCMenuItem * CCMenuItem : : itemWithTarget ( CCObject * rec , SEL_MenuHandler selector ) <nl> + CCMenuItem * CCMenuItem : : itemWithTarget ( CCObject * rec , SEL_MenuHandler selector ) <nl> { <nl> return CCMenuItem : : create ( rec , selector ) ; <nl> } <nl> <nl> - CCMenuItem * CCMenuItem : : create ( CCObject * rec , SEL_MenuHandler selector ) <nl> + CCMenuItem * CCMenuItem : : create ( ) <nl> + { <nl> + return CCMenuItem : : create ( NULL , NULL ) ; <nl> + } <nl> + <nl> + CCMenuItem * CCMenuItem : : create ( CCObject * rec , SEL_MenuHandler selector ) <nl> { <nl> CCMenuItem * pRet = new CCMenuItem ( ) ; <nl> pRet - > initWithTarget ( rec , selector ) ; <nl> mmm a / cocos2dx / menu_nodes / CCMenuItem . h <nl> ppp b / cocos2dx / menu_nodes / CCMenuItem . h <nl> class CC_DLL CCMenuItem : public CCNode <nl> @ deprecated : This interface will be deprecated sooner or later . <nl> * / <nl> CC_DEPRECATED_ATTRIBUTE static CCMenuItem * itemWithTarget ( CCObject * rec , SEL_MenuHandler selector ) ; <nl> + / * * Creates a CCMenuItem with no target / selector * / <nl> + static CCMenuItem * create ( ) ; <nl> / * * Creates a CCMenuItem with a target / selector * / <nl> - static CCMenuItem * create ( CCObject * rec , SEL_MenuHandler selector ) ; <nl> + static CCMenuItem * create ( CCObject * rec , SEL_MenuHandler selector ) ; <nl> / * * Initializes a CCMenuItem with a target / selector * / <nl> bool initWithTarget ( CCObject * rec , SEL_MenuHandler selector ) ; <nl> / * * Returns the outside box * / <nl>
adds empty create for CCMenuItem
cocos2d/cocos2d-x
9d11298d8ee78ab12b0cb4b4e0109782734f1f03
2012-08-27T15:43:37Z
mmm a / torch / csrc / jit / passes / alias_analysis . cpp <nl> ppp b / torch / csrc / jit / passes / alias_analysis . cpp <nl> std : : string AliasDb : : toString ( ) const { <nl> std : : stringstream ss { } ; <nl> std : : unordered_map < size_t , Element * > indexToElementMap ; <nl> <nl> + for ( const auto & ent : wildcardIndex_ ) { <nl> + indexToElementMap [ ent . second - > index ] = ent . second ; <nl> + } <nl> + <nl> ss < < " \ n = = = 1 . GRAPH = = = \ n " ; <nl> ss < < graph_ - > toString ( ) ; <nl> <nl> std : : string AliasDb : : toString ( ) const { <nl> ss < < * node ; <nl> ss < < " " ; <nl> for ( const auto value : values ) { <nl> - ss < < indexToElementMap [ value ] - > value - > debugName ( ) < < " , " ; <nl> + ss < < getElementName ( indexToElementMap [ value ] ) < < " , " ; <nl> } <nl> ss < < " \ n " ; <nl> } <nl>
fix to loggin in AA
pytorch/pytorch
c395f421099108b8eaa52ecb4ee8a5f9a95ea62b
2019-08-26T19:24:00Z
mmm a / Makefile <nl> ppp b / Makefile <nl> pc_cxx : $ ( LIBDIR ) / $ ( CONFIG ) / pkgconfig / grpc + + . pc <nl> pc_cxx_unsecure : $ ( LIBDIR ) / $ ( CONFIG ) / pkgconfig / grpc + + _unsecure . pc <nl> <nl> ifeq ( $ ( EMBED_OPENSSL ) , true ) <nl> - privatelibs_cxx : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aes_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_asn1_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_base64_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bio_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bn_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bytestring_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aead_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cipher_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cmac_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ed25519_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x25519_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dh_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_digest_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ec_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_err_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_extra_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pbkdf_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hmac_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs12_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs8_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_poly1305_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_rsa_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x509_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ssl_test_lib . a <nl> + privatelibs_cxx : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection_codegen . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aes_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_asn1_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_base64_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bio_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bn_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bytestring_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aead_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cipher_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cmac_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ed25519_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x25519_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dh_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_digest_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ec_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_err_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_extra_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pbkdf_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hmac_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs12_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs8_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_poly1305_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_rsa_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x509_test_lib . a $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ssl_test_lib . a <nl> else <nl> - privatelibs_cxx : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a <nl> + privatelibs_cxx : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection_codegen . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a <nl> endif <nl> <nl> <nl> $ ( GENDIR ) / src / proto / grpc / lb / v1 / load_balancer . grpc . pb . cc : src / proto / grpc / lb / v1 / lo <nl> $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> + ifeq ( $ ( NO_PROTOC ) , true ) <nl> + $ ( GENDIR ) / src / proto / grpc / reflection / v1alpha / reflection . pb . cc : protoc_dep_error <nl> + $ ( GENDIR ) / src / proto / grpc / reflection / v1alpha / reflection . grpc . pb . cc : protoc_dep_error <nl> + else <nl> + $ ( GENDIR ) / src / proto / grpc / reflection / v1alpha / reflection . pb . cc : src / proto / grpc / reflection / v1alpha / reflection . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) <nl> + $ ( E ) " [ PROTOC ] Generating protobuf CC file from $ < " <nl> + $ ( Q ) mkdir - p ` dirname $ @ ` <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - cpp_out = $ ( GENDIR ) $ < <nl> + <nl> + $ ( GENDIR ) / src / proto / grpc / reflection / v1alpha / reflection . grpc . pb . cc : src / proto / grpc / reflection / v1alpha / reflection . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) <nl> + $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> + $ ( Q ) mkdir - p ` dirname $ @ ` <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> + endif <nl> + <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / compiler_test . pb . cc : protoc_dep_error <nl> $ ( GENDIR ) / src / proto / grpc / testing / compiler_test . grpc . pb . cc : protoc_dep_error <nl> endif <nl> endif <nl> <nl> <nl> + LIBGRPC + + _REFLECTION_CODEGEN_SRC = \ <nl> + $ ( GENDIR ) / src / proto / grpc / reflection / v1alpha / reflection . pb . cc $ ( GENDIR ) / src / proto / grpc / reflection / v1alpha / reflection . grpc . pb . cc \ <nl> + <nl> + PUBLIC_HEADERS_CXX + = \ <nl> + <nl> + LIBGRPC + + _REFLECTION_CODEGEN_OBJS = $ ( addprefix $ ( OBJDIR ) / $ ( CONFIG ) / , $ ( addsuffix . o , $ ( basename $ ( LIBGRPC + + _REFLECTION_CODEGEN_SRC ) ) ) ) <nl> + <nl> + <nl> + ifeq ( $ ( NO_SECURE ) , true ) <nl> + <nl> + # You can ' t build secure libraries if you don ' t have OpenSSL . <nl> + <nl> + $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection_codegen . a : openssl_dep_error <nl> + <nl> + <nl> + else <nl> + <nl> + ifeq ( $ ( NO_PROTOBUF ) , true ) <nl> + <nl> + # You can ' t build a C + + library if you don ' t have protobuf - a bit overreached , but still okay . <nl> + <nl> + $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection_codegen . a : protobuf_dep_error <nl> + <nl> + <nl> + else <nl> + <nl> + $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection_codegen . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PROTOBUF_DEP ) $ ( LIBGRPC + + _REFLECTION_CODEGEN_OBJS ) <nl> + $ ( E ) " [ AR ] Creating $ @ " <nl> + $ ( Q ) mkdir - p ` dirname $ @ ` <nl> + $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection_codegen . a <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection_codegen . a $ ( LIBGRPC + + _REFLECTION_CODEGEN_OBJS ) <nl> + ifeq ( $ ( SYSTEM ) , Darwin ) <nl> + $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection_codegen . a <nl> + endif <nl> + <nl> + <nl> + <nl> + <nl> + endif <nl> + <nl> + endif <nl> + <nl> + ifneq ( $ ( NO_SECURE ) , true ) <nl> + ifneq ( $ ( NO_DEPS ) , true ) <nl> + - include $ ( LIBGRPC + + _REFLECTION_CODEGEN_OBJS : . o = . dep ) <nl> + endif <nl> + endif <nl> + <nl> + <nl> LIBGRPC + + _TEST_CONFIG_SRC = \ <nl> test / cpp / util / test_config . cc \ <nl> <nl> mmm a / build . yaml <nl> ppp b / build . yaml <nl> filegroups : <nl> language : c + + <nl> public_headers : <nl> - include / grpc + + / impl / codegen / config_protobuf . h <nl> + - name : grpc + + _reflection_proto <nl> + language : c + + <nl> + public_headers : <nl> + - include / grpc + + / ext / reflection . grpc . pb . h <nl> + - include / grpc + + / ext / reflection . pb . h <nl> + src : <nl> + - src / cpp / ext / reflection . grpc . pb . cc <nl> + - src / cpp / ext / reflection . pb . cc <nl> + uses : <nl> + - grpc + + _codegen_proto <nl> libs : <nl> - name : gpr <nl> build : all <nl> libs : <nl> language : c + + <nl> public_headers : <nl> - include / grpc + + / ext / proto_server_reflection_plugin . h <nl> - - include / grpc + + / ext / reflection . grpc . pb . h <nl> - - include / grpc + + / ext / reflection . pb . h <nl> headers : <nl> - src / cpp / ext / proto_server_reflection . h <nl> src : <nl> - src / cpp / ext / proto_server_reflection . cc <nl> - src / cpp / ext / proto_server_reflection_plugin . cc <nl> - - src / cpp / ext / reflection . grpc . pb . cc <nl> - - src / cpp / ext / reflection . pb . cc <nl> deps : <nl> - grpc + + <nl> filegroups : <nl> - - grpc + + _codegen_proto <nl> + - grpc + + _reflection_proto <nl> + - name : grpc + + _reflection_codegen <nl> + build : private <nl> + language : c + + <nl> + src : <nl> + - src / proto / grpc / reflection / v1alpha / reflection . proto <nl> - name : grpc + + _test_config <nl> build : private <nl> language : c + + <nl> mmm a / include / grpc + + / impl / codegen / config_protobuf . h <nl> ppp b / include / grpc + + / impl / codegen / config_protobuf . h <nl> <nl> # define GRPC_CUSTOM_SOURCELOCATION : : google : : protobuf : : SourceLocation <nl> # endif <nl> <nl> + # ifndef GRPC_CUSTOM_DESCRIPTORDATABASE <nl> + # include < google / protobuf / descriptor_database . h > <nl> + # define GRPC_CUSTOM_DESCRIPTORDATABASE : : google : : protobuf : : DescriptorDatabase <nl> + # define GRPC_CUSTOM_SIMPLEDESCRIPTORDATABASE \ <nl> + : : google : : protobuf : : SimpleDescriptorDatabase <nl> + # endif <nl> + <nl> # ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM <nl> # include < google / protobuf / io / coded_stream . h > <nl> # include < google / protobuf / io / zero_copy_stream . h > <nl> typedef GRPC_CUSTOM_PROTOBUF_INT64 int64 ; <nl> <nl> typedef GRPC_CUSTOM_DESCRIPTOR Descriptor ; <nl> typedef GRPC_CUSTOM_DESCRIPTORPOOL DescriptorPool ; <nl> + typedef GRPC_CUSTOM_DESCRIPTORDATABASE DescriptorDatabase ; <nl> typedef GRPC_CUSTOM_FIELDDESCRIPTOR FieldDescriptor ; <nl> typedef GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor ; <nl> typedef GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto ; <nl> typedef GRPC_CUSTOM_METHODDESCRIPTOR MethodDescriptor ; <nl> typedef GRPC_CUSTOM_SERVICEDESCRIPTOR ServiceDescriptor ; <nl> + typedef GRPC_CUSTOM_SIMPLEDESCRIPTORDATABASE SimpleDescriptorDatabase ; <nl> typedef GRPC_CUSTOM_SOURCELOCATION SourceLocation ; <nl> <nl> namespace io { <nl> mmm a / src / cpp / ext / proto_server_reflection . h <nl> ppp b / src / cpp / ext / proto_server_reflection . h <nl> <nl> * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> * <nl> * / <nl> + <nl> + / * <nl> + - If the generated header ` grpc + + / ext / reflection . grpc . pb . h ` needs to be <nl> + installed , target ` grpc + + _reflection ` in ` build . yaml ` should use the <nl> + filegroup ` grpc + + _reflection_proto ` , and GRPC_NO_GENERATED_CODE should not <nl> + be defined . <nl> + - If the server reflection library needs to generate ` reflection . grpc . pb . h ` <nl> + from ` reflection . proto ` at compile time , the generated header <nl> + ` grpc + + / ext / reflection . grpc . pb . h ` should not be installed . In this case , <nl> + target ` grpc + + _reflection ` should depend on ` grpc + + _reflection_codegen ` , and <nl> + GRPC_NO_GENERATED_CODE should be defined . <nl> + * / <nl> + <nl> # ifndef GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H <nl> # define GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H <nl> <nl> # include < unordered_set > <nl> # include < vector > <nl> <nl> + / / GRPC_NO_GENERATED_CODE indicates generated pb files should not be used <nl> + # ifdef GRPC_NO_GENERATED_CODE <nl> + # include " src / proto / grpc / reflection / v1alpha / reflection . grpc . pb . h " <nl> + # else <nl> # include < grpc + + / ext / reflection . grpc . pb . h > <nl> + # endif / / GRPC_NO_GENERATED_CODE <nl> # include < grpc + + / grpc + + . h > <nl> <nl> namespace grpc { <nl> mmm a / test / cpp / end2end / async_end2end_test . cc <nl> ppp b / test / cpp / end2end / async_end2end_test . cc <nl> class Verifier { <nl> bool spin_ ; <nl> } ; <nl> <nl> + bool plugin_has_sync_methods ( std : : unique_ptr < ServerBuilderPlugin > & plugin ) { <nl> + return plugin - > has_sync_methods ( ) ; <nl> + } <nl> + <nl> / / This class disables the server builder plugins that may add sync services to <nl> / / the server . If there are sync services , UnimplementedRpc test will triger <nl> / / the sync unkown rpc routine on the server side , rather than the async one <nl> class ServerBuilderSyncPluginDisabler : public : : grpc : : ServerBuilderOption { <nl> <nl> void UpdatePlugins ( std : : vector < std : : unique_ptr < ServerBuilderPlugin > > * plugins ) <nl> GRPC_OVERRIDE { <nl> - auto plugin = plugins - > begin ( ) ; <nl> - while ( plugin ! = plugins - > end ( ) ) { <nl> - if ( ( * plugin ) - > has_sync_methods ( ) ) { <nl> - plugins - > erase ( plugin + + ) ; <nl> - } else { <nl> - plugin + + ; <nl> - } <nl> - } <nl> + plugins - > erase ( std : : remove_if ( plugins - > begin ( ) , plugins - > end ( ) , <nl> + plugin_has_sync_methods ) , <nl> + plugins - > end ( ) ) ; <nl> } <nl> } ; <nl> <nl> mmm a / test / cpp / end2end / proto_server_reflection_test . cc <nl> ppp b / test / cpp / end2end / proto_server_reflection_test . cc <nl> <nl> * <nl> * / <nl> <nl> - # include < google / protobuf / descriptor . h > <nl> # include < grpc + + / channel . h > <nl> # include < grpc + + / client_context . h > <nl> # include < grpc + + / create_channel . h > <nl> class ProtoServerReflectionTest : public : : testing : : Test { <nl> <nl> void SetUp ( ) GRPC_OVERRIDE { <nl> port_ = grpc_pick_unused_port_or_die ( ) ; <nl> - ref_desc_pool_ = google : : protobuf : : DescriptorPool : : generated_pool ( ) ; <nl> + ref_desc_pool_ = protobuf : : DescriptorPool : : generated_pool ( ) ; <nl> <nl> ServerBuilder builder ; <nl> grpc : : string server_address = " localhost : " + to_string ( port_ ) ; <nl> class ProtoServerReflectionTest : public : : testing : : Test { <nl> CreateChannel ( target , InsecureChannelCredentials ( ) ) ; <nl> stub_ = grpc : : testing : : EchoTestService : : NewStub ( channel ) ; <nl> desc_db_ . reset ( new ProtoReflectionDescriptorDatabase ( channel ) ) ; <nl> - desc_pool_ . reset ( new google : : protobuf : : DescriptorPool ( desc_db_ . get ( ) ) ) ; <nl> + desc_pool_ . reset ( new protobuf : : DescriptorPool ( desc_db_ . get ( ) ) ) ; <nl> } <nl> <nl> string to_string ( const int number ) { <nl> class ProtoServerReflectionTest : public : : testing : : Test { <nl> } <nl> <nl> void CompareService ( const grpc : : string & service ) { <nl> - const google : : protobuf : : ServiceDescriptor * service_desc = <nl> + const protobuf : : ServiceDescriptor * service_desc = <nl> desc_pool_ - > FindServiceByName ( service ) ; <nl> - const google : : protobuf : : ServiceDescriptor * ref_service_desc = <nl> + const protobuf : : ServiceDescriptor * ref_service_desc = <nl> ref_desc_pool_ - > FindServiceByName ( service ) ; <nl> EXPECT_TRUE ( service_desc ! = nullptr ) ; <nl> EXPECT_TRUE ( ref_service_desc ! = nullptr ) ; <nl> EXPECT_EQ ( service_desc - > DebugString ( ) , ref_service_desc - > DebugString ( ) ) ; <nl> <nl> - const google : : protobuf : : FileDescriptor * file_desc = service_desc - > file ( ) ; <nl> + const protobuf : : FileDescriptor * file_desc = service_desc - > file ( ) ; <nl> if ( known_files_ . find ( file_desc - > package ( ) + " / " + file_desc - > name ( ) ) ! = <nl> known_files_ . end ( ) ) { <nl> EXPECT_EQ ( file_desc - > DebugString ( ) , <nl> class ProtoServerReflectionTest : public : : testing : : Test { <nl> } <nl> <nl> void CompareMethod ( const grpc : : string & method ) { <nl> - const google : : protobuf : : MethodDescriptor * method_desc = <nl> + const protobuf : : MethodDescriptor * method_desc = <nl> desc_pool_ - > FindMethodByName ( method ) ; <nl> - const google : : protobuf : : MethodDescriptor * ref_method_desc = <nl> + const protobuf : : MethodDescriptor * ref_method_desc = <nl> ref_desc_pool_ - > FindMethodByName ( method ) ; <nl> EXPECT_TRUE ( method_desc ! = nullptr ) ; <nl> EXPECT_TRUE ( ref_method_desc ! = nullptr ) ; <nl> class ProtoServerReflectionTest : public : : testing : : Test { <nl> return ; <nl> } <nl> <nl> - const google : : protobuf : : Descriptor * desc = <nl> - desc_pool_ - > FindMessageTypeByName ( type ) ; <nl> - const google : : protobuf : : Descriptor * ref_desc = <nl> + const protobuf : : Descriptor * desc = desc_pool_ - > FindMessageTypeByName ( type ) ; <nl> + const protobuf : : Descriptor * ref_desc = <nl> ref_desc_pool_ - > FindMessageTypeByName ( type ) ; <nl> EXPECT_TRUE ( desc ! = nullptr ) ; <nl> EXPECT_TRUE ( ref_desc ! = nullptr ) ; <nl> class ProtoServerReflectionTest : public : : testing : : Test { <nl> std : : unique_ptr < Server > server_ ; <nl> std : : unique_ptr < grpc : : testing : : EchoTestService : : Stub > stub_ ; <nl> std : : unique_ptr < ProtoReflectionDescriptorDatabase > desc_db_ ; <nl> - std : : unique_ptr < google : : protobuf : : DescriptorPool > desc_pool_ ; <nl> + std : : unique_ptr < protobuf : : DescriptorPool > desc_pool_ ; <nl> std : : unordered_set < string > known_files_ ; <nl> std : : unordered_set < string > known_types_ ; <nl> - const google : : protobuf : : DescriptorPool * ref_desc_pool_ ; <nl> + const protobuf : : DescriptorPool * ref_desc_pool_ ; <nl> int port_ ; <nl> reflection : : ProtoServerReflectionPlugin plugin_ ; <nl> } ; <nl> mmm a / test / cpp / util / proto_reflection_descriptor_database . cc <nl> ppp b / test / cpp / util / proto_reflection_descriptor_database . cc <nl> ProtoReflectionDescriptorDatabase : : ~ ProtoReflectionDescriptorDatabase ( ) { <nl> } <nl> <nl> bool ProtoReflectionDescriptorDatabase : : FindFileByName ( <nl> - const string & filename , google : : protobuf : : FileDescriptorProto * output ) { <nl> + const string & filename , protobuf : : FileDescriptorProto * output ) { <nl> if ( cached_db_ . FindFileByName ( filename , output ) ) { <nl> return true ; <nl> } <nl> bool ProtoReflectionDescriptorDatabase : : FindFileByName ( <nl> } <nl> <nl> bool ProtoReflectionDescriptorDatabase : : FindFileContainingSymbol ( <nl> - const string & symbol_name , google : : protobuf : : FileDescriptorProto * output ) { <nl> + const string & symbol_name , protobuf : : FileDescriptorProto * output ) { <nl> if ( cached_db_ . FindFileContainingSymbol ( symbol_name , output ) ) { <nl> return true ; <nl> } <nl> bool ProtoReflectionDescriptorDatabase : : FindFileContainingSymbol ( <nl> <nl> bool ProtoReflectionDescriptorDatabase : : FindFileContainingExtension ( <nl> const string & containing_type , int field_number , <nl> - google : : protobuf : : FileDescriptorProto * output ) { <nl> + protobuf : : FileDescriptorProto * output ) { <nl> if ( cached_db_ . FindFileContainingExtension ( containing_type , field_number , <nl> output ) ) { <nl> return true ; <nl> bool ProtoReflectionDescriptorDatabase : : GetServices ( <nl> return false ; <nl> } <nl> <nl> - const google : : protobuf : : FileDescriptorProto <nl> + const protobuf : : FileDescriptorProto <nl> ProtoReflectionDescriptorDatabase : : ParseFileDescriptorProtoResponse ( <nl> const std : : string & byte_fd_proto ) { <nl> - google : : protobuf : : FileDescriptorProto file_desc_proto ; <nl> + protobuf : : FileDescriptorProto file_desc_proto ; <nl> file_desc_proto . ParseFromString ( byte_fd_proto ) ; <nl> return file_desc_proto ; <nl> } <nl> ProtoReflectionDescriptorDatabase : : ParseFileDescriptorProtoResponse ( <nl> void ProtoReflectionDescriptorDatabase : : AddFileFromResponse ( <nl> const grpc : : reflection : : v1alpha : : FileDescriptorResponse & response ) { <nl> for ( int i = 0 ; i < response . file_descriptor_proto_size ( ) ; + + i ) { <nl> - const google : : protobuf : : FileDescriptorProto file_proto = <nl> + const protobuf : : FileDescriptorProto file_proto = <nl> ParseFileDescriptorProtoResponse ( response . file_descriptor_proto ( i ) ) ; <nl> if ( known_files_ . find ( file_proto . name ( ) ) = = known_files_ . end ( ) ) { <nl> known_files_ . insert ( file_proto . name ( ) ) ; <nl> mmm a / test / cpp / util / proto_reflection_descriptor_database . h <nl> ppp b / test / cpp / util / proto_reflection_descriptor_database . h <nl> <nl> # include < unordered_set > <nl> # include < vector > <nl> <nl> - # include < google / protobuf / descriptor . h > <nl> - # include < google / protobuf / descriptor . pb . h > <nl> - # include < google / protobuf / descriptor_database . h > <nl> + / / GRPC_NO_GENERATED_CODE indicates generated pb files should not be used <nl> + # ifdef GRPC_NO_GENERATED_CODE <nl> + # include " src / proto / grpc / reflection / v1alpha / reflection . grpc . pb . h " <nl> + # else <nl> # include < grpc + + / ext / reflection . grpc . pb . h > <nl> + # endif / / GRPC_NO_GENERATED_CODE <nl> # include < grpc + + / grpc + + . h > <nl> - <nl> namespace grpc { <nl> <nl> / / ProtoReflectionDescriptorDatabase takes a stub of ServerReflection and <nl> / / provides the methods defined by DescriptorDatabase interfaces . It can be used <nl> / / to feed a DescriptorPool instance . <nl> - class ProtoReflectionDescriptorDatabase <nl> - : public google : : protobuf : : DescriptorDatabase { <nl> + class ProtoReflectionDescriptorDatabase : public protobuf : : DescriptorDatabase { <nl> public : <nl> explicit ProtoReflectionDescriptorDatabase ( <nl> std : : unique_ptr < reflection : : v1alpha : : ServerReflection : : Stub > stub ) ; <nl> class ProtoReflectionDescriptorDatabase <nl> / / Find a file by file name . Fills in in * output and returns true if found . <nl> / / Otherwise , returns false , leaving the contents of * output undefined . <nl> bool FindFileByName ( const string & filename , <nl> - google : : protobuf : : FileDescriptorProto * output ) <nl> - GRPC_OVERRIDE ; <nl> + protobuf : : FileDescriptorProto * output ) GRPC_OVERRIDE ; <nl> <nl> / / Find the file that declares the given fully - qualified symbol name . <nl> / / If found , fills in * output and returns true , otherwise returns false <nl> / / and leaves * output undefined . <nl> bool FindFileContainingSymbol ( const string & symbol_name , <nl> - google : : protobuf : : FileDescriptorProto * output ) <nl> + protobuf : : FileDescriptorProto * output ) <nl> GRPC_OVERRIDE ; <nl> <nl> / / Find the file which defines an extension extending the given message type <nl> class ProtoReflectionDescriptorDatabase <nl> / / must be a fully - qualified type name . <nl> bool FindFileContainingExtension ( <nl> const string & containing_type , int field_number , <nl> - google : : protobuf : : FileDescriptorProto * output ) GRPC_OVERRIDE ; <nl> + protobuf : : FileDescriptorProto * output ) GRPC_OVERRIDE ; <nl> <nl> / / Finds the tag numbers used by all known extensions of <nl> / / extendee_type , and appends them to output in an undefined <nl> class ProtoReflectionDescriptorDatabase <nl> grpc : : reflection : : v1alpha : : ServerReflectionResponse > <nl> ClientStream ; <nl> <nl> - const google : : protobuf : : FileDescriptorProto ParseFileDescriptorProtoResponse ( <nl> + const protobuf : : FileDescriptorProto ParseFileDescriptorProtoResponse ( <nl> const std : : string & byte_fd_proto ) ; <nl> <nl> void AddFileFromResponse ( <nl> class ProtoReflectionDescriptorDatabase <nl> std : : unordered_map < string , std : : vector < int > > cached_extension_numbers_ ; <nl> std : : mutex stream_mutex_ ; <nl> <nl> - google : : protobuf : : SimpleDescriptorDatabase cached_db_ ; <nl> + protobuf : : SimpleDescriptorDatabase cached_db_ ; <nl> } ; <nl> <nl> } / / namespace grpc <nl> mmm a / tools / run_tests / sanity / check_sources_and_headers . py <nl> ppp b / tools / run_tests / sanity / check_sources_and_headers . py <nl> def target_has_header ( target , name ) : <nl> for dep in target [ ' deps ' ] : <nl> if target_has_header ( get_target ( dep ) , name ) : <nl> return True <nl> - if name = = ' src / core / lib / profiling / stap_probes . h ' : <nl> + if name in [ ' src / core / lib / profiling / stap_probes . h ' , <nl> + ' src / proto / grpc / reflection / v1alpha / reflection . grpc . pb . h ' ] : <nl> return True <nl> return False <nl> <nl> mmm a / tools / run_tests / sources_and_headers . json <nl> ppp b / tools / run_tests / sources_and_headers . json <nl> <nl> { <nl> " deps " : [ <nl> " grpc + + " , <nl> - " grpc + + _codegen_proto " <nl> + " grpc + + _reflection_proto " <nl> ] , <nl> " headers " : [ <nl> " include / grpc + + / ext / proto_server_reflection_plugin . h " , <nl> - " include / grpc + + / ext / reflection . grpc . pb . h " , <nl> - " include / grpc + + / ext / reflection . pb . h " , <nl> " src / cpp / ext / proto_server_reflection . h " <nl> ] , <nl> " language " : " c + + " , <nl> " name " : " grpc + + _reflection " , <nl> " src " : [ <nl> " include / grpc + + / ext / proto_server_reflection_plugin . h " , <nl> - " include / grpc + + / ext / reflection . grpc . pb . h " , <nl> - " include / grpc + + / ext / reflection . pb . h " , <nl> " src / cpp / ext / proto_server_reflection . cc " , <nl> " src / cpp / ext / proto_server_reflection . h " , <nl> - " src / cpp / ext / proto_server_reflection_plugin . cc " , <nl> - " src / cpp / ext / reflection . grpc . pb . cc " , <nl> - " src / cpp / ext / reflection . pb . cc " <nl> + " src / cpp / ext / proto_server_reflection_plugin . cc " <nl> ] , <nl> " third_party " : false , <nl> " type " : " lib " <nl> } , <nl> + { <nl> + " deps " : [ ] , <nl> + " headers " : [ <nl> + " src / proto / grpc / reflection / v1alpha / reflection . grpc . pb . h " , <nl> + " src / proto / grpc / reflection / v1alpha / reflection . pb . h " <nl> + ] , <nl> + " language " : " c + + " , <nl> + " name " : " grpc + + _reflection_codegen " , <nl> + " src " : [ ] , <nl> + " third_party " : false , <nl> + " type " : " lib " <nl> + } , <nl> { <nl> " deps " : [ ] , <nl> " headers " : [ <nl> <nl> ] , <nl> " third_party " : false , <nl> " type " : " filegroup " <nl> + } , <nl> + { <nl> + " deps " : [ <nl> + " grpc + + _codegen_proto " <nl> + ] , <nl> + " headers " : [ <nl> + " include / grpc + + / ext / reflection . grpc . pb . h " , <nl> + " include / grpc + + / ext / reflection . pb . h " <nl> + ] , <nl> + " language " : " c + + " , <nl> + " name " : " grpc + + _reflection_proto " , <nl> + " src " : [ <nl> + " include / grpc + + / ext / reflection . grpc . pb . h " , <nl> + " include / grpc + + / ext / reflection . pb . h " , <nl> + " src / cpp / ext / reflection . grpc . pb . cc " , <nl> + " src / cpp / ext / reflection . pb . cc " <nl> + ] , <nl> + " third_party " : false , <nl> + " type " : " filegroup " <nl> } <nl> ] <nl> new file mode 100644 <nl> index 00000000000 . . d9e10c2d37e <nl> mmm / dev / null <nl> ppp b / vsprojects / vcxproj / grpc + + _reflection_codegen / grpc + + _reflection_codegen . vcxproj <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project DefaultTargets = " Build " ToolsVersion = " 12 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < ItemGroup Label = " ProjectConfigurations " > <nl> + < ProjectConfiguration Include = " Debug | Win32 " > <nl> + < Configuration > Debug < / Configuration > <nl> + < Platform > Win32 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Debug | x64 " > <nl> + < Configuration > Debug < / Configuration > <nl> + < Platform > x64 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Release | Win32 " > <nl> + < Configuration > Release < / Configuration > <nl> + < Platform > Win32 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Release | x64 " > <nl> + < Configuration > Release < / Configuration > <nl> + < Platform > x64 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < / ItemGroup > <nl> + < PropertyGroup Label = " Globals " > <nl> + < ProjectGuid > { C8A925BF - 4373 - D85D - 60AE - 96CDCBBF33F2 } < / ProjectGuid > <nl> + < IgnoreWarnIntDirInTempDetected > true < / IgnoreWarnIntDirInTempDetected > <nl> + < IntDir > $ ( SolutionDir ) IntDir \ $ ( MSBuildProjectName ) \ < / IntDir > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . Default . props " / > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 10 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v100 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 11 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v110 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 12 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v120 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 14 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v140 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Debug ' " Label = " Configuration " > <nl> + < ConfigurationType > StaticLibrary < / ConfigurationType > <nl> + < UseDebugLibraries > true < / UseDebugLibraries > <nl> + < CharacterSet > Unicode < / CharacterSet > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Release ' " Label = " Configuration " > <nl> + < ConfigurationType > StaticLibrary < / ConfigurationType > <nl> + < UseDebugLibraries > false < / UseDebugLibraries > <nl> + < WholeProgramOptimization > true < / WholeProgramOptimization > <nl> + < CharacterSet > Unicode < / CharacterSet > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . props " / > <nl> + < ImportGroup Label = " ExtensionSettings " > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " > <nl> + < Import Project = " $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props " Condition = " exists ( ' $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props ' ) " Label = " LocalAppDataPlatform " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ global . props " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ winsock . props " / > <nl> + < / ImportGroup > <nl> + < PropertyGroup Label = " UserMacros " / > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Debug ' " > <nl> + < TargetName > grpc + + _reflection_codegen < / TargetName > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Release ' " > <nl> + < TargetName > grpc + + _reflection_codegen < / TargetName > <nl> + < / PropertyGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > Disabled < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; _DEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreadedDebug < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | x64 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > Disabled < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; _DEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreadedDebug < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > MaxSpeed < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; NDEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < FunctionLevelLinking > true < / FunctionLevelLinking > <nl> + < IntrinsicFunctions > true < / IntrinsicFunctions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreaded < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < EnableCOMDATFolding > true < / EnableCOMDATFolding > <nl> + < OptimizeReferences > true < / OptimizeReferences > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | x64 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > MaxSpeed < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; NDEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < FunctionLevelLinking > true < / FunctionLevelLinking > <nl> + < IntrinsicFunctions > true < / IntrinsicFunctions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreaded < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < EnableCOMDATFolding > true < / EnableCOMDATFolding > <nl> + < OptimizeReferences > true < / OptimizeReferences > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemGroup > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ reflection \ v1alpha \ reflection . pb . cc " > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ reflection \ v1alpha \ reflection . pb . h " > <nl> + < / ClInclude > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ reflection \ v1alpha \ reflection . grpc . pb . cc " > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ reflection \ v1alpha \ reflection . grpc . pb . h " > <nl> + < / ClInclude > <nl> + < / ItemGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> + < ImportGroup Label = " ExtensionTargets " > <nl> + < / ImportGroup > <nl> + < Target Name = " EnsureNuGetPackageBuildImports " BeforeTargets = " PrepareForBuild " > <nl> + < PropertyGroup > <nl> + < ErrorText > This project references NuGet package ( s ) that are missing on this computer . Enable NuGet Package Restore to download them . For more information , see http : / / go . microsoft . com / fwlink / ? LinkID = 322105 . The missing file is { 0 } . < / ErrorText > <nl> + < / PropertyGroup > <nl> + < / Target > <nl> + < / Project > <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 577dcc77d8f <nl> mmm / dev / null <nl> ppp b / vsprojects / vcxproj / grpc + + _reflection_codegen / grpc + + _reflection_codegen . vcxproj . filters <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project ToolsVersion = " 4 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < ItemGroup > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ proto \ grpc \ reflection \ v1alpha \ reflection . proto " > <nl> + < Filter > src \ proto \ grpc \ reflection \ v1alpha < / Filter > <nl> + < / ClCompile > <nl> + < / ItemGroup > <nl> + <nl> + < ItemGroup > <nl> + < Filter Include = " src " > <nl> + < UniqueIdentifier > { d6f45d49 - 92db - 00f7 - 3dd4 - e53f5768d80c } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ proto " > <nl> + < UniqueIdentifier > { 32b951f4 - cef1 - 24a3 - ffb9 - bb229f0cdd6a } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ proto \ grpc " > <nl> + < UniqueIdentifier > { 8fdcb9f3 - 4d86 - 2f49 - 5c15 - c92e0e0f4fba } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ proto \ grpc \ reflection " > <nl> + < UniqueIdentifier > { 098a074c - f3de - 2840 - 8009 - 1a3840af1efc } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " src \ proto \ grpc \ reflection \ v1alpha " > <nl> + < UniqueIdentifier > { 219ff371 - 7d3a - 130c - 5792 - be36514a4e98 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < / ItemGroup > <nl> + < / Project > <nl> + <nl>
Merge pull request from y - zeng / seperate_generated_files
grpc/grpc
b5fa72c89e07c3a4a6730d3adf108ce9cfc33d78
2016-07-25T21:32:51Z
mmm a / scene / 2d / audio_stream_player_2d . cpp <nl> ppp b / scene / 2d / audio_stream_player_2d . cpp <nl> void AudioStreamPlayer2D : : _bind_methods ( ) { <nl> <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : OBJECT , " stream " , PROPERTY_HINT_RESOURCE_TYPE , " AudioStream " ) , " set_stream " , " get_stream " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " volume_db " , PROPERTY_HINT_RANGE , " - 80 , 24 " ) , " set_volume_db " , " get_volume_db " ) ; <nl> - ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " pitch_scale " , PROPERTY_HINT_RANGE , " 0 . 01 , 32 , 0 . 01 " ) , " set_pitch_scale " , " get_pitch_scale " ) ; <nl> + ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " pitch_scale " , PROPERTY_HINT_RANGE , " 0 . 01 , 4 , 0 . 01 , or_greater " ) , " set_pitch_scale " , " get_pitch_scale " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " playing " , PROPERTY_HINT_NONE , " " , PROPERTY_USAGE_EDITOR ) , " _set_playing " , " is_playing " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " autoplay " ) , " set_autoplay " , " is_autoplay_enabled " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " stream_paused " , PROPERTY_HINT_NONE , " " ) , " set_stream_paused " , " get_stream_paused " ) ; <nl> mmm a / scene / 3d / audio_stream_player_3d . cpp <nl> ppp b / scene / 3d / audio_stream_player_3d . cpp <nl> void AudioStreamPlayer3D : : _bind_methods ( ) { <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " unit_db " , PROPERTY_HINT_RANGE , " - 80 , 80 " ) , " set_unit_db " , " get_unit_db " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " unit_size " , PROPERTY_HINT_RANGE , " 0 . 1 , 100 , 0 . 1 " ) , " set_unit_size " , " get_unit_size " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " max_db " , PROPERTY_HINT_RANGE , " - 24 , 6 " ) , " set_max_db " , " get_max_db " ) ; <nl> - ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " pitch_scale " , PROPERTY_HINT_RANGE , " 0 . 01 , 32 , 0 . 01 " ) , " set_pitch_scale " , " get_pitch_scale " ) ; <nl> + ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " pitch_scale " , PROPERTY_HINT_RANGE , " 0 . 01 , 4 , 0 . 01 , or_greater " ) , " set_pitch_scale " , " get_pitch_scale " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " playing " , PROPERTY_HINT_NONE , " " , PROPERTY_USAGE_EDITOR ) , " _set_playing " , " is_playing " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " autoplay " ) , " set_autoplay " , " is_autoplay_enabled " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " stream_paused " , PROPERTY_HINT_NONE , " " ) , " set_stream_paused " , " get_stream_paused " ) ; <nl> mmm a / scene / audio / audio_stream_player . cpp <nl> ppp b / scene / audio / audio_stream_player . cpp <nl> void AudioStreamPlayer : : _bind_methods ( ) { <nl> <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : OBJECT , " stream " , PROPERTY_HINT_RESOURCE_TYPE , " AudioStream " ) , " set_stream " , " get_stream " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " volume_db " , PROPERTY_HINT_RANGE , " - 80 , 24 " ) , " set_volume_db " , " get_volume_db " ) ; <nl> - ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " pitch_scale " , PROPERTY_HINT_RANGE , " 0 . 01 , 32 , 0 . 01 " ) , " set_pitch_scale " , " get_pitch_scale " ) ; <nl> + ADD_PROPERTY ( PropertyInfo ( Variant : : REAL , " pitch_scale " , PROPERTY_HINT_RANGE , " 0 . 01 , 4 , 0 . 01 , or_greater " ) , " set_pitch_scale " , " get_pitch_scale " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " playing " , PROPERTY_HINT_NONE , " " , PROPERTY_USAGE_EDITOR ) , " _set_playing " , " is_playing " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " autoplay " ) , " set_autoplay " , " is_autoplay_enabled " ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL , " stream_paused " , PROPERTY_HINT_NONE , " " ) , " set_stream_paused " , " get_stream_paused " ) ; <nl>
Merge pull request from WARIO - MDMA / audiostreamplayer - pitch - scale
godotengine/godot
c3f2b84694d6e4c7d4c05efc6429934981f9a1b5
2020-02-17T08:54:02Z
mmm a / utils / build - script - impl <nl> ppp b / utils / build - script - impl <nl> if [ [ " $ { DARWIN_INSTALL_EXTRACT_SYMBOLS } " ] ] ; then <nl> grep - v swift - stdlib - tool | \ <nl> grep - v crashlog . py | \ <nl> grep - v symbolication . py | \ <nl> - xargs - n 1 - P $ ( BUILD_JOBS ) $ ( xcrun_find_tool dsymutil ) ) <nl> + xargs - n 1 - P $ { BUILD_JOBS } $ ( xcrun_find_tool dsymutil ) ) <nl> <nl> # Strip executables , shared libraries and static libraries in <nl> # INSTALL_DESTDIR . <nl> find " $ { INSTALL_DESTDIR } " / " $ { TOOLCHAIN_PREFIX } " \ <nl> \ ( - perm - 0111 - or - name " * . a " \ ) - type f - print | \ <nl> - xargs - n 1 - P $ ( BUILD_JOBS ) $ ( xcrun_find_tool strip ) - S <nl> + xargs - n 1 - P $ { BUILD_JOBS } $ ( xcrun_find_tool strip ) - S <nl> <nl> { set + x ; } 2 > / dev / null <nl> fi <nl>
build - script : fix syntax error in the shell script
apple/swift
4a9a6a2056aa17951a66745c05bc90ea5bd5b774
2015-12-24T11:21:22Z
mmm a / fdbserver / Knobs . cpp <nl> ppp b / fdbserver / Knobs . cpp <nl> ServerKnobs : : ServerKnobs ( bool randomize , ClientKnobs * clientKnobs , bool isSimula <nl> init ( MAX_PROXY_COMPUTE , 2 . 0 ) ; <nl> init ( PROXY_COMPUTE_BUCKETS , 20000 ) ; <nl> init ( PROXY_COMPUTE_GROWTH_RATE , 0 . 01 ) ; <nl> + init ( PROXY_REJECT_BATCH_QUEUED_TOO_LONG , true ) ; <nl> <nl> init ( RESET_MASTER_BATCHES , 200 ) ; <nl> init ( RESET_RESOLVER_BATCHES , 200 ) ; <nl> mmm a / fdbserver / Knobs . h <nl> ppp b / fdbserver / Knobs . h <nl> class ServerKnobs : public Knobs { <nl> double MAX_PROXY_COMPUTE ; <nl> int PROXY_COMPUTE_BUCKETS ; <nl> double PROXY_COMPUTE_GROWTH_RATE ; <nl> + bool PROXY_REJECT_BATCH_QUEUED_TOO_LONG ; <nl> <nl> int RESET_MASTER_BATCHES ; <nl> int RESET_RESOLVER_BATCHES ; <nl> mmm a / fdbserver / MasterProxyServer . actor . cpp <nl> ppp b / fdbserver / MasterProxyServer . actor . cpp <nl> ACTOR Future < Void > commitBatch ( <nl> TEST ( self - > latestLocalCommitBatchResolving . get ( ) < localBatchNumber - 1 ) ; / / Queuing pre - resolution commit processing <nl> wait ( self - > latestLocalCommitBatchResolving . whenAtLeast ( localBatchNumber - 1 ) ) ; <nl> double queuingDelay = g_network - > timer ( ) - timeStart ; <nl> - if ( queuingDelay > ( double ) SERVER_KNOBS - > MAX_READ_TRANSACTION_LIFE_VERSIONS / SERVER_KNOBS - > VERSIONS_PER_SECOND | | <nl> - ( BUGGIFY & & g_network - > isSimulated ( ) & & deterministicRandom ( ) - > random01 ( ) < 0 . 01 & & trs . size ( ) > 0 & & <nl> - ! trs [ 0 ] . transaction . mutations [ 0 ] . param1 . startsWith ( LiteralStringRef ( " \ xff " ) ) ) ) { <nl> + if ( ( queuingDelay > ( double ) SERVER_KNOBS - > MAX_READ_TRANSACTION_LIFE_VERSIONS / SERVER_KNOBS - > VERSIONS_PER_SECOND | | <nl> + ( BUGGIFY & & g_network - > isSimulated ( ) & & deterministicRandom ( ) - > random01 ( ) < 0 . 01 ) ) & & <nl> + SERVER_KNOBS - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG & & <nl> + trs . size ( ) > 0 & & ! trs [ 0 ] . transaction . mutations . empty ( ) & & ! trs [ 0 ] . transaction . mutations [ 0 ] . param1 . startsWith ( LiteralStringRef ( " \ xff " ) ) ) { <nl> / / Disabled for the recovery transaction . otherwise , recovery can ' t finish and keeps doing more recoveries . <nl> TEST ( true ) ; / / Reject transactions in the batch <nl> - TraceEvent ( " ProxyReject " , self - > dbgid ) . detail ( " Delay " , queuingDelay ) . detail ( " N " , trs . size ( ) ) ; <nl> - for ( const auto m : trs [ 0 ] . transaction . mutations ) { <nl> - TraceEvent ( " ProxyReject " , self - > dbgid ) . detail ( " Mutation " , m . toString ( ) ) ; <nl> + TraceEvent ( " ProxyReject " , self - > dbgid ) . detail ( " Delay " , queuingDelay ) . detail ( " N " , trs . size ( ) ) . detail ( " BatchNumber " , localBatchNumber ) ; <nl> + int i = 0 ; <nl> + for ( const auto tr : trs ) { <nl> + int j = 0 ; <nl> + for ( const auto & m : tr . transaction . mutations ) { <nl> + TraceEvent ( " ProxyReject " , self - > dbgid ) . detail ( " T " , i ) . detail ( " M " , j ) . detail ( " Mutation " , m . toString ( ) ) ; <nl> + j + + ; <nl> + } <nl> + i + + ; <nl> } <nl> ASSERT ( self - > latestLocalCommitBatchResolving . get ( ) = = localBatchNumber - 1 ) ; <nl> self - > latestLocalCommitBatchResolving . set ( localBatchNumber ) ; <nl> <nl> wait ( self - > latestLocalCommitBatchLogging . whenAtLeast ( localBatchNumber - 1 ) ) ; <nl> + ASSERT ( self - > latestLocalCommitBatchLogging . get ( ) = = localBatchNumber - 1 ) ; <nl> self - > latestLocalCommitBatchLogging . set ( localBatchNumber ) ; <nl> for ( const auto & tr : trs ) { <nl> tr . reply . sendError ( not_committed ( ) ) ; <nl> mmm a / fdbserver / workloads / AtomicRestore . actor . cpp <nl> ppp b / fdbserver / workloads / AtomicRestore . actor . cpp <nl> struct AtomicRestoreWorkload : TestWorkload { <nl> ACTOR static Future < Void > _start ( Database cx , AtomicRestoreWorkload * self ) { <nl> state FileBackupAgent backupAgent ; <nl> <nl> + / / Disable proxy rejection <nl> + const_cast < ServerKnobs * > ( SERVER_KNOBS ) - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG = false ; <nl> + <nl> wait ( delay ( self - > startAfter * deterministicRandom ( ) - > random01 ( ) ) ) ; <nl> TraceEvent ( " AtomicRestore_Start " ) ; <nl> <nl> struct AtomicRestoreWorkload : TestWorkload { <nl> } <nl> <nl> TraceEvent ( " AtomicRestore_Done " ) ; <nl> + const_cast < ServerKnobs * > ( SERVER_KNOBS ) - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG = true ; <nl> return Void ( ) ; <nl> } <nl> } ; <nl> mmm a / fdbserver / workloads / AtomicSwitchover . actor . cpp <nl> ppp b / fdbserver / workloads / AtomicSwitchover . actor . cpp <nl> struct AtomicSwitchoverWorkload : TestWorkload { <nl> state DatabaseBackupAgent backupAgent ( cx ) ; <nl> state DatabaseBackupAgent restoreAgent ( self - > extraDB ) ; <nl> <nl> + / / Disable proxy rejection to avoid ApplyMutationsError <nl> + const_cast < ServerKnobs * > ( SERVER_KNOBS ) - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG = false ; <nl> + <nl> TraceEvent ( " AS_Wait1 " ) ; <nl> wait ( success ( backupAgent . waitBackup ( self - > extraDB , BackupAgentBase : : getDefaultTag ( ) , false ) ) ) ; <nl> TraceEvent ( " AS_Ready1 " ) ; <nl> struct AtomicSwitchoverWorkload : TestWorkload { <nl> g_simulator . drAgents = ISimulator : : NoBackupAgents ; <nl> } <nl> <nl> + const_cast < ServerKnobs * > ( SERVER_KNOBS ) - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG = true ; <nl> + <nl> return Void ( ) ; <nl> } <nl> } ; <nl> mmm a / fdbserver / workloads / BackupToDBAbort . actor . cpp <nl> ppp b / fdbserver / workloads / BackupToDBAbort . actor . cpp <nl> <nl> # include " fdbclient / ManagementAPI . actor . h " <nl> # include " fdbclient / NativeAPI . actor . h " <nl> # include " fdbserver / workloads / workloads . actor . h " <nl> + # include " fdbserver / Knobs . h " <nl> + <nl> # include " flow / actorcompiler . h " / / This must be the last # include . <nl> <nl> struct BackupToDBAbort : TestWorkload { <nl> struct BackupToDBAbort : TestWorkload { <nl> ACTOR static Future < Void > _setup ( BackupToDBAbort * self , Database cx ) { <nl> state DatabaseBackupAgent backupAgent ( cx ) ; <nl> try { <nl> + / / Disable proxy rejection to avoid ApplyMutationsError <nl> + const_cast < ServerKnobs * > ( SERVER_KNOBS ) - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG = false ; <nl> TraceEvent ( " BDBA_Submit1 " ) ; <nl> wait ( backupAgent . submitBackup ( self - > extraDB , BackupAgentBase : : getDefaultTag ( ) , self - > backupRanges , false , StringRef ( ) , StringRef ( ) , true ) ) ; <nl> TraceEvent ( " BDBA_Submit2 " ) ; <nl> struct BackupToDBAbort : TestWorkload { <nl> if ( e . code ( ) ! = error_code_backup_duplicate ) <nl> throw ; <nl> } <nl> + const_cast < ServerKnobs * > ( SERVER_KNOBS ) - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG = true ; <nl> return Void ( ) ; <nl> } <nl> <nl> mmm a / fdbserver / workloads / BackupToDBCorrectness . actor . cpp <nl> ppp b / fdbserver / workloads / BackupToDBCorrectness . actor . cpp <nl> struct BackupToDBCorrectnessWorkload : TestWorkload { <nl> TraceEvent ( " BARW_Arguments " ) . detail ( " BackupTag " , printable ( self - > backupTag ) ) . detail ( " BackupAfter " , self - > backupAfter ) <nl> . detail ( " AbortAndRestartAfter " , self - > abortAndRestartAfter ) . detail ( " DifferentialAfter " , self - > stopDifferentialAfter ) ; <nl> <nl> + / / Disable proxy rejection to avoid ApplyMutationsError <nl> + const_cast < ServerKnobs * > ( SERVER_KNOBS ) - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG = false ; <nl> + <nl> state UID randomID = nondeterministicRandom ( ) - > randomUniqueID ( ) ; <nl> <nl> / / Increment the backup agent requets <nl> struct BackupToDBCorrectnessWorkload : TestWorkload { <nl> throw ; <nl> } <nl> <nl> + const_cast < ServerKnobs * > ( SERVER_KNOBS ) - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG = true ; <nl> + <nl> return Void ( ) ; <nl> } <nl> } ; <nl> mmm a / fdbserver / workloads / BackupToDBUpgrade . actor . cpp <nl> ppp b / fdbserver / workloads / BackupToDBUpgrade . actor . cpp <nl> struct BackupToDBUpgradeWorkload : TestWorkload { <nl> state UID logUid ; <nl> state Version commitVersion ; <nl> <nl> + / / Disable proxy rejection to avoid ApplyMutationsError <nl> + const_cast < ServerKnobs * > ( SERVER_KNOBS ) - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG = false ; <nl> + <nl> state Future < Void > stopDifferential = delay ( self - > stopDifferentialAfter ) ; <nl> state Future < Void > waitUpgrade = backupAgent . waitUpgradeToLatestDrVersion ( self - > extraDB , self - > backupTag ) ; <nl> wait ( success ( stopDifferential ) & & success ( waitUpgrade ) ) ; <nl> struct BackupToDBUpgradeWorkload : TestWorkload { <nl> throw ; <nl> } <nl> <nl> + const_cast < ServerKnobs * > ( SERVER_KNOBS ) - > PROXY_REJECT_BATCH_QUEUED_TOO_LONG = true ; <nl> + <nl> return Void ( ) ; <nl> } <nl> } ; <nl>
Add a knob PROXY_REJECT_BATCH_QUEUED_TOO_LONG
apple/foundationdb
df5293e2bebb60e8bdcfb3e5f35cf5d430acd333
2020-11-29T05:32:41Z
mmm a / modules / planning / integration_tests / BUILD <nl> ppp b / modules / planning / integration_tests / BUILD <nl> cc_test ( <nl> ] , <nl> ) <nl> <nl> + cc_test ( <nl> + name = " huanbaoyuan_bzone_test " , <nl> + size = " small " , <nl> + srcs = [ <nl> + " huanbaoyuan_bzone_test . cc " , <nl> + ] , <nl> + data = [ <nl> + " / / modules / common / configs : config_gflags " , <nl> + " / / modules / map : map_data " , <nl> + " / / modules / planning : planning_testdata " , <nl> + ] , <nl> + deps = [ <nl> + " : planning_test_base " , <nl> + " @ gtest / / : main " , <nl> + ] , <nl> + ) <nl> + <nl> cpplint ( ) <nl> new file mode 100644 <nl> index 00000000000 . . 8cf51d2e2d7 <nl> mmm / dev / null <nl> ppp b / modules / planning / integration_tests / huanbaoyuan_bzone_test . cc <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2017 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + # include < string > <nl> + <nl> + # include " gtest / gtest . h " <nl> + <nl> + # include " modules / common / configs / config_gflags . h " <nl> + # include " modules / planning / common / planning_gflags . h " <nl> + # include " modules / planning / integration_tests / planning_test_base . h " <nl> + # include " modules / planning / planning . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + <nl> + / * * <nl> + * @ class HuangbaoyuanBzoneTest <nl> + * @ brief This is an integration test that uses the huanbaoyuan_bzone map . <nl> + * / <nl> + <nl> + class HuangbaoyuanBzoneTest : public PlanningTestBase { <nl> + public : <nl> + virtual void SetUp ( ) { <nl> + FLAGS_map_dir = " modules / map / data / huanbaoyuan_bzone " ; <nl> + FLAGS_test_data_dir = " modules / planning / testdata / huanbaoyuan_bzone_test " ; <nl> + } <nl> + } ; <nl> + <nl> + / * <nl> + * test follow a vehicle with medium distance <nl> + * A follow test case <nl> + * / <nl> + TEST_F ( HuangbaoyuanBzoneTest , follow_01 ) { <nl> + std : : string seq_num = " 1 " ; <nl> + FLAGS_test_routing_response_file = seq_num + " _routing . pb . txt " ; <nl> + FLAGS_test_prediction_file = seq_num + " _prediction . pb . txt " ; <nl> + FLAGS_test_localization_file = seq_num + " _localization . pb . txt " ; <nl> + FLAGS_test_chassis_file = seq_num + " _chassis . pb . txt " ; <nl> + PlanningTestBase : : SetUp ( ) ; <nl> + RUN_GOLDEN_TEST ; <nl> + } <nl> + <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . c6b88b30a47 <nl> mmm / dev / null <nl> ppp b / modules / planning / testdata / huanbaoyuan_bzone_test / 1_chassis . pb . txt <nl> <nl> + engine_started : true <nl> + engine_rpm : 1317 . 5 <nl> + speed_mps : 2 . 1388888 <nl> + odometer_m : 0 <nl> + fuel_range_m : 0 <nl> + throttle_percentage : 15 . 617609 <nl> + brake_percentage : 25 . 226215 <nl> + steering_percentage : - 2 . 93617 <nl> + steering_torque_nm : 0 . 1875 <nl> + parking_brake : false <nl> + driving_mode : COMPLETE_AUTO_DRIVE <nl> + error_code : NO_ERROR <nl> + gear_location : GEAR_DRIVE <nl> + header { <nl> + timestamp_sec : 1505101374 . 9773252 <nl> + module_name : " chassis " <nl> + sequence_num : 280364 <nl> + } <nl> + signal { <nl> + turn_signal : TURN_NONE <nl> + horn : false <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 664bc56bb86 <nl> mmm / dev / null <nl> ppp b / modules / planning / testdata / huanbaoyuan_bzone_test / 1_localization . pb . txt <nl> <nl> + header { <nl> + timestamp_sec : 1505101374 . 9853282 <nl> + module_name : " localization " <nl> + sequence_num : 337443 <nl> + } <nl> + pose { <nl> + position { <nl> + x : 431261 . 66160004272 <nl> + y : 4434248 . 5207988014 <nl> + z : 37 . 6539776455611 <nl> + } <nl> + orientation { <nl> + qx : 0 . 013319129882817875 <nl> + qy : - 0 . 0046843402546536562 <nl> + qz : - 0 . 97313825154254918 <nl> + qw : 0 . 22978816575327293 <nl> + } <nl> + linear_velocity { <nl> + x : 0 . 89730226965427606 <nl> + y : - 1 . 9163766414814525 <nl> + z : - 0 . 013419422385524293 <nl> + } <nl> + linear_acceleration { <nl> + x : - 0 . 31452898438100124 <nl> + y : 0 . 37311052841730336 <nl> + z : - 0 . 158151510559894 <nl> + } <nl> + angular_velocity { <nl> + x : - 0 . 011159738983989495 <nl> + y : - 0 . 0043238653408360491 <nl> + z : - 0 . 00902805473684146 <nl> + } <nl> + heading : - 1 . 107210378549587 <nl> + linear_acceleration_vrf { <nl> + x : 0 . 11804747092946921 <nl> + y : - 0 . 47672964337296797 <nl> + z : - 0 . 14814010416021237 <nl> + } <nl> + angular_velocity_vrf { <nl> + x : 0 . 01212615646460174 <nl> + y : - 0 . 0012601103148023045 <nl> + z : - 0 . 0087240936147195188 <nl> + } <nl> + euler_angles { <nl> + x : 0 . 023774897526526308 <nl> + y : - 0 . 015238768004890147 <nl> + z : - 1 . 107210378549587 <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 7d04c1d4a04 <nl> mmm / dev / null <nl> ppp b / modules / planning / testdata / huanbaoyuan_bzone_test / 1_prediction . pb . txt <nl> <nl> + header { <nl> + timestamp_sec : 1505101374 . 9681535 <nl> + module_name : " prediction " <nl> + sequence_num : 27886 <nl> + } <nl> + prediction_obstacle { <nl> + perception_obstacle { <nl> + id : 4158 <nl> + position { <nl> + x : 431269 . 46421984775 <nl> + y : 4434227 . 2687848564 <nl> + z : 36 . 790656844122587 <nl> + } <nl> + theta : - 1 . 1046185536287838 <nl> + velocity { <nl> + x : 1 . 9628990888595581 <nl> + y : - 3 . 9010908603668213 <nl> + z : 0 <nl> + } <nl> + length : 2 . 196852445602417 <nl> + width : 1 . 5805786848068237 <nl> + height : 1 . 5161072015762329 <nl> + polygon_point { <nl> + x : 431269 . 03010480892 <nl> + y : 4434228 . 2773005888 <nl> + z : 36 . 8101149702993 <nl> + } <nl> + polygon_point { <nl> + x : 431269 . 17984672467 <nl> + y : 4434228 . 3315352853 <nl> + z : 36 . 813884544288584 <nl> + } <nl> + polygon_point { <nl> + x : 431269 . 62134435022 <nl> + y : 4434228 . 4259341 <nl> + z : 36 . 823886346582405 <nl> + } <nl> + polygon_point { <nl> + x : 431269 . 72612966265 <nl> + y : 4434228 . 3343186909 <nl> + z : 36 . 82432398471763 <nl> + } <nl> + polygon_point { <nl> + x : 431269 . 83167073544 <nl> + y : 4434228 . 2331340453 <nl> + z : 36 . 82461350306771 <nl> + } <nl> + polygon_point { <nl> + x : 431269 . 99003631779 <nl> + y : 4434227 . 9820505809 <nl> + z : 36 . 823362465743891 <nl> + } <nl> + polygon_point { <nl> + x : 431270 . 60117411258 <nl> + y : 4434226 . 6798378127 <nl> + z : 36 . 812875291483515 <nl> + } <nl> + polygon_point { <nl> + x : 431270 . 54261154146 <nl> + y : 4434226 . 5875284076 <nl> + z : 36 . 810193707815351 <nl> + } <nl> + polygon_point { <nl> + x : 431269 . 22785377823 <nl> + y : 4434226 . 2594778426 <nl> + z : 36 . 7796118202069 <nl> + } <nl> + polygon_point { <nl> + x : 431269 . 15352119884 <nl> + y : 4434226 . 2620281866 <nl> + z : 36 . 778241067472266 <nl> + } <nl> + polygon_point { <nl> + x : 431268 . 37560297374 <nl> + y : 4434227 . 7016486889 <nl> + z : 36 . 787888851618135 <nl> + } <nl> + polygon_point { <nl> + x : 431268 . 37681847269 <nl> + y : 4434227 . 7266655695 <nl> + z : 36 . 788336790748019 <nl> + } <nl> + polygon_point { <nl> + x : 431268 . 38256755861 <nl> + y : 4434227 . 76290393 <nl> + z : 36 . 789061528243096 <nl> + } <nl> + polygon_point { <nl> + x : 431268 . 46442806924 <nl> + y : 4434227 . 9623066541 <nl> + z : 36 . 794004889681133 <nl> + } <nl> + polygon_point { <nl> + x : 431268 . 51351631264 <nl> + y : 4434228 . 0180830825 <nl> + z : 36 . 795885866053439 <nl> + } <nl> + polygon_point { <nl> + x : 431268 . 97076182946 <nl> + y : 4434228 . 25402822 <nl> + z : 36 . 808590871004967 <nl> + } <nl> + tracking_time : 39 . 447443962097168 <nl> + type : UNKNOWN <nl> + timestamp : 0 <nl> + } <nl> + timestamp : 1505101374 . 9670451 <nl> + predicted_period : 3 <nl> + trajectory { <nl> + probability : 0 . 98135912074028975 <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431269 . 78326196538 <nl> + y : 4434226 . 7485125754 <nl> + z : 0 <nl> + theta : - 1 . 1433428564553827 <nl> + } <nl> + v : 2 . 9395357343930626 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 0 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431269 . 90256987588 <nl> + y : 4434226 . 4866096349 <nl> + z : 0 <nl> + theta : - 1 . 1199583873568875 <nl> + } <nl> + v : 2 . 6680318320769545 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 0 . 1 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 01011043089 <nl> + y : 4434226 . 2644592328 <nl> + z : 0 <nl> + theta : - 1 . 1445984930099968 <nl> + } <nl> + v : 2 . 3965279297608464 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 0 . 2 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 10600913886 <nl> + y : 4434226 . 0532412175 <nl> + z : 0 <nl> + theta : - 1 . 1242854755692564 <nl> + } <nl> + v : 2 . 1250240274447383 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 0 . 30000000000000004 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 19149403658 <nl> + y : 4434225 . 8746860316 <nl> + z : 0 <nl> + theta : - 1 . 137708883118556 <nl> + } <nl> + v : 1 . 8535201251286302 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 0 . 4 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 26541186671 <nl> + y : 4434225 . 7148163989 <nl> + z : 0 <nl> + theta : - 1 . 0929785429772054 <nl> + } <nl> + v : 1 . 5820162228125221 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 0 . 5 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 33026980888 <nl> + y : 4434225 . 5895694057 <nl> + z : 0 <nl> + theta : - 1 . 124554780908215 <nl> + } <nl> + v : 1 . 310512320496414 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 0 . 60000000000000009 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 38286824559 <nl> + y : 4434225 . 4796292717 <nl> + z : 0 <nl> + theta : - 1 . 1032861151325419 <nl> + } <nl> + v : 1 . 0390084181803059 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 0 . 70000000000000007 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 42521792935 <nl> + y : 4434225 . 3957415381 <nl> + z : 0 <nl> + theta : - 1 . 0063702274204851 <nl> + } <nl> + v : 0 . 76750451586419777 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 0 . 8 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 45907039492 <nl> + y : 4434225 . 3422733285 <nl> + z : 0 <nl> + theta : - 0 . 884813722787277 <nl> + } <nl> + v : 0 . 49600061354808972 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 0 . 9 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 48290682776 <nl> + y : 4434225 . 3131549507 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 . 22449671123198167 <nl> + a : - 2 . 71503902316108 <nl> + relative_time : 1 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 1 . 1 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 1 . 2000000000000002 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 1 . 3 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 1 . 4000000000000001 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 1 . 5 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 1 . 6 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 1 . 7000000000000002 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 1 . 8 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 1 . 9000000000000001 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 2 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 2 . 1 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 2 . 2 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 2 . 3000000000000003 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 2 . 4000000000000004 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 2 . 5 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 2 . 6 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 2 . 7 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 2 . 8000000000000003 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431270 . 496751675 <nl> + y : 4434225 . 3085706821 <nl> + z : 0 <nl> + theta : - 0 . 31975481577604503 <nl> + } <nl> + v : 0 <nl> + a : 0 <nl> + relative_time : 2 . 9000000000000004 <nl> + } <nl> + } <nl> + } <nl> + perception_error_code : OK <nl> new file mode 100644 <nl> index 00000000000 . . 75f72624d2f <nl> mmm / dev / null <nl> ppp b / modules / planning / testdata / huanbaoyuan_bzone_test / 1_routing . pb . txt <nl> <nl> + header { <nl> + timestamp_sec : 1505101372 . 3203726 <nl> + module_name : " routing " <nl> + sequence_num : 29 <nl> + } <nl> + route { <nl> + road_info { <nl> + id : " 131 - 72 - 64 " <nl> + in_lane { <nl> + id : " 64_1_ - 1 " <nl> + s : 63 . 683761497934711 <nl> + } <nl> + out_lane { <nl> + id : " 72_1_ - 1 " <nl> + s : 42 . 389566612060662 <nl> + } <nl> + passage_region { <nl> + segment { <nl> + id : " 64_1_ - 1 " <nl> + start_s : 63 . 683761497934711 <nl> + end_s : 144 . 45 <nl> + } <nl> + segment { <nl> + id : " 131_1_ - 1 " <nl> + start_s : 0 <nl> + end_s : 36 . 9394 <nl> + } <nl> + segment { <nl> + id : " 72_1_ - 1 " <nl> + start_s : 0 <nl> + end_s : 42 . 389566612060662 <nl> + } <nl> + } <nl> + } <nl> + } <nl> + measurement { <nl> + distance : 160 . 09520511412595 <nl> + } <nl> + routing_request { <nl> + header { <nl> + timestamp_sec : 1505101372 . 320029 <nl> + module_name : " dreamview " <nl> + sequence_num : 35 <nl> + } <nl> + start { <nl> + id : " 64_1_ - 1 " <nl> + s : 63 . 683761497934711 <nl> + pose { <nl> + x : 431259 . 224200729 <nl> + y : 4434253 . 73378437 <nl> + } <nl> + } <nl> + end { <nl> + id : " 72_1_ - 1 " <nl> + s : 42 . 389566612060662 <nl> + pose { <nl> + x : 431311 . 80160710122 <nl> + y : 4434102 . 6230789386 <nl> + } <nl> + } <nl> + } <nl> + map_version : " 1 . 400000 " <nl> + error_code { <nl> + error_id : SUCCESS <nl> + error_string : " Success ! " <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 314e08015c4 <nl> mmm / dev / null <nl> ppp b / modules / planning / testdata / huanbaoyuan_bzone_test / result_follow_01_0 . pb . txt <nl> <nl> + header { <nl> + module_name : " planning " <nl> + } <nl> + is_replan : true <nl> + gear : GEAR_DRIVE <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431261 . 66160004272 <nl> + y : 4434248 . 5207988014 <nl> + z : 0 <nl> + theta : - 1 . 107210378549587 <nl> + kappa : 2 . 84871307956969e - 19 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 2 . 1388888359069824 <nl> + a : - 0 . 47672964337296797 <nl> + relative_time : 0 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431261 . 70905962924 <nl> + y : 4434248 . 4256328885 <nl> + theta : - 1 . 10752193779367 <nl> + kappa : - 0 . 00059663641077774233 <nl> + s : 0 . 10634360914577207 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 2 . 1147583810902097 <nl> + a : - 0 . 48838750341579645 <nl> + relative_time : 0 . 05 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431261 . 7559743718 <nl> + y : 4434248 . 3315594979 <nl> + theta : - 1 . 1078299205050792 <nl> + kappa : - 0 . 0011864233355915212 <nl> + s : 0 . 21146637584035732 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 2 . 0900601901536167 <nl> + a : - 0 . 49943908816578242 <nl> + relative_time : 0 . 1 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431261 . 80233194 <nl> + y : 4434248 . 2386033516 <nl> + theta : - 1 . 108134245672973 <nl> + kappa : - 0 . 0017692057632960594 <nl> + s : 0 . 3153406711218808 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 2 . 0648245768618456 <nl> + a : - 0 . 5098843976229257 <nl> + relative_time : 0 . 15000000000000002 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431261 . 84812067979 <nl> + y : 4434248 . 1467878195 <nl> + theta : - 1 . 1084348367311043 <nl> + kappa : - 0 . 0023448371864520749 <nl> + s : 0 . 41794038171669962 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 2 . 0390818549795382 <nl> + a : - 0 . 51972343178722646 <nl> + relative_time : 0 . 2 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431261 . 89332961361 <nl> + y : 4434248 . 0561349131 <nl> + theta : - 1 . 1087316215578515 <nl> + kappa : - 0 . 002913179601326281 <nl> + s : 0 . 519240910039403 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 2 . 0128623382713369 <nl> + a : - 0 . 52895619065868471 <nl> + relative_time : 0 . 25 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431261 . 93794844043 <nl> + y : 4434247 . 9666652894 <nl> + theta : - 1 . 1090245324762278 <nl> + kappa : - 0 . 0034741035078913875 <nl> + s : 0 . 61921917419281247 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 9861963405018839 <nl> + a : - 0 . 53758267423730033 <nl> + relative_time : 0 . 3 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431261 . 98196753557 <nl> + y : 4434247 . 8783982471 <nl> + theta : - 1 . 1093135062538706 <nl> + kappa : - 0 . 004027487909826097 <nl> + s : 0 . 71785360796798114 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 959114175435821 <nl> + a : - 0 . 54560288252307332 <nl> + relative_time : 0 . 35 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 02537795069 <nl> + y : 4434247 . 7913517291 <nl> + theta : - 1 . 1095984841030129 <nl> + kappa : - 0 . 0045732203145151121 <nl> + s : 0 . 81512416084419514 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 9316461568377905 <nl> + a : - 0 . 55301681551600379 <nl> + relative_time : 0 . 39999999999999997 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 06817141414 <nl> + y : 4434247 . 7055423222 <nl> + theta : - 1 . 109879411680436 <nl> + kappa : - 0 . 0051111967330491241 <nl> + s : 0 . 91101229798897143 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 9038225984724346 <nl> + a : - 0 . 55982447321609163 <nl> + relative_time : 0 . 44999999999999996 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 110301941 <nl> + y : 4434247 . 6209662436 <nl> + theta : - 1 . 1101939271518662 <nl> + kappa : - 0 . 0056297519358119693 <nl> + s : 1 . 0055010002580602 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 8756738141043954 <nl> + a : - 0 . 56602585562333685 <nl> + relative_time : 0 . 49999999999999994 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 151380336 <nl> + y : 4434247 . 5374480356 <nl> + theta : - 1 . 1109172799282 <nl> + kappa : - 0 . 0060135889754906113 <nl> + s : 1 . 0985747641954435 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 847230117498315 <nl> + a : - 0 . 57162096273773955 <nl> + relative_time : 0 . 54999999999999993 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 19182807021 <nl> + y : 4434247 . 455212051 <nl> + theta : - 1 . 1116295305116377 <nl> + kappa : - 0 . 006391533111081725 <nl> + s : 1 . 1902196020333353 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 8185218224188355 <nl> + a : - 0 . 57660979455929973 <nl> + relative_time : 0 . 6 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 23163963872 <nl> + y : 4434247 . 3742694817 <nl> + theta : - 1 . 1123305811176794 <nl> + kappa : - 0 . 00676353290761704 <nl> + s : 1 . 2804230416921814 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 789579242630599 <nl> + a : - 0 . 58099235108801728 <nl> + relative_time : 0 . 65 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 27081020607 <nl> + y : 4434247 . 2946301587 <nl> + theta : - 1 . 1130203458092105 <nl> + kappa : - 0 . 0071295431808401939 <nl> + s : 1 . 36917412678066 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 7604326918982478 <nl> + a : - 0 . 5847686323238922 <nl> + relative_time : 0 . 70000000000000007 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 30933560553 <nl> + y : 4434247 . 2163025541 <nl> + theta : - 1 . 1136987504948945 <nl> + kappa : - 0 . 0074895249972067261 <nl> + s : 1 . 4564634165956818 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 7311124839864238 <nl> + a : - 0 . 58793863826692461 <nl> + relative_time : 0 . 75000000000000011 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 3472123394 <nl> + y : 4434247 . 1392937787 <nl> + theta : - 1 . 1143657329273553 <nl> + kappa : - 0 . 007843445673884078 <nl> + s : 1 . 5422829861223888 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 7016489326597695 <nl> + a : - 0 . 59050236891711438 <nl> + relative_time : 0 . 80000000000000016 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 38443757885 <nl> + y : 4434247 . 0636095833 <nl> + theta : - 1 . 1150212427011714 <nl> + kappa : - 0 . 00819127877875159 <nl> + s : 1 . 6266264260341556 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 6720723516829263 <nl> + a : - 0 . 59245982427446164 <nl> + relative_time : 0 . 8500000000000002 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 421009164 <nl> + y : 4434246 . 9892543592 <nl> + theta : - 1 . 1156652412507022 <nl> + kappa : - 0 . 0085330041304005153 <nl> + s : 1 . 7094888426925892 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 6424130548205371 <nl> + a : - 0 . 59381100433896628 <nl> + relative_time : 0 . 90000000000000024 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 45692560414 <nl> + y : 4434246 . 9162311386 <nl> + theta : - 1 . 1162977018477636 <nl> + kappa : - 0 . 0088686077981340022 <nl> + s : 1 . 790866858147528 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 6127013558372438 <nl> + a : - 0 . 59455590911062828 <nl> + relative_time : 0 . 95000000000000029 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 49218607729 <nl> + y : 4434246 . 8445415925 <nl> + theta : - 1 . 1169186095991759 <nl> + kappa : - 0 . 0091980821019671029 <nl> + s : 1 . 8707586101370426 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 5829675684976885 <nl> + a : - 0 . 59469453858944776 <nl> + relative_time : 1 . 0000000000000002 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 52679043048 <nl> + y : 4434246 . 774186031 <nl> + theta : - 1 . 1175279614442011 <nl> + kappa : - 0 . 009521425612626774 <nl> + s : 1 . 9491637520874365 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 5532420065665131 <nl> + a : - 0 . 59422689277542462 <nl> + relative_time : 1 . 0500000000000003 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 56047730363 <nl> + y : 4434246 . 70503615 <nl> + theta : - 1 . 1182310394118609 <nl> + kappa : - 0 . 0097990414703512021 <nl> + s : 2 . 0260834531132441 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 52355498380836 <nl> + a : - 0 . 593152971668559 <nl> + relative_time : 1 . 1000000000000003 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 59312423773 <nl> + y : 4434246 . 6370294569 <nl> + theta : - 1 . 1190775757704183 <nl> + kappa : - 0 . 010012242911885209 <nl> + s : 2 . 1015203980172337 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 493936813987871 <nl> + a : - 0 . 59147277526885067 <nl> + relative_time : 1 . 1500000000000004 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 62513129553 <nl> + y : 4434246 . 5703556864 <nl> + theta : - 1 . 1199075262550175 <nl> + kappa : - 0 . 010221265629157778 <nl> + s : 2 . 1754787872904036 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 4644178108696888 <nl> + a : - 0 . 58918630357629986 <nl> + relative_time : 1 . 2000000000000004 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 65650095092 <nl> + y : 4434246 . 5050096866 <nl> + theta : - 1 . 1207209535382805 <nl> + kappa : - 0 . 010426125777351941 <nl> + s : 2 . 2479643371119851 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 4350282882184551 <nl> + a : - 0 . 58629355659090643 <nl> + relative_time : 1 . 2500000000000004 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 68723633362 <nl> + y : 4434246 . 4409849383 <nl> + theta : - 1 . 1215179374431525 <nl> + kappa : - 0 . 010626843795319911 <nl> + s : 2 . 3189842793494422 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 4057985597988121 <nl> + a : - 0 . 58279453431267036 <nl> + relative_time : 1 . 3000000000000005 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 71734122932 <nl> + y : 4434246 . 3782735551 <nl> + theta : - 1 . 1222985749355707 <nl> + kappa : - 0 . 010823444405583081 <nl> + s : 2 . 3885473615584703 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 3767589393754021 <nl> + a : - 0 . 57868923674159178 <nl> + relative_time : 1 . 3500000000000005 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 74682007963 <nl> + y : 4434246 . 3168662833 <nl> + theta : - 1 . 1230629801170502 <nl> + kappa : - 0 . 011015956614332023 <nl> + s : 2 . 4566638469829969 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 347939740712867 <nl> + a : - 0 . 57397766387767069 <nl> + relative_time : 1 . 4000000000000006 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 77567798214 <nl> + y : 4434246 . 2567525059 <nl> + theta : - 1 . 1238112842172303 <nl> + kappa : - 0 . 011204413711426494 <nl> + s : 2 . 5233455145551824 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 319371277575849 <nl> + a : - 0 . 56865981572090685 <nl> + relative_time : 1 . 4500000000000006 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 80392069044 <nl> + y : 4434246 . 1979202367 <nl> + theta : - 1 . 1245436355864182 <nl> + kappa : - 0 . 011388853270395426 <nl> + s : 2 . 588605658895418 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 2910838637289903 <nl> + a : - 0 . 56273569227130049 <nl> + relative_time : 1 . 5000000000000007 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 83155461395 <nl> + y : 4434246 . 1403561253 <nl> + theta : - 1 . 1252601996881662 <nl> + kappa : - 0 . 011569317148436942 <nl> + s : 2 . 6524590903123282 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 2631078129369331 <nl> + a : - 0 . 55620529352885162 <nl> + relative_time : 1 . 5500000000000007 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 85858681804 <nl> + y : 4434246 . 084045453 <nl> + theta : - 1 . 125961159091913 <nl> + kappa : - 0 . 011745851486418338 <nl> + s : 2 . 714922134802769 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 2354734389643194 <nl> + a : - 0 . 54906861949356012 <nl> + relative_time : 1 . 6000000000000008 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 88502502418 <nl> + y : 4434246 . 0289721349 <nl> + theta : - 1 . 1266467134657234 <nl> + kappa : - 0 . 01191850670887609 <nl> + s : 2 . 7760126340518281 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 208211055575791 <nl> + a : - 0 . 541325670165426 <nl> + relative_time : 1 . 6500000000000008 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 91087760968 <nl> + y : 4434245 . 97511872 <nl> + theta : - 1 . 1273170795691485 <nl> + kappa : - 0 . 012087337524015864 <nl> + s : 2 . 8357499454328265 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 1813509765359906 <nl> + a : - 0 . 53297644554444934 <nl> + relative_time : 1 . 7000000000000008 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 93615360768 <nl> + y : 4434245 . 9224663936 <nl> + theta : - 1 . 1279724912462354 <nl> + kappa : - 0 . 012252402923712498 <nl> + s : 2 . 8941549420073169 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 15492351560956 <nl> + a : - 0 . 52402094563063006 <nl> + relative_time : 1 . 7500000000000009 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 96086270752 <nl> + y : 4434245 . 8709949693 <nl> + theta : - 1 . 1286131994187054 <nl> + kappa : - 0 . 012413766183510016 <nl> + s : 2 . 9512500125250831 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 1289589865611416 <nl> + a : - 0 . 51445917042396827 <nl> + relative_time : 1 . 8000000000000009 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431262 . 98486121983 <nl> + y : 4434245 . 8206101311 <nl> + theta : - 1 . 1292702700099604 <nl> + kappa : - 0 . 012556265431159759 <nl> + s : 3 . 0070590614241421 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 1034877031553771 <nl> + a : - 0 . 50429111992446385 <nl> + relative_time : 1 . 850000000000001 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 00785390474 <nl> + y : 4434245 . 7711442895 <nl> + theta : - 1 . 1300052255443784 <nl> + kappa : - 0 . 012649694361949643 <nl> + s : 3 . 0616075088307424 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 078539979156909 <nl> + a : - 0 . 49351679413211691 <nl> + relative_time : 1 . 900000000000001 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 03032658785 <nl> + y : 4434245 . 7227971638 <nl> + theta : - 1 . 1307235654143772 <nl> + kappa : - 0 . 012741010307481 <nl> + s : 3 . 1149222905593654 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 0541461283303795 <nl> + a : - 0 . 48213619304692729 <nl> + relative_time : 1 . 9500000000000011 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 05229126191 <nl> + y : 4434245 . 6755429562 <nl> + theta : - 1 . 1314256718351712 <nl> + kappa : - 0 . 012830261998627105 <nl> + s : 3 . 1670318581127237 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 0303364644404305 <nl> + a : - 0 . 47014931666889537 <nl> + relative_time : 2 . 0000000000000009 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 0737596695 <nl> + y : 4434245 . 6293564029 <nl> + theta : - 1 . 1321119191518905 <nl> + kappa : - 0 . 012917497150894089 <nl> + s : 3 . 2179640701717909 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 1 . 0070134353831939 <nl> + a : - 0 . 46277922135703792 <nl> + relative_time : 2 . 0500000000000007 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 09474040871 <nl> + y : 4434245 . 5842190068 <nl> + theta : - 1 . 132782581296194 <nl> + kappa : - 0 . 013002750701738282 <nl> + s : 3 . 2677393249577946 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 98405780473108029 <nl> + a : - 0 . 45545338046397321 <nl> + relative_time : 2 . 1000000000000005 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 11524119932 <nl> + y : 4434245 . 5401141588 <nl> + theta : - 1 . 1334379042223506 <nl> + kappa : - 0 . 013086054019856429 <nl> + s : 3 . 3163759370729684 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 96146735976315023 <nl> + a : - 0 . 44817179398970131 <nl> + relative_time : 2 . 1500000000000004 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 1352697144 <nl> + y : 4434245 . 497025352 <nl> + theta : - 1 . 1340781324831244 <nl> + kappa : - 0 . 013167438284451192 <nl> + s : 3 . 3638921104834969 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 93923988775846379 <nl> + a : - 0 . 44093446193422214 <nl> + relative_time : 2 . 2 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 15483358048 <nl> + y : 4434245 . 4549361775 <nl> + theta : - 1 . 1347035092228883 <nl> + kappa : - 0 . 01324693448523117 <nl> + s : 3 . 4103059385195196 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 91737317599608159 <nl> + a : - 0 . 43374138429753573 <nl> + relative_time : 2 . 25 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 17394037754 <nl> + y : 4434245 . 41383033 <nl> + theta : - 1 . 1353142761711514 <nl> + kappa : - 0 . 013324573422410875 <nl> + s : 3 . 4556354038751276 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 89586501175506383 <nl> + a : - 0 . 42659256107964211 <nl> + relative_time : 2 . 3 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 1925976387 <nl> + y : 4434245 . 3736916 <nl> + theta : - 1 . 135910673636477 <nl> + kappa : - 0 . 013400385706710751 <nl> + s : 3 . 4998983786083659 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 87471318231447093 <nl> + a : - 0 . 41948799228054123 <nl> + relative_time : 2 . 3499999999999996 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 21081285062 <nl> + y : 4434245 . 3345038854 <nl> + theta : - 1 . 1364929405007749 <nl> + kappa : - 0 . 013474401759357168 <nl> + s : 3 . 5431126241412323 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 85391547495336328 <nl> + a : - 0 . 4124276779002331 <nl> + relative_time : 2 . 3999999999999995 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 2285934533 <nl> + y : 4434245 . 2962511759 <nl> + theta : - 1 . 1370613142139503 <nl> + kappa : - 0 . 013546651812082415 <nl> + s : 3 . 5852957912596777 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 83346967695080121 <nl> + a : - 0 . 40541161793871772 <nl> + relative_time : 2 . 4499999999999993 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 24594684003 <nl> + y : 4434245 . 2589175673 <nl> + theta : - 1 . 137616030788889 <nl> + kappa : - 0 . 013617165907124714 <nl> + s : 3 . 6264654201136057 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 81337357558584511 <nl> + a : - 0 . 39843981239599507 <nl> + relative_time : 2 . 4999999999999991 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 26288035756 <nl> + y : 4434245 . 2224872541 <nl> + theta : - 1 . 138157324796764 <nl> + kappa : - 0 . 013685973897228206 <nl> + s : 3 . 6666389402168731 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 7936249581375554 <nl> + a : - 0 . 39151226127206523 <nl> + relative_time : 2 . 5499999999999989 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 27940130583 <nl> + y : 4434245 . 1869445313 <nl> + theta : - 1 . 1386854293626487 <nl> + kappa : - 0 . 013753105445642958 <nl> + s : 3 . 70583367044729 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 77422161188499228 <nl> + a : - 0 . 38462896456692813 <nl> + relative_time : 2 . 5999999999999988 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 29551693844 <nl> + y : 4434245 . 1522737946 <nl> + theta : - 1 . 1392005761614175 <nl> + kappa : - 0 . 013818590026124964 <nl> + s : 3 . 7440668190466182 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 75516132410721615 <nl> + a : - 0 . 37778992228058383 <nl> + relative_time : 2 . 6499999999999986 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 31123446213 <nl> + y : 4434245 . 1184595376 <nl> + theta : - 1 . 1397029954139206 <nl> + kappa : - 0 . 013882456922936144 <nl> + s : 3 . 7813554836205752 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 73644188208328742 <nl> + a : - 0 . 37099513441303222 <nl> + relative_time : 2 . 6999999999999984 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 3265610371 <nl> + y : 4434245 . 0854863571 <nl> + theta : - 1 . 1401929158834216 <nl> + kappa : - 0 . 01394473523084434 <nl> + s : 3 . 8177166511388285 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 71806107309226652 <nl> + a : - 0 . 36424460096427341 <nl> + relative_time : 2 . 7499999999999982 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 34150377678 <nl> + y : 4434245 . 05333895 <nl> + theta : - 1 . 1406705648722775 <nl> + kappa : - 0 . 014005453855123319 <nl> + s : 3 . 8531671979350008 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 70001668441321363 <nl> + a : - 0 . 35753832193430735 <nl> + relative_time : 2 . 799999999999998 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 35606974817 <nl> + y : 4434245 . 0220021121 <nl> + theta : - 1 . 1411361682188552 <nl> + kappa : - 0 . 014064641511552779 <nl> + s : 3 . 8877238897066668 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 68230650332518938 <nl> + a : - 0 . 35087629732313408 <nl> + relative_time : 2 . 8499999999999979 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 37026597152 <nl> + y : 4434244 . 99146074 <nl> + theta : - 1 . 1415899502946671 <nl> + kappa : - 0 . 014122326726418336 <nl> + s : 3 . 9214033815153546 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 66492831710725375 <nl> + a : - 0 . 34425852713075356 <nl> + relative_time : 2 . 8999999999999977 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 38409942039 <nl> + y : 4434244 . 96169983 <nl> + theta : - 1 . 1420321340017145 <nl> + kappa : - 0 . 014178537836511537 <nl> + s : 3 . 9542222177865445 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 64787991303846759 <nl> + a : - 0 . 33768501135716572 <nl> + relative_time : 2 . 9499999999999975 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 39757702191 <nl> + y : 4434244 . 9327044822 <nl> + theta : - 1 . 1424629407700284 <nl> + kappa : - 0 . 014233302989129847 <nl> + s : 3 . 986196832309671 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 63115907839789087 <nl> + a : - 0 . 33115575000237074 <nl> + relative_time : 2 . 9999999999999973 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 41036876128 <nl> + y : 4434244 . 9043061733 <nl> + theta : - 1 . 1429148058344887 <nl> + kappa : - 0 . 014262145096672065 <nl> + s : 4 . 017343548238121 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 614763600464584 <nl> + a : - 0 . 32467074306636845 <nl> + relative_time : 3 . 0499999999999972 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 42276642873 <nl> + y : 4434244 . 8766202228 <nl> + theta : - 1 . 1433607037524767 <nl> + kappa : - 0 . 014285819071234863 <nl> + s : 4 . 0476785780892346 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 59869126651760751 <nl> + a : - 0 . 3182299905491589 <nl> + relative_time : 3 . 099999999999997 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 43483894772 <nl> + y : 4434244 . 84966038 <nl> + theta : - 1 . 1437949097766842 <nl> + kappa : - 0 . 014308872158324923 <nl> + s : 4 . 0772180237443045 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 5829398638360217 <nl> + a : - 0 . 31183349245074221 <nl> + relative_time : 3 . 1499999999999968 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 44659285375 <nl> + y : 4434244 . 82341205 <nl> + theta : - 1 . 1442176586120265 <nl> + kappa : - 0 . 014331316837782715 <nl> + s : 4 . 1059778764485779 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 56750717969888687 <nl> + a : - 0 . 30548124877111821 <nl> + relative_time : 3 . 1999999999999966 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 45803463703 <nl> + y : 4434244 . 79786074 <nl> + theta : - 1 . 1446291833720694 <nl> + kappa : - 0 . 01435316550310645 <nl> + s : 4 . 1339740168112522 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 55239100138526342 <nl> + a : - 0 . 29917325951028695 <nl> + relative_time : 3 . 2499999999999964 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 46917074267 <nl> + y : 4434244 . 7729920549 <nl> + theta : - 1 . 145029715576213 <nl> + kappa : - 0 . 01437443046145208 <nl> + s : 4 . 1612222148054805 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 53758911617421179 <nl> + a : - 0 . 29290952466824849 <nl> + relative_time : 3 . 2999999999999963 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 48000757053 <nl> + y : 4434244 . 7487917058 <nl> + theta : - 1 . 1454194851470658 <nl> + kappa : - 0 . 014395123933633307 <nl> + s : 4 . 1877381297683671 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 52309931134479215 <nl> + a : - 0 . 28669004424500277 <nl> + relative_time : 3 . 3499999999999961 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 49055147514 <nl> + y : 4434244 . 7252455 <nl> + theta : - 1 . 1457987204079985 <nl> + kappa : - 0 . 014415258054121569 <nl> + s : 4 . 21353731040097 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 508919374176065 <nl> + a : - 0 . 2805148182405498 <nl> + relative_time : 3 . 3999999999999959 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 50080876605 <nl> + y : 4434244 . 7023393493 <nl> + theta : - 1 . 1461676480808676 <nl> + kappa : - 0 . 014434844871046043 <nl> + s : 4 . 2386351947683023 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 49504709194709073 <nl> + a : - 0 . 27438384665488968 <nl> + relative_time : 3 . 4499999999999957 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 51078570727 <nl> + y : 4434244 . 6800592626 <nl> + theta : - 1 . 1465264932838981 <nl> + kappa : - 0 . 014453896346193658 <nl> + s : 4 . 2630471102993264 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 48148025193692967 <nl> + a : - 0 . 2682971294880222 <nl> + relative_time : 3 . 4999999999999956 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 52048851788 <nl> + y : 4434244 . 6583913518 <nl> + theta : - 1 . 1468754795297185 <nl> + kappa : - 0 . 014472424355009077 <nl> + s : 4 . 28678827378696 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 46821664142464214 <nl> + a : - 0 . 26225466673994752 <nl> + relative_time : 3 . 5499999999999954 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 52992337162 <nl> + y : 4434244 . 6373218326 <nl> + theta : - 1 . 1472148287235353 <nl> + kappa : - 0 . 01449044068659471 <nl> + s : 4 . 3098737913880729 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 45525404768928845 <nl> + a : - 0 . 25625645841066563 <nl> + relative_time : 3 . 5999999999999952 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 539096397 <nl> + y : 4434244 . 6168370172 <nl> + theta : - 1 . 1475447611614407 <nl> + kappa : - 0 . 014507957043710711 <nl> + s : 4 . 3323186586234881 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 442590258009929 <nl> + a : - 0 . 25030250450017644 <nl> + relative_time : 3 . 649999999999995 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 54801367747 <nl> + y : 4434244 . 5969233206 <nl> + theta : - 1 . 1478654955288479 <nl> + kappa : - 0 . 014524985042774968 <nl> + s : 4 . 3541377603779834 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 43022305966562435 <nl> + a : - 0 . 24439280500848 <nl> + relative_time : 3 . 6999999999999948 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 556681251 <nl> + y : 4434244 . 5775672588 <nl> + theta : - 1 . 1481772488990396 <nl> + kappa : - 0 . 014541536213863122 <nl> + s : 4 . 3753458709002855 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 41815023993543465 <nl> + a : - 0 . 23852735993557636 <nl> + relative_time : 3 . 7499999999999947 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 56510511052 <nl> + y : 4434244 . 558755449 <nl> + theta : - 1 . 1484802367318308 <nl> + kappa : - 0 . 014557622000708549 <nl> + s : 4 . 3959576538030793 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 40636958609842022 <nl> + a : - 0 . 23270616928146551 <nl> + relative_time : 3 . 7999999999999945 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 57329120371 <nl> + y : 4434244 . 5404746085 <nl> + theta : - 1 . 1487746728723314 <nl> + kappa : - 0 . 014573253760702367 <nl> + s : 4 . 4159876620629976 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 39487888543364169 <nl> + a : - 0 . 22692923304614737 <nl> + relative_time : 3 . 8499999999999943 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 58124543307 <nl> + y : 4434244 . 5227115573 <nl> + theta : - 1 . 1490607695498067 <nl> + kappa : - 0 . 014588442764893444 <nl> + s : 4 . 4354503380206314 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 38367592522015903 <nl> + a : - 0 . 22119655122962198 <nl> + relative_time : 3 . 8999999999999941 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 58897365577 <nl> + y : 4434244 . 505453215 <nl> + theta : - 1 . 1493387373766291 <nl> + kappa : - 0 . 014603200197988383 <nl> + s : 4 . 45436001338052 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 37275849273703288 <nl> + a : - 0 . 21550812383188939 <nl> + relative_time : 3 . 949999999999994 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 5964816839 <nl> + y : 4434244 . 4886866026 <nl> + theta : - 1 . 149608785347312 <nl> + kappa : - 0 . 014617537158351531 <nl> + s : 4 . 4727309092111582 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 36212437526332375 <nl> + a : - 0 . 20986395085294957 <nl> + relative_time : 3 . 9999999999999938 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 60377522151 <nl> + y : 4434244 . 47239898 <nl> + theta : - 1 . 1498711185803685 <nl> + kappa : - 0 . 014631464538166303 <nl> + s : 4 . 49057698238777 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 35176208903366885 <nl> + a : - 0 . 20463948295363796 <nl> + relative_time : 4 . 0499999999999936 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 61085966695 <nl> + y : 4434244 . 4565782929 <nl> + theta : - 1 . 1501259312069823 <nl> + kappa : - 0 . 014644992645934902 <nl> + s : 4 . 5079114418762227 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 3416592285059209 <nl> + a : - 0 . 19948692277667318 <nl> + relative_time : 4 . 0999999999999934 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 61774028477 <nl> + y : 4434244 . 4412127854 <nl> + theta : - 1 . 150373412549234 <nl> + kappa : - 0 . 014658131534521879 <nl> + s : 4 . 5247471690769583 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 33181219829396247 <nl> + a : - 0 . 19440627032205515 <nl> + relative_time : 4 . 1499999999999932 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 62442226603 <nl> + y : 4434244 . 426290866 <nl> + theta : - 1 . 1506137492920083 <nl> + kappa : - 0 . 014670891116496762 <nl> + s : 4 . 5410968656211139 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 32221740301167634 <nl> + a : - 0 . 18939752558978387 <nl> + relative_time : 4 . 1999999999999931 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 63091072824 <nl> + y : 4434244 . 4118011035 <nl> + theta : - 1 . 1508471254823871 <nl> + kappa : - 0 . 014683281164134043 <nl> + s : 4 . 5569730533705188 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 31287124727294507 <nl> + a : - 0 . 18446068857985931 <nl> + relative_time : 4 . 2499999999999929 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 63721071556 <nl> + y : 4434244 . 3977322364 <nl> + theta : - 1 . 1510737225290986 <nl> + kappa : - 0 . 014695311309413182 <nl> + s : 4 . 5723880744176988 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 30377013569165134 <nl> + a : - 0 . 17959575929228153 <nl> + relative_time : 4 . 2999999999999927 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 64332719869 <nl> + y : 4434244 . 3840731625 <nl> + theta : - 1 . 1512937192020152 <nl> + kappa : - 0 . 014706991044018611 <nl> + s : 4 . 5873540910858726 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 29491047288167788 <nl> + a : - 0 . 17480273772705046 <nl> + relative_time : 4 . 3499999999999925 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 64926507475 <nl> + y : 4434244 . 3708129469 <nl> + theta : - 1 . 1515072916316995 <nl> + kappa : - 0 . 014718329719339725 <nl> + s : 4 . 6018830859289528 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 28628866345690723 <nl> + a : - 0 . 17008162388416614 <nl> + relative_time : 4 . 3999999999999924 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 65502916742 <nl> + y : 4434244 . 3579408173 <nl> + theta : - 1 . 1517146133089888 <nl> + kappa : - 0 . 014729336546470894 <nl> + s : 4 . 6159868617315478 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 2779011120312222 <nl> + a : - 0 . 16543241776362858 <nl> + relative_time : 4 . 4499999999999922 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 66062422685 <nl> + y : 4434244 . 3454461657 <nl> + theta : - 1 . 1519158550846236 <nl> + kappa : - 0 . 014740020596211448 <nl> + s : 4 . 6296770415089581 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 26974422321850533 <nl> + a : - 0 . 16085511936543773 <nl> + relative_time : 4 . 499999999999992 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 66605492996 <nl> + y : 4434244 . 3333185473 <nl> + theta : - 1 . 1521111851689099 <nl> + kappa : - 0 . 014750390799065696 <nl> + s : 4 . 6429650685071788 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 26181440163263936 <nl> + a : - 0 . 15634972868959363 <nl> + relative_time : 4 . 5499999999999918 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 67132587987 <nl> + y : 4434244 . 3215476824 <nl> + theta : - 1 . 1523007691314142 <nl> + kappa : - 0 . 014760455945242903 <nl> + s : 4 . 6558622062029009 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 25410805188750696 <nl> + a : - 0 . 15191624573609627 <nl> + relative_time : 4 . 5999999999999917 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 67644160654 <nl> + y : 4434244 . 3101234566 <nl> + theta : - 1 . 1524847699006915 <nl> + kappa : - 0 . 014770224684657312 <nl> + s : 4 . 6683795383035065 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 24662157859699069 <nl> + a : - 0 . 14755467050494567 <nl> + relative_time : 4 . 6499999999999915 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 68140656629 <nl> + y : 4434244 . 2990359161 <nl> + theta : - 1 . 1526633477640398 <nl> + kappa : - 0 . 01477970552692813 <nl> + s : 4 . 6805279687470751 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 2393513863749733 <nl> + a : - 0 . 14326500299614181 <nl> + relative_time : 4 . 6999999999999913 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 68622514186 <nl> + y : 4434244 . 2882752754 <nl> + theta : - 1 . 1528366603672811 <nl> + kappa : - 0 . 014788906841379533 <nl> + s : 4 . 6923182217023767 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 23229387983533742 <nl> + a : - 0 . 13904724320968467 <nl> + relative_time : 4 . 7499999999999911 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 69090164278 <nl> + y : 4434244 . 27783191 <nl> + theta : - 1 . 1530048627145655 <nl> + kappa : - 0 . 014797836857040662 <nl> + s : 4 . 7037608415688794 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 22544546359196577 <nl> + a : - 0 . 13490139114557428 <nl> + relative_time : 4 . 7999999999999909 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 69544030505 <nl> + y : 4434244 . 26769636 <nl> + theta : - 1 . 1531681071681983 <nl> + kappa : - 0 . 014806503662645638 <nl> + s : 4 . 7148661929767428 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 21880254225874093 <nl> + a : - 0 . 13082744680381064 <nl> + relative_time : 4 . 8499999999999908 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 699845291 <nl> + y : 4434244 . 25785933 <nl> + theta : - 1 . 1533265434484861 <nl> + kappa : - 0 . 014814915206633535 <nl> + s : 4 . 72564446078682 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 21236152044954565 <nl> + a : - 0 . 12682541018439375 <nl> + relative_time : 4 . 8999999999999906 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 70412068965 <nl> + y : 4434244 . 2483116891 <nl> + theta : - 1 . 1534803186336002 <nl> + kappa : - 0 . 014823079297148404 <nl> + s : 4 . 7361056500906624 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 2061188027782625 <nl> + a : - 0 . 12289528128732358 <nl> + relative_time : 4 . 94999999999999 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 70827051654 <nl> + y : 4434244 . 23904447 <nl> + theta : - 1 . 1536295771594585 <nl> + kappa : - 0 . 014831003602039265 <nl> + s : 4 . 74625958621051 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 20007079385877422 <nl> + a : - 0 . 11903706011260017 <nl> + relative_time : 4 . 99999999999999 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 7122987138 <nl> + y : 4434244 . 2300488688 <nl> + theta : - 1 . 1537744608196199 <nl> + kappa : - 0 . 0148386956488601 <nl> + s : 4 . 7561159146993006 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 19421389830496341 <nl> + a : - 0 . 11525074666022349 <nl> + relative_time : 5 . 04999999999999 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 71620914986 <nl> + y : 4434244 . 2213162463 <nl> + theta : - 1 . 1539151087651947 <nl> + kappa : - 0 . 014846162824869866 <nl> + s : 4 . 7656841013406659 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 18854452073071279 <nl> + a : - 0 . 11153634093019354 <nl> + relative_time : 5 . 09999999999999 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 72000562004 <nl> + y : 4434244 . 2128381291 <nl> + theta : - 1 . 154051657504765 <nl> + kappa : - 0 . 014853412377032485 <nl> + s : 4 . 7749734321489292 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 183059065749905 <nl> + a : - 0 . 10789384292251035 <nl> + relative_time : 5 . 14999999999999 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 72369184578 <nl> + y : 4434244 . 2046062043 <nl> + theta : - 1 . 1541842409043188 <nl> + kappa : - 0 . 01486045141201685 <nl> + s : 4 . 7839930133691118 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 17775393797642267 <nl> + a : - 0 . 1043232526371739 <nl> + relative_time : 5 . 1999999999999895 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 72727147531 <nl> + y : 4434244 . 1966123255 <nl> + theta : - 1 . 1543129901871909 <nl> + kappa : - 0 . 014867286896196815 <nl> + s : 4 . 792751771476925 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 17262554202414851 <nl> + a : - 0 . 1008245700741842 <nl> + relative_time : 5 . 2499999999999893 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 73074808344 <nl> + y : 4434244 . 18884851 <nl> + theta : - 1 . 1544380339340161 <nl> + kappa : - 0 . 01487392565565121 <nl> + s : 4 . 8012584531787779 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 16767028250696517 <nl> + a : - 0 . 097397795233541237 <nl> + relative_time : 5 . 2999999999999892 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 73412517132 <nl> + y : 4434244 . 1813069386 <nl> + theta : - 1 . 1545594980826888 <nl> + kappa : - 0 . 014880374376163834 <nl> + s : 4 . 8095216254117714 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 16288456403875531 <nl> + a : - 0 . 09404292811524502 <nl> + relative_time : 5 . 349999999999989 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 73740616674 <nl> + y : 4434244 . 1739799576 <nl> + theta : - 1 . 154677505928329 <nl> + kappa : - 0 . 014886639603223447 <nl> + s : 4 . 8175496753437006 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 15826479123340159 <nl> + a : - 0 . 090759968719295522 <nl> + relative_time : 5 . 3999999999999888 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 74059442396 <nl> + y : 4434244 . 1668600757 <nl> + theta : - 1 . 1547921781232566 <nl> + kappa : - 0 . 014892727742023784 <nl> + s : 4 . 8253508103730569 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 15380736870478667 <nl> + a : - 0 . 087548917045692787 <nl> + relative_time : 5 . 4499999999999886 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 74369322381 <nl> + y : 4434244 . 1599399662 <nl> + theta : - 1 . 1549036326769713 <nl> + kappa : - 0 . 014898645057463545 <nl> + s : 4 . 8329330581290231 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 14950870106679323 <nl> + a : - 0 . 084409773094436785 <nl> + relative_time : 5 . 4999999999999885 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 74670577364 <nl> + y : 4434244 . 1532124653 <nl> + theta : - 1 . 1550119849561356 <nl> + kappa : - 0 . 014904397674146396 <nl> + s : 4 . 8403042664714775 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 14536519293330394 <nl> + a : - 0 . 0813425368655275 <nl> + relative_time : 5 . 5499999999999883 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 74963520741 <nl> + y : 4434244 . 1466705771 <nl> + theta : - 1 . 1551173476845646 <nl> + kappa : - 0 . 01490999157638098 <nl> + s : 4 . 8474721034909933 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 14137324891820141 <nl> + a : - 0 . 078347208358965 <nl> + relative_time : 5 . 5999999999999881 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 75248458539 <nl> + y : 4434244 . 1403074656 <nl> + theta : - 1 . 1552198309432189 <nl> + kappa : - 0 . 014915432608180897 <nl> + s : 4 . 8544440575088359 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 13752927363536835 <nl> + a : - 0 . 07542378757474924 <nl> + relative_time : 5 . 6499999999999879 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 75525689468 <nl> + y : 4434244 . 1341164606 <nl> + theta : - 1 . 1553195421702005 <nl> + kappa : - 0 . 014920726473264726 <nl> + s : 4 . 8612274370769661 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 13382967169868742 <nl> + a : - 0 . 0725722745128802 <nl> + relative_time : 5 . 6999999999999877 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 75795504864 <nl> + y : 4434244 . 1280910568 <nl> + theta : - 1 . 1554165861607526 <nl> + kappa : - 0 . 014925878735056009 <nl> + s : 4 . 867829370978038 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 1302708477220412 <nl> + a : - 0 . 069792669173357913 <nl> + relative_time : 5 . 7499999999999876 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 76058188733 <nl> + y : 4434244 . 1222249111 <nl> + theta : - 1 . 1555110650672615 <nl> + kappa : - 0 . 014930894816683252 <nl> + s : 4 . 8742568082254021 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 12684920631931251 <nl> + a : - 0 . 067084971556182343 <nl> + relative_time : 5 . 7999999999999874 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 76314017724 <nl> + y : 4434244 . 116511845 <nl> + theta : - 1 . 1556030783992612 <nl> + kappa : - 0 . 014935780000979938 <nl> + s : 4 . 8805165180631 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 12356115210438393 <nl> + a : - 0 . 06444918166135355 <nl> + relative_time : 5 . 8499999999999872 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 76563261141 <nl> + y : 4434244 . 110945846 <nl> + theta : - 1 . 1556927230234391 <nl> + kappa : - 0 . 014940539430484514 <nl> + s : 4 . 8866150899658685 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 12040308969113808 <nl> + a : - 0 . 061885299488871476 <nl> + relative_time : 5 . 899999999999987 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 76806180959 <nl> + y : 4434244 . 1055210624 <nl> + theta : - 1 . 1557800931636448 <nl> + kappa : - 0 . 014945178107440392 <nl> + s : 4 . 8925589336391395 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 11737142369345768 <nl> + a : - 0 . 059393325038736178 <nl> + relative_time : 5 . 9499999999999869 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 77043031767 <nl> + y : 4434244 . 10023181 <nl> + theta : - 1 . 1558652804008982 <nl> + kappa : - 0 . 014949700893795959 <nl> + s : 4 . 8983542790190384 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 11446255872522537 <nl> + a : - 0 . 056973258310947572 <nl> + relative_time : 5 . 9999999999999867 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 77274058922 <nl> + y : 4434244 . 0950726075 <nl> + theta : - 1 . 1559483729813151 <nl> + kappa : - 0 . 014954112474460038 <nl> + s : 4 . 9040071291891874 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 11167013678960847 <nl> + a : - 0 . 054730613247121258 <nl> + relative_time : 6 . 0499999999999865 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 77499493741 <nl> + y : 4434244 . 0900382921 <nl> + theta : - 1 . 1560294541066436 <nl> + kappa : - 0 . 014958417266541606 <nl> + s : 4 . 9095231440835514 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 10898879798717494 <nl> + a : - 0 . 052529932983605448 <nl> + relative_time : 6 . 0999999999999863 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 77719561057 <nl> + y : 4434244 . 0851238407 <nl> + theta : - 1 . 1561086046524114 <nl> + kappa : - 0 . 014962619563661673 <nl> + s : 4 . 9149078254027909 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 10641644407790943 <nl> + a : - 0 . 050371217520400018 <nl> + relative_time : 6 . 1499999999999861 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 77934481454 <nl> + y : 4434244 . 0803243285 <nl> + theta : - 1 . 1561859039517164 <nl> + kappa : - 0 . 014966723577566128 <nl> + s : 4 . 9201665699355619 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 10395097682179644 <nl> + a : - 0 . 04825446685750498 <nl> + relative_time : 6 . 199999999999986 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 78144471196 <nl> + y : 4434244 . 0756349256 <nl> + theta : - 1 . 1562614297952341 <nl> + kappa : - 0 . 014970733438125754 <nl> + s : 4 . 9253046695585221 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 10159029797882045 <nl> + a : - 0 . 046179680994920327 <nl> + relative_time : 6 . 2499999999999858 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 7834974227 <nl> + y : 4434244 . 0710508982 <nl> + theta : - 1 . 1563352584312268 <nl> + kappa : - 0 . 014974653193336218 <nl> + s : 4 . 9303273112363293 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 099332309308965916 <nl> + a : - 0 . 044146859932646061 <nl> + relative_time : 6 . 2999999999999856 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 78550502378 <nl> + y : 4434244 . 0665676082 <nl> + theta : - 1 . 1564074645655511 <nl> + kappa : - 0 . 014978486809318067 <nl> + s : 4 . 9352395770216377 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 097174912572217359 <nl> + a : - 0 . 042156003670682181 <nl> + relative_time : 6 . 3499999999999854 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 78746954922 <nl> + y : 4434244 . 0621805117 <nl> + theta : - 1 . 1564781213616677 <nl> + kappa : - 0 . 014982238170316738 <nl> + s : 4 . 9400464440551026 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 095116009528559212 <nl> + a : - 0 . 040207112209028686 <nl> + relative_time : 6 . 3999999999999853 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 78939299035 <nl> + y : 4434244 . 0578851644 <nl> + theta : - 1 . 1565473004406506 <nl> + kappa : - 0 . 014985911078702554 <nl> + s : 4 . 9447527845653783 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 093153501937975988 <nl> + a : - 0 . 038300185547685578 <nl> + relative_time : 6 . 4499999999999851 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 7912772955 <nl> + y : 4434244 . 0536772134 <nl> + theta : - 1 . 1566150718811961 <nl> + kappa : - 0 . 014989509254970721 <nl> + s : 4 . 9493633658691172 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 091285291560452161 <nl> + a : - 0 . 036435223686652848 <nl> + relative_time : 6 . 4999999999999849 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 79312437022 <nl> + y : 4434244 . 0495524025 <nl> + theta : - 1 . 1566815042196332 <nl> + kappa : - 0 . 014993036337741334 <nl> + s : 4 . 9538828503709738 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 0895092801559722 <nl> + a : - 0 . 034612226625930512 <nl> + relative_time : 6 . 5499999999999847 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 79493607709 <nl> + y : 4434244 . 0455065761 <nl> + theta : - 1 . 1567466644499322 <nl> + kappa : - 0 . 014996495883759373 <nl> + s : 4 . 9583157955635988 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 087823369484520616 <nl> + a : - 0 . 032831194365518568 <nl> + relative_time : 6 . 5999999999999845 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 79671423574 <nl> + y : 4434244 . 0415356662 <nl> + theta : - 1 . 1568106180237145 <nl> + kappa : - 0 . 0149998913678947 <nl> + s : 4 . 9626666540276432 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 086225461306081858 <nl> + a : - 0 . 031092126905416996 <nl> + relative_time : 6 . 6499999999999844 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 79846062307 <nl> + y : 4434244 . 0376357073 <nl> + theta : - 1 . 1568734288502622 <nl> + kappa : - 0 . 015003226183142067 <nl> + s : 4 . 9669397734317569 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 084713457380640428 <nl> + a : - 0 . 029395024245625821 <nl> + relative_time : 6 . 6999999999999842 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 80017697316 <nl> + y : 4434244 . 033802826 <nl> + theta : - 1 . 1569351592965273 <nl> + kappa : - 0 . 015006503640621106 <nl> + s : 4 . 97113939653259 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 083285259468180786 <nl> + a : - 0 . 027739886386145027 <nl> + relative_time : 6 . 749999999999984 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 80186497705 <nl> + y : 4434244 . 0300332466 <nl> + theta : - 1 . 1569958701871412 <nl> + kappa : - 0 . 015009726969576344 <nl> + s : 4 . 97526966117479 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 081938769328687433 <nl> + a : - 0 . 026126713326974617 <nl> + relative_time : 6 . 7999999999999838 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 80352628289 <nl> + y : 4434244 . 0263232877 <nl> + theta : - 1 . 1570556208044229 <nl> + kappa : - 0 . 015012899317377185 <nl> + s : 4 . 9793346002910077 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 080671888722144813 <nl> + a : - 0 . 024555505068114603 <nl> + relative_time : 6 . 8499999999999837 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 80516249617 <nl> + y : 4434244 . 0226693647 <nl> + theta : - 1 . 157114468888389 <nl> + kappa : - 0 . 015016023749517923 <nl> + s : 4 . 9833381419018874 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 079482519408537469 <nl> + a : - 0 . 02302626160956496 <nl> + relative_time : 6 . 8999999999999835 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 80677517923 <nl> + y : 4434244 . 0190679887 <nl> + theta : - 1 . 1571724706367612 <nl> + kappa : - 0 . 015019103249617737 <nl> + s : 4 . 9872841091160769 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 078368563147849818 <nl> + a : - 0 . 021538982951325718 <nl> + relative_time : 6 . 9499999999999833 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 8083304821 <nl> + y : 4434244 . 0155002447 <nl> + theta : - 1 . 15723069563693 <nl> + kappa : - 0 . 0150202057916536 <nl> + s : 4 . 991176220130221 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 077327921700066388 <nl> + a : - 0 . 020093669093396854 <nl> + relative_time : 6 . 9999999999999831 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 8098479975 <nl> + y : 4434244 . 0119707827 <nl> + theta : - 1 . 1572886772425786 <nl> + kappa : - 0 . 015020325251613034 <nl> + s : 4 . 9950180882289645 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 076358496825171651 <nl> + a : - 0 . 01869032003577837 <nl> + relative_time : 7 . 0499999999999829 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 8113470531 <nl> + y : 4434244 . 0084842555 <nl> + theta : - 1 . 1573459535779491 <nl> + kappa : - 0 . 015020443258397491 <nl> + s : 4 . 9988132217849524 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 075458190283150053 <nl> + a : - 0 . 017328935778470285 <nl> + relative_time : 7 . 0999999999999828 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 81282899313 <nl> + y : 4434244 . 0050375359 <nl> + theta : - 1 . 1574025760061255 <nl> + kappa : - 0 . 015020559917834983 <nl> + s : 5 . 0025650242588275 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 074624903833986123 <nl> + a : - 0 . 016009516321472579 <nl> + relative_time : 7 . 1499999999999826 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 81429512054 <nl> + y : 4434244 . 0016275942 <nl> + theta : - 1 . 1574585943070685 <nl> + kappa : - 0 . 015020675332491372 <nl> + s : 5 . 0062767941992314 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 0738565392376643 <nl> + a : - 0 . 014732061664785266 <nl> + relative_time : 7 . 1999999999999824 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 81574669684 <nl> + y : 4434243 . 998251494 <nl> + theta : - 1 . 1575140566776008 <nl> + kappa : - 0 . 015020789601670349 <nl> + s : 5 . 0099517252428072 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 0731509982541691 <nl> + a : - 0 . 013496571808408332 <nl> + relative_time : 7 . 2499999999999822 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 81718494196 <nl> + y : 4434243 . 9949064013 <nl> + theta : - 1 . 1575690097313918 <nl> + kappa : - 0 . 015020902821413454 <nl> + s : 5 . 0135929061141953 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 072506182643484962 <nl> + a : - 0 . 012303046752341777 <nl> + relative_time : 7 . 2999999999999821 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 8186110346 <nl> + y : 4434243 . 9915895732 <nl> + theta : - 1 . 1576234984989462 <nl> + kappa : - 0 . 015021015084500065 <nl> + s : 5 . 0172033206260362 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 0719199941655964 <nl> + a : - 0 . 011151486496585622 <nl> + relative_time : 7 . 3499999999999819 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 82002611185 <nl> + y : 4434243 . 988298364 <nl> + theta : - 1 . 15767756642759 <nl> + kappa : - 0 . 015021126480447405 <nl> + s : 5 . 020785847678968 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 0713903345804879 <nl> + a : - 0 . 010041891041139846 <nl> + relative_time : 7 . 3999999999999817 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 8214312694 <nl> + y : 4434243 . 9850302255 <nl> + theta : - 1 . 1577312553814594 <nl> + kappa : - 0 . 01502123709551053 <nl> + s : 5 . 024343261261631 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 07091510564814392 <nl> + a : - 0 . 0089742603860044623 <nl> + relative_time : 7 . 4499999999999815 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 82282756153 <nl> + y : 4434243 . 9817827074 <nl> + theta : - 1 . 1577846056414891 <nl> + kappa : - 0 . 015021347012682351 <nl> + s : 5 . 0278782304506615 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 070492209128548949 <nl> + a : - 0 . 0079485945311794579 <nl> + relative_time : 7 . 4999999999999813 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 82421600114 <nl> + y : 4434243 . 9785534525 <nl> + theta : - 1 . 1578376559054029 <nl> + kappa : - 0 . 015021456311693607 <nl> + s : 5 . 0313933194106983 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 07011954678168747 <nl> + a : - 0 . 0069648934766648393 <nl> + relative_time : 7 . 5499999999999812 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 82559755951 <nl> + y : 4434243 . 9753402025 <nl> + theta : - 1 . 1578904432877022 <nl> + kappa : - 0 . 015021565069012885 <nl> + s : 5 . 0348909873943759 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 069795020367543967 <nl> + a : - 0 . 0060231572224606136 <nl> + relative_time : 7 . 599999999999981 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 82697316667 <nl> + y : 4434243 . 9721407928 <nl> + theta : - 1 . 1579430033196576 <nl> + kappa : - 0 . 015021673357846611 <nl> + s : 5 . 03837358874233 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 069516531646102914 <nl> + a : - 0 . 0051233857685667739 <nl> + relative_time : 7 . 6499999999999808 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 82834371115 <nl> + y : 4434243 . 96895316 <nl> + theta : - 1 . 1579953699492995 <nl> + kappa : - 0 . 015021781248139056 <nl> + s : 5 . 0418433728831973 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 069281982377348783 <nl> + a : - 0 . 004265579114983313 <nl> + relative_time : 7 . 6999999999999806 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 82971004 <nl> + y : 4434243 . 9657753306 <nl> + theta : - 1 . 15804757554141 <nl> + kappa : - 0 . 015021888806572327 <nl> + s : 5 . 04530248433361 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 069089274321266075 <nl> + a : - 0 . 0034497372617102381 <nl> + relative_time : 7 . 7499999999999805 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 83107295877 <nl> + y : 4434243 . 9626054335 <nl> + theta : - 1 . 1580996508775139 <nl> + kappa : - 0 . 015021996096566379 <nl> + s : 5 . 0487529626982015 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 068936309237839249 <nl> + a : - 0 . 0026758602087475561 <nl> + relative_time : 7 . 79999999999998 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 8324332317 <nl> + y : 4434243 . 9594416888 <nl> + theta : - 1 . 1581516251558712 <nl> + kappa : - 0 . 015022103178279 <nl> + s : 5 . 0521967426696044 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 0688209888870528 <nl> + a : - 0 . 001943947956095253 <nl> + relative_time : 7 . 84999999999998 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 83379158156 <nl> + y : 4434243 . 9562824173 <nl> + theta : - 1 . 1582035259914703 <nl> + kappa : - 0 . 015022210108605825 <nl> + s : 5 . 0556356540284506 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 068741215028891217 <nl> + a : - 0 . 0012540005037533358 <nl> + relative_time : 7 . 89999999999998 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 83514868969 <nl> + y : 4434243 . 9531260338 <nl> + theta : - 1 . 1582553794160191 <nl> + kappa : - 0 . 015022316941180332 <nl> + s : 5 . 05907142164337 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 068694889423338956 <nl> + a : - 0 . 0006060178517218115 <nl> + relative_time : 7 . 94999999999998 <nl> + } <nl> + trajectory_point { <nl> + path_point { <nl> + x : 431263 . 83650519594 <nl> + y : 4434243 . 94997105 <nl> + theta : - 1 . 1583072098779397 <nl> + kappa : - 0 . 015022423726373833 <nl> + s : 5 . 0625056654709946 <nl> + dkappa : 0 <nl> + ddkappa : 0 <nl> + } <nl> + v : 0 . 068679913830380523 <nl> + a : - 6 . 7307270867900115e - 16 <nl> + relative_time : 7 . 99999999999998 <nl> + } <nl> + decision { <nl> + main_decision { <nl> + cruise { <nl> + } <nl> + } <nl> + object_decision { <nl> + decision { <nl> + id : " 4158_0 " <nl> + perception_id : 4158 <nl> + object_decision { <nl> + follow { <nl> + distance_s : - 10 <nl> + fence_point { <nl> + x : 431265 . 22978481423 <nl> + y : 4434240 . 7501821388 <nl> + z : 0 <nl> + } <nl> + fence_heading : - 1 . 2040851813181954 <nl> + } <nl> + } <nl> + } <nl> + decision { <nl> + id : " DEST " <nl> + perception_id : - 1109540454 <nl> + object_decision { <nl> + ignore { <nl> + } <nl> + } <nl> + } <nl> + } <nl> + } <nl>
Plannning : added a huanbaoyuan_bzone test .
ApolloAuto/apollo
c47e0700c08f48d8a3363c3922736d0488167b0e
2017-09-13T20:44:46Z
deleted file mode 120000 <nl> index 42061c01a1c7 . . 000000000000 <nl> mmm a / README <nl> ppp / dev / null <nl> @ @ - 1 + 0 , 0 @ @ <nl> - README . md <nl> \ No newline at end of file <nl> mmm a / README . md <nl> ppp b / README . md <nl> <nl> - <nl> Bitcoin integration / staging tree <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + <nl> + http : / / www . bitcoin . org <nl> + <nl> + Copyright ( c ) 2009 - 2012 Bitcoin Developers <nl> + <nl> + What is Bitcoin ? <nl> + mmmmmmmmmmmmmmm - <nl> + <nl> + Bitcoin is an experimental new digital currency that enables instant payments to <nl> + anyone , anywhere in the world . Bitcoin uses peer - to - peer technology to operate <nl> + with no central authority : managing transactions and issuing money are carried <nl> + out collectively by the network . Bitcoin is also the name of the open source <nl> + software which enables the use of this currency . <nl> + <nl> + For more information , as well as an immediately useable , binary version of <nl> + the Bitcoin client sofware , see http : / / www . bitcoin . org . <nl> + <nl> + License <nl> + mmmmmm - <nl> + <nl> + Bitcoin is released under the terms of the MIT license . See ` COPYING ` for more <nl> + information or see http : / / opensource . org / licenses / MIT . <nl> <nl> Development process <nl> - = = = = = = = = = = = = = = = = = = = <nl> + mmmmmmmmmmmmmmmmmm - <nl> <nl> - Developers work in their own trees , then submit pull requests when <nl> - they think their feature or bug fix is ready . <nl> + Developers work in their own trees , then submit pull requests when they think <nl> + their feature or bug fix is ready . <nl> <nl> - If it is a simple / trivial / non - controversial change , then one of the <nl> - bitcoin development team members simply pulls it . <nl> + If it is a simple / trivial / non - controversial change , then one of the Bitcoin <nl> + development team members simply pulls it . <nl> <nl> - If it is a more complicated or potentially controversial <nl> - change , then the patch submitter will be asked to start a <nl> - discussion ( if they haven ' t already ) on the mailing list : <nl> - http : / / sourceforge . net / mailarchive / forum . php ? forum_name = bitcoin - development <nl> + If it is a * more complicated or potentially controversial * change , then the patch <nl> + submitter will be asked to start a discussion ( if they haven ' t already ) on the <nl> + [ mailing list ] ( http : / / sourceforge . net / mailarchive / forum . php ? forum_name = bitcoin - development ) . <nl> <nl> - The patch will be accepted if there is broad consensus that it is a <nl> - good thing . Developers should expect to rework and resubmit patches <nl> - if they don ' t match the project ' s coding conventions ( see coding . txt ) <nl> - or are controversial . <nl> + The patch will be accepted if there is broad consensus that it is a good thing . <nl> + Developers should expect to rework and resubmit patches if the code doesn ' t <nl> + match the project ' s coding conventions ( see ` doc / coding . txt ` ) or are <nl> + controversial . <nl> <nl> - The master branch is regularly built and tested , but is not guaranteed <nl> - to be completely stable . Tags are regularly created to indicate new <nl> - official , stable release versions of Bitcoin . <nl> + The ` master ` branch is regularly built and tested , but is not guaranteed to be <nl> + completely stable . [ Tags ] ( https : / / github . com / bitcoin / bitcoin / tags ) are created <nl> + regularly to indicate new official , stable release versions of Bitcoin . <nl> <nl> Testing <nl> - = = = = = = = <nl> + mmmmmm - <nl> + <nl> + Testing and code review is the bottleneck for development ; we get more pull <nl> + requests than we can review and test . Please be patient and help out , and <nl> + remember this is a security - critical project where any mistake might cost people <nl> + lots of money . <nl> + <nl> + # # # Automated Testing <nl> <nl> - Testing and code review is the bottleneck for development ; we get more <nl> - pull requests than we can review and test . Please be patient and help <nl> - out , and remember this is a security - critical project where any <nl> - mistake might cost people lots of money . <nl> + Developers are strongly encouraged to write unit tests for new code , and to <nl> + submit new unit tests for old code . <nl> <nl> - Automated Testing <nl> mmmmmmmmmmmmmmmmmm <nl> + Unit tests for the core code are in ` src / test / ` . To compile and run them : <nl> <nl> - Developers are strongly encouraged to write unit tests for new code , <nl> - and to submit new unit tests for old code . <nl> + cd src ; make - f makefile . linux test <nl> <nl> - Unit tests for the core code are in src / test / <nl> - To compile and run them : <nl> - cd src ; make - f makefile . linux test <nl> + Unit tests for the GUI code are in ` src / qt / test / ` . To compile and run them : <nl> <nl> - Unit tests for the GUI code are in src / qt / test / <nl> - To compile and run them : <nl> - qmake BITCOIN_QT_TEST = 1 - o Makefile . test bitcoin - qt . pro <nl> - make - f Makefile . test <nl> - . / Bitcoin - Qt <nl> + qmake BITCOIN_QT_TEST = 1 - o Makefile . test bitcoin - qt . pro <nl> + make - f Makefile . test <nl> + . / Bitcoin - Qt <nl> <nl> - Every pull request is built for both Windows and <nl> - Linux on a dedicated server , and unit and sanity <nl> - tests are automatically run . The binaries <nl> - produced may be used for manual QA testing <nl> - ( a link to them will appear in a comment on the pull request <nl> - from ' BitcoinPullTester ' ) . <nl> - See https : / / github . com / TheBlueMatt / test - scripts for the <nl> - build / test scripts . <nl> + Every pull request is built for both Windows and Linux on a dedicated server , <nl> + and unit and sanity tests are automatically run . The binaries produced may be <nl> + used for manual QA testing - - a link to them will appear in a comment on the <nl> + pull request posted by ' BitcoinPullTester ' . See ` https : / / github . com / TheBlueMatt / test - scripts ` <nl> + for the build / test scripts . <nl> <nl> - Manual Quality Assurance ( QA ) Testing <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + # # # Manual Quality Assurance ( QA ) Testing <nl> <nl> - Large changes should have a test plan , and should be tested <nl> - by somebody other than the developer who wrote the code . <nl> + Large changes should have a test plan , and should be tested by somebody other <nl> + than the developer who wrote the code . <nl> <nl> - See https : / / github . com / bitcoin / QA / for how to create a test plan . <nl> + See ` https : / / github . com / bitcoin / QA / ` for how to create a test plan . <nl>
Merge pull request from colindean / doc / root - readme
bitcoin/bitcoin
2daa2c13e1d35d51cc3f70b2a7ff345810ae7f3d
2013-02-04T14:43:20Z
mmm a / dbms / src / DataStreams / RemoteBlockInputStream . cpp <nl> ppp b / dbms / src / DataStreams / RemoteBlockInputStream . cpp <nl> void RemoteBlockInputStream : : sendExternalTables ( ) <nl> { <nl> StoragePtr cur = table . second ; <nl> QueryProcessingStage : : Enum stage = QueryProcessingStage : : Complete ; <nl> - DB : : BlockInputStreams input = cur - > read ( cur - > getColumnNamesList ( ) , ASTPtr ( ) , context , settings , <nl> + DB : : BlockInputStreams input = cur - > read ( cur - > getColumnNamesList ( ) , ASTPtr ( ) , context , <nl> stage , DEFAULT_BLOCK_SIZE , 1 ) ; <nl> if ( input . size ( ) = = 0 ) <nl> res . push_back ( std : : make_pair ( std : : make_shared < OneBlockInputStream > ( cur - > getSampleBlock ( ) ) , table . first ) ) ; <nl> Block RemoteBlockInputStream : : readImpl ( ) <nl> { <nl> sendQuery ( ) ; <nl> <nl> - if ( settings . skip_unavailable_shards & & ( 0 = = multiplexed_connections - > size ( ) ) ) <nl> + if ( context . getSettingsRef ( ) . skip_unavailable_shards & & ( 0 = = multiplexed_connections - > size ( ) ) ) <nl> return { } ; <nl> } <nl> <nl> void RemoteBlockInputStream : : readSuffixImpl ( ) <nl> <nl> void RemoteBlockInputStream : : createMultiplexedConnections ( ) <nl> { <nl> - Settings * multiplexed_connections_settings = send_settings ? & settings : nullptr ; <nl> + Settings * multiplexed_connections_settings = send_settings ? & context . getSettingsRef ( ) : nullptr ; <nl> const QualifiedTableName * main_table_ptr = main_table ? & main_table . value ( ) : nullptr ; <nl> if ( connection ! = nullptr ) <nl> multiplexed_connections = std : : make_unique < MultiplexedConnections > ( <nl> void RemoteBlockInputStream : : createMultiplexedConnections ( ) <nl> throw Exception ( " Internal error " , ErrorCodes : : LOGICAL_ERROR ) ; <nl> } <nl> <nl> - void RemoteBlockInputStream : : init ( const Settings * settings_ ) <nl> + void RemoteBlockInputStream : : init ( const Settings * settings ) <nl> { <nl> - if ( settings_ ) <nl> + if ( settings ) <nl> { <nl> send_settings = true ; <nl> - settings = * settings_ ; <nl> + context . setSettings ( * settings ) ; <nl> } <nl> else <nl> send_settings = false ; <nl> void RemoteBlockInputStream : : sendQuery ( ) <nl> { <nl> createMultiplexedConnections ( ) ; <nl> <nl> - if ( settings . skip_unavailable_shards & & 0 = = multiplexed_connections - > size ( ) ) <nl> + if ( context . getSettingsRef ( ) . skip_unavailable_shards & & 0 = = multiplexed_connections - > size ( ) ) <nl> return ; <nl> <nl> established = true ; <nl> mmm a / dbms / src / DataStreams / RemoteBlockInputStream . h <nl> ppp b / dbms / src / DataStreams / RemoteBlockInputStream . h <nl> class RemoteBlockInputStream : public IProfilingBlockInputStream <nl> bool hasThrownException ( ) const ; <nl> <nl> private : <nl> - void init ( const Settings * settings_ ) ; <nl> + void init ( const Settings * settings ) ; <nl> <nl> void sendQuery ( ) ; <nl> <nl> class RemoteBlockInputStream : public IProfilingBlockInputStream <nl> <nl> const String query ; <nl> bool send_settings ; <nl> - Settings settings ; <nl> / / / If ! = nullptr , used to limit network trafic <nl> ThrottlerPtr throttler ; <nl> / / / Temporary tables needed to be sent to remote servers <nl> mmm a / dbms / src / DataStreams / tests / expression_stream . cpp <nl> ppp b / dbms / src / DataStreams / tests / expression_stream . cpp <nl> try <nl> QueryProcessingStage : : Enum stage ; <nl> <nl> BlockInputStreamPtr in ; <nl> - in = table - > read ( column_names , 0 , context , Settings ( ) , stage ) [ 0 ] ; <nl> + in = table - > read ( column_names , 0 , context , stage ) [ 0 ] ; <nl> in = std : : make_shared < ExpressionBlockInputStream > ( in , expression ) ; <nl> in = std : : make_shared < LimitBlockInputStream > ( in , 10 , std : : max ( static_cast < Int64 > ( 0 ) , static_cast < Int64 > ( n ) - 10 ) ) ; <nl> <nl> mmm a / dbms / src / DataStreams / tests / filter_stream . cpp <nl> ppp b / dbms / src / DataStreams / tests / filter_stream . cpp <nl> try <nl> <nl> QueryProcessingStage : : Enum stage ; <nl> <nl> - BlockInputStreamPtr in = table - > read ( column_names , 0 , context , Settings ( ) , stage ) [ 0 ] ; <nl> + BlockInputStreamPtr in = table - > read ( column_names , 0 , context , stage ) [ 0 ] ; <nl> in = std : : make_shared < FilterBlockInputStream > ( in , expression , 1 ) ; <nl> in = std : : make_shared < LimitBlockInputStream > ( in , 10 , std : : max ( static_cast < Int64 > ( 0 ) , static_cast < Int64 > ( n ) - 10 ) ) ; <nl> <nl> mmm a / dbms / src / DataStreams / tests / filter_stream_hitlog . cpp <nl> ppp b / dbms / src / DataStreams / tests / filter_stream_hitlog . cpp <nl> int main ( int argc , char * * argv ) <nl> <nl> QueryProcessingStage : : Enum stage ; <nl> <nl> - BlockInputStreamPtr in = table - > read ( column_names , 0 , context , Settings ( ) , stage ) [ 0 ] ; <nl> + BlockInputStreamPtr in = table - > read ( column_names , 0 , context , stage ) [ 0 ] ; <nl> in = std : : make_shared < FilterBlockInputStream > ( in , expression , 4 ) ; <nl> / / in = std : : make_shared < LimitBlockInputStream > ( in , 10 , 0 ) ; <nl> <nl> mmm a / dbms / src / DataStreams / tests / fork_streams . cpp <nl> ppp b / dbms / src / DataStreams / tests / fork_streams . cpp <nl> try <nl> <nl> QueryProcessingStage : : Enum stage ; <nl> <nl> - BlockInputStreamPtr in = table - > read ( column_names , 0 , context , Settings ( ) , stage ) [ 0 ] ; <nl> + BlockInputStreamPtr in = table - > read ( column_names , 0 , context , stage ) [ 0 ] ; <nl> <nl> ForkBlockInputStreams fork ( in ) ; <nl> <nl> mmm a / dbms / src / DataStreams / tests / native_streams . cpp <nl> ppp b / dbms / src / DataStreams / tests / native_streams . cpp <nl> try <nl> if ( argc = = 2 & & 0 = = strcmp ( argv [ 1 ] , " read " ) ) <nl> { <nl> QueryProcessingStage : : Enum stage ; <nl> - BlockInputStreamPtr in = table - > read ( column_names , 0 , Context { } , Settings ( ) , stage ) [ 0 ] ; <nl> + BlockInputStreamPtr in = table - > read ( column_names , 0 , Context { } , stage ) [ 0 ] ; <nl> WriteBufferFromFileDescriptor out1 ( STDOUT_FILENO ) ; <nl> CompressedWriteBuffer out2 ( out1 ) ; <nl> NativeBlockOutputStream out3 ( out2 , ClickHouseRevision : : get ( ) ) ; <nl> mmm a / dbms / src / DataStreams / tests / sorting_stream . cpp <nl> ppp b / dbms / src / DataStreams / tests / sorting_stream . cpp <nl> try <nl> <nl> QueryProcessingStage : : Enum stage ; <nl> <nl> - BlockInputStreamPtr in = table - > read ( column_names , 0 , Context { } , Settings ( ) , stage , argc = = 2 ? atoi ( argv [ 1 ] ) : 1048576 ) [ 0 ] ; <nl> + BlockInputStreamPtr in = table - > read ( column_names , 0 , Context { } , stage , argc = = 2 ? atoi ( argv [ 1 ] ) : 1048576 ) [ 0 ] ; <nl> in = std : : make_shared < PartialSortingBlockInputStream > ( in , sort_columns ) ; <nl> in = std : : make_shared < MergeSortingBlockInputStream > ( in , sort_columns , DEFAULT_BLOCK_SIZE , 0 , 0 , " " ) ; <nl> / / in = std : : make_shared < LimitBlockInputStream > ( in , 10 , 0 ) ; <nl> mmm a / dbms / src / DataStreams / tests / union_stream . cpp <nl> ppp b / dbms / src / DataStreams / tests / union_stream . cpp <nl> void test1 ( ) <nl> QueryProcessingStage : : Enum stage3 ; <nl> <nl> BlockInputStreams streams ; <nl> - streams . emplace_back ( std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , Settings ( ) , stage1 , 1 ) [ 0 ] , 30 , 30000 ) ) ; <nl> - streams . emplace_back ( std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , Settings ( ) , stage2 , 1 ) [ 0 ] , 30 , 2000 ) ) ; <nl> - streams . emplace_back ( std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , Settings ( ) , stage3 , 1 ) [ 0 ] , 30 , 100 ) ) ; <nl> + streams . emplace_back ( std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , stage1 , 1 ) [ 0 ] , 30 , 30000 ) ) ; <nl> + streams . emplace_back ( std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , stage2 , 1 ) [ 0 ] , 30 , 2000 ) ) ; <nl> + streams . emplace_back ( std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , stage3 , 1 ) [ 0 ] , 30 , 100 ) ) ; <nl> <nl> UnionBlockInputStream < > union_stream ( streams , nullptr , 2 ) ; <nl> <nl> void test2 ( ) <nl> <nl> BlockInputStreams streams ; <nl> <nl> - BlockInputStreamPtr stream1 = std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , Settings ( ) , stage1 , 1 ) [ 0 ] , 30 , 30000 ) ; <nl> + BlockInputStreamPtr stream1 = std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , stage1 , 1 ) [ 0 ] , 30 , 30000 ) ; <nl> stream1 = std : : make_shared < BlockExtraInfoInputStream > ( stream1 , extra_info1 ) ; <nl> streams . emplace_back ( stream1 ) ; <nl> <nl> - BlockInputStreamPtr stream2 = std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , Settings ( ) , stage2 , 1 ) [ 0 ] , 30 , 2000 ) ; <nl> + BlockInputStreamPtr stream2 = std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , stage2 , 1 ) [ 0 ] , 30 , 2000 ) ; <nl> stream2 = std : : make_shared < BlockExtraInfoInputStream > ( stream2 , extra_info2 ) ; <nl> streams . emplace_back ( stream2 ) ; <nl> <nl> - BlockInputStreamPtr stream3 = std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , Settings ( ) , stage3 , 1 ) [ 0 ] , 30 , 100 ) ; <nl> + BlockInputStreamPtr stream3 = std : : make_shared < LimitBlockInputStream > ( table - > read ( column_names , 0 , context , stage3 , 1 ) [ 0 ] , 30 , 100 ) ; <nl> stream3 = std : : make_shared < BlockExtraInfoInputStream > ( stream3 , extra_info3 ) ; <nl> streams . emplace_back ( stream3 ) ; <nl> <nl> mmm a / dbms / src / DataStreams / tests / union_stream2 . cpp <nl> ppp b / dbms / src / DataStreams / tests / union_stream2 . cpp <nl> try <nl> StoragePtr table = context . getTable ( " default " , " hits6 " ) ; <nl> <nl> QueryProcessingStage : : Enum stage ; <nl> - BlockInputStreams streams = table - > read ( column_names , nullptr , context , settings , stage , settings . max_block_size , settings . max_threads ) ; <nl> + BlockInputStreams streams = table - > read ( column_names , nullptr , context , stage , settings . max_block_size , settings . max_threads ) ; <nl> <nl> for ( size_t i = 0 , size = streams . size ( ) ; i < size ; + + i ) <nl> streams [ i ] = std : : make_shared < AsynchronousBlockInputStream > ( streams [ i ] ) ; <nl> mmm a / dbms / src / Interpreters / InterpreterSelectQuery . cpp <nl> ppp b / dbms / src / Interpreters / InterpreterSelectQuery . cpp <nl> QueryProcessingStage : : Enum InterpreterSelectQuery : : executeFetchColumns ( ) <nl> actual_query_ptr = query_ptr ; <nl> <nl> streams = storage - > read ( required_columns , actual_query_ptr , <nl> - context , settings , from_stage , <nl> - max_block_size , max_streams ) ; <nl> + context , from_stage , max_block_size , max_streams ) ; <nl> <nl> if ( alias_actions ) <nl> + { <nl> / / / Wrap each stream returned from the table to calculate and add ALIAS columns <nl> transformStreams ( [ & ] ( auto & stream ) <nl> { <nl> stream = std : : make_shared < ExpressionBlockInputStream > ( stream , alias_actions ) ; <nl> } ) ; <nl> + } <nl> <nl> transformStreams ( [ & ] ( auto & stream ) <nl> { <nl> mmm a / dbms / src / Storages / IStorage . h <nl> ppp b / dbms / src / Storages / IStorage . h <nl> class IStorage : public std : : enable_shared_from_this < IStorage > , private boost : : n <nl> * ( Normally , the function only reads the columns from the list , but in other cases , <nl> * for example , the request can be partially processed on a remote server . ) <nl> * <nl> - * settings - settings for one query . <nl> + * context contains settings for one query . <nl> * Usually Storage does not care about these settings , since they are used in the interpreter . <nl> * But , for example , for distributed query processing , the settings are passed to the remote server . <nl> * <nl> class IStorage : public std : : enable_shared_from_this < IStorage > , private boost : : n <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) <nl> mmm a / dbms / src / Storages / MergeTree / MergeTreeDataSelectExecutor . cpp <nl> ppp b / dbms / src / Storages / MergeTree / MergeTreeDataSelectExecutor . cpp <nl> BlockInputStreams MergeTreeDataSelectExecutor : : read ( <nl> const Names & column_names_to_return , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads , <nl> BlockInputStreams MergeTreeDataSelectExecutor : : read ( <nl> SortDescription ( 1 , SortColumnDescription ( data . date_column_name , 1 , 1 ) ) , <nl> Block { { DataTypeDate { } . createColumn ( ) , std : : make_shared < DataTypeDate > ( ) , data . date_column_name } } ) ; <nl> <nl> + const Settings & settings = context . getSettingsRef ( ) ; <nl> + <nl> if ( settings . force_primary_key & & key_condition . alwaysUnknownOrTrue ( ) ) <nl> { <nl> std : : stringstream exception_message ; <nl> mmm a / dbms / src / Storages / MergeTree / MergeTreeDataSelectExecutor . h <nl> ppp b / dbms / src / Storages / MergeTree / MergeTreeDataSelectExecutor . h <nl> class MergeTreeDataSelectExecutor <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size , <nl> unsigned threads , <nl> mmm a / dbms / src / Storages / StorageBuffer . cpp <nl> ppp b / dbms / src / Storages / StorageBuffer . cpp <nl> BlockInputStreams StorageBuffer : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size , <nl> unsigned threads ) <nl> BlockInputStreams StorageBuffer : : read ( <nl> if ( destination . get ( ) = = this ) <nl> throw Exception ( " Destination table is myself . Read will cause infinite loop . " , ErrorCodes : : INFINITE_LOOP ) ; <nl> <nl> - / * * Turn off the optimization " transfer to PREWHERE " , <nl> - * since Buffer does not support PREWHERE . <nl> - * / <nl> - Settings modified_settings = settings ; <nl> - modified_settings . optimize_move_to_prewhere = false ; <nl> - <nl> - streams_from_dst = destination - > read ( column_names , query , context , modified_settings , processed_stage , max_block_size , threads ) ; <nl> + streams_from_dst = destination - > read ( column_names , query , context , processed_stage , max_block_size , threads ) ; <nl> } <nl> <nl> BlockInputStreams streams_from_buffers ; <nl> mmm a / dbms / src / Storages / StorageBuffer . h <nl> ppp b / dbms / src / Storages / StorageBuffer . h <nl> friend class BufferBlockOutputStream ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageCloud . h <nl> ppp b / dbms / src / Storages / StorageCloud . h <nl> friend class ext : : shared_ptr_helper < StorageCloud > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageDistributed . cpp <nl> ppp b / dbms / src / Storages / StorageDistributed . cpp <nl> BlockInputStreams StorageDistributed : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> { <nl> auto cluster = getCluster ( ) ; <nl> <nl> + const Settings & settings = context . getSettingsRef ( ) ; <nl> + <nl> size_t result_size = ( cluster - > getRemoteShardCount ( ) * settings . max_parallel_replicas ) + cluster - > getLocalShardCount ( ) ; <nl> <nl> processed_stage = result_size = = 1 | | settings . distributed_group_by_no_merge <nl> mmm a / dbms / src / Storages / StorageDistributed . h <nl> ppp b / dbms / src / Storages / StorageDistributed . h <nl> class StorageDistributed : private ext : : shared_ptr_helper < StorageDistributed > , p <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageFile . cpp <nl> ppp b / dbms / src / Storages / StorageFile . cpp <nl> BlockInputStreams StorageFile : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size , <nl> unsigned threads ) <nl> mmm a / dbms / src / Storages / StorageFile . h <nl> ppp b / dbms / src / Storages / StorageFile . h <nl> class StorageFile : public IStorage <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageLog . cpp <nl> ppp b / dbms / src / Storages / StorageLog . cpp <nl> <nl> # include < Columns / ColumnArray . h > <nl> # include < Columns / ColumnNullable . h > <nl> <nl> - # include < Interpreters / Settings . h > <nl> + # include < Interpreters / Context . h > <nl> <nl> # include < Poco / Path . h > <nl> # include < Poco / DirectoryIterator . h > <nl> const Marks & StorageLog : : getMarksWithRealRowCount ( ) const <nl> <nl> <nl> BlockInputStreams StorageLog : : read ( <nl> - size_t from_mark , <nl> - size_t to_mark , <nl> - size_t from_null_mark , <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size , <nl> unsigned threads ) <nl> BlockInputStreams StorageLog : : read ( <nl> { <nl> / / / The computation below reflects the fact that marks <nl> / / / are uniformly distributed among threads . <nl> - return from_mark + thread * ( to_mark - from_mark ) / threads ; <nl> + return thread * marks_size / threads ; <nl> } ; <nl> <nl> / / / Given a thread , get the parameters that specify the area <nl> BlockInputStreams StorageLog : : read ( <nl> { <nl> size_t mark_number = mark_from_thread ( thread ) ; <nl> <nl> - size_t cur_total_row_count = ( ( thread = = 0 & & from_mark = = 0 ) <nl> - ? 0 <nl> - : marks [ mark_number - 1 ] . rows ) ; <nl> + size_t cur_total_row_count = thread = = 0 <nl> + ? 0 <nl> + : marks [ mark_number - 1 ] . rows ; <nl> + <nl> size_t next_total_row_count = marks [ mark_from_thread ( thread + 1 ) - 1 ] . rows ; <nl> size_t rows_limit = next_total_row_count - cur_total_row_count ; <nl> <nl> return std : : make_pair ( mark_number , rows_limit ) ; <nl> } ; <nl> <nl> - if ( to_mark = = std : : numeric_limits < size_t > : : max ( ) ) <nl> - to_mark = marks_size ; <nl> - <nl> - if ( to_mark > marks_size | | to_mark < from_mark ) <nl> - throw Exception ( " Marks out of range in StorageLog : : read " , ErrorCodes : : LOGICAL_ERROR ) ; <nl> + if ( threads > marks_size ) <nl> + threads = marks_size ; <nl> <nl> - if ( threads > to_mark - from_mark ) <nl> - threads = to_mark - from_mark ; <nl> + size_t max_read_buffer_size = context . getSettingsRef ( ) . max_read_buffer_size ; <nl> <nl> if ( has_nullable_columns ) <nl> { <nl> BlockInputStreams StorageLog : : read ( <nl> size_t rows_limit ; <nl> std : : tie ( mark_number , rows_limit ) = get_reader_parameters ( thread ) ; <nl> <nl> - / / / This works since we have the same number of marks and null marks . <nl> - size_t null_mark_number = from_null_mark + ( mark_number - from_mark ) ; <nl> - <nl> res . push_back ( std : : make_shared < LogBlockInputStream > ( <nl> max_block_size , <nl> column_names , <nl> * this , <nl> mark_number , <nl> - null_mark_number , <nl> + mark_number , <nl> rows_limit , <nl> - settings . max_read_buffer_size ) ) ; <nl> + max_read_buffer_size ) ) ; <nl> } <nl> } <nl> else <nl> BlockInputStreams StorageLog : : read ( <nl> * this , <nl> mark_number , <nl> rows_limit , <nl> - settings . max_read_buffer_size ) ) ; <nl> + max_read_buffer_size ) ) ; <nl> } <nl> } <nl> <nl> BlockInputStreams StorageLog : : read ( <nl> } <nl> <nl> <nl> - BlockInputStreams StorageLog : : read ( <nl> - const Names & column_names , <nl> - ASTPtr query , <nl> - const Context & context , <nl> - const Settings & settings , <nl> - QueryProcessingStage : : Enum & processed_stage , <nl> - const size_t max_block_size , <nl> - const unsigned threads ) <nl> - { <nl> - return read ( <nl> - 0 , std : : numeric_limits < size_t > : : max ( ) , <nl> - 0 , <nl> - column_names , <nl> - query , context , settings , processed_stage , <nl> - max_block_size , threads ) ; <nl> - } <nl> - <nl> - <nl> BlockOutputStreamPtr StorageLog : : write ( <nl> const ASTPtr & query , const Settings & settings ) <nl> { <nl> mmm a / dbms / src / Storages / StorageLog . h <nl> ppp b / dbms / src / Storages / StorageLog . h <nl> friend class LogBlockOutputStream ; <nl> <nl> const NamesAndTypesList & getColumnsListImpl ( ) const override { return * columns ; } <nl> <nl> - virtual BlockInputStreams read ( <nl> + BlockInputStreams read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageMaterializedView . cpp <nl> ppp b / dbms / src / Storages / StorageMaterializedView . cpp <nl> BlockInputStreams StorageMaterializedView : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> { <nl> - return getInnerTable ( ) - > read ( column_names , query , context , settings , processed_stage , max_block_size , threads ) ; <nl> + return getInnerTable ( ) - > read ( column_names , query , context , processed_stage , max_block_size , threads ) ; <nl> } <nl> <nl> BlockOutputStreamPtr StorageMaterializedView : : write ( const ASTPtr & query , const Settings & settings ) <nl> mmm a / dbms / src / Storages / StorageMaterializedView . h <nl> ppp b / dbms / src / Storages / StorageMaterializedView . h <nl> friend class ext : : shared_ptr_helper < StorageMaterializedView > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageMemory . cpp <nl> ppp b / dbms / src / Storages / StorageMemory . cpp <nl> BlockInputStreams StorageMemory : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size , <nl> unsigned threads ) <nl> mmm a / dbms / src / Storages / StorageMemory . h <nl> ppp b / dbms / src / Storages / StorageMemory . h <nl> friend class MemoryBlockOutputStream ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageMerge . cpp <nl> ppp b / dbms / src / Storages / StorageMerge . cpp <nl> BlockInputStreams StorageMerge : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> BlockInputStreams StorageMerge : : read ( <nl> / * * Just in case , turn off optimization " transfer to PREWHERE " , <nl> * since there is no certainty that it works when one of table is MergeTree and other is not . <nl> * / <nl> - Settings modified_settings = settings ; <nl> - modified_settings . optimize_move_to_prewhere = false ; <nl> + Context modified_context = context ; <nl> + modified_context . getSettingsRef ( ) . optimize_move_to_prewhere = false ; <nl> <nl> size_t tables_count = selected_tables . size ( ) ; <nl> size_t curr_table_number = 0 ; <nl> BlockInputStreams StorageMerge : : read ( <nl> source_streams = table - > read ( <nl> real_column_names , <nl> modified_query_ast , <nl> - context , <nl> - modified_settings , <nl> + modified_context , <nl> processed_stage_in_source_table , <nl> max_block_size , <nl> tables_count > = threads ? 1 : ( threads / tables_count ) ) ; <nl> BlockInputStreams StorageMerge : : read ( <nl> BlockInputStreams streams = table - > read ( <nl> real_column_names , <nl> modified_query_ast , <nl> - context , <nl> - modified_settings , <nl> + modified_context , <nl> processed_stage_in_source_table , <nl> max_block_size , <nl> 1 ) ; <nl> mmm a / dbms / src / Storages / StorageMerge . h <nl> ppp b / dbms / src / Storages / StorageMerge . h <nl> friend class ext : : shared_ptr_helper < StorageMerge > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageMergeTree . cpp <nl> ppp b / dbms / src / Storages / StorageMergeTree . cpp <nl> BlockInputStreams StorageMergeTree : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> { <nl> auto & select = typeid_cast < const ASTSelectQuery & > ( * query ) ; <nl> <nl> + const Settings & settings = context . getSettingsRef ( ) ; <nl> + <nl> / / / Try transferring some condition from WHERE to PREWHERE if enabled and viable <nl> if ( settings . optimize_move_to_prewhere & & select . where_expression & & ! select . prewhere_expression & & ! select . final ( ) ) <nl> MergeTreeWhereOptimizer { query , context , data , column_names , log } ; <nl> <nl> - return reader . read ( column_names , query , context , settings , processed_stage , max_block_size , threads , nullptr , 0 ) ; <nl> + return reader . read ( column_names , query , context , processed_stage , max_block_size , threads , nullptr , 0 ) ; <nl> } <nl> <nl> BlockOutputStreamPtr StorageMergeTree : : write ( const ASTPtr & query , const Settings & settings ) <nl> mmm a / dbms / src / Storages / StorageMergeTree . h <nl> ppp b / dbms / src / Storages / StorageMergeTree . h <nl> friend class MergeTreeBlockOutputStream ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageNull . h <nl> ppp b / dbms / src / Storages / StorageNull . h <nl> friend class ext : : shared_ptr_helper < StorageNull > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> const unsigned threads = 1 ) override <nl> mmm a / dbms / src / Storages / StorageReplicatedMergeTree . cpp <nl> ppp b / dbms / src / Storages / StorageReplicatedMergeTree . cpp <nl> BlockInputStreams StorageReplicatedMergeTree : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> { <nl> + const Settings & settings = context . getSettingsRef ( ) ; <nl> + <nl> / * * The table can have two kinds of data <nl> * - replicated data ; <nl> * - old , non - replicable data - they lie separately and their integrity is not controlled . <nl> BlockInputStreams StorageReplicatedMergeTree : : read ( <nl> if ( ( settings . parallel_replica_offset = = 0 ) & & unreplicated_reader & & values . count ( 0 ) ) <nl> { <nl> res = unreplicated_reader - > read ( real_column_names , query , <nl> - context , settings , processed_stage , <nl> - max_block_size , threads , & part_index , 0 ) ; <nl> + context , processed_stage , max_block_size , threads , & part_index , 0 ) ; <nl> <nl> for ( auto & virtual_column : virt_column_names ) <nl> { <nl> BlockInputStreams StorageReplicatedMergeTree : : read ( <nl> } <nl> <nl> auto res2 = reader . read ( <nl> - real_column_names , query , context , settings , processed_stage , max_block_size , threads , & part_index , max_block_number_to_read ) ; <nl> + real_column_names , query , context , processed_stage , max_block_size , threads , & part_index , max_block_number_to_read ) ; <nl> <nl> for ( auto & virtual_column : virt_column_names ) <nl> { <nl> mmm a / dbms / src / Storages / StorageReplicatedMergeTree . h <nl> ppp b / dbms / src / Storages / StorageReplicatedMergeTree . h <nl> friend class ext : : shared_ptr_helper < StorageReplicatedMergeTree > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageStripeLog . cpp <nl> ppp b / dbms / src / Storages / StorageStripeLog . cpp <nl> <nl> <nl> # include < Columns / ColumnArray . h > <nl> <nl> - # include < Interpreters / Settings . h > <nl> + # include < Interpreters / Context . h > <nl> <nl> # include < Storages / StorageStripeLog . h > <nl> # include < Poco / DirectoryIterator . h > <nl> BlockInputStreams StorageStripeLog : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> unsigned threads ) <nl> BlockInputStreams StorageStripeLog : : read ( <nl> std : : advance ( begin , thread * size / threads ) ; <nl> std : : advance ( end , ( thread + 1 ) * size / threads ) ; <nl> <nl> - res . emplace_back ( std : : make_shared < StripeLogBlockInputStream > ( column_names_set , * this , settings . max_read_buffer_size , index , begin , end ) ) ; <nl> + res . emplace_back ( std : : make_shared < StripeLogBlockInputStream > ( <nl> + column_names_set , * this , context . getSettingsRef ( ) . max_read_buffer_size , index , begin , end ) ) ; <nl> } <nl> <nl> / / / We do not keep read lock directly at the time of reading , because we read ranges of data that do not change . <nl> mmm a / dbms / src / Storages / StorageStripeLog . h <nl> ppp b / dbms / src / Storages / StorageStripeLog . h <nl> friend class StripeLogBlockOutputStream ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageTinyLog . cpp <nl> ppp b / dbms / src / Storages / StorageTinyLog . cpp <nl> <nl> # include < Columns / ColumnArray . h > <nl> # include < Columns / ColumnNullable . h > <nl> <nl> - # include < Interpreters / Settings . h > <nl> + # include < Interpreters / Context . h > <nl> <nl> # include < Storages / StorageTinyLog . h > <nl> # include < Poco / DirectoryIterator . h > <nl> BlockInputStreams StorageTinyLog : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> { <nl> check ( column_names ) ; <nl> processed_stage = QueryProcessingStage : : FetchColumns ; <nl> - return BlockInputStreams ( 1 , std : : make_shared < TinyLogBlockInputStream > ( max_block_size , column_names , * this , settings . max_read_buffer_size ) ) ; <nl> + return BlockInputStreams ( 1 , std : : make_shared < TinyLogBlockInputStream > ( <nl> + max_block_size , column_names , * this , context . getSettingsRef ( ) . max_read_buffer_size ) ) ; <nl> } <nl> <nl> <nl> mmm a / dbms / src / Storages / StorageTinyLog . h <nl> ppp b / dbms / src / Storages / StorageTinyLog . h <nl> friend class TinyLogBlockOutputStream ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / StorageTrivialBuffer . cpp <nl> ppp b / dbms / src / Storages / StorageTrivialBuffer . cpp <nl> BlockInputStreams StorageTrivialBuffer : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size , <nl> unsigned threads ) <nl> BlockInputStreams StorageTrivialBuffer : : read ( <nl> <nl> if ( destination . get ( ) = = this ) <nl> throw Exception ( " Destination table is myself . Read will cause infinite loop . " , <nl> - ErrorCodes : : INFINITE_LOOP ) ; <nl> + ErrorCodes : : INFINITE_LOOP ) ; <nl> <nl> - / * * TrivialStorageBuffer does not support ' PREWHERE ' , <nl> - * so turn off corresponding optimization . <nl> - * / <nl> - Settings modified_settings = settings ; <nl> - modified_settings . optimize_move_to_prewhere = false ; <nl> - <nl> - streams = destination - > read ( column_names , query , context , modified_settings , <nl> + streams = destination - > read ( column_names , query , context , <nl> processed_stage , max_block_size , threads ) ; <nl> } <nl> <nl> BlockInputStreams StorageTrivialBuffer : : read ( <nl> return streams ; <nl> } <nl> <nl> - template < typename DeduplicatioController > <nl> - void StorageTrivialBuffer : : addBlock ( const Block & block , DeduplicatioController & deduplication_controller ) <nl> + template < typename DeduplicationController > <nl> + void StorageTrivialBuffer : : addBlock ( const Block & block , DeduplicationController & deduplication_controller ) <nl> { <nl> SipHash hash ; <nl> block . updateHash ( hash ) ; <nl> - typename DeduplicatioController : : HashType block_hash = DeduplicatioController : : getHashFrom ( hash ) ; <nl> + typename DeduplicationController : : HashType block_hash = DeduplicationController : : getHashFrom ( hash ) ; <nl> <nl> std : : lock_guard < std : : mutex > lock ( mutex ) ; <nl> if ( ! deduplication_controller . contains ( block_hash ) ) <nl> mmm a / dbms / src / Storages / StorageTrivialBuffer . h <nl> ppp b / dbms / src / Storages / StorageTrivialBuffer . h <nl> friend class TrivialBufferBlockOutputStream ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> friend class TrivialBufferBlockOutputStream ; <nl> const String & new_table_name ) override { name = new_table_name ; } <nl> <nl> bool supportsSampling ( ) const override { return true ; } <nl> - bool supportsPrewhere ( ) const override { return true ; } <nl> + bool supportsPrewhere ( ) const override { return false ; } <nl> bool supportsFinal ( ) const override { return true ; } <nl> bool supportsIndexForIn ( ) const override { return true ; } <nl> bool supportsParallelReplicas ( ) const override { return true ; } <nl> friend class TrivialBufferBlockOutputStream ; <nl> const Thresholds & min_thresholds_ , const Thresholds & max_thresholds_ , <nl> const String & destination_database_ , const String & destination_table_ ) ; <nl> <nl> - template < typename DeduplicatioController > <nl> - void addBlock ( const Block & block , DeduplicatioController & deduplication_controller ) ; <nl> + template < typename DeduplicationController > <nl> + void addBlock ( const Block & block , DeduplicationController & deduplication_controller ) ; <nl> / / / Parameter ' table ' is passed because it ' s sometimes pre - computed . It should <nl> / / / conform the ' destination_table ' . <nl> void writeBlockToDestination ( const Block & block , StoragePtr table ) ; <nl> mmm a / dbms / src / Storages / StorageView . cpp <nl> ppp b / dbms / src / Storages / StorageView . cpp <nl> BlockInputStreams StorageView : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / StorageView . h <nl> ppp b / dbms / src / Storages / StorageView . h <nl> friend class ext : : shared_ptr_helper < StorageView > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemAsynchronousMetrics . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemAsynchronousMetrics . cpp <nl> BlockInputStreams StorageSystemAsynchronousMetrics : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemAsynchronousMetrics . h <nl> ppp b / dbms / src / Storages / System / StorageSystemAsynchronousMetrics . h <nl> friend class ext : : shared_ptr_helper < StorageSystemAsynchronousMetrics > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemBuildOptions . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemBuildOptions . cpp <nl> BlockInputStreams StorageSystemBuildOptions : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemBuildOptions . h <nl> ppp b / dbms / src / Storages / System / StorageSystemBuildOptions . h <nl> friend class ext : : shared_ptr_helper < StorageSystemBuildOptions > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemClusters . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemClusters . cpp <nl> BlockInputStreams StorageSystemClusters : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context_ , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemClusters . h <nl> ppp b / dbms / src / Storages / System / StorageSystemClusters . h <nl> friend class ext : : shared_ptr_helper < StorageSystemClusters > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemColumns . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemColumns . cpp <nl> BlockInputStreams StorageSystemColumns : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemColumns . h <nl> ppp b / dbms / src / Storages / System / StorageSystemColumns . h <nl> friend class ext : : shared_ptr_helper < StorageSystemColumns > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemDatabases . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemDatabases . cpp <nl> BlockInputStreams StorageSystemDatabases : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemDatabases . h <nl> ppp b / dbms / src / Storages / System / StorageSystemDatabases . h <nl> friend class ext : : shared_ptr_helper < StorageSystemDatabases > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemDictionaries . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemDictionaries . cpp <nl> BlockInputStreams StorageSystemDictionaries : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned ) <nl> mmm a / dbms / src / Storages / System / StorageSystemDictionaries . h <nl> ppp b / dbms / src / Storages / System / StorageSystemDictionaries . h <nl> friend class ext : : shared_ptr_helper < StorageSystemDictionaries > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemEvents . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemEvents . cpp <nl> BlockInputStreams StorageSystemEvents : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemEvents . h <nl> ppp b / dbms / src / Storages / System / StorageSystemEvents . h <nl> friend class ext : : shared_ptr_helper < StorageSystemEvents > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemFunctions . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemFunctions . cpp <nl> BlockInputStreams StorageSystemFunctions : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemFunctions . h <nl> ppp b / dbms / src / Storages / System / StorageSystemFunctions . h <nl> friend class ext : : shared_ptr_helper < StorageSystemFunctions > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemGraphite . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemGraphite . cpp <nl> BlockInputStreams StorageSystemGraphite : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size , <nl> unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemGraphite . h <nl> ppp b / dbms / src / Storages / System / StorageSystemGraphite . h <nl> class StorageSystemGraphite <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemMerges . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemMerges . cpp <nl> BlockInputStreams StorageSystemMerges : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned ) <nl> mmm a / dbms / src / Storages / System / StorageSystemMerges . h <nl> ppp b / dbms / src / Storages / System / StorageSystemMerges . h <nl> friend class ext : : shared_ptr_helper < StorageSystemMerges > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemMetrics . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemMetrics . cpp <nl> BlockInputStreams StorageSystemMetrics : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemMetrics . h <nl> ppp b / dbms / src / Storages / System / StorageSystemMetrics . h <nl> friend class ext : : shared_ptr_helper < StorageSystemMetrics > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemNumbers . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemNumbers . cpp <nl> BlockInputStreams StorageSystemNumbers : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemNumbers . h <nl> ppp b / dbms / src / Storages / System / StorageSystemNumbers . h <nl> friend class ext : : shared_ptr_helper < StorageSystemNumbers > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemOne . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemOne . cpp <nl> BlockInputStreams StorageSystemOne : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemOne . h <nl> ppp b / dbms / src / Storages / System / StorageSystemOne . h <nl> friend class ext : : shared_ptr_helper < StorageSystemOne > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemParts . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemParts . cpp <nl> BlockInputStreams StorageSystemParts : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemParts . h <nl> ppp b / dbms / src / Storages / System / StorageSystemParts . h <nl> friend class ext : : shared_ptr_helper < StorageSystemParts > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemProcesses . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemProcesses . cpp <nl> BlockInputStreams StorageSystemProcesses : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemProcesses . h <nl> ppp b / dbms / src / Storages / System / StorageSystemProcesses . h <nl> friend class ext : : shared_ptr_helper < StorageSystemProcesses > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemReplicas . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemReplicas . cpp <nl> BlockInputStreams StorageSystemReplicas : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemReplicas . h <nl> ppp b / dbms / src / Storages / System / StorageSystemReplicas . h <nl> friend class ext : : shared_ptr_helper < StorageSystemReplicas > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemReplicationQueue . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemReplicationQueue . cpp <nl> BlockInputStreams StorageSystemReplicationQueue : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemReplicationQueue . h <nl> ppp b / dbms / src / Storages / System / StorageSystemReplicationQueue . h <nl> friend class ext : : shared_ptr_helper < StorageSystemReplicationQueue > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemSettings . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemSettings . cpp <nl> <nl> # include < DataTypes / DataTypeString . h > <nl> # include < DataTypes / DataTypesNumber . h > <nl> # include < DataStreams / OneBlockInputStream . h > <nl> - # include < Interpreters / Settings . h > <nl> + # include < Interpreters / Context . h > <nl> # include < Storages / System / StorageSystemSettings . h > <nl> <nl> <nl> BlockInputStreams StorageSystemSettings : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> BlockInputStreams StorageSystemSettings : : read ( <nl> check ( column_names ) ; <nl> processed_stage = QueryProcessingStage : : FetchColumns ; <nl> <nl> + const Settings & settings = context . getSettingsRef ( ) ; <nl> + <nl> ColumnWithTypeAndName col_name { std : : make_shared < ColumnString > ( ) , std : : make_shared < DataTypeString > ( ) , " name " } ; <nl> ColumnWithTypeAndName col_value { std : : make_shared < ColumnString > ( ) , std : : make_shared < DataTypeString > ( ) , " value " } ; <nl> ColumnWithTypeAndName col_changed { std : : make_shared < ColumnUInt8 > ( ) , std : : make_shared < DataTypeUInt8 > ( ) , " changed " } ; <nl> mmm a / dbms / src / Storages / System / StorageSystemSettings . h <nl> ppp b / dbms / src / Storages / System / StorageSystemSettings . h <nl> friend class ext : : shared_ptr_helper < StorageSystemSettings > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemTables . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemTables . cpp <nl> BlockInputStreams StorageSystemTables : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> mmm a / dbms / src / Storages / System / StorageSystemTables . h <nl> ppp b / dbms / src / Storages / System / StorageSystemTables . h <nl> friend class ext : : shared_ptr_helper < StorageSystemTables > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / System / StorageSystemZooKeeper . cpp <nl> ppp b / dbms / src / Storages / System / StorageSystemZooKeeper . cpp <nl> BlockInputStreams StorageSystemZooKeeper : : read ( <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> const size_t max_block_size , <nl> const unsigned threads ) <nl> BlockInputStreams StorageSystemZooKeeper : : read ( <nl> if ( path . empty ( ) ) <nl> throw Exception ( " SELECT from system . zookeeper table must contain condition like path = ' path ' in WHERE clause . " ) ; <nl> <nl> - ColumnWithTypeAndName col_name { std : : make_shared < ColumnString > ( ) , std : : make_shared < DataTypeString > ( ) , " name " } ; <nl> - ColumnWithTypeAndName col_value { std : : make_shared < ColumnString > ( ) , std : : make_shared < DataTypeString > ( ) , " value " } ; <nl> - ColumnWithTypeAndName col_czxid { std : : make_shared < ColumnInt64 > ( ) , std : : make_shared < DataTypeInt64 > ( ) , " czxid " } ; <nl> - ColumnWithTypeAndName col_mzxid { std : : make_shared < ColumnInt64 > ( ) , std : : make_shared < DataTypeInt64 > ( ) , " mzxid " } ; <nl> - ColumnWithTypeAndName col_ctime { std : : make_shared < ColumnUInt32 > ( ) , std : : make_shared < DataTypeDateTime > ( ) , " ctime " } ; <nl> - ColumnWithTypeAndName col_mtime { std : : make_shared < ColumnUInt32 > ( ) , std : : make_shared < DataTypeDateTime > ( ) , " mtime " } ; <nl> - ColumnWithTypeAndName col_version { std : : make_shared < ColumnInt32 > ( ) , std : : make_shared < DataTypeInt32 > ( ) , " version " } ; <nl> - ColumnWithTypeAndName col_cversion { std : : make_shared < ColumnInt32 > ( ) , std : : make_shared < DataTypeInt32 > ( ) , " cversion " } ; <nl> - ColumnWithTypeAndName col_aversion { std : : make_shared < ColumnInt32 > ( ) , std : : make_shared < DataTypeInt32 > ( ) , " aversion " } ; <nl> - ColumnWithTypeAndName col_ephemeralOwner { std : : make_shared < ColumnInt64 > ( ) , std : : make_shared < DataTypeInt64 > ( ) , " ephemeralOwner " } ; <nl> - ColumnWithTypeAndName col_dataLength { std : : make_shared < ColumnInt32 > ( ) , std : : make_shared < DataTypeInt32 > ( ) , " dataLength " } ; <nl> - ColumnWithTypeAndName col_numChildren { std : : make_shared < ColumnInt32 > ( ) , std : : make_shared < DataTypeInt32 > ( ) , " numChildren " } ; <nl> - ColumnWithTypeAndName col_pzxid { std : : make_shared < ColumnInt64 > ( ) , std : : make_shared < DataTypeInt64 > ( ) , " pzxid " } ; <nl> - ColumnWithTypeAndName col_path { std : : make_shared < ColumnString > ( ) , std : : make_shared < DataTypeString > ( ) , " path " } ; <nl> + ColumnWithTypeAndName col_name { std : : make_shared < ColumnString > ( ) , std : : make_shared < DataTypeString > ( ) , " name " } ; <nl> + ColumnWithTypeAndName col_value { std : : make_shared < ColumnString > ( ) , std : : make_shared < DataTypeString > ( ) , " value " } ; <nl> + ColumnWithTypeAndName col_czxid { std : : make_shared < ColumnInt64 > ( ) , std : : make_shared < DataTypeInt64 > ( ) , " czxid " } ; <nl> + ColumnWithTypeAndName col_mzxid { std : : make_shared < ColumnInt64 > ( ) , std : : make_shared < DataTypeInt64 > ( ) , " mzxid " } ; <nl> + ColumnWithTypeAndName col_ctime { std : : make_shared < ColumnUInt32 > ( ) , std : : make_shared < DataTypeDateTime > ( ) , " ctime " } ; <nl> + ColumnWithTypeAndName col_mtime { std : : make_shared < ColumnUInt32 > ( ) , std : : make_shared < DataTypeDateTime > ( ) , " mtime " } ; <nl> + ColumnWithTypeAndName col_version { std : : make_shared < ColumnInt32 > ( ) , std : : make_shared < DataTypeInt32 > ( ) , " version " } ; <nl> + ColumnWithTypeAndName col_cversion { std : : make_shared < ColumnInt32 > ( ) , std : : make_shared < DataTypeInt32 > ( ) , " cversion " } ; <nl> + ColumnWithTypeAndName col_aversion { std : : make_shared < ColumnInt32 > ( ) , std : : make_shared < DataTypeInt32 > ( ) , " aversion " } ; <nl> + ColumnWithTypeAndName col_ephemeralOwner { std : : make_shared < ColumnInt64 > ( ) , std : : make_shared < DataTypeInt64 > ( ) , " ephemeralOwner " } ; <nl> + ColumnWithTypeAndName col_dataLength { std : : make_shared < ColumnInt32 > ( ) , std : : make_shared < DataTypeInt32 > ( ) , " dataLength " } ; <nl> + ColumnWithTypeAndName col_numChildren { std : : make_shared < ColumnInt32 > ( ) , std : : make_shared < DataTypeInt32 > ( ) , " numChildren " } ; <nl> + ColumnWithTypeAndName col_pzxid { std : : make_shared < ColumnInt64 > ( ) , std : : make_shared < DataTypeInt64 > ( ) , " pzxid " } ; <nl> + ColumnWithTypeAndName col_path { std : : make_shared < ColumnString > ( ) , std : : make_shared < DataTypeString > ( ) , " path " } ; <nl> <nl> zkutil : : ZooKeeperPtr zookeeper = context . getZooKeeper ( ) ; <nl> <nl> BlockInputStreams StorageSystemZooKeeper : : read ( <nl> col_path . column - > insert ( path ) ; / / / This is the original path . In order to process the request , condition in WHERE should be triggered . <nl> } <nl> <nl> - Block block { <nl> + Block block <nl> + { <nl> col_name , <nl> col_value , <nl> col_czxid , <nl> mmm a / dbms / src / Storages / System / StorageSystemZooKeeper . h <nl> ppp b / dbms / src / Storages / System / StorageSystemZooKeeper . h <nl> friend class ext : : shared_ptr_helper < StorageSystemZooKeeper > ; <nl> const Names & column_names , <nl> ASTPtr query , <nl> const Context & context , <nl> - const Settings & settings , <nl> QueryProcessingStage : : Enum & processed_stage , <nl> size_t max_block_size = DEFAULT_BLOCK_SIZE , <nl> unsigned threads = 1 ) override ; <nl> mmm a / dbms / src / Storages / tests / hit_log . cpp <nl> ppp b / dbms / src / Storages / tests / hit_log . cpp <nl> try <nl> <nl> QueryProcessingStage : : Enum stage ; <nl> <nl> - BlockInputStreamPtr in = table - > read ( column_names , 0 , Context { } , Settings ( ) , stage ) [ 0 ] ; <nl> + BlockInputStreamPtr in = table - > read ( column_names , 0 , Context { } , stage ) [ 0 ] ; <nl> RowOutputStreamPtr out_ = std : : make_shared < TabSeparatedRowOutputStream > ( out_buf , sample ) ; <nl> BlockOutputStreamFromRowOutputStream out ( out_ ) ; <nl> copyData ( * in , out ) ; <nl> mmm a / dbms / src / Storages / tests / merge_tree . cpp <nl> ppp b / dbms / src / Storages / tests / merge_tree . cpp <nl> try <nl> if ( ! parser . parse ( begin , end , select , max_parsed_pos , expected ) ) <nl> throw Poco : : Exception ( " Cannot parse " + primary_expr_str ) ; <nl> <nl> - BlockInputStreamPtr in = table - > read ( column_names , select , context , Settings ( ) , stage ) [ 0 ] ; <nl> + BlockInputStreamPtr in = table - > read ( column_names , select , context , stage ) [ 0 ] ; <nl> <nl> Block sample ; <nl> { <nl> mmm a / dbms / src / Storages / tests / storage_log . cpp <nl> ppp b / dbms / src / Storages / tests / storage_log . cpp <nl> try <nl> <nl> QueryProcessingStage : : Enum stage ; <nl> <nl> - BlockInputStreamPtr in = table - > read ( column_names , 0 , Context { } , Settings ( ) , stage ) [ 0 ] ; <nl> + BlockInputStreamPtr in = table - > read ( column_names , 0 , Context { } , stage ) [ 0 ] ; <nl> <nl> Block sample ; <nl> { <nl> mmm a / dbms / src / Storages / tests / system_numbers . cpp <nl> ppp b / dbms / src / Storages / tests / system_numbers . cpp <nl> try <nl> <nl> QueryProcessingStage : : Enum stage ; <nl> <nl> - LimitBlockInputStream input ( table - > read ( column_names , 0 , Context { } , Settings ( ) , stage , 10 ) [ 0 ] , 10 , 96 ) ; <nl> + LimitBlockInputStream input ( table - > read ( column_names , 0 , Context { } , stage , 10 ) [ 0 ] , 10 , 96 ) ; <nl> RowOutputStreamPtr output_ = std : : make_shared < TabSeparatedRowOutputStream > ( out_buf , sample ) ; <nl> BlockOutputStreamFromRowOutputStream output ( output_ ) ; <nl> <nl>
Preparation : untangling [ # CLICKHOUSE - 31 ] .
ClickHouse/ClickHouse
48f65e9097fcc4190ff7ad103a82b38dae473b97
2017-05-24T21:06:29Z
mmm a / lib / SILGen / Cleanup . cpp <nl> ppp b / lib / SILGen / Cleanup . cpp <nl> void CleanupManager : : setCleanupState ( CleanupsDepth depth , CleanupState state ) { <nl> } <nl> <nl> void CleanupManager : : setCleanupState ( Cleanup & cleanup , CleanupState state ) { <nl> - assert ( ( state ! = CleanupState : : Active | | Gen . B . hasValidInsertionPoint ( ) ) & & <nl> - " activating cleanup at invalid IP " ) ; <nl> + assert ( Gen . B . hasValidInsertionPoint ( ) & & <nl> + " changing cleanup state at invalid IP " ) ; <nl> <nl> / / Do the transition now to avoid doing it in N places below . <nl> CleanupState oldState = cleanup . getState ( ) ; <nl> ( void ) oldState ; <nl> cleanup . setState ( state ) ; <nl> - <nl> - assert ( state ! = oldState & & " cleanup state is already active " ) ; <nl> - <nl> - / / TODO : port the full transition logic from irgen here . For now , we only <nl> - / / handle active and dead cleanups and only support transitions from active to <nl> - / / dead . <nl> - assert ( state = = CleanupState : : Dead & & oldState = = CleanupState : : Active & & <nl> - " only active to dead transition currently supported " ) ; <nl> + <nl> + assert ( state ! = oldState & & " trivial cleanup state change " ) ; <nl> + assert ( oldState ! = CleanupState : : Dead & & " changing state of dead cleanup " ) ; <nl> + <nl> + / / Our current cleanup emission logic , where we don ' t try to re - use <nl> + / / cleanup emissions between various branches , doesn ' t require any <nl> + / / code to be emitted at transition points . <nl> } <nl> mmm a / lib / SILGen / Initialization . h <nl> ppp b / lib / SILGen / Initialization . h <nl> class Initialization { <nl> } ; <nl> <nl> / / / Abstract base class for single - buffer initializations . <nl> - class SingleInitializationBase : public Initialization { <nl> + class SingleBufferInitialization : public Initialization { <nl> public : <nl> - SingleInitializationBase ( ) <nl> + SingleBufferInitialization ( ) <nl> : Initialization ( Initialization : : Kind : : SingleBuffer ) <nl> { } <nl> <nl> - ArrayRef < InitializationPtr > getSubInitializations ( ) override { <nl> - return { } ; <nl> - } <nl> + ArrayRef < InitializationPtr > getSubInitializations ( ) override ; <nl> } ; <nl> <nl> + / / / Abstract base class for single - buffer initializations . <nl> + class TemporaryInitialization : public SingleBufferInitialization { <nl> + SILValue Addr ; <nl> + CleanupsDepth Cleanup ; <nl> + public : <nl> + TemporaryInitialization ( SILValue addr , CleanupsDepth cleanup ) <nl> + : Addr ( addr ) , Cleanup ( cleanup ) { } <nl> + <nl> + void finishInitialization ( SILGenFunction & gen ) override ; <nl> + <nl> + / / / Returns the cleanup corresponding to the value of the temporary . <nl> + CleanupsDepth getInitializedCleanup ( ) const { return Cleanup ; } <nl> + } ; <nl> <nl> } / / end namespace Lowering <nl> } / / end namespace swift <nl> mmm a / lib / SILGen / JumpDest . h <nl> ppp b / lib / SILGen / JumpDest . h <nl> class LLVM_LIBRARY_VISIBILITY JumpDest { <nl> SILBasicBlock * getBlock ( ) const { return Block ; } <nl> CleanupsDepth getDepth ( ) const { return Depth ; } <nl> CleanupLocation getCleanupLocation ( ) const { return CleanupLoc ; } <nl> + <nl> + bool isValid ( ) const { return Block ! = nullptr ; } <nl> + static JumpDest invalid ( ) { <nl> + return JumpDest ( CleanupLocation ( ( Expr * ) nullptr ) ) ; <nl> + } <nl> } ; <nl> <nl> } / / end namespace Lowering <nl> mmm a / lib / SILGen / SILGenDecl . cpp <nl> ppp b / lib / SILGen / SILGenDecl . cpp <nl> namespace { <nl> <nl> <nl> / / / An Initialization subclass used to destructure tuple initializations . <nl> - class TupleElementInitialization : public SingleInitializationBase { <nl> + class TupleElementInitialization : public SingleBufferInitialization { <nl> public : <nl> - SILValue elementAddr ; <nl> + SILValue ElementAddr ; <nl> <nl> TupleElementInitialization ( SILValue addr ) <nl> - : elementAddr ( addr ) <nl> + : ElementAddr ( addr ) <nl> { } <nl> <nl> - SILValue getAddressOrNull ( ) override { return elementAddr ; } <nl> - <nl> + SILValue getAddressOrNull ( ) override { return ElementAddr ; } <nl> + <nl> void finishInitialization ( SILGenFunction & gen ) override { } <nl> } ; <nl> } <nl> void SILGenFunction : : visitFuncDecl ( FuncDecl * fd ) { <nl> } <nl> } <nl> <nl> + ArrayRef < InitializationPtr > <nl> + SingleBufferInitialization : : getSubInitializations ( ) { <nl> + return { } ; <nl> + } <nl> + <nl> + void TemporaryInitialization : : finishInitialization ( SILGenFunction & gen ) { <nl> + if ( Cleanup . isValid ( ) ) <nl> + gen . Cleanups . setCleanupState ( Cleanup , CleanupState : : Active ) ; <nl> + } ; <nl> + <nl> namespace { <nl> <nl> / / / An Initialization of a tuple pattern , such as " var ( a , b ) " . <nl> class TupleInitialization : public Initialization { <nl> / / / here . <nl> SmallVector < InitializationPtr , 4 > subInitializations ; <nl> <nl> - TupleInitialization ( ) : Initialization ( Initialization : : Kind : : Tuple ) <nl> - { } <nl> + TupleInitialization ( ) : Initialization ( Initialization : : Kind : : Tuple ) { } <nl> <nl> SILValue getAddressOrNull ( ) override { <nl> if ( subInitializations . size ( ) = = 1 ) <nl> class DeallocStack : public Cleanup { <nl> } ; <nl> <nl> / / / Cleanup to destroy an initialized variable . <nl> - class CleanupLocalVariable : public Cleanup { <nl> - VarDecl * var ; <nl> + class DestroyLocalVariable : public Cleanup { <nl> + VarDecl * Var ; <nl> public : <nl> - CleanupLocalVariable ( VarDecl * var ) <nl> - : var ( var ) { } <nl> + DestroyLocalVariable ( VarDecl * var ) : Var ( var ) { } <nl> <nl> void emit ( SILGenFunction & gen , CleanupLocation l ) override { <nl> - gen . destroyLocalVariable ( l , var ) ; <nl> + gen . destroyLocalVariable ( l , Var ) ; <nl> } <nl> } ; <nl> + <nl> + / / / Cleanup to destroy an uninitialized local variable . <nl> + class DeallocateUninitializedLocalVariable : public Cleanup { <nl> + VarDecl * Var ; <nl> + public : <nl> + DeallocateUninitializedLocalVariable ( VarDecl * var ) : Var ( var ) { } <nl> <nl> - / / / Cleanup to destroy an address - only argument . We destroy the value without <nl> - / / / deallocating the storage . <nl> - class CleanupAddressOnlyArgument : public Cleanup { <nl> - SILValue addr ; <nl> + void emit ( SILGenFunction & gen , CleanupLocation l ) override { <nl> + gen . deallocateUninitializedLocalVariable ( l , Var ) ; <nl> + } <nl> + } ; <nl> + <nl> + / / / Cleanup to perform a destroy address . <nl> + class DestroyAddr : public Cleanup { <nl> + SILValue Addr ; <nl> public : <nl> - CleanupAddressOnlyArgument ( SILValue addr ) <nl> - : addr ( addr ) { } <nl> + DestroyAddr ( SILValue addr ) : Addr ( addr ) { } <nl> <nl> void emit ( SILGenFunction & gen , CleanupLocation l ) override { <nl> - gen . B . createDestroyAddr ( l , addr ) ; <nl> + gen . B . createDestroyAddr ( l , Addr ) ; <nl> } <nl> } ; <nl> <nl> / / / An initialization of a local variable . <nl> - class LocalVariableInitialization : public SingleInitializationBase { <nl> - / / FIXME : We should install a deallocation cleanup then deactivate it and <nl> - / / activate a destroying cleanup when the value is initialized . <nl> - <nl> + class LocalVariableInitialization : public SingleBufferInitialization { <nl> / / / The local variable decl being initialized . <nl> - VarDecl * var ; <nl> - SILGenFunction & gen ; <nl> + VarDecl * Var ; <nl> + SILGenFunction & Gen ; <nl> + <nl> + / / / The cleanup we pushed to deallocate the local variable before it <nl> + / / / gets initialized . <nl> + CleanupsDepth DeallocCleanup ; <nl> + <nl> + / / / The cleanup we pushed to destroy and deallocate the local variable . <nl> + CleanupsDepth ReleaseCleanup ; <nl> <nl> - bool didFinish ; <nl> + bool DidFinish = false ; <nl> public : <nl> / / / Sets up an initialization for the allocated box . This pushes a <nl> / / / CleanupUninitializedBox cleanup that will be replaced when <nl> / / / initialization is completed . <nl> LocalVariableInitialization ( VarDecl * var , SILGenFunction & gen ) <nl> - : var ( var ) , gen ( gen ) , didFinish ( false ) <nl> - { <nl> - gen . Cleanups . pushCleanup < CleanupLocalVariable > ( var ) ; <nl> + : Var ( var ) , Gen ( gen ) { <nl> + / / Push a cleanup to destroy the local variable . This has to be <nl> + / / inactive until the variable is initialized . <nl> + gen . Cleanups . pushCleanupInState < DestroyLocalVariable > ( CleanupState : : Dormant , <nl> + var ) ; <nl> + ReleaseCleanup = gen . Cleanups . getCleanupsDepth ( ) ; <nl> + <nl> + / / Push a cleanup to deallocate the local variable . <nl> + gen . Cleanups . pushCleanup < DeallocateUninitializedLocalVariable > ( var ) ; <nl> + DeallocCleanup = gen . Cleanups . getCleanupsDepth ( ) ; <nl> } <nl> <nl> ~ LocalVariableInitialization ( ) override { <nl> - assert ( didFinish & & " did not call VarInit : : finishInitialization ! " ) ; <nl> + assert ( DidFinish & & " did not call VarInit : : finishInitialization ! " ) ; <nl> } <nl> <nl> SILValue getAddressOrNull ( ) override { <nl> - assert ( gen . VarLocs . count ( var ) & & " did not emit var ? ! " ) ; <nl> - return gen . VarLocs [ var ] . address ; <nl> + assert ( Gen . VarLocs . count ( Var ) & & " did not emit var ? ! " ) ; <nl> + return Gen . VarLocs [ Var ] . address ; <nl> } <nl> - <nl> + <nl> void finishInitialization ( SILGenFunction & gen ) override { <nl> - assert ( ! didFinish & & <nl> + assert ( ! DidFinish & & <nl> " called LocalVariableInitialization : : finishInitialization twice ! " ) ; <nl> - / / FIXME : deactivate the deallocating cleanup and activate the <nl> - / / destroying one . <nl> - didFinish = true ; <nl> + Gen . Cleanups . setCleanupState ( DeallocCleanup , CleanupState : : Dead ) ; <nl> + Gen . Cleanups . setCleanupState ( ReleaseCleanup , CleanupState : : Active ) ; <nl> + DidFinish = true ; <nl> } <nl> } ; <nl> <nl> / / / An initialization for a global variable . <nl> - class GlobalInitialization : public SingleInitializationBase { <nl> + class GlobalInitialization : public SingleBufferInitialization { <nl> / / / The physical address of the global . <nl> SILValue address ; <nl> <nl> struct ArgumentInitVisitor : <nl> / / If this is an address - only non - inout argument , we take ownership <nl> / / of the referenced value . <nl> if ( ! ty - > is < LValueType > ( ) ) <nl> - gen . Cleanups . pushCleanup < CleanupAddressOnlyArgument > ( arg ) ; <nl> + gen . Cleanups . pushCleanup < DestroyAddr > ( arg ) ; <nl> break ; <nl> <nl> case Initialization : : Kind : : SingleBuffer : <nl> mmm a / lib / SILGen / SILGenExpr . cpp <nl> ppp b / lib / SILGen / SILGenExpr . cpp <nl> RValue RValueEmitter : : visitFunctionConversionExpr ( FunctionConversionExpr * e , <nl> namespace { <nl> / / / An Initialization representing the concrete value buffer inside an <nl> / / / existential container . <nl> - class ExistentialValueInitialization : public SingleInitializationBase { <nl> + class ExistentialValueInitialization : public SingleBufferInitialization { <nl> SILValue valueAddr ; <nl> public : <nl> ExistentialValueInitialization ( SILValue valueAddr ) <nl> static RValue emitImplicitValueConstructorArg ( SILGenFunction & gen , <nl> } <nl> <nl> namespace { <nl> - class ImplicitValueInitialization : public SingleInitializationBase { <nl> + class ImplicitValueInitialization : public SingleBufferInitialization { <nl> SILValue slot ; <nl> public : <nl> - ImplicitValueInitialization ( SILValue slot ) : slot ( slot ) <nl> - { } <nl> + ImplicitValueInitialization ( SILValue slot ) : slot ( slot ) { } <nl> <nl> SILValue getAddressOrNull ( ) override { <nl> return slot ; <nl> RValue RValueEmitter : : visitBridgeToBlockExpr ( BridgeToBlockExpr * E , <nl> <nl> namespace { <nl> / / / An Initialization representing the result of an address - only ternary . <nl> - class TernaryInitialization : public SingleInitializationBase { <nl> + class TernaryInitialization : public SingleBufferInitialization { <nl> SILValue valueAddr ; <nl> public : <nl> TernaryInitialization ( SILValue valueAddr ) <nl> mmm a / lib / SILGen / SILGenStmt . cpp <nl> ppp b / lib / SILGen / SILGenStmt . cpp <nl> namespace { <nl> <nl> / / / IndirectReturnInitialization - represents initializing an indirect return <nl> / / / value . <nl> - class IndirectReturnInitialization : public SingleInitializationBase { <nl> + class IndirectReturnInitialization : public SingleBufferInitialization { <nl> SILValue address ; <nl> public : <nl> IndirectReturnInitialization ( SILValue address ) <nl>
Push and invalidate uninitialized - local cleanups .
apple/swift
916b566fa61cdfced63f3040bdf44869424b449f
2013-10-02T01:27:39Z
mmm a / lib / SIL / Verifier . cpp <nl> ppp b / lib / SIL / Verifier . cpp <nl> class SILVerifier : public SILVerifierBase < SILVerifier > { <nl> " failure dest of checked_cast_br must take no arguments " ) ; <nl> } <nl> <nl> + void checkCheckedCastAddrBranchInst ( CheckedCastAddrBranchInst * CCABI ) { <nl> + require ( CCABI - > getSrc ( ) . getType ( ) . isAddress ( ) , <nl> + " checked_cast_addr_br src must be an address " ) ; <nl> + require ( CCABI - > getDest ( ) . getType ( ) . isAddress ( ) , <nl> + " checked_cast_addr_br dest must be an address " ) ; <nl> + <nl> + require ( CCABI - > getSuccessBB ( ) - > bbarg_size ( ) = = 0 , <nl> + " success dest block of checked_cast_addr_br must not take an argument " ) ; <nl> + require ( CCABI - > getFailureBB ( ) - > bbarg_size ( ) = = 0 , <nl> + " failure dest block of checked_cast_addr_br must not take an argument " ) ; <nl> + } <nl> + <nl> void checkThinToThickFunctionInst ( ThinToThickFunctionInst * TTFI ) { <nl> auto opFTy = requireObjectType ( SILFunctionType , TTFI - > getOperand ( ) , <nl> " thin_to_thick_function operand " ) ; <nl>
Add some minimal SIL verification of checked_cast_addr_br .
apple/swift
343712d38f0a42fd98ae6606e38b780af58f9f77
2016-01-04T23:40:11Z
mmm a / objectivec / GPBMessage . m <nl> ppp b / objectivec / GPBMessage . m <nl> @ interface GPBMessage ( ) { <nl> @ package <nl> GPBUnknownFieldSet * unknownFields_ ; <nl> NSMutableDictionary * extensionMap_ ; <nl> + / / Readonly access to autocreatedExtensionMap_ is protected via <nl> + / / readOnlySemaphore_ . <nl> NSMutableDictionary * autocreatedExtensionMap_ ; <nl> <nl> / / If the object was autocreated , we remember the creator so that if we get <nl> @ interface GPBMessage ( ) { <nl> GPBFieldDescriptor * autocreatorField_ ; <nl> GPBExtensionDescriptor * autocreatorExtension_ ; <nl> <nl> - / / A lock to provide mutual exclusion from internal data that can be modified <nl> - / / by * read * operations such as getters ( autocreation of message fields and <nl> - / / message extensions , not setting of values ) . Used to guarantee thread safety <nl> - / / for concurrent reads on the message . <nl> + / / Message can only be mutated from one thread . But some * readonly * operations <nl> + / / modifify internal state because they autocreate things . The <nl> + / / autocreatedExtensionMap_ is one such structure . Access during readonly <nl> + / / operations is protected via this semaphore . <nl> / / NOTE : OSSpinLock may seem like a good fit here but Apple engineers have <nl> / / pointed out that they are vulnerable to live locking on iOS in cases of <nl> / / priority inversion : <nl> static id GetOrCreateArrayIvarWithField ( GPBMessage * self , <nl> / / This is like GPBGetObjectIvarWithField ( ) , but for arrays , it should <nl> / / only be used to wire the method into the class . <nl> static id GetArrayIvarWithField ( GPBMessage * self , GPBFieldDescriptor * field ) { <nl> - id array = GPBGetObjectIvarWithFieldNoAutocreate ( self , field ) ; <nl> - if ( ! array ) { <nl> - / / Check again after getting the lock . <nl> - GPBPrepareReadOnlySemaphore ( self ) ; <nl> - dispatch_semaphore_wait ( self - > readOnlySemaphore_ , DISPATCH_TIME_FOREVER ) ; <nl> - array = GPBGetObjectIvarWithFieldNoAutocreate ( self , field ) ; <nl> - if ( ! array ) { <nl> - array = CreateArrayForField ( field , self ) ; <nl> - GPBSetAutocreatedRetainedObjectIvarWithField ( self , field , array ) ; <nl> - } <nl> - dispatch_semaphore_signal ( self - > readOnlySemaphore_ ) ; <nl> + uint8_t * storage = ( uint8_t * ) self - > messageStorage_ ; <nl> + _Atomic ( id ) * typePtr = ( _Atomic ( id ) * ) & storage [ field - > description_ - > offset ] ; <nl> + id array = atomic_load ( typePtr ) ; <nl> + if ( array ) { <nl> + return array ; <nl> } <nl> - return array ; <nl> + <nl> + id expected = nil ; <nl> + id autocreated = CreateArrayForField ( field , self ) ; <nl> + if ( atomic_compare_exchange_strong ( typePtr , & expected , autocreated ) ) { <nl> + / / Value was set , return it . <nl> + return autocreated ; <nl> + } <nl> + <nl> + / / Some other thread set it , release the one created and return what got set . <nl> + if ( GPBFieldDataTypeIsObject ( field ) ) { <nl> + GPBAutocreatedArray * autoArray = autocreated ; <nl> + autoArray - > _autocreator = nil ; <nl> + } else { <nl> + GPBInt32Array * gpbArray = autocreated ; <nl> + gpbArray - > _autocreator = nil ; <nl> + } <nl> + [ autocreated release ] ; <nl> + return expected ; <nl> } <nl> <nl> static id GetOrCreateMapIvarWithField ( GPBMessage * self , <nl> static id GetOrCreateMapIvarWithField ( GPBMessage * self , <nl> / / This is like GPBGetObjectIvarWithField ( ) , but for maps , it should <nl> / / only be used to wire the method into the class . <nl> static id GetMapIvarWithField ( GPBMessage * self , GPBFieldDescriptor * field ) { <nl> - id dict = GPBGetObjectIvarWithFieldNoAutocreate ( self , field ) ; <nl> - if ( ! dict ) { <nl> - / / Check again after getting the lock . <nl> - GPBPrepareReadOnlySemaphore ( self ) ; <nl> - dispatch_semaphore_wait ( self - > readOnlySemaphore_ , DISPATCH_TIME_FOREVER ) ; <nl> - dict = GPBGetObjectIvarWithFieldNoAutocreate ( self , field ) ; <nl> - if ( ! dict ) { <nl> - dict = CreateMapForField ( field , self ) ; <nl> - GPBSetAutocreatedRetainedObjectIvarWithField ( self , field , dict ) ; <nl> - } <nl> - dispatch_semaphore_signal ( self - > readOnlySemaphore_ ) ; <nl> + uint8_t * storage = ( uint8_t * ) self - > messageStorage_ ; <nl> + _Atomic ( id ) * typePtr = ( _Atomic ( id ) * ) & storage [ field - > description_ - > offset ] ; <nl> + id dict = atomic_load ( typePtr ) ; <nl> + if ( dict ) { <nl> + return dict ; <nl> } <nl> - return dict ; <nl> + <nl> + id expected = nil ; <nl> + id autocreated = CreateMapForField ( field , self ) ; <nl> + if ( atomic_compare_exchange_strong ( typePtr , & expected , autocreated ) ) { <nl> + / / Value was set , return it . <nl> + return autocreated ; <nl> + } <nl> + <nl> + / / Some other thread set it , release the one created and return what got set . <nl> + if ( ( field . mapKeyDataType = = GPBDataTypeString ) & & <nl> + GPBFieldDataTypeIsObject ( field ) ) { <nl> + GPBAutocreatedDictionary * autoDict = autocreated ; <nl> + autoDict - > _autocreator = nil ; <nl> + } else { <nl> + GPBInt32Int32Dictionary * gpbDict = autocreated ; <nl> + gpbDict - > _autocreator = nil ; <nl> + } <nl> + [ autocreated release ] ; <nl> + return expected ; <nl> } <nl> <nl> # endif / / ! defined ( __clang_analyzer__ ) <nl> id GPBGetMessageMapField ( GPBMessage * self , GPBFieldDescriptor * field ) { <nl> <nl> id GPBGetObjectIvarWithField ( GPBMessage * self , GPBFieldDescriptor * field ) { <nl> NSCAssert ( ! GPBFieldIsMapOrArray ( field ) , @ " Shouldn ' t get here " ) ; <nl> - if ( GPBGetHasIvarField ( self , field ) ) { <nl> - uint8_t * storage = ( uint8_t * ) self - > messageStorage_ ; <nl> - id * typePtr = ( id * ) & storage [ field - > description_ - > offset ] ; <nl> - return * typePtr ; <nl> - } <nl> - / / Not set . . . <nl> - <nl> - / / Non messages ( string / data ) , get their default . <nl> if ( ! GPBFieldDataTypeIsMessage ( field ) ) { <nl> + if ( GPBGetHasIvarField ( self , field ) ) { <nl> + uint8_t * storage = ( uint8_t * ) self - > messageStorage_ ; <nl> + id * typePtr = ( id * ) & storage [ field - > description_ - > offset ] ; <nl> + return * typePtr ; <nl> + } <nl> + / / Not set . . . non messages ( string / data ) , get their default . <nl> return field . defaultValue . valueMessage ; <nl> } <nl> <nl> - GPBPrepareReadOnlySemaphore ( self ) ; <nl> - dispatch_semaphore_wait ( self - > readOnlySemaphore_ , DISPATCH_TIME_FOREVER ) ; <nl> - GPBMessage * result = GPBGetObjectIvarWithFieldNoAutocreate ( self , field ) ; <nl> - if ( ! result ) { <nl> - / / For non repeated messages , create the object , set it and return it . <nl> - / / This object will not initially be visible via GPBGetHasIvar , so <nl> - / / we save its creator so it can become visible if it ' s mutated later . <nl> - result = GPBCreateMessageWithAutocreator ( field . msgClass , self , field ) ; <nl> - GPBSetAutocreatedRetainedObjectIvarWithField ( self , field , result ) ; <nl> - } <nl> - dispatch_semaphore_signal ( self - > readOnlySemaphore_ ) ; <nl> - return result ; <nl> + uint8_t * storage = ( uint8_t * ) self - > messageStorage_ ; <nl> + _Atomic ( id ) * typePtr = ( _Atomic ( id ) * ) & storage [ field - > description_ - > offset ] ; <nl> + id msg = atomic_load ( typePtr ) ; <nl> + if ( msg ) { <nl> + return msg ; <nl> + } <nl> + <nl> + id expected = nil ; <nl> + id autocreated = GPBCreateMessageWithAutocreator ( field . msgClass , self , field ) ; <nl> + if ( atomic_compare_exchange_strong ( typePtr , & expected , autocreated ) ) { <nl> + / / Value was set , return it . <nl> + return autocreated ; <nl> + } <nl> + <nl> + / / Some other thread set it , release the one created and return what got set . <nl> + GPBClearMessageAutocreator ( autocreated ) ; <nl> + [ autocreated release ] ; <nl> + return expected ; <nl> } <nl> <nl> # pragma clang diagnostic pop <nl> mmm a / objectivec / GPBUtilities . m <nl> ppp b / objectivec / GPBUtilities . m <nl> static void GPBMaybeClearOneofPrivate ( GPBMessage * self , <nl> / / Object types are handled slightly differently , they need to be released <nl> / / and retained . <nl> <nl> - void GPBSetAutocreatedRetainedObjectIvarWithField ( <nl> - GPBMessage * self , GPBFieldDescriptor * field , <nl> - id __attribute__ ( ( ns_consumed ) ) value ) { <nl> - uint8_t * storage = ( uint8_t * ) self - > messageStorage_ ; <nl> - id * typePtr = ( id * ) & storage [ field - > description_ - > offset ] ; <nl> - NSCAssert ( * typePtr = = NULL , @ " Can ' t set autocreated object more than once . " ) ; <nl> - * typePtr = value ; <nl> - } <nl> - <nl> void GPBClearAutocreatedMessageIvarWithField ( GPBMessage * self , <nl> GPBFieldDescriptor * field ) { <nl> if ( GPBGetHasIvarField ( self , field ) ) { <nl> mmm a / objectivec / GPBUtilities_PackagePrivate . h <nl> ppp b / objectivec / GPBUtilities_PackagePrivate . h <nl> void GPBSetRetainedObjectIvarWithFieldPrivate ( GPBMessage * self , <nl> id GPBGetObjectIvarWithFieldNoAutocreate ( GPBMessage * self , <nl> GPBFieldDescriptor * field ) ; <nl> <nl> - void GPBSetAutocreatedRetainedObjectIvarWithField ( <nl> - GPBMessage * self , GPBFieldDescriptor * field , <nl> - id __attribute__ ( ( ns_consumed ) ) value ) ; <nl> - <nl> / / Clears and releases the autocreated message ivar , if it ' s autocreated . If <nl> / / it ' s not set as autocreated , this method does nothing . <nl> void GPBClearAutocreatedMessageIvarWithField ( GPBMessage * self , <nl>
Switch to atomic for setting autocreated objects .
protocolbuffers/protobuf
2123ed5df70b043cc14f74231cfeabd26e02176a
2020-10-26T15:28:17Z
mmm a / include / fmt / core . h <nl> ppp b / include / fmt / core . h <nl> <nl> # define FMT_CONSTEXPR_DECL <nl> # endif <nl> <nl> - # if __cplusplus > = 202002L <nl> - # define FMT_CONSTEXPR20 constexpr <nl> - # else <nl> - # define FMT_CONSTEXPR20 inline <nl> - # endif <nl> - <nl> # ifndef FMT_OVERRIDE <nl> # if FMT_HAS_FEATURE ( cxx_override_control ) | | \ <nl> ( FMT_GCC_VERSION > = 408 & & FMT_HAS_GXX_CXX11 ) | | FMT_MSC_VER > = 1900 <nl> struct monostate { } ; <nl> <nl> namespace detail { <nl> <nl> - constexpr bool is_constant_evaluated ( ) FMT_DETECTED_NOEXCEPT { <nl> - # ifdef __cpp_lib_is_constant_evaluated <nl> - return std : : is_constant_evaluated ( ) ; <nl> - # else <nl> - return false ; <nl> - # endif <nl> - } <nl> - <nl> / / A helper function to suppress " conditional expression is constant " warnings . <nl> template < typename T > constexpr T const_check ( T value ) { return value ; } <nl> <nl> mmm a / include / fmt / format . h <nl> ppp b / include / fmt / format . h <nl> FMT_END_NAMESPACE <nl> FMT_BEGIN_NAMESPACE <nl> namespace detail { <nl> <nl> + # if __cplusplus > = 202002L <nl> + # define FMT_CONSTEXPR20 constexpr <nl> + # else <nl> + # define FMT_CONSTEXPR20 inline <nl> + # endif <nl> + <nl> + constexpr bool is_constant_evaluated ( ) FMT_DETECTED_NOEXCEPT { <nl> + # ifdef __cpp_lib_is_constant_evaluated <nl> + return std : : is_constant_evaluated ( ) ; <nl> + # else <nl> + return false ; <nl> + # endif <nl> + } <nl> + <nl> / / An equivalent of ` * reinterpret_cast < Dest * > ( & source ) ` that doesn ' t have <nl> / / undefined behavior ( e . g . due to type aliasing ) . <nl> / / Example : uint64_t d = bit_cast < uint64_t > ( 2 . 718 ) ; <nl>
Move some code from core . h to format . h where it is used
fmtlib/fmt
5a493560f59369e9fa664e8945b8e8a8ec4391b2
2020-11-29T17:45:15Z
mmm a / . jenkins / pytorch / enabled - configs . txt <nl> ppp b / . jenkins / pytorch / enabled - configs . txt <nl> pytorch - linux - trusty - pynightly - build <nl> pytorch - linux - trusty - pynightly - test <nl> pytorch - win - ws2016 - cuda9 - cudnn7 - py3 - build <nl> pytorch - win - ws2016 - cuda9 - cudnn7 - py3 - test <nl> - pytorch - macos - 10 . 13 - py3 - build - test <nl> + pytorch - macos - 10 . 13 - py3 - build <nl> + pytorch - macos - 10 . 13 - py3 - test <nl> + pytorch - macos - 10 . 13 - cuda9 . 2 - cudnn7 - py3 - build <nl> pytorch - docker - build - test <nl> short - perf - test - cpu <nl> short - perf - test - gpu <nl> mmm a / . jenkins / pytorch / macos - build . sh <nl> ppp b / . jenkins / pytorch / macos - build . sh <nl> <nl> # ! / bin / bash <nl> <nl> - COMPACT_JOB_NAME = pytorch - macos - 10 . 13 - py3 - build - test <nl> - source " $ ( dirname " $ { BASH_SOURCE [ 0 ] } " ) / common . sh " <nl> - <nl> + COMPACT_JOB_NAME = " $ { BUILD_ENVIRONMENT } - build " <nl> export PATH = " / usr / local / bin : $ PATH " <nl> + source " $ ( dirname " $ { BASH_SOURCE [ 0 ] } " ) / common . sh " <nl> <nl> # Set up conda environment <nl> export PYTORCH_ENV_DIR = " $ { HOME } / pytorch - ci - env " <nl> git submodule update - - init - - recursive <nl> export CMAKE_PREFIX_PATH = $ { PYTORCH_ENV_DIR } / miniconda3 / <nl> <nl> # Build PyTorch <nl> + if [ [ " $ { JOB_BASE_NAME } " = = * cuda9 . 2 * ] ] ; then <nl> + export CUDA_VERSION = 9 . 2 <nl> + export TORCH_CUDA_ARCH_LIST = 5 . 2 <nl> + export PATH = / Developer / NVIDIA / CUDA - $ { CUDA_VERSION } / bin $ { PATH : + : $ { PATH } } <nl> + export DYLD_LIBRARY_PATH = / Developer / NVIDIA / CUDA - $ { CUDA_VERSION } / lib $ { DYLD_LIBRARY_PATH : + : $ { DYLD_LIBRARY_PATH } } <nl> + export CUDA_HOME = / Developer / NVIDIA / CUDA - $ { CUDA_VERSION } <nl> + export NO_CUDA = 0 <nl> + <nl> + # We need to do this for install_name_tool to be found <nl> + export PATH = / Applications / Xcode9 . app / Contents / Developer / Toolchains / XcodeDefault . xctoolchain / usr / bin : $ PATH <nl> + fi <nl> + <nl> export MACOSX_DEPLOYMENT_TARGET = 10 . 9 <nl> export CXX = clang + + <nl> export CC = clang <nl> if which sccache > / dev / null ; then <nl> - export CXX = " sccache clang + + " <nl> - export CC = " sccache clang " <nl> + printf " # ! / bin / sh \ nexec sccache $ ( which clang + + ) \ $ * " > " $ { PYTORCH_ENV_DIR } / clang + + " <nl> + chmod a + x " $ { PYTORCH_ENV_DIR } / clang + + " <nl> + <nl> + printf " # ! / bin / sh \ nexec sccache $ ( which clang ) \ $ * " > " $ { PYTORCH_ENV_DIR } / clang " <nl> + chmod a + x " $ { PYTORCH_ENV_DIR } / clang " <nl> + <nl> + if [ [ " $ { JOB_BASE_NAME } " = = * cuda * ] ] ; then <nl> + printf " # ! / bin / sh \ nexec sccache $ ( which nvcc ) \ $ * " > " $ { PYTORCH_ENV_DIR } / nvcc " <nl> + chmod a + x " $ { PYTORCH_ENV_DIR } / nvcc " <nl> + export CUDA_NVCC_EXECUTABLE = " $ { PYTORCH_ENV_DIR } / nvcc " <nl> + fi <nl> + <nl> + export PATH = " $ { PYTORCH_ENV_DIR } : $ PATH " <nl> fi <nl> # If we run too many parallel jobs , we will OOM <nl> export MAX_JOBS = 2 <nl> mmm a / . jenkins / pytorch / macos - test . sh <nl> ppp b / . jenkins / pytorch / macos - test . sh <nl> <nl> # ! / bin / bash <nl> <nl> - COMPACT_JOB_NAME = pytorch - macos - 10 . 13 - py3 - build - test <nl> + COMPACT_JOB_NAME = " $ { BUILD_ENVIRONMENT } - test " <nl> source " $ ( dirname " $ { BASH_SOURCE [ 0 ] } " ) / common . sh " <nl> <nl> export PATH = " / usr / local / bin : $ PATH " <nl> mmm a / . jenkins / pytorch / print_sccache_log . py <nl> ppp b / . jenkins / pytorch / print_sccache_log . py <nl> <nl> <nl> for line in lines : <nl> # Ignore errors from CPU instruction set testing <nl> - if ' CMakeFiles / CMakeTmp / src . c ' not in line : <nl> + if ' src . c ' not in line : <nl> print ( line ) <nl> mmm a / aten / src / ATen / native / cuda / TensorFactories . cu <nl> ppp b / aten / src / ATen / native / cuda / TensorFactories . cu <nl> Tensor & randperm_out_cuda ( Tensor & result , int64_t n , Generator * generator ) { <nl> throw std : : runtime_error ( oss . str ( ) ) ; <nl> } <nl> <nl> - if ( n > 0 ) { <nl> - AT_DISPATCH_ALL_TYPES_AND_HALF ( <nl> - result . type ( ) , " randperm_out_cuda " , [ & ] { <nl> - AT_CHECK ( Scalar ( n ) . to < scalar_t > ( ) , <nl> - " n is too large for result tensor type : ' " , result . type ( ) . toString ( ) , " ' " ) ; <nl> - } <nl> - ) ; <nl> - } <nl> + AT_CHECK ( result . type ( ) . scalarTensor ( n ) . defined ( ) , <nl> + " n is too large for result tensor type : ' " , result . type ( ) . toString ( ) , " ' " ) ; <nl> <nl> result . resize_ ( { n } ) ; <nl> <nl>
Set up CI build for CUDA 9 . 2 + macOS ( )
pytorch/pytorch
d56b4f25682e541537dad820feb7b0d81d8c9d03
2018-06-08T18:12:52Z
mmm a / src / Interpreters / ExpressionJIT . cpp <nl> ppp b / src / Interpreters / ExpressionJIT . cpp <nl> static LLVMFunction : : CompileDAG getCompilableDAG ( ActionsDAG : : Node * root , std : : v <nl> : ( is_compilable_function ? LLVMFunction : : CompileNode : : NodeType : : FUNCTION <nl> : LLVMFunction : : CompileNode : : NodeType : : INPUT ) ; <nl> <nl> - for ( const auto * child : frame . node - > children ) <nl> - node . arguments . push_back ( positions [ child ] ) ; <nl> + if ( node . type = = LLVMFunction : : CompileNode : : NodeType : : FUNCTION ) <nl> + for ( const auto * child : frame . node - > children ) <nl> + node . arguments . push_back ( positions [ child ] ) ; <nl> + <nl> + if ( node . type = = LLVMFunction : : CompileNode : : NodeType : : CONSTANT ) <nl> + node . column = frame . node - > column ; <nl> <nl> if ( node . type = = LLVMFunction : : CompileNode : : NodeType : : INPUT ) <nl> children . emplace_back ( frame . node ) ; <nl> mmm a / src / Interpreters / ExpressionJIT . h <nl> ppp b / src / Interpreters / ExpressionJIT . h <nl> class LLVMFunction : public IFunctionBaseImpl <nl> <nl> / / / For CONSTANT <nl> ColumnPtr column ; <nl> - llvm : : Value * value = nullptr ; <nl> <nl> / / / For FUNCTION <nl> FunctionBasePtr function ; <nl>
Update complie expressions .
ClickHouse/ClickHouse
8eab6b7694a2b90a45e53cba2655602585b66fc9
2020-11-05T16:34:17Z
mmm a / db / db_filesnapshot . cc <nl> ppp b / db / db_filesnapshot . cc <nl> Status DBImpl : : GetLiveFiles ( std : : vector < std : : string > & ret , <nl> if ( flush_memtable ) { <nl> / / flush all dirty data to disk . <nl> Status status ; <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> autovector < ColumnFamilyData * > cfds ; <nl> SelectColumnFamiliesForAtomicFlush ( & cfds ) ; <nl> mutex_ . Unlock ( ) ; <nl> mmm a / db / db_impl . cc <nl> ppp b / db / db_impl . cc <nl> DBImpl : : DBImpl ( const DBOptions & options , const std : : string & dbname , <nl> preserve_deletes_ ( options . preserve_deletes ) , <nl> closed_ ( false ) , <nl> error_handler_ ( this , immutable_db_options_ , & mutex_ ) , <nl> - atomic_flush_ ( options . atomic_flush ) , <nl> atomic_flush_commit_in_progress_ ( false ) { <nl> / / ! batch_per_trx_ implies seq_per_batch_ because it is only unset for <nl> / / WriteUnprepared , which should use seq_per_batch_ . <nl> Status DBImpl : : ResumeImpl ( ) { <nl> FlushOptions flush_opts ; <nl> / / We allow flush to stall write since we are trying to resume from error . <nl> flush_opts . allow_write_stall = true ; <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> autovector < ColumnFamilyData * > cfds ; <nl> SelectColumnFamiliesForAtomicFlush ( & cfds ) ; <nl> mutex_ . Unlock ( ) ; <nl> void DBImpl : : CancelAllBackgroundWork ( bool wait ) { <nl> if ( ! shutting_down_ . load ( std : : memory_order_acquire ) & & <nl> has_unpersisted_data_ . load ( std : : memory_order_relaxed ) & & <nl> ! mutable_db_options_ . avoid_flush_during_shutdown ) { <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> autovector < ColumnFamilyData * > cfds ; <nl> SelectColumnFamiliesForAtomicFlush ( & cfds ) ; <nl> mutex_ . Unlock ( ) ; <nl> Status DBImpl : : IngestExternalFile ( <nl> TEST_SYNC_POINT_CALLBACK ( " DBImpl : : IngestExternalFile : NeedFlush " , <nl> & need_flush ) ; <nl> if ( status . ok ( ) & & need_flush ) { <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> mutex_ . Unlock ( ) ; <nl> autovector < ColumnFamilyData * > cfds ; <nl> SelectColumnFamiliesForAtomicFlush ( & cfds ) ; <nl> mmm a / db / db_impl . h <nl> ppp b / db / db_impl . h <nl> class DBImpl : public DB { <nl> <nl> ErrorHandler error_handler_ ; <nl> <nl> - / / True if DB enables atomic flush . <nl> - bool atomic_flush_ ; <nl> - <nl> / / True if the DB is committing atomic flush . <nl> / / TODO ( yanqin ) the current impl assumes that the entire DB belongs to <nl> / / a single atomic flush group . In the future we need to add a new class <nl> mmm a / db / db_impl_compaction_flush . cc <nl> ppp b / db / db_impl_compaction_flush . cc <nl> Status DBImpl : : FlushMemTableToOutputFile ( <nl> Status DBImpl : : FlushMemTablesToOutputFiles ( <nl> const autovector < BGFlushArg > & bg_flush_args , bool * made_progress , <nl> JobContext * job_context , LogBuffer * log_buffer ) { <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> return AtomicFlushMemTablesToOutputFiles ( bg_flush_args , made_progress , <nl> job_context , log_buffer ) ; <nl> } <nl> Status DBImpl : : CompactRange ( const CompactRangeOptions & options , <nl> if ( flush_needed ) { <nl> FlushOptions fo ; <nl> fo . allow_write_stall = options . allow_write_stall ; <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> autovector < ColumnFamilyData * > cfds ; <nl> SelectColumnFamiliesForAtomicFlush ( & cfds ) ; <nl> s = AtomicFlushMemTables ( cfds , fo , FlushReason : : kManualCompaction , <nl> Status DBImpl : : Flush ( const FlushOptions & flush_options , <nl> ROCKS_LOG_INFO ( immutable_db_options_ . info_log , " [ % s ] Manual flush start . " , <nl> cfh - > GetName ( ) . c_str ( ) ) ; <nl> Status s ; <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> s = AtomicFlushMemTables ( { cfh - > cfd ( ) } , flush_options , <nl> FlushReason : : kManualFlush ) ; <nl> } else { <nl> Status DBImpl : : Flush ( const FlushOptions & flush_options , <nl> Status DBImpl : : Flush ( const FlushOptions & flush_options , <nl> const std : : vector < ColumnFamilyHandle * > & column_families ) { <nl> Status s ; <nl> - if ( ! atomic_flush_ ) { <nl> + if ( ! immutable_db_options_ . atomic_flush ) { <nl> for ( auto cfh : column_families ) { <nl> s = Flush ( flush_options , cfh ) ; <nl> if ( ! s . ok ( ) ) { <nl> mmm a / db / db_impl_write . cc <nl> ppp b / db / db_impl_write . cc <nl> void DBImpl : : SelectColumnFamiliesForAtomicFlush ( <nl> <nl> / / Assign sequence number for atomic flush . <nl> void DBImpl : : AssignAtomicFlushSeq ( const autovector < ColumnFamilyData * > & cfds ) { <nl> - assert ( atomic_flush_ ) ; <nl> + assert ( immutable_db_options_ . atomic_flush ) ; <nl> auto seq = versions_ - > LastSequence ( ) ; <nl> for ( auto cfd : cfds ) { <nl> cfd - > imm ( ) - > AssignAtomicFlushSeq ( seq ) ; <nl> Status DBImpl : : SwitchWAL ( WriteContext * write_context ) { <nl> / / no need to refcount because drop is happening in write thread , so can ' t <nl> / / happen while we ' re in the write thread <nl> autovector < ColumnFamilyData * > cfds ; <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> SelectColumnFamiliesForAtomicFlush ( & cfds ) ; <nl> } else { <nl> for ( auto cfd : * versions_ - > GetColumnFamilySet ( ) ) { <nl> Status DBImpl : : SwitchWAL ( WriteContext * write_context ) { <nl> } <nl> } <nl> if ( status . ok ( ) ) { <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> AssignAtomicFlushSeq ( cfds ) ; <nl> } <nl> for ( auto cfd : cfds ) { <nl> Status DBImpl : : HandleWriteBufferFull ( WriteContext * write_context ) { <nl> / / no need to refcount because drop is happening in write thread , so can ' t <nl> / / happen while we ' re in the write thread <nl> autovector < ColumnFamilyData * > cfds ; <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> SelectColumnFamiliesForAtomicFlush ( & cfds ) ; <nl> } else { <nl> ColumnFamilyData * cfd_picked = nullptr ; <nl> Status DBImpl : : HandleWriteBufferFull ( WriteContext * write_context ) { <nl> } <nl> } <nl> if ( status . ok ( ) ) { <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> AssignAtomicFlushSeq ( cfds ) ; <nl> } <nl> for ( const auto cfd : cfds ) { <nl> Status DBImpl : : ThrottleLowPriWritesIfNeeded ( const WriteOptions & write_options , <nl> <nl> Status DBImpl : : ScheduleFlushes ( WriteContext * context ) { <nl> autovector < ColumnFamilyData * > cfds ; <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> SelectColumnFamiliesForAtomicFlush ( & cfds ) ; <nl> for ( auto cfd : cfds ) { <nl> cfd - > Ref ( ) ; <nl> Status DBImpl : : ScheduleFlushes ( WriteContext * context ) { <nl> } <nl> } <nl> if ( status . ok ( ) ) { <nl> - if ( atomic_flush_ ) { <nl> + if ( immutable_db_options_ . atomic_flush ) { <nl> AssignAtomicFlushSeq ( cfds ) ; <nl> } <nl> FlushRequest flush_req ; <nl> mmm a / options / db_options . cc <nl> ppp b / options / db_options . cc <nl> ImmutableDBOptions : : ImmutableDBOptions ( const DBOptions & options ) <nl> allow_ingest_behind ( options . allow_ingest_behind ) , <nl> preserve_deletes ( options . preserve_deletes ) , <nl> two_write_queues ( options . two_write_queues ) , <nl> - manual_wal_flush ( options . manual_wal_flush ) { <nl> + manual_wal_flush ( options . manual_wal_flush ) , <nl> + atomic_flush ( options . atomic_flush ) { <nl> } <nl> <nl> void ImmutableDBOptions : : Dump ( Logger * log ) const { <nl> mmm a / options / options_helper . cc <nl> ppp b / options / options_helper . cc <nl> DBOptions BuildDBOptions ( const ImmutableDBOptions & immutable_db_options , <nl> immutable_db_options . preserve_deletes ; <nl> options . two_write_queues = immutable_db_options . two_write_queues ; <nl> options . manual_wal_flush = immutable_db_options . manual_wal_flush ; <nl> + options . atomic_flush = immutable_db_options . atomic_flush ; <nl> <nl> return options ; <nl> } <nl>
Remove redundant member var and set options ( )
facebook/rocksdb
05dec0c7c70eb774740da7f1bc0df42a96f696c8
2018-11-12T20:24:26Z
mmm a / src / platform - win32 . cc <nl> ppp b / src / platform - win32 . cc <nl> class SamplerThread : public Thread { <nl> interval_ ( interval ) { } <nl> <nl> static void AddActiveSampler ( Sampler * sampler ) { <nl> - ScopedLock lock ( mutex_ ) ; <nl> + ScopedLock lock ( mutex_ . Pointer ( ) ) ; <nl> SamplerRegistry : : AddActiveSampler ( sampler ) ; <nl> if ( instance_ = = NULL ) { <nl> instance_ = new SamplerThread ( sampler - > interval ( ) ) ; <nl> class SamplerThread : public Thread { <nl> } <nl> <nl> static void RemoveActiveSampler ( Sampler * sampler ) { <nl> - ScopedLock lock ( mutex_ ) ; <nl> + ScopedLock lock ( mutex_ . Pointer ( ) ) ; <nl> SamplerRegistry : : RemoveActiveSampler ( sampler ) ; <nl> if ( SamplerRegistry : : GetState ( ) = = SamplerRegistry : : HAS_NO_SAMPLERS ) { <nl> RuntimeProfiler : : StopRuntimeProfilerThreadBeforeShutdown ( instance_ ) ; <nl>
Fix broken build on Win32 due to r11010 .
v8/v8
12c09fdfe41598dc05beb5b64d10faf4d76c7c73
2012-03-12T14:41:59Z
mmm a / tensorflow / contrib / learn / BUILD <nl> ppp b / tensorflow / contrib / learn / BUILD <nl> py_test ( <nl> size = " medium " , <nl> srcs = [ " python / learn / tests / nonlinear_test . py " ] , <nl> srcs_version = " PY2AND3 " , <nl> - tags = [ " manual " ] , # http : / / b / 29220227 <nl> + tags = [ <nl> + " manual " , # http : / / b / 29220227 <nl> + " noasan " , <nl> + ] , <nl> deps = [ <nl> " : learn " , <nl> " / / tensorflow : tensorflow_py " , <nl> py_test ( <nl> size = " small " , <nl> srcs = [ " python / learn / learn_io / graph_io_test . py " ] , <nl> srcs_version = " PY2AND3 " , <nl> + tags = [ " manual " ] , # http : / / b / 29229547 <nl> deps = [ <nl> " : learn " , <nl> " / / tensorflow : tensorflow_py " , <nl>
nonlinear test is flaky in asan : turning off for now
tensorflow/tensorflow
14146362d565b8e9fb1e26b234e988c8e4e8917e
2016-08-31T22:17:27Z
mmm a / src / core / ext / filters / http / client / http_client_filter . cc <nl> ppp b / src / core / ext / filters / http / client / http_client_filter . cc <nl> static grpc_slice user_agent_from_args ( const grpc_channel_args * args , <nl> <nl> tmp = gpr_strvec_flatten ( & v , nullptr ) ; <nl> gpr_strvec_destroy ( & v ) ; <nl> - result = grpc_slice_intern ( grpc_slice_from_static_string ( tmp ) ) ; <nl> + result = grpc_slice_intern ( grpc_slice_from_static_string_internal ( tmp ) ) ; <nl> gpr_free ( tmp ) ; <nl> <nl> return result ; <nl> mmm a / src / core / ext / filters / http / client_authority_filter . cc <nl> ppp b / src / core / ext / filters / http / client_authority_filter . cc <nl> grpc_error * init_channel_elem ( grpc_channel_element * elem , <nl> return GRPC_ERROR_CREATE_FROM_STATIC_STRING ( <nl> " GRPC_ARG_DEFAULT_AUTHORITY channel arg . must be a string " ) ; <nl> } <nl> - chand - > default_authority = <nl> - grpc_slice_intern ( grpc_slice_from_static_string ( default_authority_str ) ) ; <nl> + chand - > default_authority = grpc_slice_intern ( <nl> + grpc_slice_from_static_string_internal ( default_authority_str ) ) ; <nl> chand - > default_authority_mdelem = grpc_mdelem_create ( <nl> GRPC_MDSTR_AUTHORITY , chand - > default_authority , nullptr ) ; <nl> GPR_ASSERT ( ! args - > is_last ) ; <nl> mmm a / src / core / ext / transport / chttp2 / transport / hpack_parser . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / hpack_parser . cc <nl> static grpc_slice take_string ( grpc_chttp2_hpack_parser * p , <nl> str - > copied = true ; <nl> str - > data . referenced = grpc_empty_slice ( ) ; <nl> } else if ( intern ) { <nl> - s = grpc_slice_intern ( grpc_slice_from_static_buffer ( <nl> + s = grpc_slice_intern ( grpc_slice_from_static_buffer_internal ( <nl> str - > data . copied . str , str - > data . copied . length ) ) ; <nl> } else { <nl> s = grpc_slice_from_copied_buffer ( str - > data . copied . str , <nl> static grpc_error * parse_key_string ( grpc_chttp2_hpack_parser * p , <nl> <nl> static bool is_binary_literal_header ( grpc_chttp2_hpack_parser * p ) { <nl> / * We know that either argument here is a reference counter slice . <nl> - * 1 . If a result of grpc_slice_from_static_buffer , the refcount is set to <nl> - * NoopRefcount . <nl> + * 1 . If a result of grpc_slice_from_static_buffer_internal , the refcount is <nl> + * set to kNoopRefcount . <nl> * 2 . If it ' s p - > key . data . referenced , then p - > key . copied was set to false , <nl> * which occurs in begin_parse_string ( ) - where the refcount is set to <nl> * p - > current_slice_refcount , which is not null . * / <nl> return grpc_is_refcounted_slice_binary_header ( <nl> - p - > key . copied ? grpc_slice_from_static_buffer ( p - > key . data . copied . str , <nl> - p - > key . data . copied . length ) <nl> + p - > key . copied ? grpc_slice_from_static_buffer_internal ( <nl> + p - > key . data . copied . str , p - > key . data . copied . length ) <nl> : p - > key . data . referenced ) ; <nl> } <nl> <nl> mmm a / src / core / ext / transport / chttp2 / transport / hpack_table . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / hpack_table . cc <nl> <nl> <nl> # include " src / core / lib / debug / trace . h " <nl> # include " src / core / lib / gpr / murmur_hash . h " <nl> + # include " src / core / lib / slice / slice_internal . h " <nl> # include " src / core / lib / surface / validate_metadata . h " <nl> # include " src / core / lib / transport / static_metadata . h " <nl> <nl> void grpc_chttp2_hptbl_init ( grpc_chttp2_hptbl * tbl ) { <nl> memset ( tbl - > ents , 0 , sizeof ( * tbl - > ents ) * tbl - > cap_entries ) ; <nl> for ( i = 1 ; i < = GRPC_CHTTP2_LAST_STATIC_ENTRY ; i + + ) { <nl> tbl - > static_ents [ i - 1 ] = grpc_mdelem_from_slices ( <nl> - grpc_slice_intern ( grpc_slice_from_static_string ( static_table [ i ] . key ) ) , <nl> grpc_slice_intern ( <nl> - grpc_slice_from_static_string ( static_table [ i ] . value ) ) ) ; <nl> + grpc_slice_from_static_string_internal ( static_table [ i ] . key ) ) , <nl> + grpc_slice_intern ( <nl> + grpc_slice_from_static_string_internal ( static_table [ i ] . value ) ) ) ; <nl> } <nl> } <nl> <nl> mmm a / src / core / ext / transport / inproc / inproc_transport . cc <nl> ppp b / src / core / ext / transport / inproc / inproc_transport . cc <nl> void inproc_transports_create ( grpc_transport * * server_transport , <nl> * / <nl> void grpc_inproc_transport_init ( void ) { <nl> grpc_core : : ExecCtx exec_ctx ; <nl> - g_empty_slice = grpc_slice_from_static_buffer ( nullptr , 0 ) ; <nl> + g_empty_slice = grpc_slice_from_static_buffer_internal ( nullptr , 0 ) ; <nl> <nl> grpc_slice key_tmp = grpc_slice_from_static_string ( " : path " ) ; <nl> g_fake_path_key = grpc_slice_intern ( key_tmp ) ; <nl> mmm a / src / core / lib / iomgr / error . cc <nl> ppp b / src / core / lib / iomgr / error . cc <nl> grpc_error * grpc_error_set_int ( grpc_error * src , grpc_error_ints which , <nl> typedef struct { <nl> grpc_status_code code ; <nl> const char * msg ; <nl> + size_t len ; <nl> } special_error_status_map ; <nl> - static const special_error_status_map error_status_map [ ] = { <nl> - { GRPC_STATUS_OK , " " } , / / GRPC_ERROR_NONE <nl> - { GRPC_STATUS_INVALID_ARGUMENT , " " } , / / GRPC_ERROR_RESERVED_1 <nl> - { GRPC_STATUS_RESOURCE_EXHAUSTED , " Out of memory " } , / / GRPC_ERROR_OOM <nl> - { GRPC_STATUS_INVALID_ARGUMENT , " " } , / / GRPC_ERROR_RESERVED_2 <nl> - { GRPC_STATUS_CANCELLED , " Cancelled " } , / / GRPC_ERROR_CANCELLED <nl> + <nl> + const special_error_status_map error_status_map [ ] = { <nl> + { GRPC_STATUS_OK , " " , 0 } , / / GRPC_ERROR_NONE <nl> + { GRPC_STATUS_INVALID_ARGUMENT , " " , 0 } , / / GRPC_ERROR_RESERVED_1 <nl> + { GRPC_STATUS_RESOURCE_EXHAUSTED , " Out of memory " , <nl> + strlen ( " Out of memory " ) } , / / GRPC_ERROR_OOM <nl> + { GRPC_STATUS_INVALID_ARGUMENT , " " , 0 } , / / GRPC_ERROR_RESERVED_2 <nl> + { GRPC_STATUS_CANCELLED , " Cancelled " , <nl> + strlen ( " Cancelled " ) } , / / GRPC_ERROR_CANCELLED <nl> } ; <nl> <nl> bool grpc_error_get_int ( grpc_error * err , grpc_error_ints which , intptr_t * p ) { <nl> bool grpc_error_get_str ( grpc_error * err , grpc_error_strs which , <nl> grpc_slice * str ) { <nl> if ( grpc_error_is_special ( err ) ) { <nl> if ( which ! = GRPC_ERROR_STR_GRPC_MESSAGE ) return false ; <nl> - * str = grpc_slice_from_static_string ( <nl> - error_status_map [ reinterpret_cast < size_t > ( err ) ] . msg ) ; <nl> + const special_error_status_map & msg = <nl> + error_status_map [ reinterpret_cast < size_t > ( err ) ] ; <nl> + str - > refcount = & grpc_core : : kNoopRefcount ; <nl> + str - > data . refcounted . bytes = <nl> + reinterpret_cast < uint8_t * > ( const_cast < char * > ( msg . msg ) ) ; <nl> + str - > data . refcounted . length = msg . len ; <nl> return true ; <nl> } <nl> uint8_t slot = err - > strs [ which ] ; <nl> mmm a / src / core / lib / slice / slice . cc <nl> ppp b / src / core / lib / slice / slice . cc <nl> void grpc_slice_unref ( grpc_slice slice ) { <nl> } <nl> } <nl> <nl> + namespace grpc_core { <nl> + <nl> / * grpc_slice_from_static_string support structure - a refcount that does <nl> nothing * / <nl> - static grpc_slice_refcount NoopRefcount = <nl> - grpc_slice_refcount ( grpc_slice_refcount : : Type : : NOP ) ; <nl> - <nl> - size_t grpc_slice_memory_usage ( grpc_slice s ) { <nl> - if ( s . refcount = = nullptr | | s . refcount = = & NoopRefcount ) { <nl> - return 0 ; <nl> - } else { <nl> - return s . data . refcounted . length ; <nl> - } <nl> - } <nl> - <nl> - grpc_slice grpc_slice_from_static_buffer ( const void * s , size_t len ) { <nl> - grpc_slice slice ; <nl> - slice . refcount = & NoopRefcount ; <nl> - slice . data . refcounted . bytes = ( uint8_t * ) s ; <nl> - slice . data . refcounted . length = len ; <nl> - return slice ; <nl> - } <nl> - <nl> - grpc_slice grpc_slice_from_static_string ( const char * s ) { <nl> - return grpc_slice_from_static_buffer ( s , strlen ( s ) ) ; <nl> - } <nl> - <nl> - namespace grpc_core { <nl> + grpc_slice_refcount kNoopRefcount ( grpc_slice_refcount : : Type : : NOP ) ; <nl> + static_assert ( std : : is_trivially_destructible < decltype ( kNoopRefcount ) > : : value , <nl> + " kNoopRefcount must be trivially destructible . " ) ; <nl> <nl> / * grpc_slice_new support structures - we create a refcount object extended <nl> with the user provided data pointer & destroy function * / <nl> class NewSliceRefcount { <nl> <nl> } / / namespace grpc_core <nl> <nl> + size_t grpc_slice_memory_usage ( grpc_slice s ) { <nl> + if ( s . refcount = = nullptr | | s . refcount = = & grpc_core : : kNoopRefcount ) { <nl> + return 0 ; <nl> + } else { <nl> + return s . data . refcounted . length ; <nl> + } <nl> + } <nl> + <nl> + grpc_slice grpc_slice_from_static_buffer ( const void * s , size_t len ) { <nl> + return grpc_slice_from_static_buffer_internal ( s , len ) ; <nl> + } <nl> + <nl> + grpc_slice grpc_slice_from_static_string ( const char * s ) { <nl> + return grpc_slice_from_static_buffer_internal ( s , strlen ( s ) ) ; <nl> + } <nl> + <nl> grpc_slice grpc_slice_new_with_user_data ( void * p , size_t len , <nl> void ( * destroy ) ( void * ) , <nl> void * user_data ) { <nl> grpc_slice grpc_slice_split_tail_maybe_ref ( grpc_slice * source , size_t split , <nl> switch ( ref_whom ) { <nl> case GRPC_SLICE_REF_TAIL : <nl> tail . refcount = source - > refcount - > sub_refcount ( ) ; <nl> - source - > refcount = & NoopRefcount ; <nl> + source - > refcount = & grpc_core : : kNoopRefcount ; <nl> break ; <nl> case GRPC_SLICE_REF_HEAD : <nl> - tail . refcount = & NoopRefcount ; <nl> + tail . refcount = & grpc_core : : kNoopRefcount ; <nl> source - > refcount = source - > refcount - > sub_refcount ( ) ; <nl> break ; <nl> case GRPC_SLICE_REF_BOTH : <nl> mmm a / src / core / lib / slice / slice_internal . h <nl> ppp b / src / core / lib / slice / slice_internal . h <nl> struct grpc_slice_refcount { <nl> <nl> namespace grpc_core { <nl> <nl> + extern grpc_slice_refcount kNoopRefcount ; <nl> + <nl> struct InternedSliceRefcount { <nl> static void Destroy ( void * arg ) { <nl> auto * rc = static_cast < InternedSliceRefcount * > ( arg ) ; <nl> grpc_slice grpc_slice_from_moved_string ( grpc_core : : UniquePtr < char > p ) ; <nl> / / 0 . All other slices will return the size of the allocated chars . <nl> size_t grpc_slice_memory_usage ( grpc_slice s ) ; <nl> <nl> + inline grpc_slice grpc_slice_from_static_buffer_internal ( const void * s , <nl> + size_t len ) { <nl> + grpc_slice slice ; <nl> + slice . refcount = & grpc_core : : kNoopRefcount ; <nl> + slice . data . refcounted . bytes = ( uint8_t * ) s ; <nl> + slice . data . refcounted . length = len ; <nl> + return slice ; <nl> + } <nl> + <nl> + inline grpc_slice grpc_slice_from_static_string_internal ( const char * s ) { <nl> + return grpc_slice_from_static_buffer_internal ( s , strlen ( s ) ) ; <nl> + } <nl> + <nl> # endif / * GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H * / <nl> mmm a / src / core / lib / transport / error_utils . cc <nl> ppp b / src / core / lib / transport / error_utils . cc <nl> <nl> <nl> # include < grpc / support / string_util . h > <nl> # include " src / core / lib / iomgr / error_internal . h " <nl> + # include " src / core / lib / slice / slice_internal . h " <nl> # include " src / core / lib / transport / status_conversion . h " <nl> <nl> static grpc_error * recursively_find_error_with_field ( grpc_error * error , <nl> void grpc_error_get_status ( grpc_error * error , grpc_millis deadline , <nl> if ( GPR_LIKELY ( error = = GRPC_ERROR_NONE ) ) { <nl> if ( code ! = nullptr ) * code = GRPC_STATUS_OK ; <nl> if ( slice ! = nullptr ) { <nl> - grpc_error_get_str ( error , GRPC_ERROR_STR_GRPC_MESSAGE , slice ) ; <nl> + / / Normally , we call grpc_error_get_str ( <nl> + / / error , GRPC_ERROR_STR_GRPC_MESSAGE , slice ) . <nl> + / / We can fastpath since we know that : <nl> + / / 1 ) Error is null <nl> + / / 2 ) which = = GRPC_ERROR_STR_GRPC_MESSAGE <nl> + / / 3 ) The resulting slice is statically known . <nl> + / / 4 ) Said resulting slice is of length 0 ( " " ) . <nl> + / / This means 3 movs , instead of 10s of instructions and a strlen . <nl> + * slice = grpc_slice_from_static_string_internal ( " " ) ; <nl> } <nl> if ( http_error ! = nullptr ) { <nl> * http_error = GRPC_HTTP2_NO_ERROR ; <nl> mmm a / tools / run_tests / sanity / core_banned_functions . py <nl> ppp b / tools / run_tests / sanity / core_banned_functions . py <nl> <nl> <nl> # map of banned function signature to whitelist <nl> BANNED_EXCEPT = { <nl> + ' grpc_slice_from_static_buffer ( ' : [ ' src / core / lib / slice / slice . cc ' ] , <nl> ' grpc_resource_quota_ref ( ' : [ ' src / core / lib / iomgr / resource_quota . cc ' ] , <nl> ' grpc_resource_quota_unref ( ' : <nl> [ ' src / core / lib / iomgr / resource_quota . cc ' , ' src / core / lib / surface / server . cc ' ] , <nl>
Fast - path for no - error case for grpc_error_get_status .
grpc/grpc
bff4dd1b2d6af9e467243b4424999a3c307c0c0c
2019-06-21T21:59:34Z
mmm a / script / bootstrap . py <nl> ppp b / script / bootstrap . py <nl> def main ( ) : <nl> update_apm ( ) <nl> update_node_modules ( ) <nl> bootstrap_brightray ( args . url ) <nl> - if sys . platform is ' cygwin ' : <nl> + if sys . platform = = ' cygwin ' : <nl> update_win32_python ( ) <nl> <nl> touch_config_gypi ( ) <nl> mmm a / script / update . py <nl> ppp b / script / update . py <nl> def main ( ) : <nl> <nl> <nl> def update_frameworks ( ) : <nl> - if sys . platform is ' darwin ' : <nl> + if sys . platform = = ' darwin ' : <nl> uf = os . path . join ( ' script ' , ' update - frameworks . py ' ) <nl> subprocess . check_call ( [ sys . executable , uf ] ) <nl> <nl> def update_frameworks ( ) : <nl> def update_gyp ( ) : <nl> gyp = os . path . join ( ' vendor ' , ' gyp ' , ' gyp_main . py ' ) <nl> python = sys . executable <nl> - if sys . platform is ' cygwin ' : <nl> + if sys . platform = = ' cygwin ' : <nl> python = os . path . join ( ' vendor ' , ' python_26 ' , ' python . exe ' ) <nl> subprocess . call ( [ python , gyp , <nl> ' - f ' , ' ninja ' , ' - - depth ' , ' . ' , ' atom . gyp ' , <nl>
: lipstick : on string comparison .
electron/electron
296feb1a50b1a4708423d6b8c2e022805845fd44
2013-08-06T12:44:18Z
similarity index 100 % <nl> rename from bin / libyufacedetect_hi3519_glibc_eval . so <nl> rename to bin / libfacedetect_hi3519_glibc_eval . so <nl> similarity index 100 % <nl> rename from bin / libyufacedetect_hi3519_uclibc_eval . so <nl> rename to bin / libfacedetect_hi3519_uclibc_eval . so <nl>
Evaluation libraries for Hi3519
ShiqiYu/libfacedetection
51214ed853f07dc84990ab9b3f33d8db933469db
2017-12-17T11:29:14Z
mmm a / doc / classes / ProjectSettings . xml <nl> ppp b / doc / classes / ProjectSettings . xml <nl> <nl> < member name = " display / mouse_cursor / custom_image_hotspot " type = " Vector2 " setter = " " getter = " " > <nl> Hotspot for the custom mouse cursor image . <nl> < / member > <nl> + < member name = " display / mouse_cursor / tooltip_position_offset " type = " Vector2 " setter = " " getter = " " > <nl> + Position offset for tooltips , relative to the hotspot of the mouse cursor . <nl> + < / member > <nl> < member name = " display / window / dpi / allow_hidpi " type = " bool " setter = " " getter = " " > <nl> Allow HiDPI display on Windows and OSX . On Desktop Linux , this can ' t be enabled or disabled . <nl> < / member > <nl> mmm a / main / main . cpp <nl> ppp b / main / main . cpp <nl> Error Main : : setup2 ( Thread : : ID p_main_tid_override ) { <nl> <nl> GLOBAL_DEF ( " display / mouse_cursor / custom_image " , String ( ) ) ; <nl> GLOBAL_DEF ( " display / mouse_cursor / custom_image_hotspot " , Vector2 ( ) ) ; <nl> + GLOBAL_DEF ( " display / mouse_cursor / tooltip_position_offset " , Point2 ( 10 , 10 ) ) ; <nl> ProjectSettings : : get_singleton ( ) - > set_custom_property_info ( " display / mouse_cursor / custom_image " , PropertyInfo ( Variant : : STRING , " display / mouse_cursor / custom_image " , PROPERTY_HINT_FILE , " * . png , * . webp " ) ) ; <nl> <nl> if ( String ( ProjectSettings : : get_singleton ( ) - > get ( " display / mouse_cursor / custom_image " ) ) ! = String ( ) ) { <nl> mmm a / scene / main / viewport . cpp <nl> ppp b / scene / main / viewport . cpp <nl> void Viewport : : _gui_show_tooltip ( ) { <nl> gui . tooltip_popup - > set_as_toplevel ( true ) ; <nl> / / gui . tooltip_popup - > hide ( ) ; <nl> <nl> - Rect2 r ( gui . tooltip_pos + Point2 ( 10 , 10 ) , gui . tooltip_popup - > get_minimum_size ( ) ) ; <nl> + Point2 tooltip_offset = ProjectSettings : : get_singleton ( ) - > get ( " display / mouse_cursor / tooltip_position_offset " ) ; <nl> + Rect2 r ( gui . tooltip_pos + tooltip_offset , gui . tooltip_popup - > get_minimum_size ( ) ) ; <nl> Rect2 vr = gui . tooltip_popup - > get_viewport_rect ( ) ; <nl> if ( r . size . x + r . position . x > vr . size . x ) <nl> r . position . x = vr . size . x - r . size . x ; <nl>
Merge pull request from Andrettin / Configurable - Tooltip - Offset
godotengine/godot
775e74e0d41daa9cf3679c2e215f4ef46eee9cbc
2019-03-13T19:12:22Z
new file mode 100644 <nl> index 000000000000 . . 9bec45f81f5a <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / dev - kit - api - level . cmake <nl> <nl> + SET ( ADDON_API_LEVEL 3 ) <nl> + SET ( ADDON_API_VERSION 3 . 0 . 0 ) <nl> new file mode 100644 <nl> index 000000000000 . . e4533c801d48 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / AddonLib . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2015 - 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , AddonLib . hpp ) <nl> + <nl> + # include " . . / version . h " <nl> + <nl> + # include < string > <nl> + # include < stdarg . h > / * va_list , va_start , va_arg , va_end * / <nl> + # include < stdio . h > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + extern " C " <nl> + { <nl> + <nl> + int KODI_API_Level = ADDON_API_LEVEL ; <nl> + const char * KODI_API_Version = ADDON_API_VERSION ; <nl> + <nl> + int InitLibAddon ( void * hdl ) <nl> + { <nl> + return g_interProcess . InitLibAddon ( hdl ) ; <nl> + } <nl> + <nl> + int Finalize ( ) <nl> + { <nl> + return g_interProcess . Finalize ( ) ; <nl> + } <nl> + <nl> + void Log ( const addon_log loglevel , const char * format , . . . ) <nl> + { <nl> + char buffer [ 16384 ] ; <nl> + va_list args ; <nl> + va_start ( args , format ) ; <nl> + vsprintf ( buffer , format , args ) ; <nl> + va_end ( args ) ; <nl> + g_interProcess . Log ( loglevel , buffer ) ; <nl> + } <nl> + <nl> + } / * extern " C " * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . b0d2799152f7 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / CMakeLists . txt <nl> <nl> + project ( kodi - addon - sharedlibrary - api3 ) <nl> + <nl> + cmake_minimum_required ( VERSION 3 . 0 . 0 ) <nl> + <nl> + set ( CMAKE_MODULE_PATH $ { CMAKE_MODULE_PATH } $ { PROJECT_SOURCE_DIR } ) <nl> + <nl> + enable_language ( C CXX ) <nl> + <nl> + include ( . . / dev - kit - api - level . cmake ) <nl> + include ( . . / . . / . . / UseMultiArch . cmake ) <nl> + <nl> + set ( kodi - addon - sharedlibrary_NAME kodi - addon - sharedlibrary ) <nl> + set ( kodi - addon - sharedlibrary_DESCRIPTION " Kodi add - on API 3 development kit for shared libraries " ) <nl> + set ( kodi - addon - sharedlibrary_API_LEVEL = $ { ADDON_API_LEVEL } ) <nl> + set ( kodi - addon - sharedlibrary_VERSION $ { ADDON_API_VERSION } ) <nl> + <nl> + add_definitions ( - DUSE_DEMUX ) <nl> + add_definitions ( - DADDON_API_LEVEL = $ { ADDON_API_LEVEL } ) <nl> + <nl> + list ( APPEND LIB_SOURCES InterProcess . cpp <nl> + AddonLib . cpp <nl> + ErrorCodeNames . cpp <nl> + addon / AddonLib_Addon_General . cpp <nl> + addon / AddonLib_Addon_Network . cpp <nl> + addon / AddonLib_Addon_SoundPlay . cpp <nl> + addon / AddonLib_Addon_VFSUtils . cpp <nl> + audioengine / AddonLib_AudioEngine_General . cpp <nl> + audioengine / AddonLib_AudioEngine_Stream . cpp <nl> + gui / AddonLib_GUI_General . cpp <nl> + gui / AddonLib_GUI_ControlButton . cpp <nl> + gui / AddonLib_GUI_ControlEdit . cpp <nl> + gui / AddonLib_GUI_ControlFadeLabel . cpp <nl> + gui / AddonLib_GUI_ControlImage . cpp <nl> + gui / AddonLib_GUI_ControlLabel . cpp <nl> + gui / AddonLib_GUI_ControlProgress . cpp <nl> + gui / AddonLib_GUI_ControlRadioButton . cpp <nl> + gui / AddonLib_GUI_ControlRendering . cpp <nl> + gui / AddonLib_GUI_ControlSettingsSlider . cpp <nl> + gui / AddonLib_GUI_ControlSlider . cpp <nl> + gui / AddonLib_GUI_ControlSpin . cpp <nl> + gui / AddonLib_GUI_ControlTextBox . cpp <nl> + gui / AddonLib_GUI_DialogContextMenu . cpp <nl> + gui / AddonLib_GUI_DialogExtendedProgress . cpp <nl> + gui / AddonLib_GUI_DialogFileBrowser . cpp <nl> + gui / AddonLib_GUI_DialogKeyboard . cpp <nl> + gui / AddonLib_GUI_DialogNumeric . cpp <nl> + gui / AddonLib_GUI_DialogOK . cpp <nl> + gui / AddonLib_GUI_DialogProgress . cpp <nl> + gui / AddonLib_GUI_DialogSelect . cpp <nl> + gui / AddonLib_GUI_DialogTextViewer . cpp <nl> + gui / AddonLib_GUI_DialogYesNo . cpp <nl> + gui / AddonLib_GUI_ListItem . cpp <nl> + gui / AddonLib_GUI_Window . cpp <nl> + inputstream / AddonLib_InputStream . cpp <nl> + peripheral / AddonLib_Peripheral . cpp <nl> + player / AddonLib_Player_InfoTagMusic . cpp <nl> + player / AddonLib_Player_InfoTagVideo . cpp <nl> + player / AddonLib_Player_Player . cpp <nl> + player / AddonLib_Player_PlayList . cpp <nl> + pvr / AddonLib_PVR_General . cpp <nl> + pvr / AddonLib_PVR_Stream . cpp <nl> + pvr / AddonLib_PVR_Transfer . cpp <nl> + pvr / AddonLib_PVR_Trigger . cpp ) <nl> + <nl> + if ( WIN32 ) <nl> + list ( APPEND DEPLIBS ws2_32 ) <nl> + list ( APPEND LIB_SOURCES dlfcn - win32 . cpp ) <nl> + else ( ) <nl> + set ( CMAKE_CXX_FLAGS " $ { CMAKE_CXX_FLAGS } - fPIC - std = c + + 11 " ) <nl> + endif ( ) <nl> + <nl> + if ( BUILD_KODI_ADDON ) <nl> + list ( APPEND INCLUDES $ { KODI_INCLUDE_DIR } ) <nl> + else ( ) <nl> + list ( APPEND INCLUDES . . / . . / . . / . . / . . / <nl> + . . / . . / . . / . . / . . / cores / VideoPlayer / DVDDemuxers ) <nl> + endif ( ) <nl> + <nl> + include_directories ( $ { INCLUDES } <nl> + . . / . . / . . / include / <nl> + . ) <nl> + <nl> + add_library ( kodi . addon . sharedlibrary . api $ { ADDON_API_LEVEL } STATIC $ { LIB_SOURCES } ) <nl> + target_link_libraries ( kodi . addon . sharedlibrary . api $ { ADDON_API_LEVEL } $ { DEPLIBS } ) <nl> + set_target_properties ( kodi . addon . sharedlibrary . api $ { ADDON_API_LEVEL } PROPERTIES OUTPUT_NAME kodi . addon . sharedlibrary . api $ { ADDON_API_LEVEL } ) <nl> + <nl> + install ( TARGETS kodi . addon . sharedlibrary . api $ { ADDON_API_LEVEL } DESTINATION $ { CMAKE_INSTALL_LIBDIR } ) <nl> + <nl> + # Set this way for compatibility to old configure system of kodi <nl> + set ( prefix $ { CMAKE_INSTALL_PREFIX } ) <nl> + set ( exec_prefix $ { CMAKE_INSTALL_PREFIX } ) <nl> + set ( libdir $ { CMAKE_INSTALL_PREFIX } / $ { CMAKE_INSTALL_LIBDIR } ) <nl> + set ( includedir $ { CMAKE_INSTALL_PREFIX } / include ) <nl> + set ( CXX $ { CMAKE_CXX_COMPILER } $ { CXX_STD0X_FLAGS } ) <nl> + set ( CC $ { CMAKE_C_COMPILER } $ { C_STD99_FLAGS } ) <nl> + set ( CXXFLAGS $ { CMAKE_CXX_FLAGS } ) <nl> + <nl> + IF ( NOT WIN32 ) <nl> + configure_file ( kodi - addon - sharedlibrary - api3 . pc . in $ { CMAKE_BINARY_DIR } / kodi - addon - sharedlibrary - api3 . pc @ ONLY ) <nl> + install ( FILES $ { CMAKE_BINARY_DIR } / kodi - addon - sharedlibrary - api3 . pc <nl> + DESTINATION $ { CMAKE_INSTALL_LIBDIR_NOARCH } / pkgconfig ) <nl> + ENDIF ( NOT WIN32 ) <nl> + <nl> + # config mode <nl> + configure_file ( kodi - addon - sharedlibrary - api3 - config . cmake . in <nl> + $ { CMAKE_BINARY_DIR } / kodi - addon - sharedlibrary - api3 - config . cmake @ ONLY ) <nl> + install ( FILES $ { CMAKE_BINARY_DIR } / kodi - addon - sharedlibrary - api3 - config . cmake <nl> + DESTINATION $ { CMAKE_INSTALL_LIBDIR_NOARCH } / kodi ) <nl> new file mode 100644 <nl> index 000000000000 . . 362529bdf31e <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / ErrorCodeNames . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include " ErrorCodeNames . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , . internal / AddonLib_internal . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + extern " C " <nl> + { <nl> + <nl> + / * ! <nl> + * @ brief Last error code . <nl> + * / <nl> + uint32_t KODI_API_lasterror = API_SUCCESS ; <nl> + <nl> + const KODI_API_ErrorTranslator errorTranslator [ API_ERR_LASTCODE ] = <nl> + { <nl> + { API_SUCCESS , " Successful return code " } , <nl> + { API_ERR_BUFFER , " Invalid buffer pointer " } , <nl> + { API_ERR_COUNT , " Invalid count argument " } , <nl> + { API_ERR_TYPE , " Invalid datatype argument " } , <nl> + { API_ERR_TAG , " Invalid tag argument " } , <nl> + { API_ERR_COMM , " Invalid communicator " } , <nl> + { API_ERR_RANK , " Invalid rank " } , <nl> + { API_ERR_ROOT , " Invalid root " } , <nl> + { API_ERR_GROUP , " Null group passed to function " } , <nl> + { API_ERR_OP , " Invalid operation " } , <nl> + { API_ERR_TOPOLOGY , " Invalid topology " } , <nl> + { API_ERR_DIMS , " Illegal dimension argument " } , <nl> + { API_ERR_ARG , " Invalid argument " } , <nl> + { API_ERR_UNKNOWN , " Unknown error " } , <nl> + { API_ERR_TRUNCATE , " message truncated on receive " } , <nl> + { API_ERR_OTHER , " Other error ; use Error_string " } , <nl> + { API_ERR_INTERN , " internal error code " } , <nl> + { API_ERR_IN_STATUS , " Look in status for error value " } , <nl> + { API_ERR_PENDING , " Pending request " } , <nl> + { API_ERR_REQUEST , " illegal API_request handle " } , <nl> + { API_ERR_CONNECTION , " Failed to connect " } , <nl> + { API_ERR_VALUE_NOT_AVAILABLE , " Requested value not available " } <nl> + } ; <nl> + <nl> + const char * KodiAPI_ErrorCodeToString ( uint32_t code ) <nl> + { <nl> + if ( code < API_ERR_LASTCODE ) <nl> + return errorTranslator [ code ] . errorName ; <nl> + else <nl> + return " Invalid Error code ! " ; <nl> + } <nl> + <nl> + } / * extern " C " * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . e7e5c0103969 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / ErrorCodeNames . h <nl> <nl> + # pragma once <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include < stdint . h > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + extern " C " <nl> + { <nl> + <nl> + extern uint32_t KODI_API_lasterror ; <nl> + <nl> + const char * KodiAPI_ErrorCodeToString ( uint32_t code ) ; <nl> + <nl> + } / * extern " C " * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . b81a86203552 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / InterProcess . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + <nl> + # include < stdio . h > <nl> + <nl> + # ifdef _WIN32 / / windows <nl> + # ifndef _SSIZE_T_DEFINED <nl> + typedef intptr_t ssize_t ; <nl> + # define _SSIZE_T_DEFINED <nl> + # endif / / ! _SSIZE_T_DEFINED <nl> + # include " dlfcn - win32 . h " <nl> + # else <nl> + # include < dlfcn . h > / / linux + osx <nl> + # endif <nl> + <nl> + extern " C " <nl> + { <nl> + <nl> + CKODIAddon_InterProcess g_interProcess ; <nl> + <nl> + CKODIAddon_InterProcess : : CKODIAddon_InterProcess ( ) <nl> + : m_Handle ( NULL ) , <nl> + m_Callbacks ( NULL ) , <nl> + m_libKODI_addon ( NULL ) <nl> + { <nl> + <nl> + } <nl> + <nl> + CKODIAddon_InterProcess : : ~ CKODIAddon_InterProcess ( ) <nl> + { <nl> + Finalize ( ) ; <nl> + } <nl> + <nl> + / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <nl> + <nl> + int CKODIAddon_InterProcess : : InitLibAddon ( void * hdl ) <nl> + { <nl> + m_Handle = static_cast < ADDON : : AddonCB * > ( hdl ) ; <nl> + <nl> + m_libKODI_addon = dlopen ( NULL , RTLD_LAZY ) ; <nl> + if ( m_libKODI_addon = = NULL ) <nl> + { <nl> + fprintf ( stderr , " Unable to load % s \ n " , dlerror ( ) ) ; <nl> + KODI_API_lasterror = API_ERR_OP ; <nl> + return KODI_API_lasterror ; <nl> + } <nl> + <nl> + KODI_register = ( _register_level * ) <nl> + dlsym ( m_libKODI_addon , " AddOnLib_Register " ) ; <nl> + if ( KODI_register = = NULL ) <nl> + { <nl> + fprintf ( stderr , " Unable to assign function % s \ n " , dlerror ( ) ) ; <nl> + KODI_API_lasterror = API_ERR_CONNECTION ; <nl> + return KODI_API_lasterror ; <nl> + } <nl> + <nl> + KODI_unregister = ( _unregister_me * ) <nl> + dlsym ( m_libKODI_addon , " AddOnLib_UnRegister " ) ; <nl> + if ( KODI_unregister = = NULL ) <nl> + { <nl> + fprintf ( stderr , " Unable to assign function % s \ n " , dlerror ( ) ) ; <nl> + KODI_API_lasterror = API_ERR_CONNECTION ; <nl> + return KODI_API_lasterror ; <nl> + } <nl> + <nl> + m_Callbacks = KODI_register ( m_Handle , 3 ) ; <nl> + if ( m_Callbacks = = NULL ) <nl> + { <nl> + KODI_API_lasterror = API_ERR_BUFFER ; <nl> + return KODI_API_lasterror ; <nl> + } <nl> + <nl> + KODI_API_lasterror = API_SUCCESS ; <nl> + return KODI_API_lasterror ; <nl> + } <nl> + <nl> + int CKODIAddon_InterProcess : : Finalize ( ) <nl> + { <nl> + if ( m_libKODI_addon ) <nl> + { <nl> + KODI_unregister ( m_Handle , m_Callbacks ) ; <nl> + dlclose ( m_libKODI_addon ) ; <nl> + m_libKODI_addon = NULL ; <nl> + } <nl> + <nl> + KODI_API_lasterror = API_SUCCESS ; <nl> + return KODI_API_lasterror ; <nl> + } <nl> + <nl> + void CKODIAddon_InterProcess : : Log ( const addon_log loglevel , const char * string ) <nl> + { <nl> + m_Callbacks - > addon_log_msg ( m_Handle , loglevel , string ) ; <nl> + } <nl> + <nl> + } / * extern " C " * / <nl> new file mode 100644 <nl> index 000000000000 . . a1c3ae817ef2 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / InterProcess . h <nl> <nl> + # pragma once <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " . . / version . h " <nl> + # include " kodi / api3 / definitions . hpp " <nl> + <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , AddonLib . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , . internal / AddonLib_internal . hpp ) <nl> + <nl> + # include < stdlib . h > <nl> + # include < string > <nl> + <nl> + # ifdef TARGET_WINDOWS <nl> + # include < windows . h > <nl> + # else <nl> + # ifndef __cdecl <nl> + # define __cdecl <nl> + # endif <nl> + # ifndef __declspec <nl> + # define __declspec ( X ) <nl> + # endif <nl> + # endif <nl> + <nl> + extern " C " <nl> + { <nl> + <nl> + using namespace API_NAMESPACE_NAME : : KodiAPI ; <nl> + <nl> + namespace ADDON <nl> + { <nl> + typedef struct AddonCB <nl> + { <nl> + const char * libBasePath ; / / / < Never , never change this ! ! ! <nl> + void * addonData ; <nl> + } AddonCB ; <nl> + } <nl> + <nl> + class CKODIAddon_InterProcess <nl> + { <nl> + public : <nl> + CKODIAddon_InterProcess ( ) ; <nl> + virtual ~ CKODIAddon_InterProcess ( ) ; <nl> + <nl> + int InitLibAddon ( void * hdl ) ; <nl> + int Finalize ( ) ; <nl> + void Log ( const addon_log loglevel , const char * string ) ; <nl> + <nl> + ADDON : : AddonCB * m_Handle ; <nl> + CB_AddOnLib * m_Callbacks ; <nl> + <nl> + protected : <nl> + _register_level * KODI_register ; <nl> + _unregister_me * KODI_unregister ; <nl> + <nl> + private : <nl> + void * m_libKODI_addon ; <nl> + struct cb_array <nl> + { <nl> + const char * libPath ; <nl> + } ; <nl> + } ; <nl> + <nl> + extern CKODIAddon_InterProcess g_interProcess ; <nl> + <nl> + } / * extern " C " * / <nl> new file mode 100644 <nl> index 000000000000 . . 4cc847d77237 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / Makefile <nl> <nl> + # WARNING : This Makefile is only be used on Kodi ' s own build . If you use it <nl> + # independent is cmake needed for creation ! <nl> + # <nl> + <nl> + # # # The archiver options : <nl> + <nl> + AR ? = ar <nl> + ARFLAGS ? = ru <nl> + <nl> + INCLUDES = - I . \ <nl> + - I . . / . . / . . / . . / . . / \ <nl> + - I . . / . . / . . / . . / . . / cores / VideoPlayer / DVDDemuxers \ <nl> + - I . . / . . / . . / include / <nl> + <nl> + DEFINES + = <nl> + CXXFLAGS = - fPIC - std = c + + 11 <nl> + LIBNAME = libkodi . addon . sharedlibrary . api3 . a <nl> + <nl> + # # # The object files ( add further files here ) : <nl> + <nl> + OBJS = InterProcess . o \ <nl> + AddonLib . o \ <nl> + ErrorCodeNames . o \ <nl> + addon / AddonLib_Addon_General . o \ <nl> + addon / AddonLib_Addon_Network . o \ <nl> + addon / AddonLib_Addon_SoundPlay . o \ <nl> + addon / AddonLib_Addon_VFSUtils . o \ <nl> + audioengine / AddonLib_AudioEngine_General . o \ <nl> + audioengine / AddonLib_AudioEngine_Stream . o \ <nl> + gui / AddonLib_GUI_General . o \ <nl> + gui / AddonLib_GUI_ControlButton . o \ <nl> + gui / AddonLib_GUI_ControlEdit . o \ <nl> + gui / AddonLib_GUI_ControlFadeLabel . o \ <nl> + gui / AddonLib_GUI_ControlImage . o \ <nl> + gui / AddonLib_GUI_ControlLabel . o \ <nl> + gui / AddonLib_GUI_ControlProgress . o \ <nl> + gui / AddonLib_GUI_ControlRadioButton . o \ <nl> + gui / AddonLib_GUI_ControlRendering . o \ <nl> + gui / AddonLib_GUI_ControlSettingsSlider . o \ <nl> + gui / AddonLib_GUI_ControlSlider . o \ <nl> + gui / AddonLib_GUI_ControlSpin . o \ <nl> + gui / AddonLib_GUI_ControlTextBox . o \ <nl> + gui / AddonLib_GUI_DialogExtendedProgress . o \ <nl> + gui / AddonLib_GUI_DialogFileBrowser . o \ <nl> + gui / AddonLib_GUI_DialogKeyboard . o \ <nl> + gui / AddonLib_GUI_DialogNumeric . o \ <nl> + gui / AddonLib_GUI_DialogOK . o \ <nl> + gui / AddonLib_GUI_DialogProgress . o \ <nl> + gui / AddonLib_GUI_DialogSelect . o \ <nl> + gui / AddonLib_GUI_DialogTextViewer . o \ <nl> + gui / AddonLib_GUI_DialogYesNo . o \ <nl> + gui / AddonLib_GUI_ListItem . o \ <nl> + gui / AddonLib_GUI_Window . o \ <nl> + inputstream / AddonLib_InputStream . o \ <nl> + peripheral / AddonLib_Peripheral . o \ <nl> + player / AddonLib_Player_InfoTagMusic . o \ <nl> + player / AddonLib_Player_InfoTagVideo . o \ <nl> + player / AddonLib_Player_Player . o \ <nl> + player / AddonLib_Player_PlayList . o \ <nl> + pvr / AddonLib_PVR_General . o \ <nl> + pvr / AddonLib_PVR_Stream . o \ <nl> + pvr / AddonLib_PVR_Transfer . o \ <nl> + pvr / AddonLib_PVR_Trigger . o <nl> + <nl> + # # # Implicit rules : <nl> + <nl> + % . o : % . cpp <nl> + $ ( CXX ) $ ( CXXFLAGS ) - c $ ( DEFINES ) $ ( INCLUDES ) $ < <nl> + <nl> + all : $ ( LIBNAME ) <nl> + <nl> + # # # Targets : <nl> + <nl> + $ ( LIBNAME ) : $ ( OBJS ) <nl> + $ ( AR ) $ ( ARFLAGS ) $ @ $ ( OBJS ) <nl> + <nl> + CLEAN_FILES = \ <nl> + $ ( LIBNAME ) \ <nl> + <nl> + include . . / . . / . . / . . / . . / . . / Makefile . include <nl> new file mode 100644 <nl> index 000000000000 . . e290279c34d1 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / addon / AddonLib_Addon_General . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , addon / General . hpp ) <nl> + <nl> + # include < string > <nl> + # include < cstring > <nl> + # include < stdarg . h > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace AddOn <nl> + { <nl> + namespace General <nl> + { <nl> + <nl> + bool GetSettingString ( <nl> + const std : : string & settingName , <nl> + std : : string & settingValue , <nl> + bool global ) <nl> + { <nl> + char * buffer = ( char * ) malloc ( 1024 ) ; <nl> + buffer [ 0 ] = 0 ; / * Set the end of string * / <nl> + bool ret = g_interProcess . m_Callbacks - > General . get_setting ( g_interProcess . m_Handle , settingName . c_str ( ) , buffer , global ) ; <nl> + if ( ret ) <nl> + settingValue = buffer ; <nl> + free ( buffer ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool GetSettingInt ( <nl> + const std : : string & settingName , <nl> + int & settingValue , <nl> + bool global ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > General . get_setting ( g_interProcess . m_Handle , settingName . c_str ( ) , & settingValue , global ) ; <nl> + } <nl> + <nl> + bool GetSettingBoolean ( <nl> + const std : : string & settingName , <nl> + bool & settingValue , <nl> + bool global ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > General . get_setting ( g_interProcess . m_Handle , settingName . c_str ( ) , & settingValue , global ) ; <nl> + } <nl> + <nl> + bool GetSettingFloat ( <nl> + const std : : string & settingName , <nl> + float & settingValue , <nl> + bool global ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > General . get_setting ( g_interProcess . m_Handle , settingName . c_str ( ) , & settingValue , global ) ; <nl> + } <nl> + <nl> + void OpenSettings ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . open_settings_dialog ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void QueueFormattedNotification ( const queue_msg type , const char * format , . . . ) <nl> + { <nl> + va_list args ; <nl> + char buffer [ 16384 ] ; <nl> + va_start ( args , format ) ; <nl> + vsprintf ( buffer , format , args ) ; <nl> + va_end ( args ) ; <nl> + g_interProcess . m_Callbacks - > General . queue_notification ( g_interProcess . m_Handle , type , buffer ) ; <nl> + } <nl> + <nl> + void QueueNotification ( <nl> + const queue_msg type , <nl> + const std : : string & aCaption , <nl> + const std : : string & aDescription , <nl> + unsigned int displayTime , <nl> + bool withSound , <nl> + unsigned int messageTime ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . queue_notification_from_type ( g_interProcess . m_Handle , <nl> + type , aCaption . c_str ( ) , aDescription . c_str ( ) , <nl> + displayTime , withSound , messageTime ) ; <nl> + } <nl> + <nl> + void QueueNotification ( <nl> + const std : : string & aCaption , <nl> + const std : : string & aDescription ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . queue_notification_with_image ( g_interProcess . m_Handle , " " , <nl> + aCaption . c_str ( ) , aDescription . c_str ( ) , <nl> + 5000 , false , 1000 ) ; <nl> + } <nl> + <nl> + void QueueNotification ( <nl> + const std : : string & aImageFile , <nl> + const std : : string & aCaption , <nl> + const std : : string & aDescription , <nl> + unsigned int displayTime , <nl> + bool withSound , <nl> + unsigned int messageTime ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . queue_notification_with_image ( g_interProcess . m_Handle , aImageFile . c_str ( ) , <nl> + aCaption . c_str ( ) , aDescription . c_str ( ) , <nl> + displayTime , withSound , messageTime ) ; <nl> + } <nl> + <nl> + void GetMD5 ( const std : : string & text , std : : string & md5 ) <nl> + { <nl> + char * md5ret = ( char * ) malloc ( 40 * sizeof ( char ) ) ; / / md5 size normally 32 bytes <nl> + g_interProcess . m_Callbacks - > General . get_md5 ( text . c_str ( ) , * md5ret ) ; <nl> + md5 = md5ret ; <nl> + free ( md5ret ) ; <nl> + } <nl> + <nl> + bool UnknownToUTF8 ( <nl> + const std : : string & stringSrc , <nl> + std : : string & utf8StringDst , <nl> + bool failOnBadChar ) <nl> + { <nl> + bool ret = false ; <nl> + char * retString = g_interProcess . m_Callbacks - > General . unknown_to_utf8 ( g_interProcess . m_Handle , stringSrc . c_str ( ) , ret , failOnBadChar ) ; <nl> + if ( retString ! = nullptr ) <nl> + { <nl> + if ( ret ) <nl> + utf8StringDst = retString ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , retString ) ; <nl> + } <nl> + return ret ; <nl> + } <nl> + <nl> + std : : string GetLocalizedString ( uint32_t labelId , const std : : string & strDefault ) <nl> + { <nl> + std : : string strReturn = strDefault ; <nl> + char * strMsg = g_interProcess . m_Callbacks - > General . get_localized_string ( g_interProcess . m_Handle , labelId ) ; <nl> + if ( strMsg ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strMsg ) ) <nl> + strReturn = strMsg ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strMsg ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + std : : string GetLanguage ( lang_formats format , bool region ) <nl> + { <nl> + std : : string language ; <nl> + language . resize ( 256 ) ; <nl> + unsigned int size = ( unsigned int ) language . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > General . get_language ( g_interProcess . m_Handle , language [ 0 ] , size , format , region ) ; <nl> + language . resize ( size ) ; <nl> + language . shrink_to_fit ( ) ; <nl> + return language ; <nl> + } <nl> + <nl> + std : : string GetDVDMenuLanguage ( ) <nl> + { <nl> + std : : string language ; <nl> + language . resize ( 16 ) ; <nl> + unsigned int size = ( unsigned int ) language . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > General . get_dvd_menu_language ( g_interProcess . m_Handle , language [ 0 ] , size ) ; <nl> + language . resize ( size ) ; <nl> + language . shrink_to_fit ( ) ; <nl> + return language ; <nl> + } <nl> + <nl> + bool StartServer ( eservers typ , bool start , bool wait ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > General . start_server ( g_interProcess . m_Handle , ( int ) typ , start , wait ) ; <nl> + } <nl> + <nl> + void AudioSuspend ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . audio_suspend ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void AudioResume ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . audio_resume ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + float GetVolume ( bool percentage ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > General . get_volume ( g_interProcess . m_Handle , percentage ) ; <nl> + } <nl> + <nl> + void SetVolume ( float value , bool isPercentage ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . set_volume ( g_interProcess . m_Handle , value , isPercentage ) ; <nl> + } <nl> + <nl> + bool IsMuted ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > General . is_muted ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void ToggleMute ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . toggle_mute ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void SetMute ( bool mute ) <nl> + { <nl> + if ( g_interProcess . m_Callbacks - > General . is_muted ( g_interProcess . m_Handle ) ! = mute ) <nl> + g_interProcess . m_Callbacks - > General . toggle_mute ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + dvd_state GetOpticalDriveState ( ) <nl> + { <nl> + return ( dvd_state ) g_interProcess . m_Callbacks - > General . get_optical_state ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + bool EjectOpticalDrive ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > General . eject_optical_drive ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void KodiVersion ( kodi_version & version ) <nl> + { <nl> + char * compile_name = nullptr ; <nl> + char * revision = nullptr ; <nl> + char * tag = nullptr ; <nl> + char * tag_revision = nullptr ; <nl> + <nl> + g_interProcess . m_Callbacks - > General . kodi_version ( g_interProcess . m_Handle , compile_name , version . major , version . minor , revision , tag , tag_revision ) ; <nl> + if ( compile_name ! = nullptr ) <nl> + { <nl> + version . compile_name = compile_name ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , compile_name ) ; <nl> + } <nl> + if ( revision ! = nullptr ) <nl> + { <nl> + version . revision = revision ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , revision ) ; <nl> + } <nl> + if ( tag ! = nullptr ) <nl> + { <nl> + version . tag = tag ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , tag ) ; <nl> + } <nl> + if ( tag_revision ! = nullptr ) <nl> + { <nl> + version . tag_revision = tag_revision ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , tag_revision ) ; <nl> + } <nl> + } <nl> + <nl> + void KodiQuit ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . kodi_quit ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void HTPCShutdown ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . htpc_shutdown ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void HTPCRestart ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . htpc_restart ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void ExecuteScript ( const std : : string & script ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . execute_script ( g_interProcess . m_Handle , script . c_str ( ) ) ; <nl> + } <nl> + <nl> + void ExecuteBuiltin ( const std : : string & function , bool wait ) <nl> + { <nl> + g_interProcess . m_Callbacks - > General . execute_builtin ( g_interProcess . m_Handle , function . c_str ( ) , wait ) ; <nl> + } <nl> + <nl> + std : : string ExecuteJSONRPC ( const std : : string & jsonrpccommand ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strMsg = g_interProcess . m_Callbacks - > General . execute_jsonrpc ( g_interProcess . m_Handle , jsonrpccommand . c_str ( ) ) ; <nl> + if ( strMsg ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strMsg ) ) <nl> + strReturn = strMsg ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strMsg ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + std : : string GetRegion ( const std : : string & id ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strMsg = g_interProcess . m_Callbacks - > General . get_region ( g_interProcess . m_Handle , id . c_str ( ) ) ; <nl> + if ( strMsg ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strMsg ) ) <nl> + strReturn = strMsg ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strMsg ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + long GetFreeMem ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > General . get_free_mem ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + int GetGlobalIdleTime ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > General . get_global_idle_time ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + std : : string GetAddonInfo ( const std : : string & id ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strMsg = g_interProcess . m_Callbacks - > General . get_addon_info ( g_interProcess . m_Handle , id . c_str ( ) ) ; <nl> + if ( strMsg ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strMsg ) ) <nl> + strReturn = strMsg ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strMsg ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + std : : string TranslatePath ( const std : : string & path ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strMsg = g_interProcess . m_Callbacks - > General . translate_path ( g_interProcess . m_Handle , path . c_str ( ) ) ; <nl> + if ( strMsg ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strMsg ) ) <nl> + strReturn = strMsg ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strMsg ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + std : : string TranslateAddonStatus ( ADDON_STATUS status ) <nl> + { <nl> + switch ( status ) <nl> + { <nl> + case ADDON_STATUS_OK : return " OK " ; <nl> + case ADDON_STATUS_LOST_CONNECTION : return " Lost connection " ; <nl> + case ADDON_STATUS_NEED_RESTART : return " Needs restart " ; <nl> + case ADDON_STATUS_NEED_SETTINGS : return " Needs settngs " ; <nl> + case ADDON_STATUS_UNKNOWN : return " Unknown " ; <nl> + case ADDON_STATUS_NEED_SAVEDSETTINGS : return " Needs saved settings " ; <nl> + case ADDON_STATUS_PERMANENT_FAILURE : return " Permanent failure " ; <nl> + default : <nl> + break ; <nl> + } <nl> + return " " ; <nl> + } <nl> + <nl> + } / * namespace General * / <nl> + } / * namespace AddOn * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 7b7da73200bb <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / addon / AddonLib_Addon_Network . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + <nl> + # include < string > <nl> + # include < stdarg . h > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace AddOn <nl> + { <nl> + namespace Network <nl> + { <nl> + <nl> + bool WakeOnLan ( const std : : string & mac ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > Network . wake_on_lan ( g_interProcess . m_Handle , mac . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string GetIPAddress ( ) <nl> + { <nl> + std : : string ip ; <nl> + ip . resize ( 32 ) ; <nl> + unsigned int size = ( unsigned int ) ip . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > Network . get_ip_address ( g_interProcess . m_Handle , ip [ 0 ] , size ) ; <nl> + ip . resize ( size ) ; <nl> + ip . shrink_to_fit ( ) ; <nl> + return ip ; <nl> + } <nl> + <nl> + std : : string URLEncode ( const std : : string & url ) <nl> + { <nl> + std : : string retString ; <nl> + char * string = g_interProcess . m_Callbacks - > Network . url_encode ( g_interProcess . m_Handle , url . c_str ( ) ) ; <nl> + if ( string ! = nullptr ) <nl> + { <nl> + retString = string ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , string ) ; <nl> + } <nl> + return retString ; <nl> + } <nl> + <nl> + bool DNSLookup ( const std : : string & strHostName , std : : string & strIpAddress ) <nl> + { <nl> + bool ret = false ; <nl> + char * ipAddress = g_interProcess . m_Callbacks - > Network . dns_lookup ( g_interProcess . m_Handle , strHostName . c_str ( ) , ret ) ; <nl> + if ( ipAddress ! = nullptr ) <nl> + { <nl> + strIpAddress = ipAddress ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , ipAddress ) ; <nl> + } <nl> + return ret ; <nl> + } <nl> + <nl> + } / * namespace KodiAPI_Codec * / <nl> + } / * namespace AddOn * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 5ae3ba69d050 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / addon / AddonLib_Addon_SoundPlay . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , addon / SoundPlay . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace AddOn <nl> + { <nl> + <nl> + CSoundPlay : : CSoundPlay ( const std : : string & filename ) <nl> + : m_PlayHandle ( nullptr ) <nl> + { <nl> + m_PlayHandle = g_interProcess . m_Callbacks - > Audio . soundplay_get_handle ( g_interProcess . m_Handle , filename . c_str ( ) ) ; <nl> + if ( ! m_PlayHandle ) <nl> + fprintf ( stderr , " libKODI_addon - ERROR : CSoundPlay can ' t get callback table from KODI ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CSoundPlay : : ~ CSoundPlay ( ) <nl> + { <nl> + if ( m_PlayHandle ) <nl> + g_interProcess . m_Callbacks - > Audio . soundplay_release_handle ( g_interProcess . m_Handle , m_PlayHandle ) ; <nl> + } <nl> + <nl> + void CSoundPlay : : Play ( ) <nl> + { <nl> + if ( m_PlayHandle ) <nl> + g_interProcess . m_Callbacks - > Audio . soundplay_play ( g_interProcess . m_Handle , m_PlayHandle ) ; <nl> + } <nl> + <nl> + void CSoundPlay : : Stop ( ) <nl> + { <nl> + if ( m_PlayHandle ) <nl> + g_interProcess . m_Callbacks - > Audio . soundplay_stop ( g_interProcess . m_Handle , m_PlayHandle ) ; <nl> + } <nl> + <nl> + void CSoundPlay : : SetChannel ( audio_channel channel ) <nl> + { <nl> + if ( m_PlayHandle ) <nl> + g_interProcess . m_Callbacks - > Audio . soundplay_set_channel ( g_interProcess . m_Handle , m_PlayHandle , channel ) ; <nl> + } <nl> + <nl> + audio_channel CSoundPlay : : GetChannel ( ) <nl> + { <nl> + if ( ! m_PlayHandle ) <nl> + return AUDIO_CH_INVALID ; <nl> + return ( audio_channel ) g_interProcess . m_Callbacks - > Audio . soundplay_get_channel ( g_interProcess . m_Handle , m_PlayHandle ) ; <nl> + } <nl> + <nl> + void CSoundPlay : : SetVolume ( float volume ) <nl> + { <nl> + if ( m_PlayHandle ) <nl> + g_interProcess . m_Callbacks - > Audio . soundplay_set_volume ( g_interProcess . m_Handle , m_PlayHandle , volume ) ; <nl> + } <nl> + <nl> + float CSoundPlay : : GetVolume ( ) <nl> + { <nl> + if ( ! m_PlayHandle ) <nl> + return 0 . 0f ; <nl> + return g_interProcess . m_Callbacks - > Audio . soundplay_get_volume ( g_interProcess . m_Handle , m_PlayHandle ) ; <nl> + } <nl> + <nl> + } / * namespace AddOn * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . afe6bddc965c <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / addon / AddonLib_Addon_VFSUtils . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , addon / VFSUtils . hpp ) <nl> + <nl> + # include < cstring > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace AddOn <nl> + { <nl> + <nl> + CVFSDirEntry : : CVFSDirEntry ( <nl> + const std : : string & label , <nl> + const std : : string & path , <nl> + bool bFolder , <nl> + int64_t size ) <nl> + : m_label ( label ) , <nl> + m_path ( path ) , <nl> + m_bFolder ( bFolder ) , <nl> + m_size ( size ) <nl> + { <nl> + } <nl> + <nl> + CVFSDirEntry : : CVFSDirEntry ( const VFSDirEntry & dirEntry ) <nl> + : m_label ( dirEntry . label ? dirEntry . label : " " ) , <nl> + m_path ( dirEntry . path ? dirEntry . path : " " ) , <nl> + m_bFolder ( dirEntry . folder ) , <nl> + m_size ( dirEntry . size ) <nl> + { <nl> + } <nl> + <nl> + const std : : string & CVFSDirEntry : : Label ( void ) const <nl> + { <nl> + return m_label ; <nl> + } <nl> + <nl> + const std : : string & CVFSDirEntry : : Path ( void ) const <nl> + { <nl> + return m_path ; <nl> + } <nl> + <nl> + bool CVFSDirEntry : : IsFolder ( void ) const <nl> + { <nl> + return m_bFolder ; <nl> + } <nl> + <nl> + int64_t CVFSDirEntry : : Size ( void ) const <nl> + { <nl> + return m_size ; <nl> + } <nl> + <nl> + void CVFSDirEntry : : SetLabel ( const std : : string & label ) <nl> + { <nl> + m_label = label ; <nl> + } <nl> + <nl> + void CVFSDirEntry : : SetPath ( const std : : string & path ) <nl> + { <nl> + m_path = path ; <nl> + } <nl> + <nl> + void CVFSDirEntry : : SetFolder ( bool bFolder ) <nl> + { <nl> + m_bFolder = bFolder ; <nl> + } <nl> + <nl> + void CVFSDirEntry : : SetSize ( int64_t size ) <nl> + { <nl> + m_size = size ; <nl> + } <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + CVFSFile : : CVFSFile ( ) <nl> + : m_pFile ( nullptr ) <nl> + { <nl> + <nl> + } <nl> + <nl> + CVFSFile : : ~ CVFSFile ( ) <nl> + { <nl> + Close ( ) ; <nl> + } <nl> + <nl> + bool CVFSFile : : OpenFile ( const std : : string & strFileName , unsigned int flags ) <nl> + { <nl> + Close ( ) ; <nl> + m_pFile = g_interProcess . m_Callbacks - > File . open_file ( g_interProcess . m_Handle , strFileName . c_str ( ) , flags ) ; <nl> + return m_pFile ! = nullptr ; <nl> + } <nl> + <nl> + bool CVFSFile : : OpenFileForWrite ( const std : : string & strFileName , bool bOverWrite ) <nl> + { <nl> + Close ( ) ; <nl> + <nl> + / / Try to open the file . If it fails , check if we need to create the directory first <nl> + / / This way we avoid checking if the directory exists every time <nl> + m_pFile = g_interProcess . m_Callbacks - > File . open_file_for_write ( g_interProcess . m_Handle , strFileName . c_str ( ) , bOverWrite ) ; <nl> + if ( ! m_pFile ) <nl> + { <nl> + std : : string cacheDirectory = KodiAPI : : AddOn : : VFSUtils : : GetDirectoryName ( strFileName ) ; <nl> + if ( g_interProcess . m_Callbacks - > Directory . directory_exists ( g_interProcess . m_Handle , cacheDirectory . c_str ( ) ) | | <nl> + g_interProcess . m_Callbacks - > Directory . create_directory ( g_interProcess . m_Handle , cacheDirectory . c_str ( ) ) ) <nl> + m_pFile = g_interProcess . m_Callbacks - > File . open_file_for_write ( g_interProcess . m_Handle , strFileName . c_str ( ) , bOverWrite ) ; <nl> + } <nl> + return m_pFile ! = nullptr ; <nl> + } <nl> + <nl> + ssize_t CVFSFile : : Read ( void * lpBuf , size_t uiBufSize ) <nl> + { <nl> + if ( ! m_pFile ) <nl> + return 0 ; <nl> + return g_interProcess . m_Callbacks - > File . read_file ( g_interProcess . m_Handle , m_pFile , lpBuf , uiBufSize ) ; <nl> + } <nl> + <nl> + bool CVFSFile : : ReadLine ( std : : string & strLine ) <nl> + { <nl> + strLine . clear ( ) ; <nl> + if ( ! m_pFile ) <nl> + return false ; <nl> + / / TODO : Read 1024 chars into buffer . If file position advanced that many <nl> + / / chars , we didn ' t hit a newline . Otherwise , if file position is 1 or 2 <nl> + / / past the number of bytes read , we read ( and skipped ) a newline sequence . <nl> + char buffer [ 1025 ] ; <nl> + if ( g_interProcess . m_Callbacks - > File . read_file_string ( g_interProcess . m_Handle , m_pFile , buffer , sizeof ( buffer ) ) ) <nl> + { <nl> + strLine = buffer ; <nl> + return ! strLine . empty ( ) ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + ssize_t CVFSFile : : Write ( const void * lpBuf , size_t uiBufSize ) <nl> + { <nl> + if ( ! m_pFile ) <nl> + return 0 ; <nl> + return g_interProcess . m_Callbacks - > File . write_file ( g_interProcess . m_Handle , m_pFile , lpBuf , uiBufSize ) ; <nl> + } <nl> + <nl> + void CVFSFile : : Flush ( ) <nl> + { <nl> + if ( ! m_pFile ) <nl> + return ; <nl> + g_interProcess . m_Callbacks - > File . flush_file ( g_interProcess . m_Handle , m_pFile ) ; <nl> + } <nl> + <nl> + int64_t CVFSFile : : Seek ( int64_t iFilePosition , int iWhence ) <nl> + { <nl> + if ( ! m_pFile ) <nl> + return 0 ; <nl> + return g_interProcess . m_Callbacks - > File . seek_file ( g_interProcess . m_Handle , m_pFile , iFilePosition , iWhence ) ; <nl> + } <nl> + <nl> + int CVFSFile : : Truncate ( int64_t iSize ) <nl> + { <nl> + if ( ! m_pFile ) <nl> + return - 1 ; <nl> + return g_interProcess . m_Callbacks - > File . truncate_file ( g_interProcess . m_Handle , m_pFile , iSize ) ; <nl> + } <nl> + <nl> + int64_t CVFSFile : : GetPosition ( ) <nl> + { <nl> + if ( ! m_pFile ) <nl> + return - 1 ; <nl> + return g_interProcess . m_Callbacks - > File . get_file_position ( g_interProcess . m_Handle , m_pFile ) ; <nl> + } <nl> + <nl> + int64_t CVFSFile : : GetLength ( ) <nl> + { <nl> + if ( ! m_pFile ) <nl> + return 0 ; <nl> + return g_interProcess . m_Callbacks - > File . get_file_length ( g_interProcess . m_Handle , m_pFile ) ; <nl> + } <nl> + <nl> + void CVFSFile : : Close ( ) <nl> + { <nl> + if ( ! m_pFile ) <nl> + return ; <nl> + g_interProcess . m_Callbacks - > File . close_file ( g_interProcess . m_Handle , m_pFile ) ; <nl> + m_pFile = nullptr ; <nl> + } <nl> + <nl> + int CVFSFile : : GetChunkSize ( ) <nl> + { <nl> + if ( ! m_pFile ) <nl> + return 0 ; <nl> + return g_interProcess . m_Callbacks - > File . get_file_chunk_size ( g_interProcess . m_Handle , m_pFile ) ; <nl> + } <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + namespace VFSUtils <nl> + { <nl> + <nl> + bool CreateDirectory ( const std : : string & strPath ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > Directory . create_directory ( g_interProcess . m_Handle , strPath . c_str ( ) ) ; <nl> + } <nl> + <nl> + bool DirectoryExists ( const std : : string & strPath ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > Directory . directory_exists ( g_interProcess . m_Handle , strPath . c_str ( ) ) ; <nl> + } <nl> + <nl> + bool RemoveDirectory ( const std : : string & strPath ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > Directory . remove_directory ( g_interProcess . m_Handle , strPath . c_str ( ) ) ; <nl> + } <nl> + <nl> + bool GetDirectory ( <nl> + const std : : string & path , <nl> + const std : : string & mask , <nl> + std : : vector < CVFSDirEntry > & items ) <nl> + { <nl> + VFSDirEntry * dir_list = nullptr ; <nl> + unsigned int num_items = 0 ; <nl> + if ( g_interProcess . m_Callbacks - > VFS . get_directory ( g_interProcess . m_Handle , path . c_str ( ) , mask . c_str ( ) , & dir_list , & num_items ) ) <nl> + { <nl> + if ( dir_list ) <nl> + { <nl> + for ( unsigned int i = 0 ; i < num_items ; + + i ) <nl> + items . push_back ( CVFSDirEntry ( dir_list [ i ] ) ) ; <nl> + <nl> + g_interProcess . m_Callbacks - > VFS . free_directory ( g_interProcess . m_Handle , dir_list , num_items ) ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + std : : string MakeLegalFileName ( const std : : string & strFileName ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strLegalFileName = g_interProcess . m_Callbacks - > File . make_legal_filename ( g_interProcess . m_Handle , strFileName . c_str ( ) ) ; <nl> + if ( strLegalFileName ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strLegalFileName ) ) <nl> + strReturn = strLegalFileName ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strLegalFileName ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + std : : string MakeLegalPath ( const std : : string & strPath ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strLegalPath = g_interProcess . m_Callbacks - > File . make_legal_path ( g_interProcess . m_Handle , strPath . c_str ( ) ) ; <nl> + if ( strLegalPath ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strLegalPath ) ) <nl> + strReturn = strLegalPath ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strLegalPath ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + bool FileExists ( const std : : string & strFileName , bool bUseCache ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > File . file_exists ( g_interProcess . m_Handle , strFileName . c_str ( ) , bUseCache ) ; <nl> + } <nl> + <nl> + int StatFile ( const std : : string & strFileName , struct __stat64 * buffer ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > File . stat_file ( g_interProcess . m_Handle , strFileName . c_str ( ) , buffer ) ; <nl> + } <nl> + <nl> + bool DeleteFile ( const std : : string & strFileName ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > File . delete_file ( g_interProcess . m_Handle , strFileName . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string GetFileMD5 ( const std : : string & strPath ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strMd5 = g_interProcess . m_Callbacks - > File . get_file_md5 ( g_interProcess . m_Handle , strPath . c_str ( ) ) ; <nl> + if ( strMd5 ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strMd5 ) ) <nl> + strReturn = strMd5 ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strMd5 ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + std : : string GetCacheThumbName ( const std : : string & strFileName ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strThumbName = g_interProcess . m_Callbacks - > File . get_cache_thumb_name ( g_interProcess . m_Handle , strFileName . c_str ( ) ) ; <nl> + if ( strThumbName ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strThumbName ) ) <nl> + strReturn = strThumbName ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strThumbName ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + unsigned int GetChunkSize ( unsigned int chunk , unsigned int minimum ) <nl> + { <nl> + if ( chunk ) <nl> + return chunk * ( ( minimum + chunk - 1 ) / chunk ) ; <nl> + else <nl> + return minimum ; <nl> + } <nl> + <nl> + std : : string GetFileName ( const std : : string & strFileNameAndPath ) <nl> + { <nl> + / * find the last slash * / <nl> + const size_t slash = strFileNameAndPath . find_last_of ( " / \ \ " ) ; <nl> + return strFileNameAndPath . substr ( slash + 1 ) ; <nl> + } <nl> + <nl> + std : : string GetDirectoryName ( const std : : string & strFilePath ) <nl> + { <nl> + / / Will from a full filename return the directory the file resides in . <nl> + / / Keeps the final slash at end and possible | option = foo options . <nl> + <nl> + size_t iPosSlash = strFilePath . find_last_of ( " / \ \ " ) ; <nl> + if ( iPosSlash = = std : : string : : npos ) <nl> + return " " ; / / No slash , so no path ( ignore any options ) <nl> + <nl> + size_t iPosBar = strFilePath . rfind ( ' | ' ) ; <nl> + if ( iPosBar = = std : : string : : npos ) <nl> + return strFilePath . substr ( 0 , iPosSlash + 1 ) ; / / Only path <nl> + <nl> + return strFilePath . substr ( 0 , iPosSlash + 1 ) + strFilePath . substr ( iPosBar ) ; / / Path + options <nl> + } <nl> + <nl> + } / * namespace VFSUtils * / <nl> + <nl> + } / * namespace AddOn * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 695da0403f24 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / audioengine / AddonLib_AudioEngine_General . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , audioengine / General . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + <nl> + namespace AudioEngine <nl> + { <nl> + namespace General <nl> + { <nl> + <nl> + void AddDSPMenuHook ( AE_DSP_MENUHOOK * hook ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AudioEngine . add_dsp_menu_hook ( g_interProcess . m_Handle , hook ) ; <nl> + } <nl> + <nl> + void RemoveDSPMenuHook ( AE_DSP_MENUHOOK * hook ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AudioEngine . remove_dsp_menu_hook ( g_interProcess . m_Handle , hook ) ; <nl> + } <nl> + / * \ _________________________________________________________________________ <nl> + \ * / <nl> + void RegisterDSPMode ( AE_DSP_MODES : : AE_DSP_MODE * mode ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AudioEngine . register_dsp_mode ( g_interProcess . m_Handle , mode ) ; <nl> + } <nl> + <nl> + void UnregisterDSPMode ( AE_DSP_MODES : : AE_DSP_MODE * mode ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AudioEngine . unregister_dsp_Mode ( g_interProcess . m_Handle , mode ) ; <nl> + } <nl> + / * \ _________________________________________________________________________ <nl> + \ * / <nl> + bool GetCurrentSinkFormat ( AudioEngineFormat & SinkFormat ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngine . get_current_sink_format ( g_interProcess . m_Handle , & SinkFormat ) ; <nl> + } <nl> + <nl> + } / * namespace General * / <nl> + } / * namespace AudioEngine * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . cb20cca7027b <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / audioengine / AddonLib_AudioEngine_Stream . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , audioengine / Stream . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + <nl> + namespace AudioEngine <nl> + { <nl> + <nl> + CStream : : CStream ( <nl> + AudioEngineFormat Format , <nl> + unsigned int Options ) <nl> + { <nl> + m_StreamHandle = g_interProcess . m_Callbacks - > AudioEngine . make_stream ( g_interProcess . m_Handle , Format , Options ) ; <nl> + if ( ! m_StreamHandle ) <nl> + fprintf ( stderr , " libKODI_audioengine - ERROR : make_stream failed ! \ n " ) ; <nl> + m_planes = g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetChannelCount ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + CStream : : ~ CStream ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AudioEngine . free_stream ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + unsigned int CStream : : GetSpace ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetSpace ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + unsigned int CStream : : AddData ( uint8_t * const * Data , unsigned int Offset , unsigned int Frames ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_AddData ( g_interProcess . m_Handle , m_StreamHandle , Data , Offset , Frames ) ; <nl> + } <nl> + <nl> + double CStream : : GetDelay ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetDelay ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + bool CStream : : IsBuffering ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_IsBuffering ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + double CStream : : GetCacheTime ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetCacheTime ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + double CStream : : GetCacheTotal ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetCacheTotal ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + void CStream : : Pause ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_Pause ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + void CStream : : Resume ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_Resume ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + void CStream : : Drain ( bool Wait ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_Drain ( g_interProcess . m_Handle , m_StreamHandle , Wait ) ; <nl> + } <nl> + <nl> + bool CStream : : IsDraining ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_IsDraining ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + bool CStream : : IsDrained ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_IsDrained ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + void CStream : : Flush ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_Flush ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + float CStream : : GetVolume ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetVolume ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + void CStream : : SetVolume ( float Volume ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_SetVolume ( g_interProcess . m_Handle , m_StreamHandle , Volume ) ; <nl> + } <nl> + <nl> + float CStream : : GetAmplification ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetAmplification ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + void CStream : : SetAmplification ( float Amplify ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_SetAmplification ( g_interProcess . m_Handle , m_StreamHandle , Amplify ) ; <nl> + } <nl> + <nl> + const unsigned int CStream : : GetFrameSize ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetFrameSize ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + const unsigned int CStream : : GetChannelCount ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetChannelCount ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + const unsigned int CStream : : GetSampleRate ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetSampleRate ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + const AEDataFormat CStream : : GetDataFormat ( ) const <nl> + { <nl> + return ( AEDataFormat ) g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetDataFormat ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + double CStream : : GetResampleRatio ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_GetResampleRatio ( g_interProcess . m_Handle , m_StreamHandle ) ; <nl> + } <nl> + <nl> + void CStream : : SetResampleRatio ( double Ratio ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AudioEngineStream . AEStream_SetResampleRatio ( g_interProcess . m_Handle , m_StreamHandle , Ratio ) ; <nl> + } <nl> + <nl> + } / * namespace AudioEngine * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 127c3e2e5d89 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / dlfcn - win32 . cpp <nl> <nl> + / * <nl> + * dlfcn - win32 <nl> + * Copyright ( c ) 2007 Ramiro Polla <nl> + * <nl> + * This library is free software ; you can redistribute it and / or <nl> + * modify it under the terms of the GNU Lesser General Public <nl> + * License as published by the Free Software Foundation ; either <nl> + * version 2 . 1 of the License , or ( at your option ) any later version . <nl> + * <nl> + * This library is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU <nl> + * Lesser General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU Lesser General Public <nl> + * License along with this library ; if not , write to the Free Software <nl> + * Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA <nl> + * / <nl> + <nl> + # include < windows . h > <nl> + # include < stdio . h > <nl> + <nl> + # include " dlfcn - win32 . h " <nl> + <nl> + / * Note : <nl> + * MSDN says these functions are not thread - safe . We make no efforts to have <nl> + * any kind of thread safety . <nl> + * / <nl> + <nl> + / * I have no special reason to have set MAX_GLOBAL_OBJECTS to this value . Any <nl> + * comments are welcome . <nl> + * / <nl> + # define MAX_OBJECTS 255 <nl> + <nl> + static HMODULE global_objects [ MAX_OBJECTS ] ; <nl> + <nl> + / * This function adds an object to the list of global objects . <nl> + * The implementation is very simple and slow . <nl> + * TODO : should failing this function be enough to fail the call to dlopen ( ) ? <nl> + * / <nl> + static void global_object_add ( HMODULE hModule ) <nl> + { <nl> + int i ; <nl> + <nl> + for ( i = 0 ; i < MAX_OBJECTS ; i + + ) <nl> + { <nl> + if ( ! global_objects [ i ] ) <nl> + { <nl> + global_objects [ i ] = hModule ; <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + static void global_object_rem ( HMODULE hModule ) <nl> + { <nl> + int i ; <nl> + <nl> + for ( i = 0 ; i < MAX_OBJECTS ; i + + ) <nl> + { <nl> + if ( global_objects [ i ] = = hModule ) <nl> + { <nl> + global_objects [ i ] = 0 ; <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + / * Argument to last function . Used in dlerror ( ) * / <nl> + static char last_name [ MAX_PATH ] ; <nl> + <nl> + static int copy_string ( char * dest , int dest_size , const char * src ) <nl> + { <nl> + int i = 0 ; <nl> + <nl> + if ( src & & dest ) <nl> + { <nl> + for ( i = 0 ; i < dest_size - 1 ; i + + ) <nl> + { <nl> + if ( ! src [ i ] ) <nl> + break ; <nl> + else <nl> + dest [ i ] = src [ i ] ; <nl> + } <nl> + } <nl> + dest [ i ] = ' \ 0 ' ; <nl> + <nl> + return i ; <nl> + } <nl> + <nl> + void * dlopen ( const char * file , int mode ) <nl> + { <nl> + HMODULE hModule ; <nl> + UINT uMode ; <nl> + <nl> + / * Do not let Windows display the critical - error - handler message box * / <nl> + uMode = SetErrorMode ( SEM_FAILCRITICALERRORS ) ; <nl> + <nl> + if ( file = = 0 ) <nl> + { <nl> + / * Save NULL pointer for error message * / <nl> + _snprintf_s ( last_name , MAX_PATH , MAX_PATH , " 0x % p " , file ) ; <nl> + <nl> + / * POSIX says that if the value of file is 0 , a handle on a global <nl> + * symbol object must be provided . That object must be able to access <nl> + * all symbols from the original program file , and any objects loaded <nl> + * with the RTLD_GLOBAL flag . <nl> + * The return value from GetModuleHandle ( ) allows us to retrieve <nl> + * symbols only from the original program file . For objects loaded with <nl> + * the RTLD_GLOBAL flag , we create our own list later on . <nl> + * / <nl> + hModule = GetModuleHandle ( NULL ) ; <nl> + } <nl> + else <nl> + { <nl> + char lpFileName [ MAX_PATH ] ; <nl> + int i ; <nl> + <nl> + / * MSDN says backslashes * must * be used instead of forward slashes . * / <nl> + for ( i = 0 ; i < sizeof ( lpFileName ) - 1 ; i + + ) <nl> + { <nl> + if ( ! file [ i ] ) <nl> + break ; <nl> + else if ( file [ i ] = = ' / ' ) <nl> + lpFileName [ i ] = ' \ \ ' ; <nl> + else <nl> + lpFileName [ i ] = file [ i ] ; <nl> + } <nl> + lpFileName [ i ] = ' \ 0 ' ; <nl> + <nl> + / * Save file name for error message * / <nl> + copy_string ( last_name , sizeof ( last_name ) , lpFileName ) ; <nl> + <nl> + / * POSIX says the search path is implementation - defined . <nl> + * LOAD_WITH_ALTERED_SEARCH_PATH is used to make it behave more closely <nl> + * to UNIX ' s search paths ( start with system folders instead of current <nl> + * folder ) . <nl> + * / <nl> + hModule = LoadLibraryEx ( ( LPSTR ) lpFileName , NULL , <nl> + LOAD_WITH_ALTERED_SEARCH_PATH ) ; <nl> + / * If the object was loaded with RTLD_GLOBAL , add it to list of global <nl> + * objects , so that its symbols may be retrieved even if the handle for <nl> + * the original program file is passed . POSIX says that if the same <nl> + * file is specified in multiple invocations , and any of them are <nl> + * RTLD_GLOBAL , even if any further invocations use RTLD_LOCAL , the <nl> + * symbols will remain global . <nl> + * / <nl> + <nl> + if ( hModule & & ( mode & RTLD_GLOBAL ) ) <nl> + global_object_add ( hModule ) ; <nl> + } <nl> + <nl> + / * Return to previous state of the error - mode bit flags . * / <nl> + SetErrorMode ( uMode ) ; <nl> + <nl> + return ( void * ) hModule ; <nl> + } <nl> + <nl> + int dlclose ( void * handle ) <nl> + { <nl> + HMODULE hModule = ( HMODULE ) handle ; <nl> + BOOL ret ; <nl> + <nl> + / * Save handle for error message * / <nl> + _snprintf_s ( last_name , MAX_PATH , MAX_PATH , " 0x % p " , handle ) ; <nl> + <nl> + ret = FreeLibrary ( hModule ) ; <nl> + <nl> + / * If the object was loaded with RTLD_GLOBAL , remove it from list of global <nl> + * objects . <nl> + * / <nl> + if ( ret ) <nl> + global_object_rem ( hModule ) ; <nl> + <nl> + / * dlclose ' s return value in inverted in relation to FreeLibrary ' s . * / <nl> + ret = ! ret ; <nl> + <nl> + return ( int ) ret ; <nl> + } <nl> + <nl> + void * dlsym ( void * handle , const char * name ) <nl> + { <nl> + FARPROC symbol ; <nl> + HMODULE myhandle = ( HMODULE ) handle ; <nl> + <nl> + / * Save symbol name for error message * / <nl> + copy_string ( last_name , sizeof ( last_name ) , name ) ; <nl> + <nl> + symbol = GetProcAddress ( myhandle , name ) ; <nl> + # if 0 <nl> + if ( symbol = = NULL ) <nl> + { <nl> + HMODULE hModule ; <nl> + <nl> + / * If the handle for the original program file is passed , also search <nl> + * in all globally loaded objects . <nl> + * / <nl> + <nl> + hModule = GetModuleHandle ( NULL ) ; <nl> + <nl> + if ( hModule = = handle ) <nl> + { <nl> + int i ; <nl> + <nl> + for ( i = 0 ; i < MAX_OBJECTS ; i + + ) <nl> + { <nl> + if ( global_objects [ i ] ! = 0 ) <nl> + { <nl> + symbol = GetProcAddress ( global_objects [ i ] , name ) ; <nl> + if ( symbol ! = NULL ) <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + <nl> + CloseHandle ( hModule ) ; <nl> + } <nl> + # endif <nl> + return ( void * ) symbol ; <nl> + } <nl> + <nl> + char * dlerror ( void ) <nl> + { <nl> + DWORD dwMessageId ; <nl> + / * POSIX says this function doesn ' t have to be thread - safe , so we use one <nl> + * static buffer . <nl> + * MSDN says the buffer cannot be larger than 64K bytes , so we set it to <nl> + * the limit . <nl> + * / <nl> + static char lpBuffer [ 65535 ] ; <nl> + DWORD ret ; <nl> + <nl> + dwMessageId = GetLastError ( ) ; <nl> + <nl> + if ( dwMessageId = = 0 ) <nl> + return NULL ; <nl> + <nl> + / * Format error message to : <nl> + * " < argument to function that failed > " : < Windows localized error message > <nl> + * / <nl> + ret = copy_string ( lpBuffer , sizeof ( lpBuffer ) , " \ " " ) ; <nl> + ret + = copy_string ( lpBuffer + ret , sizeof ( lpBuffer ) - ret , last_name ) ; <nl> + ret + = copy_string ( lpBuffer + ret , sizeof ( lpBuffer ) - ret , " \ " : " ) ; <nl> + ret + = FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM , NULL , dwMessageId , <nl> + MAKELANGID ( LANG_NEUTRAL , SUBLANG_DEFAULT ) , <nl> + lpBuffer + ret , sizeof ( lpBuffer ) - ret , NULL ) ; <nl> + <nl> + if ( ret > 1 ) <nl> + { <nl> + / * POSIX says the string must not have trailing < newline > * / <nl> + if ( lpBuffer [ ret - 2 ] = = ' \ r ' & & lpBuffer [ ret - 1 ] = = ' \ n ' ) <nl> + lpBuffer [ ret - 2 ] = ' \ 0 ' ; <nl> + } <nl> + <nl> + / * POSIX says that invoking dlerror ( ) a second time , immediately following <nl> + * a prior invocation , shall result in NULL being returned . <nl> + * / <nl> + SetLastError ( 0 ) ; <nl> + <nl> + return lpBuffer ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . b93a029f2903 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / dlfcn - win32 . h <nl> <nl> + # pragma once <nl> + / * <nl> + * dlfcn - win32 <nl> + * Copyright ( c ) 2007 Ramiro Polla <nl> + * <nl> + * This library is free software ; you can redistribute it and / or <nl> + * modify it under the terms of the GNU Lesser General Public <nl> + * License as published by the Free Software Foundation ; either <nl> + * version 2 . 1 of the License , or ( at your option ) any later version . <nl> + * <nl> + * This library is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU <nl> + * Lesser General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU Lesser General Public <nl> + * License along with this library ; if not , write to the Free Software <nl> + * Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA <nl> + * / <nl> + <nl> + # ifndef DLFCN_H <nl> + # define DLFCN_H <nl> + <nl> + / * POSIX says these are implementation - defined . <nl> + * To simplify use with Windows API , we treat them the same way . <nl> + * / <nl> + <nl> + # define RTLD_LAZY 0 <nl> + # define RTLD_NOW 0 <nl> + <nl> + # define RTLD_GLOBAL ( 1 < < 1 ) <nl> + # define RTLD_LOCAL ( 1 < < 2 ) <nl> + <nl> + / * These two were added in The Open Group Base Specifications Issue 6 . <nl> + * Note : All other RTLD_ * flags in any dlfcn . h are not standard compliant . <nl> + * / <nl> + <nl> + # define RTLD_DEFAULT 0 <nl> + # define RTLD_NEXT 0 <nl> + <nl> + void * dlopen ( const char * file , int mode ) ; <nl> + int dlclose ( void * handle ) ; <nl> + void * dlsym ( void * handle , const char * name ) ; <nl> + char * dlerror ( void ) ; <nl> + <nl> + # endif / * DLFCN - WIN32_H * / <nl> new file mode 100644 <nl> index 000000000000 . . 4e4dd5607254 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlButton . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlButton . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlButton : : CControlButton ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_Button ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlButton can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlButton : : ~ CControlButton ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlButton : : SetVisible ( bool visible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Button . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , visible ) ; <nl> + } <nl> + <nl> + void CControlButton : : SetEnabled ( bool enabled ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Button . SetEnabled ( g_interProcess . m_Handle , m_ControlHandle , enabled ) ; <nl> + } <nl> + <nl> + void CControlButton : : SetLabel ( const std : : string & label ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Button . SetLabel ( g_interProcess . m_Handle , m_ControlHandle , label . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CControlButton : : GetLabel ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Control . Button . GetLabel ( g_interProcess . m_Handle , m_ControlHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + void CControlButton : : SetLabel2 ( const std : : string & label ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Button . SetLabel2 ( g_interProcess . m_Handle , m_ControlHandle , label . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CControlButton : : GetLabel2 ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Control . Button . GetLabel2 ( g_interProcess . m_Handle , m_ControlHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 148a8aa87d4e <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlEdit . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlEdit . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlEdit : : CControlEdit ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_Edit ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlEdit can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlEdit : : ~ CControlEdit ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlEdit : : SetVisible ( bool visible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Edit . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , visible ) ; <nl> + } <nl> + <nl> + void CControlEdit : : SetEnabled ( bool enabled ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Edit . SetEnabled ( g_interProcess . m_Handle , m_ControlHandle , enabled ) ; <nl> + } <nl> + <nl> + void CControlEdit : : SetLabel ( const std : : string & label ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Edit . SetLabel ( g_interProcess . m_Handle , m_ControlHandle , label . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CControlEdit : : GetLabel ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Control . Edit . GetLabel ( g_interProcess . m_Handle , m_ControlHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + void CControlEdit : : SetText ( const std : : string & text ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Edit . SetText ( g_interProcess . m_Handle , m_ControlHandle , text . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CControlEdit : : GetText ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Control . Edit . GetText ( g_interProcess . m_Handle , m_ControlHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + void CControlEdit : : SetCursorPosition ( unsigned int iPosition ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Edit . SetCursorPosition ( g_interProcess . m_Handle , m_ControlHandle , iPosition ) ; <nl> + } <nl> + <nl> + unsigned int CControlEdit : : GetCursorPosition ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . Edit . GetCursorPosition ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlEdit : : SetInputType ( AddonGUIInputType type , const std : : string & heading ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Edit . SetInputType ( g_interProcess . m_Handle , m_ControlHandle , type , heading . c_str ( ) ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 4fd1be9013e5 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlFadeLabel . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlFadeLabel . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlFadeLabel : : CControlFadeLabel ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_FadeLabel ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlFadeLabel can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlFadeLabel : : ~ CControlFadeLabel ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlFadeLabel : : SetVisible ( bool visible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . FadeLabel . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , visible ) ; <nl> + } <nl> + <nl> + void CControlFadeLabel : : AddLabel ( const std : : string & text ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . FadeLabel . AddLabel ( g_interProcess . m_Handle , m_ControlHandle , text . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CControlFadeLabel : : GetLabel ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Control . FadeLabel . GetLabel ( g_interProcess . m_Handle , m_ControlHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + void CControlFadeLabel : : SetScrolling ( bool scroll ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . FadeLabel . SetScrolling ( g_interProcess . m_Handle , m_ControlHandle , scroll ) ; <nl> + } <nl> + <nl> + void CControlFadeLabel : : Reset ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . FadeLabel . Reset ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . d3ef29d56ba4 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlImage . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlImage . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlImage : : CControlImage ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_Image ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlImage can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlImage : : ~ CControlImage ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlImage : : SetVisible ( bool visible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Image . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , visible ) ; <nl> + } <nl> + <nl> + void CControlImage : : SetFileName ( const std : : string & strFileName , const bool useCache ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Image . SetFileName ( g_interProcess . m_Handle , m_ControlHandle , strFileName . c_str ( ) , useCache ) ; <nl> + } <nl> + <nl> + void CControlImage : : SetColorDiffuse ( uint32_t colorDiffuse ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Image . SetColorDiffuse ( g_interProcess . m_Handle , m_ControlHandle , colorDiffuse ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 17973385371b <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlLabel . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlLabel . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlLabel : : CControlLabel ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_Label ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlLabel can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlLabel : : ~ CControlLabel ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlLabel : : SetVisible ( bool visible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Label . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , visible ) ; <nl> + } <nl> + <nl> + void CControlLabel : : SetLabel ( const std : : string & text ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Label . SetLabel ( g_interProcess . m_Handle , m_ControlHandle , text . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CControlLabel : : GetLabel ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Control . Label . GetLabel ( g_interProcess . m_Handle , m_ControlHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 9e4c25f2d2d5 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlProgress . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlProgress . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlProgress : : CControlProgress ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_Progress ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlProgress can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlProgress : : ~ CControlProgress ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlProgress : : SetVisible ( bool visible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Progress . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , visible ) ; <nl> + } <nl> + <nl> + void CControlProgress : : SetPercentage ( float percent ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Progress . SetPercentage ( g_interProcess . m_Handle , m_ControlHandle , percent ) ; <nl> + } <nl> + <nl> + float CControlProgress : : GetPercentage ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . Progress . GetPercentage ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . a5e897fc7c6d <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlRadioButton . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlRadioButton . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlRadioButton : : CControlRadioButton ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_RadioButton ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlRadioButton can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlRadioButton : : ~ CControlRadioButton ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlRadioButton : : SetVisible ( bool visible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . RadioButton . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , visible ) ; <nl> + } <nl> + <nl> + void CControlRadioButton : : SetEnabled ( bool enabled ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . RadioButton . SetEnabled ( g_interProcess . m_Handle , m_ControlHandle , enabled ) ; <nl> + } <nl> + <nl> + void CControlRadioButton : : SetLabel ( const std : : string & label ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . RadioButton . SetLabel ( g_interProcess . m_Handle , m_ControlHandle , label . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CControlRadioButton : : GetLabel ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Control . RadioButton . GetLabel ( g_interProcess . m_Handle , m_ControlHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + void CControlRadioButton : : SetSelected ( bool yesNo ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . RadioButton . SetSelected ( g_interProcess . m_Handle , m_ControlHandle , yesNo ) ; <nl> + } <nl> + <nl> + bool CControlRadioButton : : IsSelected ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . RadioButton . IsSelected ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 22e4e211eedc <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlRendering . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlRendering . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlRendering : : CControlRendering ( <nl> + CWindow * window , <nl> + int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_RenderAddon ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( m_ControlHandle ) <nl> + g_interProcess . m_Callbacks - > GUI . Control . Rendering . SetCallbacks ( g_interProcess . m_Handle , m_ControlHandle , this , <nl> + OnCreateCB , OnRenderCB , OnStopCB , OnDirtyCB ) ; <nl> + else <nl> + fprintf ( stderr , " ERROR : CControlRendering can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlRendering : : ~ CControlRendering ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Rendering . Delete ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + / * ! <nl> + * Kodi to add - on override definition function to use if class becomes used <nl> + * independet . <nl> + * / <nl> + <nl> + void CControlRendering : : SetIndependentCallbacks ( <nl> + GUIHANDLE cbhdl , <nl> + bool ( * CBCreate ) ( GUIHANDLE cbhdl , <nl> + int x , <nl> + int y , <nl> + int w , <nl> + int h , <nl> + void * device ) , <nl> + void ( * CBRender ) ( GUIHANDLE cbhdl ) , <nl> + void ( * CBStop ) ( GUIHANDLE cbhdl ) , <nl> + bool ( * CBDirty ) ( GUIHANDLE cbhdl ) ) <nl> + { <nl> + if ( ! cbhdl | | <nl> + ! CBCreate | | ! CBRender | | ! CBStop | | ! CBDirty ) <nl> + { <nl> + fprintf ( stderr , " ERROR : CControlRendering - SetIndependentCallbacks called with nullptr ! ! ! \ n " ) ; <nl> + return ; <nl> + } <nl> + <nl> + g_interProcess . m_Callbacks - > GUI . Control . Rendering . SetCallbacks ( g_interProcess . m_Handle , m_ControlHandle , cbhdl , <nl> + CBCreate , CBRender , CBStop , CBDirty ) ; <nl> + } <nl> + <nl> + / * ! <nl> + * Defined callback functions from Kodi to add - on , for use in parent / child system <nl> + * ( is private ) ! <nl> + * / <nl> + <nl> + bool CControlRendering : : OnCreateCB ( GUIHANDLE cbhdl , int x , int y , int w , int h , void * device ) <nl> + { <nl> + return static_cast < CControlRendering * > ( cbhdl ) - > Create ( x , y , w , h , device ) ; <nl> + } <nl> + <nl> + void CControlRendering : : OnRenderCB ( GUIHANDLE cbhdl ) <nl> + { <nl> + static_cast < CControlRendering * > ( cbhdl ) - > Render ( ) ; <nl> + } <nl> + <nl> + void CControlRendering : : OnStopCB ( GUIHANDLE cbhdl ) <nl> + { <nl> + static_cast < CControlRendering * > ( cbhdl ) - > Stop ( ) ; <nl> + } <nl> + <nl> + bool CControlRendering : : OnDirtyCB ( GUIHANDLE cbhdl ) <nl> + { <nl> + return static_cast < CControlRendering * > ( cbhdl ) - > Dirty ( ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . ccac7e550f5c <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlSettingsSlider . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlSettingsSlider . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlSettingsSlider : : CControlSettingsSlider ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_SettingsSlider ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlSettingsSlider can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlSettingsSlider : : ~ CControlSettingsSlider ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlSettingsSlider : : SetVisible ( bool visible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , visible ) ; <nl> + } <nl> + <nl> + void CControlSettingsSlider : : SetEnabled ( bool enabled ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . SetEnabled ( g_interProcess . m_Handle , m_ControlHandle , enabled ) ; <nl> + } <nl> + <nl> + void CControlSettingsSlider : : SetText ( const std : : string & label ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . SetText ( g_interProcess . m_Handle , m_ControlHandle , label . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CControlSettingsSlider : : Reset ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . Reset ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlSettingsSlider : : SetIntRange ( int start , int end ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . SetIntRange ( g_interProcess . m_Handle , m_ControlHandle , start , end ) ; <nl> + } <nl> + <nl> + void CControlSettingsSlider : : SetIntValue ( int value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . SetIntValue ( g_interProcess . m_Handle , m_ControlHandle , value ) ; <nl> + } <nl> + <nl> + int CControlSettingsSlider : : GetIntValue ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . GetIntValue ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlSettingsSlider : : SetIntInterval ( int interval ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . SetIntInterval ( g_interProcess . m_Handle , m_ControlHandle , interval ) ; <nl> + } <nl> + <nl> + void CControlSettingsSlider : : SetPercentage ( float percent ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . SetPercentage ( g_interProcess . m_Handle , m_ControlHandle , percent ) ; <nl> + } <nl> + <nl> + float CControlSettingsSlider : : GetPercentage ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . GetPercentage ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlSettingsSlider : : SetFloatRange ( float start , float end ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . SetFloatRange ( g_interProcess . m_Handle , m_ControlHandle , start , end ) ; <nl> + } <nl> + <nl> + void CControlSettingsSlider : : SetFloatValue ( float value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . SetFloatValue ( g_interProcess . m_Handle , m_ControlHandle , value ) ; <nl> + } <nl> + <nl> + float CControlSettingsSlider : : GetFloatValue ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . GetFloatValue ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlSettingsSlider : : SetFloatInterval ( float interval ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . SettingsSlider . SetFloatInterval ( g_interProcess . m_Handle , m_ControlHandle , interval ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 1a2c6de56dc0 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlSlider . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlSlider . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlSlider : : CControlSlider ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_Slider ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlSlider can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlSlider : : ~ CControlSlider ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlSlider : : SetVisible ( bool yesNo ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Slider . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , yesNo ) ; <nl> + } <nl> + <nl> + void CControlSlider : : SetEnabled ( bool yesNo ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Slider . SetEnabled ( g_interProcess . m_Handle , m_ControlHandle , yesNo ) ; <nl> + } <nl> + <nl> + std : : string CControlSlider : : GetDescription ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Control . Slider . GetDescription ( g_interProcess . m_Handle , m_ControlHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + void CControlSlider : : SetIntRange ( int start , int end ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Slider . SetIntRange ( g_interProcess . m_Handle , m_ControlHandle , start , end ) ; <nl> + } <nl> + <nl> + void CControlSlider : : SetIntValue ( int value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Slider . SetIntValue ( g_interProcess . m_Handle , m_ControlHandle , value ) ; <nl> + } <nl> + <nl> + int CControlSlider : : GetIntValue ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . Slider . GetIntValue ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlSlider : : SetIntInterval ( int interval ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Slider . SetIntInterval ( g_interProcess . m_Handle , m_ControlHandle , interval ) ; <nl> + } <nl> + <nl> + void CControlSlider : : SetPercentage ( float percent ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Slider . SetPercentage ( g_interProcess . m_Handle , m_ControlHandle , percent ) ; <nl> + } <nl> + <nl> + float CControlSlider : : GetPercentage ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . Slider . GetPercentage ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlSlider : : SetFloatRange ( float start , float end ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Slider . SetFloatRange ( g_interProcess . m_Handle , m_ControlHandle , start , end ) ; <nl> + } <nl> + <nl> + void CControlSlider : : SetFloatValue ( float value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Slider . SetFloatValue ( g_interProcess . m_Handle , m_ControlHandle , value ) ; <nl> + } <nl> + <nl> + float CControlSlider : : GetFloatValue ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . Slider . GetFloatValue ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlSlider : : SetFloatInterval ( float interval ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Slider . SetFloatInterval ( g_interProcess . m_Handle , m_ControlHandle , interval ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 1fa708d7d2c3 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlSpin . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlSpin . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlSpin : : CControlSpin ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_Spin ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlSpin can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlSpin : : ~ CControlSpin ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlSpin : : SetVisible ( bool visible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , visible ) ; <nl> + } <nl> + <nl> + void CControlSpin : : SetEnabled ( bool enabled ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . SetEnabled ( g_interProcess . m_Handle , m_ControlHandle , enabled ) ; <nl> + } <nl> + <nl> + void CControlSpin : : SetText ( const std : : string & label ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . SetText ( g_interProcess . m_Handle , m_ControlHandle , label . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CControlSpin : : Reset ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . Reset ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlSpin : : SetType ( AddonGUISpinControlType type ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . SetType ( g_interProcess . m_Handle , m_ControlHandle , ( int ) type ) ; <nl> + } <nl> + <nl> + void CControlSpin : : AddLabel ( const std : : string & label , const std : : string & value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . AddStringLabel ( g_interProcess . m_Handle , m_ControlHandle , label . c_str ( ) , value . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CControlSpin : : AddLabel ( const std : : string & label , int value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . AddIntLabel ( g_interProcess . m_Handle , m_ControlHandle , label . c_str ( ) , value ) ; <nl> + } <nl> + <nl> + void CControlSpin : : SetStringValue ( const std : : string & value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . SetStringValue ( g_interProcess . m_Handle , m_ControlHandle , value . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CControlSpin : : GetStringValue ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . GetStringValue ( g_interProcess . m_Handle , m_ControlHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + void CControlSpin : : SetIntRange ( int start , int end ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . SetIntRange ( g_interProcess . m_Handle , m_ControlHandle , start , end ) ; <nl> + } <nl> + <nl> + void CControlSpin : : SetIntValue ( int value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . SetIntValue ( g_interProcess . m_Handle , m_ControlHandle , value ) ; <nl> + } <nl> + <nl> + int CControlSpin : : GetIntValue ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . Spin . GetIntValue ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlSpin : : SetFloatRange ( float start , float end ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . SetFloatRange ( g_interProcess . m_Handle , m_ControlHandle , start , end ) ; <nl> + } <nl> + <nl> + void CControlSpin : : SetFloatValue ( float value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . SetFloatValue ( g_interProcess . m_Handle , m_ControlHandle , value ) ; <nl> + } <nl> + <nl> + float CControlSpin : : GetFloatValue ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Control . Spin . GetFloatValue ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlSpin : : SetFloatInterval ( float interval ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . Spin . SetFloatInterval ( g_interProcess . m_Handle , m_ControlHandle , interval ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 178445ac62ca <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ControlTextBox . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ControlTextBox . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CControlTextBox : : CControlTextBox ( CWindow * window , int controlId ) <nl> + : m_Window ( window ) , <nl> + m_ControlId ( controlId ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > GUI . Window . GetControl_TextBox ( g_interProcess . m_Handle , m_Window - > m_WindowHandle , controlId ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CControlTextBox can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CControlTextBox : : ~ CControlTextBox ( ) <nl> + { <nl> + } <nl> + <nl> + void CControlTextBox : : SetVisible ( bool visible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . TextBox . SetVisible ( g_interProcess . m_Handle , m_ControlHandle , visible ) ; <nl> + } <nl> + <nl> + void CControlTextBox : : Reset ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . TextBox . Reset ( m_ControlHandle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CControlTextBox : : SetText ( const std : : string & text ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . TextBox . SetText ( g_interProcess . m_Handle , m_ControlHandle , text . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CControlTextBox : : GetText ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 16384 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Control . TextBox . GetText ( g_interProcess . m_Handle , m_ControlHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + void CControlTextBox : : Scroll ( unsigned int position ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . TextBox . Scroll ( g_interProcess . m_Handle , m_ControlHandle , position ) ; <nl> + } <nl> + <nl> + void CControlTextBox : : SetAutoScrolling ( int delay , int time , int repeat ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Control . TextBox . SetAutoScrolling ( g_interProcess . m_Handle , m_ControlHandle , delay , time , repeat ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 39183f805410 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_DialogContextMenu . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / DialogContextMenu . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + namespace DialogContextMenu <nl> + { <nl> + <nl> + int Show ( <nl> + const std : : string & heading , <nl> + const std : : vector < std : : string > & entries ) <nl> + { <nl> + unsigned int size = entries . size ( ) ; <nl> + const char * * cEntries = ( const char * * ) malloc ( size * sizeof ( const char * * ) ) ; <nl> + for ( unsigned int i = 0 ; i < size ; + + i ) <nl> + { <nl> + cEntries [ i ] = entries [ i ] . c_str ( ) ; <nl> + } <nl> + int ret = g_interProcess . m_Callbacks - > GUI . Dialogs . ContextMenu . Open ( heading . c_str ( ) , cEntries , size ) ; <nl> + free ( cEntries ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + } / * namespace DialogContextMenu * / <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . ebc5c6ac5a7d <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_DialogExtendedProgress . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / DialogExtendedProgress . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CDialogExtendedProgress : : CDialogExtendedProgress ( const std : : string & title ) <nl> + { <nl> + m_DialogHandle = g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . New ( g_interProcess . m_Handle , title . c_str ( ) ) ; <nl> + if ( ! m_DialogHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CDialogExtendedProgress can ' t create window class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CDialogExtendedProgress : : ~ CDialogExtendedProgress ( ) <nl> + { <nl> + if ( m_DialogHandle ) <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . Delete ( g_interProcess . m_Handle , m_DialogHandle ) ; <nl> + } <nl> + <nl> + std : : string CDialogExtendedProgress : : Title ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . Title ( g_interProcess . m_Handle , m_DialogHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + void CDialogExtendedProgress : : SetTitle ( const std : : string & title ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . SetTitle ( g_interProcess . m_Handle , m_DialogHandle , title . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CDialogExtendedProgress : : Text ( ) const <nl> + { <nl> + std : : string text ; <nl> + text . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) text . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . Text ( g_interProcess . m_Handle , m_DialogHandle , text [ 0 ] , size ) ; <nl> + text . resize ( size ) ; <nl> + text . shrink_to_fit ( ) ; <nl> + return text ; <nl> + } <nl> + <nl> + void CDialogExtendedProgress : : SetText ( const std : : string & text ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . SetText ( g_interProcess . m_Handle , m_DialogHandle , text . c_str ( ) ) ; <nl> + } <nl> + <nl> + bool CDialogExtendedProgress : : IsFinished ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . IsFinished ( g_interProcess . m_Handle , m_DialogHandle ) ; <nl> + } <nl> + <nl> + void CDialogExtendedProgress : : MarkFinished ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . MarkFinished ( g_interProcess . m_Handle , m_DialogHandle ) ; <nl> + } <nl> + <nl> + float CDialogExtendedProgress : : Percentage ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . Percentage ( g_interProcess . m_Handle , m_DialogHandle ) ; <nl> + } <nl> + <nl> + void CDialogExtendedProgress : : SetPercentage ( float fPercentage ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . SetPercentage ( g_interProcess . m_Handle , m_DialogHandle , fPercentage ) ; <nl> + } <nl> + <nl> + void CDialogExtendedProgress : : SetProgress ( int currentItem , int itemCount ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . ExtendedProgress . SetProgress ( g_interProcess . m_Handle , m_DialogHandle , currentItem , itemCount ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 96ccd8d69cb7 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_DialogFileBrowser . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / DialogFileBrowser . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + namespace DialogFileBrowser <nl> + { <nl> + <nl> + bool ShowAndGetDirectory ( <nl> + const std : : string & shares , <nl> + const std : : string & heading , <nl> + std : : string & path , <nl> + bool bWriteOnly ) <nl> + { <nl> + path . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) path . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . FileBrowser . ShowAndGetDirectory ( shares . c_str ( ) , heading . c_str ( ) , path [ 0 ] , size , bWriteOnly ) ; <nl> + path . resize ( size ) ; <nl> + path . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetFile ( <nl> + const std : : string & shares , <nl> + const std : : string & mask , <nl> + const std : : string & heading , <nl> + std : : string & file , <nl> + bool useThumbs , <nl> + bool useFileDirectories ) <nl> + { <nl> + file . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) file . capacity ( ) ; ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . FileBrowser . ShowAndGetFile ( shares . c_str ( ) , mask . c_str ( ) , heading . c_str ( ) , file [ 0 ] , size , useThumbs , useFileDirectories ) ; <nl> + file . resize ( size ) ; <nl> + file . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetFileFromDir ( <nl> + const std : : string & directory , <nl> + const std : : string & mask , <nl> + const std : : string & heading , <nl> + std : : string & path , <nl> + bool useThumbs , <nl> + bool useFileDirectories , <nl> + bool singleList ) <nl> + { <nl> + path . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) path . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . FileBrowser . ShowAndGetFileFromDir ( directory . c_str ( ) , mask . c_str ( ) , heading . c_str ( ) , path [ 0 ] , size , useThumbs , useFileDirectories , singleList ) ; <nl> + path . resize ( size ) ; <nl> + path . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetFileList ( <nl> + const std : : string & shares , <nl> + const std : : string & mask , <nl> + const std : : string & heading , <nl> + std : : vector < std : : string > & path , <nl> + bool useThumbs , <nl> + bool useFileDirectories ) <nl> + { <nl> + char * * list ; <nl> + unsigned int listSize = 0 ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . FileBrowser . ShowAndGetFileList ( shares . c_str ( ) , mask . c_str ( ) , heading . c_str ( ) , list , listSize , useThumbs , useFileDirectories ) ; <nl> + if ( ret ) <nl> + { <nl> + for ( unsigned int i = 0 ; i < listSize ; + + i ) <nl> + path . push_back ( list [ i ] ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . FileBrowser . ClearList ( list , listSize ) ; <nl> + } <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetSource ( <nl> + std : : string & path , <nl> + bool allowNetworkShares , <nl> + const std : : string & additionalShare , <nl> + const std : : string & strType ) <nl> + { <nl> + path . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) path . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . FileBrowser . ShowAndGetSource ( path [ 0 ] , size , allowNetworkShares , additionalShare . c_str ( ) , strType . c_str ( ) ) ; <nl> + path . resize ( size ) ; <nl> + path . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetImage ( <nl> + const std : : string & shares , <nl> + const std : : string & heading , <nl> + std : : string & path ) <nl> + { <nl> + path . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) path . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . FileBrowser . ShowAndGetImage ( shares . c_str ( ) , heading . c_str ( ) , path [ 0 ] , size ) ; <nl> + path . resize ( size ) ; <nl> + path . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetImageList ( <nl> + const std : : string & shares , <nl> + const std : : string & heading , <nl> + std : : vector < std : : string > & path ) <nl> + { <nl> + char * * list ; <nl> + unsigned int listSize = 0 ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . FileBrowser . ShowAndGetImageList ( shares . c_str ( ) , heading . c_str ( ) , list , listSize ) ; <nl> + if ( ret ) <nl> + { <nl> + for ( unsigned int i = 0 ; i < listSize ; + + i ) <nl> + path . push_back ( list [ i ] ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . FileBrowser . ClearList ( list , listSize ) ; <nl> + } <nl> + return ret ; <nl> + } <nl> + <nl> + } / * namespace DialogFileBrowser * / <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 88fbdc9c1a35 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_DialogKeyboard . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / DialogKeyboard . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + namespace DialogKeyboard <nl> + { <nl> + <nl> + bool ShowAndGetInput ( <nl> + std : : string & strText , <nl> + const std : : string & strHeading , <nl> + bool allowEmptyResult , <nl> + bool hiddenInput , <nl> + unsigned int autoCloseMs ) <nl> + { <nl> + strText . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strText . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Keyboard . ShowAndGetInputWithHead ( strText [ 0 ] , size , strHeading . c_str ( ) , allowEmptyResult , hiddenInput , autoCloseMs ) ; <nl> + strText . resize ( size ) ; <nl> + strText . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetInput ( <nl> + std : : string & strText , <nl> + bool allowEmptyResult , <nl> + unsigned int autoCloseMs ) <nl> + { <nl> + strText . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strText . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Keyboard . ShowAndGetInput ( strText [ 0 ] , size , allowEmptyResult , autoCloseMs ) ; <nl> + strText . resize ( size ) ; <nl> + strText . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetNewPassword ( <nl> + std : : string & strNewPassword , <nl> + const std : : string & strHeading , <nl> + bool allowEmptyResult , <nl> + unsigned int autoCloseMs ) <nl> + { <nl> + strNewPassword . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strNewPassword . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Keyboard . ShowAndGetNewPasswordWithHead ( strNewPassword [ 0 ] , size , strHeading . c_str ( ) , allowEmptyResult , autoCloseMs ) ; <nl> + strNewPassword . resize ( size ) ; <nl> + strNewPassword . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetNewPassword ( <nl> + std : : string & strNewPassword , <nl> + unsigned int autoCloseMs ) <nl> + { <nl> + strNewPassword . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strNewPassword . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Keyboard . ShowAndGetNewPassword ( strNewPassword [ 0 ] , size , autoCloseMs ) ; <nl> + strNewPassword . resize ( size ) ; <nl> + strNewPassword . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndVerifyNewPassword ( <nl> + std : : string & strNewPassword , <nl> + const std : : string & strHeading , <nl> + bool allowEmptyResult , <nl> + unsigned int autoCloseMs ) <nl> + { <nl> + strNewPassword . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strNewPassword . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Keyboard . ShowAndGetNewPasswordWithHead ( strNewPassword [ 0 ] , size , strHeading . c_str ( ) , allowEmptyResult , autoCloseMs ) ; <nl> + strNewPassword . resize ( size ) ; <nl> + strNewPassword . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndVerifyNewPassword ( <nl> + std : : string & strNewPassword , <nl> + unsigned int autoCloseMs ) <nl> + { <nl> + strNewPassword . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strNewPassword . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Keyboard . ShowAndVerifyNewPassword ( strNewPassword [ 0 ] , size , autoCloseMs ) ; <nl> + strNewPassword . resize ( size ) ; <nl> + strNewPassword . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + int ShowAndVerifyPassword ( <nl> + std : : string & strPassword , <nl> + const std : : string & strHeading , <nl> + int iRetries , <nl> + unsigned int autoCloseMs ) <nl> + { <nl> + strPassword . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strPassword . capacity ( ) ; <nl> + int ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Keyboard . ShowAndVerifyPassword ( strPassword [ 0 ] , size , strHeading . c_str ( ) , iRetries , autoCloseMs ) ; <nl> + strPassword . resize ( size ) ; <nl> + strPassword . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetFilter ( <nl> + std : : string & strText , <nl> + bool searching , <nl> + unsigned int autoCloseMs ) <nl> + { <nl> + strText . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strText . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Keyboard . ShowAndGetFilter ( strText [ 0 ] , size , searching , autoCloseMs ) ; <nl> + strText . resize ( size ) ; <nl> + strText . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool SendTextToActiveKeyboard ( <nl> + const std : : string & aTextString , <nl> + bool closeKeyboard ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . Keyboard . SendTextToActiveKeyboard ( aTextString . c_str ( ) , closeKeyboard ) ; <nl> + } <nl> + <nl> + bool IsKeyboardActivated ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . Keyboard . isKeyboardActivated ( ) ; <nl> + } <nl> + <nl> + } / * namespace DialogKeyboard * / <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 1b2e3e4b81e0 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_DialogNumeric . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / DialogNumeric . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + namespace DialogNumeric <nl> + { <nl> + <nl> + bool ShowAndVerifyNewPassword ( <nl> + std : : string & strNewPassword ) <nl> + { <nl> + strNewPassword . reserve ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strNewPassword . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Numeric . ShowAndVerifyNewPassword ( strNewPassword [ 0 ] , size ) ; <nl> + strNewPassword . resize ( size ) ; <nl> + strNewPassword . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + int ShowAndVerifyPassword ( <nl> + std : : string & strPassword , <nl> + const std : : string & strHeading , <nl> + int iRetries ) <nl> + { <nl> + strPassword . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strPassword . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Numeric . ShowAndVerifyPassword ( strPassword [ 0 ] , size , strHeading . c_str ( ) , iRetries ) ; <nl> + strPassword . resize ( size ) ; <nl> + strPassword . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndVerifyInput ( <nl> + std : : string & strToVerify , <nl> + const std : : string & strHeading , <nl> + bool bVerifyInput ) <nl> + { <nl> + strToVerify . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strToVerify . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Numeric . ShowAndVerifyInput ( strToVerify [ 0 ] , size , strHeading . c_str ( ) , bVerifyInput ) ; <nl> + strToVerify . resize ( size ) ; <nl> + strToVerify . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetTime ( <nl> + tm & time , <nl> + const std : : string & strHeading ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . Numeric . ShowAndGetTime ( time , strHeading . c_str ( ) ) ; <nl> + } <nl> + <nl> + bool ShowAndGetDate ( <nl> + tm & date , <nl> + const std : : string & strHeading ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . Numeric . ShowAndGetDate ( date , strHeading . c_str ( ) ) ; <nl> + } <nl> + <nl> + bool ShowAndGetIPAddress ( <nl> + std : : string & strIPAddress , <nl> + const std : : string & strHeading ) <nl> + { <nl> + strIPAddress . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strIPAddress . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Numeric . ShowAndGetIPAddress ( strIPAddress [ 0 ] , size , strHeading . c_str ( ) ) ; <nl> + strIPAddress . resize ( size ) ; <nl> + strIPAddress . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetNumber ( <nl> + std : : string & strInput , <nl> + const std : : string & strHeading , <nl> + unsigned int iAutoCloseTimeoutMs ) <nl> + { <nl> + strInput . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strInput . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Numeric . ShowAndGetNumber ( strInput [ 0 ] , size , strHeading . c_str ( ) , iAutoCloseTimeoutMs ) ; <nl> + strInput . resize ( size ) ; <nl> + strInput . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + bool ShowAndGetSeconds ( <nl> + std : : string & strTime , <nl> + const std : : string & strHeading ) <nl> + { <nl> + strTime . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) strTime . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Numeric . ShowAndGetSeconds ( strTime [ 0 ] , size , strHeading . c_str ( ) ) ; <nl> + strTime . resize ( size ) ; <nl> + strTime . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + } / * namespace DialogNumeric * / <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 5ffe10bd8f61 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_DialogOK . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / DialogOK . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + namespace DialogOK <nl> + { <nl> + <nl> + void ShowAndGetInput ( <nl> + const std : : string & heading , <nl> + const std : : string & text ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . OK . ShowAndGetInputSingleText ( heading . c_str ( ) , text . c_str ( ) ) ; <nl> + } <nl> + <nl> + void ShowAndGetInput ( <nl> + const std : : string & heading , <nl> + const std : : string & line0 , <nl> + const std : : string & line1 , <nl> + const std : : string & line2 ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . OK . ShowAndGetInputLineText ( heading . c_str ( ) , line0 . c_str ( ) , line1 . c_str ( ) , line2 . c_str ( ) ) ; <nl> + } <nl> + <nl> + } / * namespace DialogOK * / <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 222021411f37 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_DialogProgress . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / DialogProgress . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CDialogProgress : : CDialogProgress ( ) <nl> + { <nl> + m_DialogHandle = g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . New ( g_interProcess . m_Handle ) ; <nl> + if ( ! m_DialogHandle ) <nl> + fprintf ( stderr , " libKODI_guilib - ERROR : CDialogProgress can ' t create window class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CDialogProgress : : ~ CDialogProgress ( ) <nl> + { <nl> + if ( m_DialogHandle ) <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . Delete ( g_interProcess . m_Handle , m_DialogHandle ) ; <nl> + } <nl> + <nl> + void CDialogProgress : : Open ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . Open ( g_interProcess . m_Handle , m_DialogHandle ) ; <nl> + } <nl> + <nl> + void CDialogProgress : : SetHeading ( const std : : string & title ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . SetHeading ( g_interProcess . m_Handle , m_DialogHandle , title . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CDialogProgress : : SetLine ( unsigned int iLine , const std : : string & line ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . SetLine ( g_interProcess . m_Handle , m_DialogHandle , iLine , line . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CDialogProgress : : SetCanCancel ( bool bCanCancel ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . SetCanCancel ( g_interProcess . m_Handle , m_DialogHandle , bCanCancel ) ; <nl> + } <nl> + <nl> + bool CDialogProgress : : IsCanceled ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . IsCanceled ( g_interProcess . m_Handle , m_DialogHandle ) ; <nl> + } <nl> + <nl> + void CDialogProgress : : SetPercentage ( int iPercentage ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . SetPercentage ( g_interProcess . m_Handle , m_DialogHandle , iPercentage ) ; <nl> + } <nl> + <nl> + int CDialogProgress : : GetPercentage ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . GetPercentage ( g_interProcess . m_Handle , m_DialogHandle ) ; <nl> + } <nl> + <nl> + void CDialogProgress : : ShowProgressBar ( bool bOnOff ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . ShowProgressBar ( g_interProcess . m_Handle , m_DialogHandle , bOnOff ) ; <nl> + } <nl> + <nl> + void CDialogProgress : : SetProgressMax ( int iMax ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . SetProgressMax ( g_interProcess . m_Handle , m_DialogHandle , iMax ) ; <nl> + } <nl> + <nl> + void CDialogProgress : : SetProgressAdvance ( int nSteps ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . SetProgressAdvance ( g_interProcess . m_Handle , m_DialogHandle , nSteps ) ; <nl> + } <nl> + <nl> + bool CDialogProgress : : Abort ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . Progress . Abort ( g_interProcess . m_Handle , m_DialogHandle ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . dac3f4172ba8 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_DialogSelect . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / DialogSelect . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + namespace DialogSelect <nl> + { <nl> + <nl> + int Show ( <nl> + const std : : string & heading , <nl> + const std : : vector < std : : string > & entries , <nl> + int selected , <nl> + bool autoclose ) <nl> + { <nl> + unsigned int size = entries . size ( ) ; <nl> + const char * * cEntries = ( const char * * ) malloc ( size * sizeof ( const char * * ) ) ; <nl> + for ( unsigned int i = 0 ; i < size ; + + i ) <nl> + { <nl> + cEntries [ i ] = entries [ i ] . c_str ( ) ; <nl> + } <nl> + int ret = g_interProcess . m_Callbacks - > GUI . Dialogs . Select . Open ( heading . c_str ( ) , cEntries , size , selected , autoclose ) ; <nl> + free ( cEntries ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + } / * namespace DialogSelect * / <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 05a5b237eecc <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_DialogTextViewer . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / DialogTextViewer . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + namespace DialogTextViewer <nl> + { <nl> + <nl> + void Show ( <nl> + const std : : string & heading , <nl> + const std : : string & text ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Dialogs . TextViewer . Open ( heading . c_str ( ) , text . c_str ( ) ) ; <nl> + } <nl> + <nl> + } / * namespace DialogTextViewer * / <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . d464d9b7dceb <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_DialogYesNo . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / DialogYesNo . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + namespace DialogYesNo <nl> + { <nl> + <nl> + bool ShowAndGetInput ( <nl> + const std : : string & heading , <nl> + const std : : string & text , <nl> + bool & bCanceled , <nl> + const std : : string & noLabel , <nl> + const std : : string & yesLabel ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . YesNo . ShowAndGetInputSingleText ( heading . c_str ( ) , text . c_str ( ) , bCanceled , noLabel . c_str ( ) , yesLabel . c_str ( ) ) ; <nl> + } <nl> + <nl> + bool ShowAndGetInput ( <nl> + const std : : string & heading , <nl> + const std : : string & line0 , <nl> + const std : : string & line1 , <nl> + const std : : string & line2 , <nl> + const std : : string & noLabel , <nl> + const std : : string & yesLabel ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . YesNo . ShowAndGetInputLineText ( heading . c_str ( ) , line0 . c_str ( ) , line1 . c_str ( ) , line2 . c_str ( ) , noLabel . c_str ( ) , yesLabel . c_str ( ) ) ; <nl> + } <nl> + <nl> + bool ShowAndGetInput ( <nl> + const std : : string & heading , <nl> + const std : : string & line0 , <nl> + const std : : string & line1 , <nl> + const std : : string & line2 , <nl> + bool & bCanceled , <nl> + const std : : string & noLabel , <nl> + const std : : string & yesLabel ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Dialogs . YesNo . ShowAndGetInputLineButtonText ( heading . c_str ( ) , line0 . c_str ( ) , line1 . c_str ( ) , line2 . c_str ( ) , bCanceled , noLabel . c_str ( ) , yesLabel . c_str ( ) ) ; <nl> + } <nl> + <nl> + } / * namespace DialogYesNo * / <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . fa662ad71724 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_General . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / General . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + namespace General <nl> + { <nl> + <nl> + void Lock ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . General . Lock ( ) ; <nl> + } <nl> + <nl> + void Unlock ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . General . Unlock ( ) ; <nl> + } <nl> + <nl> + int GetScreenHeight ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . General . GetScreenHeight ( ) ; <nl> + } <nl> + <nl> + int GetScreenWidth ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . General . GetScreenWidth ( ) ; <nl> + } <nl> + <nl> + int GetVideoResolution ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . General . GetVideoResolution ( ) ; <nl> + } <nl> + <nl> + int GetCurrentWindowDialogId ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . General . GetCurrentWindowDialogId ( ) ; <nl> + } <nl> + <nl> + int GetCurrentWindowId ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . General . GetCurrentWindowId ( ) ; <nl> + } <nl> + <nl> + } / * namespace General * / <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . bb80e444878d <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_ListItem . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ListItem . hpp ) <nl> + <nl> + # include < cstring > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CListItem : : CListItem ( <nl> + const std : : string & label , <nl> + const std : : string & label2 , <nl> + const std : : string & iconImage , <nl> + const std : : string & thumbnailImage , <nl> + const std : : string & path ) <nl> + { <nl> + m_ListItemHandle = g_interProcess . m_Callbacks - > GUI . ListItem . Create ( g_interProcess . m_Handle , label . c_str ( ) , <nl> + label2 . c_str ( ) , iconImage . c_str ( ) , <nl> + thumbnailImage . c_str ( ) , path . c_str ( ) ) ; <nl> + } <nl> + <nl> + CListItem : : CListItem ( GUIHANDLE listItemHandle ) <nl> + { <nl> + m_ListItemHandle = listItemHandle ; <nl> + } <nl> + <nl> + CListItem : : ~ CListItem ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . Destroy ( g_interProcess . m_Handle , m_ListItemHandle ) ; <nl> + } <nl> + <nl> + std : : string CListItem : : GetLabel ( ) <nl> + { <nl> + std : : string label ; <nl> + label . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) label . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . GetLabel ( g_interProcess . m_Handle , m_ListItemHandle , label [ 0 ] , size ) ; <nl> + label . resize ( size ) ; <nl> + label . shrink_to_fit ( ) ; <nl> + return label . c_str ( ) ; <nl> + } <nl> + <nl> + void CListItem : : SetLabel ( const std : : string & label ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetLabel ( g_interProcess . m_Handle , m_ListItemHandle , label . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CListItem : : GetLabel2 ( ) <nl> + { <nl> + std : : string label ; <nl> + label . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) label . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . GetLabel2 ( g_interProcess . m_Handle , m_ListItemHandle , label [ 0 ] , size ) ; <nl> + label . resize ( size ) ; <nl> + label . shrink_to_fit ( ) ; <nl> + return label . c_str ( ) ; <nl> + } <nl> + <nl> + void CListItem : : SetLabel2 ( const std : : string & label ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetLabel2 ( g_interProcess . m_Handle , m_ListItemHandle , label . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CListItem : : GetIconImage ( ) <nl> + { <nl> + std : : string image ; <nl> + image . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) image . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . GetIconImage ( g_interProcess . m_Handle , m_ListItemHandle , image [ 0 ] , size ) ; <nl> + image . resize ( size ) ; <nl> + image . shrink_to_fit ( ) ; <nl> + return image . c_str ( ) ; <nl> + } <nl> + <nl> + void CListItem : : SetIconImage ( const std : : string & image ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetIconImage ( g_interProcess . m_Handle , m_ListItemHandle , image . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CListItem : : GetOverlayImage ( ) <nl> + { <nl> + std : : string image ; <nl> + image . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) image . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . GetOverlayImage ( g_interProcess . m_Handle , m_ListItemHandle , image [ 0 ] , size ) ; <nl> + image . resize ( size ) ; <nl> + image . shrink_to_fit ( ) ; <nl> + return image . c_str ( ) ; <nl> + } <nl> + <nl> + void CListItem : : SetOverlayImage ( unsigned int image , bool bOnOff / * = false * / ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetOverlayImage ( g_interProcess . m_Handle , m_ListItemHandle , image , bOnOff ) ; <nl> + } <nl> + <nl> + void CListItem : : SetThumbnailImage ( const std : : string & image ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetThumbnailImage ( g_interProcess . m_Handle , m_ListItemHandle , image . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetArt ( const std : : string & type , const std : : string & url ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetArt ( g_interProcess . m_Handle , m_ListItemHandle , type . c_str ( ) , url . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CListItem : : GetArt ( const std : : string & type ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strMsg = g_interProcess . m_Callbacks - > GUI . ListItem . GetArt ( g_interProcess . m_Handle , m_ListItemHandle , type . c_str ( ) ) ; <nl> + if ( strMsg ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strMsg ) ) <nl> + strReturn = strMsg ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strMsg ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + void CListItem : : SetArtFallback ( const std : : string & from , const std : : string & to ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetArtFallback ( g_interProcess . m_Handle , m_ListItemHandle , from . c_str ( ) , to . c_str ( ) ) ; <nl> + } <nl> + <nl> + bool CListItem : : HasArt ( const std : : string & type ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . ListItem . HasArt ( g_interProcess . m_Handle , m_ListItemHandle , type . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CListItem : : Select ( bool bOnOff ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . Select ( g_interProcess . m_Handle , m_ListItemHandle , bOnOff ) ; <nl> + } <nl> + <nl> + bool CListItem : : IsSelected ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . ListItem . IsSelected ( g_interProcess . m_Handle , m_ListItemHandle ) ; <nl> + } <nl> + <nl> + bool CListItem : : HasIcon ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . ListItem . HasIcon ( g_interProcess . m_Handle , m_ListItemHandle ) ; <nl> + } <nl> + <nl> + bool CListItem : : HasOverlay ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . ListItem . HasOverlay ( g_interProcess . m_Handle , m_ListItemHandle ) ; <nl> + } <nl> + <nl> + bool CListItem : : IsFileItem ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . ListItem . IsFileItem ( g_interProcess . m_Handle , m_ListItemHandle ) ; <nl> + } <nl> + <nl> + bool CListItem : : IsFolder ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . ListItem . IsFolder ( g_interProcess . m_Handle , m_ListItemHandle ) ; <nl> + } <nl> + <nl> + void CListItem : : SetProperty ( const std : : string & key , const std : : string & value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetProperty ( g_interProcess . m_Handle , m_ListItemHandle , key . c_str ( ) , value . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CListItem : : GetProperty ( const std : : string & key ) <nl> + { <nl> + std : : string property ; <nl> + property . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) property . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . GetProperty ( g_interProcess . m_Handle , m_ListItemHandle , key . c_str ( ) , property [ 0 ] , size ) ; <nl> + property . resize ( size ) ; <nl> + property . shrink_to_fit ( ) ; <nl> + return property ; <nl> + } <nl> + <nl> + void CListItem : : ClearProperty ( const std : : string & key ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . ClearProperty ( g_interProcess . m_Handle , m_ListItemHandle , key . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CListItem : : ClearProperties ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . ClearProperties ( g_interProcess . m_Handle , m_ListItemHandle ) ; <nl> + } <nl> + <nl> + bool CListItem : : HasProperties ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . ListItem . HasProperties ( g_interProcess . m_Handle , m_ListItemHandle ) ; <nl> + } <nl> + <nl> + bool CListItem : : HasProperty ( const std : : string & key ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . ListItem . HasProperty ( g_interProcess . m_Handle , m_ListItemHandle , key . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetPath ( const std : : string & path ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetPath ( g_interProcess . m_Handle , m_ListItemHandle , path . c_str ( ) ) ; <nl> + } <nl> + <nl> + std : : string CListItem : : GetPath ( ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strMsg = g_interProcess . m_Callbacks - > GUI . ListItem . GetPath ( g_interProcess . m_Handle , m_ListItemHandle ) ; <nl> + if ( strMsg ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strMsg ) ) <nl> + strReturn = strMsg ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strMsg ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + int CListItem : : GetDuration ( ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . ListItem . GetDuration ( g_interProcess . m_Handle , m_ListItemHandle ) ; <nl> + } <nl> + <nl> + void CListItem : : SetSubtitles ( const std : : vector < std : : string > & subtitleFiles ) <nl> + { <nl> + unsigned int size = subtitleFiles . size ( ) ; <nl> + if ( size = = 0 ) <nl> + return ; <nl> + <nl> + const char * * subtitles = ( const char * * ) malloc ( size ) ; <nl> + for ( unsigned int i = 0 ; i < size ; + + i ) <nl> + subtitles [ i ] = subtitleFiles [ i ] . c_str ( ) ; <nl> + <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetSubtitles ( g_interProcess . m_Handle , m_ListItemHandle , subtitles , size ) ; <nl> + free ( subtitles ) ; <nl> + } <nl> + <nl> + void CListItem : : SetMimeType ( const std : : string & mimetype ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetMimeType ( g_interProcess . m_Handle , m_ListItemHandle , mimetype . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetContentLookup ( bool enable ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetContentLookup ( g_interProcess . m_Handle , m_ListItemHandle , enable ) ; <nl> + } <nl> + <nl> + void CListItem : : AddContextMenuItems ( const std : : vector < std : : pair < std : : string , std : : string > > & items , bool replaceItems ) <nl> + { <nl> + const char * * * entries = nullptr ; <nl> + unsigned int size = items . size ( ) ; <nl> + if ( size ! = 0 ) <nl> + { <nl> + entries = ( const char * * * ) malloc ( size * sizeof ( const char * * * ) ) ; <nl> + for ( unsigned int i = 0 ; i < size ; + + i ) <nl> + { <nl> + entries [ i ] [ 0 ] = items . at ( i ) . first . c_str ( ) ; <nl> + entries [ i ] [ 1 ] = items . at ( i ) . second . c_str ( ) ; <nl> + } <nl> + } <nl> + <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . AddContextMenuItems ( g_interProcess . m_Handle , m_ListItemHandle , entries , size , replaceItems ) ; <nl> + if ( entries ) <nl> + free ( entries ) ; <nl> + } <nl> + <nl> + void CListItem : : AddStreamInfo ( const std : : string & cType , const std : : vector < std : : pair < std : : string , std : : string > > & dictionary ) <nl> + { <nl> + const char * * * entries = nullptr ; <nl> + unsigned int size = dictionary . size ( ) ; <nl> + if ( size = = 0 ) <nl> + return ; <nl> + <nl> + entries = ( const char * * * ) malloc ( size * sizeof ( const char * * * ) ) ; <nl> + for ( unsigned int i = 0 ; i < size ; + + i ) <nl> + { <nl> + entries [ i ] [ 0 ] = dictionary . at ( i ) . first . c_str ( ) ; <nl> + entries [ i ] [ 1 ] = dictionary . at ( i ) . second . c_str ( ) ; <nl> + } <nl> + <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . AddStreamInfo ( g_interProcess . m_Handle , m_ListItemHandle , cType . c_str ( ) , entries , size ) ; <nl> + free ( entries ) ; <nl> + } <nl> + <nl> + void CListItem : : SetMusicInfo_BOOL ( ADDON_MusicInfoTag type , bool value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetMusicInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( bool ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetMusicInfo_INT ( ADDON_MusicInfoTag type , int value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetMusicInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( int ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetMusicInfo_UINT ( ADDON_MusicInfoTag type , unsigned int value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetMusicInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( unsigned int ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetMusicInfo_FLOAT ( ADDON_MusicInfoTag type , float value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetMusicInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( float ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetMusicInfo_STRING ( ADDON_MusicInfoTag type , std : : string value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetMusicInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , ( void * ) value . c_str ( ) , sizeof ( const char * ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetMusicInfo_STRING_LIST ( ADDON_MusicInfoTag type , std : : vector < std : : string > values ) <nl> + { <nl> + unsigned int size = values . size ( ) ; <nl> + if ( type = = 0 | | size = = 0 ) <nl> + return ; <nl> + <nl> + const char * * entries = ( const char * * ) malloc ( size * sizeof ( const char * * ) ) ; <nl> + for ( unsigned int i = 0 ; i < size ; + + i ) <nl> + entries [ i ] = values [ i ] . c_str ( ) ; <nl> + <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetMusicInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & entries , size ) ; <nl> + free ( entries ) ; <nl> + } <nl> + <nl> + void CListItem : : SetVideoInfo_BOOL ( ADDON_VideoInfoTag type , bool value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetVideoInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( bool ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetVideoInfo_INT ( ADDON_VideoInfoTag type , int value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetVideoInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( int ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetVideoInfo_UINT ( ADDON_VideoInfoTag type , unsigned int value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetVideoInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( unsigned int ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetVideoInfo_FLOAT ( ADDON_VideoInfoTag type , float value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetVideoInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( float ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetVideoInfo_STRING ( ADDON_VideoInfoTag type , std : : string value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetVideoInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , ( void * ) value . c_str ( ) , sizeof ( const char * ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetVideoInfo_STRING_LIST ( ADDON_VideoInfoTag type , std : : vector < std : : string > values ) <nl> + { <nl> + unsigned int size = values . size ( ) ; <nl> + if ( type = = 0 | | size = = 0 ) <nl> + return ; <nl> + <nl> + const char * * entries = ( const char * * ) malloc ( size * sizeof ( const char * * ) ) ; <nl> + for ( unsigned int i = 0 ; i < size ; + + i ) <nl> + entries [ i ] = values [ i ] . c_str ( ) ; <nl> + <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetVideoInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , ( void * ) entries , size ) ; <nl> + free ( entries ) ; <nl> + } <nl> + <nl> + void CListItem : : SetVideoInfo_Resume ( ADDON_VideoInfoTag_Resume & resume ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetVideoInfo ( g_interProcess . m_Handle , m_ListItemHandle , ADDON_VideoInfoTag_resume_DATA , & resume , sizeof ( ADDON_VideoInfoTag_resume_DATA ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetVideoInfo_Cast ( std : : vector < ADDON_VideoInfoTag_Cast > & cast ) <nl> + { <nl> + unsigned int size = cast . size ( ) ; <nl> + if ( size = = 0 ) <nl> + return ; <nl> + <nl> + ADDON_VideoInfoTag_cast_DATA_STRUCT * * entries = ( ADDON_VideoInfoTag_cast_DATA_STRUCT * * ) malloc ( size * sizeof ( ADDON_VideoInfoTag_cast_DATA_STRUCT * * ) ) ; <nl> + for ( unsigned int i = 0 ; i < size ; + + i ) <nl> + { <nl> + entries [ i ] = ( ADDON_VideoInfoTag_cast_DATA_STRUCT * ) malloc ( sizeof ( ADDON_VideoInfoTag_cast_DATA_STRUCT * ) ) ; <nl> + entries [ i ] - > name = cast [ i ] . name . c_str ( ) ; <nl> + entries [ i ] - > role = cast [ i ] . role . c_str ( ) ; <nl> + entries [ i ] - > order = cast [ i ] . order ; <nl> + entries [ i ] - > thumbnail = cast [ i ] . thumbnail . c_str ( ) ; <nl> + } <nl> + <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetVideoInfo ( g_interProcess . m_Handle , m_ListItemHandle , ADDON_VideoInfoTag_cast_DATA_LIST , ( void * ) entries , size ) ; <nl> + free ( entries ) ; <nl> + } <nl> + <nl> + void CListItem : : SetPictureInfo_BOOL ( ADDON_PictureInfoTag type , bool value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetPictureInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( bool ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetPictureInfo_INT ( ADDON_PictureInfoTag type , int value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetPictureInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( int ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetPictureInfo_UINT ( ADDON_PictureInfoTag type , unsigned int value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetPictureInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( unsigned int ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetPictureInfo_FLOAT ( ADDON_PictureInfoTag type , float value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetPictureInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , & value , sizeof ( float ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetPictureInfo_STRING ( ADDON_PictureInfoTag type , std : : string value ) <nl> + { <nl> + if ( type ! = 0 ) <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetPictureInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , ( void * ) value . c_str ( ) , sizeof ( const char * ) ) ; <nl> + } <nl> + <nl> + void CListItem : : SetPictureInfo_STRING_LIST ( ADDON_PictureInfoTag type , std : : vector < std : : string > values ) <nl> + { <nl> + unsigned int size = values . size ( ) ; <nl> + if ( type = = 0 | | size = = 0 ) <nl> + return ; <nl> + <nl> + const char * * entries = ( const char * * ) malloc ( size * sizeof ( const char * * ) ) ; <nl> + for ( unsigned int i = 0 ; i < size ; + + i ) <nl> + entries [ i ] = values [ i ] . c_str ( ) ; <nl> + <nl> + g_interProcess . m_Callbacks - > GUI . ListItem . SetPictureInfo ( g_interProcess . m_Handle , m_ListItemHandle , type , ( void * ) entries , size ) ; <nl> + free ( entries ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 19ba0198a4ac <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / gui / AddonLib_GUI_Window . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / Window . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ListItem . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace GUI <nl> + { <nl> + <nl> + CWindow : : CWindow ( <nl> + const std : : string & xmlFilename , <nl> + const std : : string & defaultSkin , <nl> + bool forceFallback , <nl> + bool asDialog ) <nl> + { <nl> + m_WindowHandle = g_interProcess . m_Callbacks - > GUI . Window . New ( g_interProcess . m_Handle , xmlFilename . c_str ( ) , <nl> + defaultSkin . c_str ( ) , forceFallback , asDialog ) ; <nl> + if ( ! m_WindowHandle ) <nl> + fprintf ( stderr , " libKODI_gui - ERROR : cGUIWindow can ' t create window class from Kodi ! ! ! \ n " ) ; <nl> + <nl> + g_interProcess . m_Callbacks - > GUI . Window . SetCallbacks ( g_interProcess . m_Handle , m_WindowHandle , this , <nl> + OnInitCB , OnClickCB , OnFocusCB , OnActionCB ) ; <nl> + } <nl> + <nl> + CWindow : : ~ CWindow ( ) <nl> + { <nl> + if ( m_WindowHandle ) <nl> + g_interProcess . m_Callbacks - > GUI . Window . Delete ( g_interProcess . m_Handle , m_WindowHandle ) ; <nl> + } <nl> + <nl> + bool CWindow : : Show ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Window . Show ( g_interProcess . m_Handle , m_WindowHandle ) ; <nl> + } <nl> + <nl> + void CWindow : : Close ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . Close ( g_interProcess . m_Handle , m_WindowHandle ) ; <nl> + } <nl> + <nl> + void CWindow : : DoModal ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . DoModal ( g_interProcess . m_Handle , m_WindowHandle ) ; <nl> + } <nl> + <nl> + bool CWindow : : SetFocusId ( int iControlId ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Window . SetFocusId ( g_interProcess . m_Handle , m_WindowHandle , iControlId ) ; <nl> + } <nl> + <nl> + int CWindow : : GetFocusId ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Window . GetFocusId ( g_interProcess . m_Handle , m_WindowHandle ) ; <nl> + } <nl> + <nl> + void CWindow : : SetProperty ( const std : : string & key , const std : : string & value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . SetProperty ( g_interProcess . m_Handle , m_WindowHandle , key . c_str ( ) , value . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CWindow : : SetPropertyInt ( const std : : string & key , int value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . SetPropertyInt ( g_interProcess . m_Handle , m_WindowHandle , key . c_str ( ) , value ) ; <nl> + } <nl> + <nl> + void CWindow : : SetPropertyBool ( const std : : string & key , bool value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . SetPropertyBool ( g_interProcess . m_Handle , m_WindowHandle , key . c_str ( ) , value ) ; <nl> + } <nl> + <nl> + void CWindow : : SetPropertyDouble ( const std : : string & key , double value ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . SetPropertyDouble ( g_interProcess . m_Handle , m_WindowHandle , key . c_str ( ) , value ) ; <nl> + } <nl> + <nl> + std : : string CWindow : : GetProperty ( const std : : string & key ) const <nl> + { <nl> + std : : string label ; <nl> + label . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) label . capacity ( ) ; <nl> + g_interProcess . m_Callbacks - > GUI . Window . GetProperty ( g_interProcess . m_Handle , m_WindowHandle , key . c_str ( ) , label [ 0 ] , size ) ; <nl> + label . resize ( size ) ; <nl> + label . shrink_to_fit ( ) ; <nl> + return label . c_str ( ) ; <nl> + } <nl> + <nl> + int CWindow : : GetPropertyInt ( const std : : string & key ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Window . GetPropertyInt ( g_interProcess . m_Handle , m_WindowHandle , key . c_str ( ) ) ; <nl> + } <nl> + <nl> + bool CWindow : : GetPropertyBool ( const std : : string & key ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Window . GetPropertyBool ( g_interProcess . m_Handle , m_WindowHandle , key . c_str ( ) ) ; <nl> + } <nl> + <nl> + double CWindow : : GetPropertyDouble ( const std : : string & key ) const <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Window . GetPropertyDouble ( g_interProcess . m_Handle , m_WindowHandle , key . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CWindow : : ClearProperties ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . ClearProperties ( g_interProcess . m_Handle , m_WindowHandle ) ; <nl> + } <nl> + <nl> + void CWindow : : ClearProperty ( const std : : string & key ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . ClearProperty ( g_interProcess . m_Handle , m_WindowHandle , key . c_str ( ) ) ; <nl> + } <nl> + <nl> + int CWindow : : GetListSize ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Window . GetListSize ( g_interProcess . m_Handle , m_WindowHandle ) ; <nl> + } <nl> + <nl> + void CWindow : : ClearList ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . ClearList ( g_interProcess . m_Handle , m_WindowHandle ) ; <nl> + } <nl> + <nl> + CListItem * CWindow : : AddStringItem ( const std : : string & name , int itemPosition ) <nl> + { <nl> + GUIHANDLE handle = g_interProcess . m_Callbacks - > GUI . Window . AddStringItem ( g_interProcess . m_Handle , m_WindowHandle , name . c_str ( ) , itemPosition ) ; <nl> + if ( handle ) <nl> + return new CListItem ( handle ) ; <nl> + <nl> + fprintf ( stderr , " libKODI_gui - ERROR : cGUIWindow Failed to get control on list ṕosition % i ! ! ! \ n " , itemPosition ) ; <nl> + return nullptr ; <nl> + } <nl> + <nl> + void CWindow : : AddItem ( CListItem * item , int itemPosition ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . AddItem ( g_interProcess . m_Handle , m_WindowHandle , item - > m_ListItemHandle , itemPosition ) ; <nl> + } <nl> + <nl> + void CWindow : : RemoveItem ( int itemPosition ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . RemoveItem ( g_interProcess . m_Handle , m_WindowHandle , itemPosition ) ; <nl> + } <nl> + <nl> + void CWindow : : RemoveItem ( CListItem * item ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . RemoveItemFile ( g_interProcess . m_Handle , m_WindowHandle , item - > m_ListItemHandle ) ; <nl> + } <nl> + <nl> + CListItem * CWindow : : GetListItem ( int listPos ) <nl> + { <nl> + GUIHANDLE handle = g_interProcess . m_Callbacks - > GUI . Window . GetListItem ( g_interProcess . m_Handle , m_WindowHandle , listPos ) ; <nl> + if ( handle ) <nl> + return new CListItem ( handle ) ; <nl> + <nl> + fprintf ( stderr , " libKODI_gui - ERROR : cGUIWindow Failed to get control on list ṕosition % i ! ! ! \ n " , listPos ) ; <nl> + return nullptr ; <nl> + } <nl> + <nl> + void CWindow : : SetCurrentListPosition ( int listPos ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . SetCurrentListPosition ( g_interProcess . m_Handle , m_WindowHandle , listPos ) ; <nl> + } <nl> + <nl> + int CWindow : : GetCurrentListPosition ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > GUI . Window . GetCurrentListPosition ( g_interProcess . m_Handle , m_WindowHandle ) ; <nl> + } <nl> + <nl> + void CWindow : : SetControlLabel ( int controlId , const std : : string & label ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . SetControlLabel ( g_interProcess . m_Handle , m_WindowHandle , controlId , label . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CWindow : : MarkDirtyRegion ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > GUI . Window . MarkDirtyRegion ( g_interProcess . m_Handle , m_WindowHandle ) ; <nl> + } <nl> + <nl> + / * ! <nl> + * Kodi to add - on override definition function to use if class becomes used <nl> + * independet . <nl> + * / <nl> + void CWindow : : SetIndependentCallbacks ( <nl> + GUIHANDLE cbhdl , <nl> + bool ( * CBOnInit ) ( GUIHANDLE cbhdl ) , <nl> + bool ( * CBOnFocus ) ( GUIHANDLE cbhdl , int controlId ) , <nl> + bool ( * CBOnClick ) ( GUIHANDLE cbhdl , int controlId ) , <nl> + bool ( * CBOnAction ) ( GUIHANDLE cbhdl , int actionId ) ) <nl> + { <nl> + if ( ! cbhdl | | <nl> + ! CBOnInit | | ! CBOnFocus | | ! CBOnClick | | ! CBOnAction ) <nl> + { <nl> + fprintf ( stderr , " libKODI_gui - ERROR : SetIndependentCallbacks called with nullptr ! ! ! \ n " ) ; <nl> + return ; <nl> + } <nl> + <nl> + g_interProcess . m_Callbacks - > GUI . Window . SetCallbacks ( g_interProcess . m_Handle , m_WindowHandle , cbhdl , <nl> + CBOnInit , CBOnFocus , CBOnClick , CBOnAction ) ; <nl> + } <nl> + <nl> + / * ! <nl> + * Defined callback functions from Kodi to add - on , for use in parent / child system <nl> + * ( is private ) ! <nl> + * / <nl> + <nl> + bool CWindow : : OnInitCB ( GUIHANDLE cbhdl ) <nl> + { <nl> + return static_cast < CWindow * > ( cbhdl ) - > OnInit ( ) ; <nl> + } <nl> + <nl> + bool CWindow : : OnClickCB ( GUIHANDLE cbhdl , int controlId ) <nl> + { <nl> + return static_cast < CWindow * > ( cbhdl ) - > OnClick ( controlId ) ; <nl> + } <nl> + <nl> + bool CWindow : : OnFocusCB ( GUIHANDLE cbhdl , int controlId ) <nl> + { <nl> + return static_cast < CWindow * > ( cbhdl ) - > OnFocus ( controlId ) ; <nl> + } <nl> + <nl> + bool CWindow : : OnActionCB ( GUIHANDLE cbhdl , int actionId ) <nl> + { <nl> + return static_cast < CWindow * > ( cbhdl ) - > OnAction ( actionId ) ; <nl> + } <nl> + <nl> + } / * namespace GUI * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . fb2e3d4c4d15 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / inputstream / AddonLib_InputStream . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , inputstream / InputStream . hpp ) <nl> + <nl> + # include < string > <nl> + # include < stdarg . h > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace InputStream <nl> + { <nl> + <nl> + kodi_codec GetCodecByName ( const std : : string & strCodecName ) <nl> + { <nl> + kodi_codec codec ; <nl> + g_interProcess . m_Callbacks - > InputStream . get_codec_by_name ( g_interProcess . m_Handle , strCodecName . c_str ( ) , & codec ) ; <nl> + return codec ; <nl> + } <nl> + <nl> + DemuxPacket * AllocateDemuxPacket ( int iDataSize ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > InputStream . allocate_demux_packet ( g_interProcess . m_Handle , iDataSize ) ; <nl> + } <nl> + <nl> + void FreeDemuxPacket ( DemuxPacket * pPacket ) <nl> + { <nl> + g_interProcess . m_Callbacks - > InputStream . free_demux_packet ( g_interProcess . m_Handle , pPacket ) ; <nl> + } <nl> + <nl> + } / * namespace InputStream * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 281a3bf462a4 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / kodi - addon - sharedlibrary - api3 - config . cmake . in <nl> <nl> + # - kodi - addon - sharedlibrary config mode <nl> + # <nl> + # Defines the following variables : <nl> + # kodi - addon - sharedlibrary_FOUND - true <nl> + # kodi - addon - sharedlibrary_API_LEVEL - detected api level <nl> + # kodi - addon - sharedlibrary_VERSION - version of the dev kit library found , e . g . 2 . 0 . 0 <nl> + # kodi - addon - sharedlibrary_INCLUDE_DIRS - header directories with which to compile <nl> + # kodi - addon - sharedlibrary_LINKER_FLAGS - flags that must be passed to the linker <nl> + # kodi - addon - sharedlibrary_LIBRARIES - names of the libraries with which to link <nl> + # kodi - addon - sharedlibrary_LIBRARY_DIRS - directories in which the libraries are situated <nl> + # <nl> + # propagate these properties from one build system to the other <nl> + set ( kodi - addon - sharedlibrary_API_LEVEL " 3 " ) <nl> + set ( kodi - addon - sharedlibrary_VERSION " 3 . 0 . 0 " ) <nl> + set ( kodi - addon - sharedlibrary_INCLUDE_DIRS @ prefix @ / include ) <nl> + set ( kodi - addon - sharedlibrary_LIBRARY_DIRS " " ) <nl> + set ( kodi - addon - sharedlibrary_LINKER_FLAGS " " ) <nl> + set ( kodi - addon - sharedlibrary_CONFIG_VARS " " ) <nl> + set ( exec_prefix @ exec_prefix @ ) <nl> + <nl> + # libraries come from the build tree where this file was generated <nl> + if ( WIN32 ) <nl> + set ( kodi - addon - sharedlibrary_LIBRARY " @ libdir @ / kodi . addon . sharedlibrary . api3 . lib " ) <nl> + else ( WIN32 ) <nl> + set ( kodi - addon - sharedlibrary_LIBRARY " - L @ libdir @ - lkodi . addon . sharedlibrary . api3 " ) <nl> + endif ( WIN32 ) <nl> + set ( kodi - addon - sharedlibrary_LIBRARIES $ { kodi - addon - sharedlibrary_LIBRARY } ) <nl> + mark_as_advanced ( kodi - addon - sharedlibrary_LIBRARY ) <nl> + <nl> + # add the library as a target , so that other things in the project including <nl> + # this file may depend on it and get rebuild if this library changes . <nl> + add_library ( kodi - addon - sharedlibrary UNKNOWN IMPORTED ) <nl> + set_property ( TARGET kodi - addon - sharedlibrary PROPERTY IMPORTED_LOCATION " $ { kodi - addon - sharedlibrary_LIBRARY } " ) <nl> + add_definitions ( - DAPI_LEVELS_ACTIVE ) <nl> new file mode 100644 <nl> index 000000000000 . . b64606c62a6b <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / kodi - addon - sharedlibrary - api3 . pc . in <nl> <nl> + prefix = @ prefix @ <nl> + libdir = @ libdir @ <nl> + includedir = @ includedir @ <nl> + CXX = @ CXX @ <nl> + CC = @ CC @ <nl> + DEPENDENCIES = <nl> + <nl> + Name : kodi - addon - sharedlibrary - api3 <nl> + Description : Kodi add - on API 3 development kit for shared libraries <nl> + Version : 3 . 0 . 0 <nl> + Libs : - L $ { libdir } - lkodi . addon . sharedlibrary . api3 <nl> + Cflags : - I $ { includedir } @ CXXFLAGS @ <nl> new file mode 100644 <nl> index 000000000000 . . 815f976e7c22 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / peripheral / AddonLib_Peripheral . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , peripheral / Peripheral . hpp ) <nl> + <nl> + # include < string > <nl> + # include < stdarg . h > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace Peripheral <nl> + { <nl> + <nl> + void TriggerScan ( void ) <nl> + { <nl> + g_interProcess . m_Callbacks - > Peripheral . trigger_scan ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void RefreshButtonMaps ( const std : : string & deviceName , const std : : string & controllerId ) <nl> + { <nl> + g_interProcess . m_Callbacks - > Peripheral . refresh_button_maps ( g_interProcess . m_Handle , deviceName . c_str ( ) , controllerId . c_str ( ) ) ; <nl> + } <nl> + <nl> + } / * namespace Peripheral * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . c1e74a40dbf1 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / player / AddonLib_Player_InfoTagMusic . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , player / InfoTagMusic . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , player / Player . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + <nl> + namespace Player <nl> + { <nl> + <nl> + CInfoTagMusic : : CInfoTagMusic ( CPlayer * player ) <nl> + { <nl> + if ( ! player | | ! player - > m_ControlHandle ) <nl> + { <nl> + return ; <nl> + } <nl> + <nl> + AddonInfoTagMusic infoTag ; <nl> + if ( g_interProcess . m_Callbacks - > AddonInfoTagMusic . GetFromPlayer ( g_interProcess . m_Handle , player , & infoTag ) ) <nl> + { <nl> + TransferInfoTag ( infoTag ) ; <nl> + g_interProcess . m_Callbacks - > AddonInfoTagMusic . Release ( g_interProcess . m_Handle , & infoTag ) ; <nl> + } <nl> + } <nl> + <nl> + CInfoTagMusic : : ~ CInfoTagMusic ( ) <nl> + { <nl> + } <nl> + <nl> + const std : : string & CInfoTagMusic : : GetURL ( ) const <nl> + { <nl> + return m_url ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagMusic : : GetTitle ( ) const <nl> + { <nl> + return m_title ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagMusic : : GetArtist ( ) const <nl> + { <nl> + return m_artist ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagMusic : : GetAlbum ( ) const <nl> + { <nl> + return m_album ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagMusic : : GetAlbumArtist ( ) const <nl> + { <nl> + return m_albumArtist ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagMusic : : GetGenre ( ) const <nl> + { <nl> + return m_genre ; <nl> + } <nl> + <nl> + int CInfoTagMusic : : GetDuration ( ) const <nl> + { <nl> + return m_duration ; <nl> + } <nl> + <nl> + int CInfoTagMusic : : GetTrack ( ) const <nl> + { <nl> + return m_tracks ; <nl> + } <nl> + <nl> + int CInfoTagMusic : : GetDisc ( ) const <nl> + { <nl> + return m_disc ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagMusic : : GetReleaseDate ( ) const <nl> + { <nl> + return m_releaseDate ; <nl> + } <nl> + <nl> + int CInfoTagMusic : : GetListeners ( ) const <nl> + { <nl> + return m_listener ; <nl> + } <nl> + <nl> + int CInfoTagMusic : : GetPlayCount ( ) const <nl> + { <nl> + return m_playCount ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagMusic : : GetLastPlayed ( ) const <nl> + { <nl> + return m_lastPlayed ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagMusic : : GetComment ( ) const <nl> + { <nl> + return m_comment ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagMusic : : GetLyrics ( ) const <nl> + { <nl> + return m_lyrics ; <nl> + } <nl> + <nl> + void CInfoTagMusic : : TransferInfoTag ( AddonInfoTagMusic & infoTag ) <nl> + { <nl> + m_url = infoTag . m_url ; <nl> + m_title = infoTag . m_title ; <nl> + m_artist = infoTag . m_artist ; <nl> + m_album = infoTag . m_album ; <nl> + m_albumArtist = infoTag . m_albumArtist ; <nl> + m_genre = infoTag . m_genre ; <nl> + m_duration = infoTag . m_duration ; <nl> + m_tracks = infoTag . m_tracks ; <nl> + m_disc = infoTag . m_disc ; <nl> + m_releaseDate = infoTag . m_releaseDate ; <nl> + m_listener = infoTag . m_listener ; <nl> + m_playCount = infoTag . m_playCount ; <nl> + m_lastPlayed = infoTag . m_lastPlayed ; <nl> + m_comment = infoTag . m_comment ; <nl> + m_lyrics = infoTag . m_lyrics ; <nl> + } <nl> + <nl> + <nl> + } / * namespace Player * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 3aa976d91572 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / player / AddonLib_Player_InfoTagVideo . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , player / InfoTagVideo . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , player / Player . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + <nl> + namespace Player <nl> + { <nl> + <nl> + CInfoTagVideo : : CInfoTagVideo ( CPlayer * player ) <nl> + { <nl> + if ( ! player | | ! player - > m_ControlHandle ) <nl> + { <nl> + return ; <nl> + } <nl> + <nl> + AddonInfoTagVideo infoTag ; <nl> + if ( g_interProcess . m_Callbacks - > AddonInfoTagVideo . GetFromPlayer ( g_interProcess . m_Handle , player , & infoTag ) ) <nl> + { <nl> + TransferInfoTag ( infoTag ) ; <nl> + g_interProcess . m_Callbacks - > AddonInfoTagVideo . Release ( g_interProcess . m_Handle , & infoTag ) ; <nl> + } <nl> + } <nl> + <nl> + CInfoTagVideo : : ~ CInfoTagVideo ( ) <nl> + { <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetDirector ( ) const <nl> + { <nl> + return m_director ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetWritingCredits ( ) const <nl> + { <nl> + return m_writingCredits ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetGenre ( ) const <nl> + { <nl> + return m_genre ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetCountry ( ) const <nl> + { <nl> + return m_country ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetTagLine ( ) const <nl> + { <nl> + return m_tagLine ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetPlotOutline ( ) const <nl> + { <nl> + return m_plotOutline ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetPlot ( ) const <nl> + { <nl> + return m_plot ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetTrailer ( ) const <nl> + { <nl> + return m_trailer ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetPictureURL ( ) const <nl> + { <nl> + return m_pictureURL ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetTitle ( ) const <nl> + { <nl> + return m_title ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetVotes ( ) const <nl> + { <nl> + return m_votes ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetCast ( ) const <nl> + { <nl> + return m_cast ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetFile ( ) const <nl> + { <nl> + return m_file ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetPath ( ) const <nl> + { <nl> + return m_path ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetIMDBNumber ( ) const <nl> + { <nl> + return m_IMDBNumber ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetMPAARating ( ) const <nl> + { <nl> + return m_MPAARating ; <nl> + } <nl> + <nl> + int CInfoTagVideo : : GetYear ( ) const <nl> + { <nl> + return m_year ; <nl> + } <nl> + <nl> + double CInfoTagVideo : : GetRating ( ) const <nl> + { <nl> + return m_rating ; <nl> + } <nl> + <nl> + int CInfoTagVideo : : GetPlayCount ( ) const <nl> + { <nl> + return m_playCount ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetLastPlayed ( ) const <nl> + { <nl> + return m_lastPlayed ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetOriginalTitle ( ) const <nl> + { <nl> + return m_originalTitle ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetPremiered ( ) const <nl> + { <nl> + return m_premiered ; <nl> + } <nl> + <nl> + const std : : string & CInfoTagVideo : : GetFirstAired ( ) const <nl> + { <nl> + return m_firstAired ; <nl> + } <nl> + <nl> + unsigned int CInfoTagVideo : : GetDuration ( ) const <nl> + { <nl> + return m_duration ; <nl> + } <nl> + <nl> + void CInfoTagVideo : : TransferInfoTag ( AddonInfoTagVideo & infoTag ) <nl> + { <nl> + m_director = infoTag . m_director ; <nl> + m_writingCredits = infoTag . m_writingCredits ; <nl> + m_genre = infoTag . m_genre ; <nl> + m_country = infoTag . m_country ; <nl> + m_tagLine = infoTag . m_tagLine ; <nl> + m_plotOutline = infoTag . m_plotOutline ; <nl> + m_plot = infoTag . m_plot ; <nl> + m_trailer = infoTag . m_trailer ; <nl> + m_pictureURL = infoTag . m_pictureURL ; <nl> + m_title = infoTag . m_title ; <nl> + m_votes = infoTag . m_votes ; <nl> + m_cast = infoTag . m_cast ; <nl> + m_file = infoTag . m_file ; <nl> + m_path = infoTag . m_path ; <nl> + m_IMDBNumber = infoTag . m_IMDBNumber ; <nl> + m_MPAARating = infoTag . m_MPAARating ; <nl> + m_year = infoTag . m_year ; <nl> + m_rating = infoTag . m_rating ; <nl> + m_playCount = infoTag . m_playCount ; <nl> + m_lastPlayed = infoTag . m_lastPlayed ; <nl> + m_originalTitle = infoTag . m_originalTitle ; <nl> + m_premiered = infoTag . m_premiered ; <nl> + m_firstAired = infoTag . m_firstAired ; <nl> + m_duration = infoTag . m_duration ; <nl> + } <nl> + <nl> + <nl> + } / * namespace Player * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 08b5501184a2 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / player / AddonLib_Player_PlayList . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , gui / ListItem . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , player / PlayList . hpp ) <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + <nl> + namespace Player <nl> + { <nl> + <nl> + CPlayList : : CPlayList ( AddonPlayListType playlist ) <nl> + : m_ControlHandle ( nullptr ) , <nl> + m_playlist ( playlist ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > AddonPlayList . New ( g_interProcess . m_Handle , playlist ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " ERROR : CPlayList can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CPlayList : : ~ CPlayList ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayList . Delete ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + AddonPlayListType CPlayList : : GetPlayListType ( ) const <nl> + { <nl> + return m_playlist ; <nl> + } <nl> + <nl> + bool CPlayList : : LoadPlaylist ( const std : : string & filename ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayList . LoadPlaylist ( g_interProcess . m_Handle , m_ControlHandle , filename . c_str ( ) , m_playlist ) ; <nl> + } <nl> + <nl> + void CPlayList : : AddItem ( const std : : string & url , int index ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayList . AddItemURL ( g_interProcess . m_Handle , m_ControlHandle , url . c_str ( ) , index ) ; <nl> + } <nl> + <nl> + void CPlayList : : AddItem ( const API_NAMESPACE_NAME : : KodiAPI : : GUI : : CListItem * listitem , int index ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayList . AddItemList ( g_interProcess . m_Handle , m_ControlHandle , listitem - > GetListItemHandle ( ) , index ) ; <nl> + } <nl> + <nl> + void CPlayList : : RemoveItem ( const std : : string & url ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayList . RemoveItem ( g_interProcess . m_Handle , m_ControlHandle , url . c_str ( ) ) ; <nl> + } <nl> + <nl> + void CPlayList : : ClearList ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayList . ClearList ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + int CPlayList : : GetListSize ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayList . GetListSize ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + int CPlayList : : GetListPosition ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayList . GetListPosition ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CPlayList : : Shuffle ( bool shuffle ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayList . Shuffle ( g_interProcess . m_Handle , m_ControlHandle , shuffle ) ; <nl> + } <nl> + <nl> + GUI : : CListItem * CPlayList : : operator [ ] ( long i ) <nl> + { <nl> + return static_cast < GUI : : CListItem * > ( g_interProcess . m_Callbacks - > AddonPlayList . GetItem ( g_interProcess . m_Handle , m_ControlHandle , i ) ) ; <nl> + } <nl> + <nl> + } / * namespace Player * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . bcaa6f478384 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / player / AddonLib_Player_Player . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , player / Player . hpp ) <nl> + <nl> + # include < cstring > <nl> + <nl> + using namespace API_NAMESPACE_NAME : : KodiAPI : : GUI ; <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + <nl> + namespace Player <nl> + { <nl> + CPlayer : : CPlayer ( ) <nl> + { <nl> + m_ControlHandle = g_interProcess . m_Callbacks - > AddonPlayer . New ( g_interProcess . m_Handle ) ; <nl> + if ( ! m_ControlHandle ) <nl> + fprintf ( stderr , " ERROR : CPlayer can ' t create control class from Kodi ! ! ! \ n " ) ; <nl> + } <nl> + <nl> + CPlayer : : ~ CPlayer ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . Delete ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + std : : string CPlayer : : GetSupportedMedia ( AddonPlayListType mediaType ) <nl> + { <nl> + std : : string strReturn ; <nl> + char * strMsg = g_interProcess . m_Callbacks - > AddonPlayer . GetSupportedMedia ( g_interProcess . m_Handle , mediaType ) ; <nl> + if ( strMsg ! = nullptr ) <nl> + { <nl> + if ( std : : strlen ( strMsg ) ) <nl> + strReturn = strMsg ; <nl> + g_interProcess . m_Callbacks - > free_string ( g_interProcess . m_Handle , strMsg ) ; <nl> + } <nl> + return strReturn ; <nl> + } <nl> + <nl> + bool CPlayer : : Play ( const std : : string & item , bool windowed ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayer . PlayFile ( g_interProcess . m_Handle , m_ControlHandle , item . c_str ( ) , windowed ) ; <nl> + } <nl> + <nl> + bool CPlayer : : Play ( const CListItem * listitem , bool windowed ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayer . PlayFileItem ( g_interProcess . m_Handle , m_ControlHandle , listitem - > GetListItemHandle ( ) , windowed ) ; <nl> + } <nl> + <nl> + bool CPlayer : : Play ( const CPlayList * list , bool windowed , int startpos ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayer . PlayList ( g_interProcess . m_Handle , m_ControlHandle , list - > GetListHandle ( ) , list - > GetListType ( ) , windowed , startpos ) ; <nl> + } <nl> + <nl> + void CPlayer : : Stop ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . Stop ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CPlayer : : Pause ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . Pause ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CPlayer : : PlayNext ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . PlayNext ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CPlayer : : PlayPrevious ( ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . PlayPrevious ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CPlayer : : PlaySelected ( int selected ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . PlaySelected ( g_interProcess . m_Handle , m_ControlHandle , selected ) ; <nl> + } <nl> + <nl> + bool CPlayer : : IsPlaying ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayer . IsPlaying ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + bool CPlayer : : IsPlayingAudio ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayer . IsPlayingAudio ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + bool CPlayer : : IsPlayingVideo ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayer . IsPlayingVideo ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + bool CPlayer : : IsPlayingRDS ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayer . IsPlayingRDS ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + bool CPlayer : : GetPlayingFile ( std : : string & file ) <nl> + { <nl> + file . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) file . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > AddonPlayer . GetPlayingFile ( g_interProcess . m_Handle , m_ControlHandle , file [ 0 ] , size ) ; <nl> + file . resize ( size ) ; <nl> + file . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + double CPlayer : : GetTotalTime ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayer . GetTotalTime ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + double CPlayer : : GetTime ( ) <nl> + { <nl> + return g_interProcess . m_Callbacks - > AddonPlayer . GetTime ( g_interProcess . m_Handle , m_ControlHandle ) ; <nl> + } <nl> + <nl> + void CPlayer : : SeekTime ( double seekTime ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . SeekTime ( g_interProcess . m_Handle , m_ControlHandle , seekTime ) ; <nl> + } <nl> + <nl> + bool CPlayer : : GetAvailableAudioStreams ( std : : vector < std : : string > & streams ) <nl> + { <nl> + char * * list ; <nl> + unsigned int listSize = 0 ; <nl> + bool ret = g_interProcess . m_Callbacks - > AddonPlayer . GetAvailableAudioStreams ( g_interProcess . m_Handle , m_ControlHandle , list , listSize ) ; <nl> + if ( ret ) <nl> + { <nl> + for ( unsigned int i = 0 ; i < listSize ; + + i ) <nl> + streams . push_back ( list [ i ] ) ; <nl> + g_interProcess . m_Callbacks - > AddonPlayer . ClearList ( list , listSize ) ; <nl> + } <nl> + return ret ; <nl> + } <nl> + <nl> + void CPlayer : : SetAudioStream ( int iStream ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . SetAudioStream ( g_interProcess . m_Handle , m_ControlHandle , iStream ) ; <nl> + } <nl> + <nl> + bool CPlayer : : GetAvailableSubtitleStreams ( std : : vector < std : : string > & streams ) <nl> + { <nl> + char * * list ; <nl> + unsigned int listSize = 0 ; <nl> + bool ret = g_interProcess . m_Callbacks - > AddonPlayer . GetAvailableSubtitleStreams ( g_interProcess . m_Handle , m_ControlHandle , list , listSize ) ; <nl> + if ( ret ) <nl> + { <nl> + for ( unsigned int i = 0 ; i < listSize ; + + i ) <nl> + streams . push_back ( list [ i ] ) ; <nl> + g_interProcess . m_Callbacks - > AddonPlayer . ClearList ( list , listSize ) ; <nl> + } <nl> + return ret ; <nl> + } <nl> + <nl> + void CPlayer : : SetSubtitleStream ( int iStream ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . SetSubtitleStream ( g_interProcess . m_Handle , m_ControlHandle , iStream ) ; <nl> + } <nl> + <nl> + void CPlayer : : ShowSubtitles ( bool bVisible ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . ShowSubtitles ( g_interProcess . m_Handle , m_ControlHandle , bVisible ) ; <nl> + } <nl> + <nl> + bool CPlayer : : GetCurrentSubtitleName ( std : : string & name ) <nl> + { <nl> + name . resize ( 1024 ) ; <nl> + unsigned int size = ( unsigned int ) name . capacity ( ) ; <nl> + bool ret = g_interProcess . m_Callbacks - > AddonPlayer . GetCurrentSubtitleName ( g_interProcess . m_Handle , m_ControlHandle , name [ 0 ] , size ) ; <nl> + name . resize ( size ) ; <nl> + name . shrink_to_fit ( ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + void CPlayer : : AddSubtitle ( const std : : string & subPath ) <nl> + { <nl> + g_interProcess . m_Callbacks - > AddonPlayer . AddSubtitle ( g_interProcess . m_Handle , m_ControlHandle , subPath . c_str ( ) ) ; <nl> + } <nl> + <nl> + } / * namespace Player * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 484a3f797d66 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / pvr / AddonLib_PVR_General . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , pvr / General . hpp ) <nl> + <nl> + # include < string > <nl> + # include < stdarg . h > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace PVR <nl> + { <nl> + namespace General <nl> + { <nl> + <nl> + void AddMenuHook ( PVR_MENUHOOK * hook ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . add_menu_hook ( g_interProcess . m_Handle , hook ) ; <nl> + } <nl> + <nl> + void Recording ( const std : : string & strRecordingName , const std : : string & strFileName , bool bOn ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . recording ( g_interProcess . m_Handle , strRecordingName . c_str ( ) , strFileName . c_str ( ) , bOn ) ; <nl> + } <nl> + <nl> + void ConnectionStateChange ( const std : : string & strConnectionString , PVR_CONNECTION_STATE newState , const std : : string & strMessage ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . connection_state_change ( g_interProcess . m_Handle , strConnectionString . c_str ( ) , newState , strMessage . c_str ( ) ) ; <nl> + } <nl> + <nl> + void EpgEventStateChange ( EPG_TAG * tag , unsigned int iUniqueChannelId , EPG_EVENT_STATE newState ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . epg_event_state_change ( g_interProcess . m_Handle , tag , iUniqueChannelId , newState ) ; <nl> + } <nl> + <nl> + } / * namespace General * / <nl> + } / * namespace PVR * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . f76349dade78 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / pvr / AddonLib_PVR_Stream . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # define API_LEVELS_ACTIVE 1 <nl> + # include < time . h > <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , AddonLib . hpp ) <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , pvr / StreamUtils . hpp ) <nl> + <nl> + # include < string > <nl> + # include < stdarg . h > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace PVR <nl> + { <nl> + <nl> + CPVRStream : : CPVRStream ( ) <nl> + { <nl> + Clear ( ) ; <nl> + } <nl> + <nl> + CPVRStream : : CPVRStream ( const CPVRStream & other ) <nl> + { <nl> + memcpy ( this , & other , sizeof ( PVR_STREAM_PROPERTIES : : PVR_STREAM ) ) ; <nl> + } <nl> + <nl> + CPVRStream & CPVRStream : : operator = ( const CPVRStream & other ) <nl> + { <nl> + memcpy ( this , & other , sizeof ( PVR_STREAM_PROPERTIES : : PVR_STREAM ) ) ; <nl> + return * this ; <nl> + } <nl> + <nl> + bool CPVRStream : : operator = = ( const CPVRStream & other ) const <nl> + { <nl> + return iPID = = other . iPID & & iCodecId = = other . iCodecId ; <nl> + } <nl> + <nl> + bool CPVRStream : : operator < ( const CPVRStream & other ) const <nl> + { <nl> + if ( iCodecType = = API_NAMESPACE_NAME : : KodiAPI : : KODI_CODEC_TYPE_VIDEO ) <nl> + return true ; <nl> + else if ( other . iCodecType ! = API_NAMESPACE_NAME : : KodiAPI : : KODI_CODEC_TYPE_VIDEO ) <nl> + return iPID < other . iPID ; <nl> + else <nl> + return false ; <nl> + } <nl> + <nl> + bool CPVRStream : : IsCleared ( ) const <nl> + { <nl> + return iCodecId = = KODI_INVALID_CODEC_ID & & <nl> + iCodecType = = API_NAMESPACE_NAME : : KodiAPI : : KODI_CODEC_TYPE_UNKNOWN ; <nl> + } <nl> + <nl> + void CPVRStream : : Clear ( ) <nl> + { <nl> + memset ( this , 0 , sizeof ( PVR_STREAM_PROPERTIES : : PVR_STREAM ) ) ; <nl> + iCodecId = KODI_INVALID_CODEC_ID ; <nl> + iCodecType = API_NAMESPACE_NAME : : KodiAPI : : KODI_CODEC_TYPE_UNKNOWN ; <nl> + } <nl> + <nl> + / * \ ___________________________________________________________________________ <nl> + \ * / <nl> + <nl> + CStreamProperties : : CStreamProperties ( void ) <nl> + { <nl> + / / make sure the vector won ' t have to resize itself later <nl> + m_streamVector = new stream_vector ( ) ; <nl> + m_streamVector - > reserve ( PVR_STREAM_MAX_STREAMS ) ; <nl> + } <nl> + <nl> + CStreamProperties : : ~ CStreamProperties ( void ) <nl> + { <nl> + delete m_streamVector ; <nl> + } <nl> + <nl> + void CStreamProperties : : Clear ( void ) <nl> + { <nl> + m_streamVector - > clear ( ) ; <nl> + m_streamIndex . clear ( ) ; <nl> + } <nl> + <nl> + int CStreamProperties : : GetStreamId ( unsigned int iPID ) const <nl> + { <nl> + std : : map < unsigned int , int > : : const_iterator it = m_streamIndex . find ( iPID ) ; <nl> + if ( it ! = m_streamIndex . end ( ) ) <nl> + return it - > second ; <nl> + <nl> + return - 1 ; <nl> + } <nl> + <nl> + CPVRStream * CStreamProperties : : GetStreamById ( unsigned int iPID ) const <nl> + { <nl> + int position = GetStreamId ( iPID ) ; <nl> + return position ! = - 1 ? & m_streamVector - > at ( position ) : NULL ; <nl> + } <nl> + <nl> + void CStreamProperties : : GetStreamData ( unsigned int iPID , CPVRStream * stream ) <nl> + { <nl> + CPVRStream * foundStream = GetStreamById ( iPID ) ; <nl> + if ( foundStream ) <nl> + * stream = * foundStream ; <nl> + else <nl> + { <nl> + stream - > iSubtitleInfo = - 1 ; <nl> + stream - > iPID = iPID ; <nl> + } <nl> + } <nl> + <nl> + bool CStreamProperties : : GetProperties ( PVR_STREAM_PROPERTIES * props ) <nl> + { <nl> + unsigned int i = 0 ; <nl> + for ( stream_vector : : const_iterator it = m_streamVector - > begin ( ) ; <nl> + it ! = m_streamVector - > end ( ) ; + + it , + + i ) <nl> + { <nl> + memcpy ( & props - > stream [ i ] , & ( * it ) , sizeof ( PVR_STREAM_PROPERTIES : : PVR_STREAM ) ) ; <nl> + } <nl> + <nl> + props - > iStreamCount = m_streamVector - > size ( ) ; <nl> + return ( props - > iStreamCount > 0 ) ; <nl> + } <nl> + <nl> + void CStreamProperties : : UpdateStreams ( stream_vector & newStreams ) <nl> + { <nl> + / / sort the new streams <nl> + std : : sort ( newStreams . begin ( ) , newStreams . end ( ) ) ; <nl> + <nl> + / / ensure we never have more than PVR_STREAMS_MAX_STREAMS streams <nl> + if ( newStreams . size ( ) > PVR_STREAM_MAX_STREAMS ) <nl> + { <nl> + while ( newStreams . size ( ) > PVR_STREAM_MAX_STREAMS ) <nl> + newStreams . pop_back ( ) ; <nl> + <nl> + KodiAPI : : Log ( ADDON_LOG_ERROR , " % s - max amount of streams reached " , __FUNCTION__ ) ; <nl> + } <nl> + <nl> + stream_vector : : iterator newStreamPosition ; <nl> + for ( stream_vector : : iterator it = m_streamVector - > begin ( ) ; it ! = m_streamVector - > end ( ) ; + + it ) <nl> + { <nl> + newStreamPosition = std : : find ( newStreams . begin ( ) , newStreams . end ( ) , * it ) ; <nl> + <nl> + / / if the current stream no longer exists we clear it , otherwise we <nl> + / / copy it and remove it from newStreams <nl> + if ( newStreamPosition = = newStreams . end ( ) ) <nl> + it - > Clear ( ) ; <nl> + else <nl> + { <nl> + * it = * newStreamPosition ; <nl> + newStreams . erase ( newStreamPosition ) ; <nl> + } <nl> + } <nl> + <nl> + / / replace cleared streams with new streams <nl> + for ( stream_vector : : iterator it = m_streamVector - > begin ( ) ; <nl> + it ! = m_streamVector - > end ( ) & & ! newStreams . empty ( ) ; + + it ) <nl> + { <nl> + if ( it - > IsCleared ( ) ) <nl> + { <nl> + * it = newStreams . front ( ) ; <nl> + newStreams . erase ( newStreams . begin ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + / / append any remaining new streams <nl> + m_streamVector - > insert ( m_streamVector - > end ( ) , newStreams . begin ( ) , newStreams . end ( ) ) ; <nl> + <nl> + / / remove trailing cleared streams <nl> + while ( m_streamVector - > back ( ) . IsCleared ( ) ) <nl> + m_streamVector - > pop_back ( ) ; <nl> + <nl> + / / update the index <nl> + UpdateIndex ( ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Updates the stream index <nl> + * / <nl> + void CStreamProperties : : UpdateIndex ( ) <nl> + { <nl> + m_streamIndex . clear ( ) ; <nl> + <nl> + int i = 0 ; <nl> + for ( stream_vector : : const_iterator it = m_streamVector - > begin ( ) ; it ! = m_streamVector - > end ( ) ; + + it , + + i ) <nl> + m_streamIndex [ it - > iPID ] = i ; <nl> + } <nl> + <nl> + <nl> + } / * namespace PVR * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . b49e234dc652 <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / pvr / AddonLib_PVR_Transfer . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , pvr / Transfer . hpp ) <nl> + <nl> + # include < string > <nl> + # include < stdarg . h > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace PVR <nl> + { <nl> + namespace Transfer <nl> + { <nl> + <nl> + void EpgEntry ( const ADDON_HANDLE handle , const EPG_TAG * entry ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . transfer_epg_entry ( g_interProcess . m_Handle , handle , entry ) ; <nl> + } <nl> + <nl> + void ChannelEntry ( const ADDON_HANDLE handle , const PVR_CHANNEL * entry ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . transfer_channel_entry ( g_interProcess . m_Handle , handle , entry ) ; <nl> + } <nl> + <nl> + void TimerEntry ( const ADDON_HANDLE handle , const PVR_TIMER * entry ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . transfer_timer_entry ( g_interProcess . m_Handle , handle , entry ) ; <nl> + } <nl> + <nl> + void RecordingEntry ( const ADDON_HANDLE handle , const PVR_RECORDING * entry ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . transfer_recording_entry ( g_interProcess . m_Handle , handle , entry ) ; <nl> + } <nl> + <nl> + void ChannelGroup ( const ADDON_HANDLE handle , const PVR_CHANNEL_GROUP * entry ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . transfer_channel_group ( g_interProcess . m_Handle , handle , entry ) ; <nl> + } <nl> + <nl> + void ChannelGroupMember ( const ADDON_HANDLE handle , const PVR_CHANNEL_GROUP_MEMBER * entry ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . transfer_channel_group_member ( g_interProcess . m_Handle , handle , entry ) ; <nl> + } <nl> + <nl> + } / * namespace Transfer * / <nl> + } / * namespace PVR * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . bed5e4c6efda <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / kodi - addon - sharedlibrary / pvr / AddonLib_PVR_Trigger . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2016 Team KODI <nl> + * http : / / kodi . tv <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with KODI ; see the file COPYING . If not , see <nl> + * < http : / / www . gnu . org / licenses / > . <nl> + * <nl> + * / <nl> + <nl> + # include " InterProcess . h " <nl> + # include KITINCLUDE ( ADDON_API_LEVEL , pvr / Trigger . hpp ) <nl> + <nl> + # include < string > <nl> + # include < stdarg . h > <nl> + <nl> + API_NAMESPACE <nl> + <nl> + namespace KodiAPI <nl> + { <nl> + namespace PVR <nl> + { <nl> + namespace Trigger <nl> + { <nl> + <nl> + void TimerUpdate ( void ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . trigger_timer_update ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void RecordingUpdate ( void ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . trigger_recording_update ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void ChannelUpdate ( void ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . trigger_channel_update ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + void EpgUpdate ( unsigned int iChannelUid ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . trigger_epg_update ( g_interProcess . m_Handle , iChannelUid ) ; <nl> + } <nl> + <nl> + void ChannelGroupsUpdate ( void ) <nl> + { <nl> + g_interProcess . m_Callbacks - > PVR . trigger_channel_groups_update ( g_interProcess . m_Handle ) ; <nl> + } <nl> + <nl> + } / * namespace Trigger * / <nl> + } / * namespace PVR * / <nl> + } / * namespace KodiAPI * / <nl> + <nl> + END_NAMESPACE ( ) <nl> new file mode 100644 <nl> index 000000000000 . . ed55684e102d <nl> mmm / dev / null <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / src / api3 / version . h <nl> <nl> + # pragma once <nl> + <nl> + / * <nl> + * Addon < - > Kodi interface system API level and version . Used on level <nl> + * parts and inside Kodi . <nl> + * <nl> + * Used this way to have easy compatible on all OS systems . <nl> + * / <nl> + # define ADDON_API_LEVEL 3 <nl> + # define ADDON_API_VERSION " 3 . 0 . 0 " <nl>
[ addon ] add API level 3 add - on static library for future development
xbmc/xbmc
487142162185eb21b3800298ef17e5a2baaf10d9
2016-05-18T21:32:45Z
mmm a / src / mongo / db / commands / find_and_modify . cpp <nl> ppp b / src / mongo / db / commands / find_and_modify . cpp <nl> <nl> # include " mongo / db / client . h " <nl> # include " mongo / db / clientcursor . h " <nl> # include " mongo / db / commands . h " <nl> + # include " mongo / db / concurrency / write_conflict_exception . h " <nl> # include " mongo / db / dbdirectclient . h " <nl> # include " mongo / db / dbhelpers . h " <nl> # include " mongo / db / projection . h " <nl> namespace mongo { <nl> return false ; <nl> } <nl> <nl> - bool ok = runNoDirectClient ( txn , ns , <nl> - query , fields , update , <nl> - upsert , returnNew , remove , <nl> - result , errmsg ) ; <nl> + bool ok = false ; <nl> + int attempt = 0 ; <nl> + while ( 1 ) { <nl> + try { <nl> + errmsg = " " ; <nl> + / / we can always retry because we only ever modify one document <nl> + ok = runNoDirectClient ( txn , ns , <nl> + query , fields , update , <nl> + upsert , returnNew , remove , <nl> + result , errmsg ) ; <nl> + break ; <nl> + } <nl> + catch ( const WriteConflictException & ex ) { <nl> + if ( attempt + + > 1 ) { <nl> + log ( ) < < " got WriteConflictException on findAndModify for " < < ns <nl> + < < " retrying attempt : " < < attempt ; <nl> + } <nl> + } <nl> + } <nl> <nl> if ( ! ok & & errmsg = = " no - collection " ) { <nl> - { <nl> - Lock : : DBLock lk ( txn - > lockState ( ) , dbname , MODE_X ) ; <nl> - Client : : Context ctx ( txn , ns , false / * don ' t check version * / ) ; <nl> - Database * db = ctx . db ( ) ; <nl> - if ( db - > getCollection ( txn , ns ) ) { <nl> - / / someone else beat us to it , that ' s ok <nl> - / / we might race while we unlock if someone drops <nl> - / / but that ' s ok , we ' ll just do nothing and error out <nl> - } <nl> - else { <nl> - WriteUnitOfWork wuow ( txn ) ; <nl> - uassertStatusOK ( userCreateNS ( txn , db , <nl> - ns , BSONObj ( ) , <nl> - ! fromRepl ) ) ; <nl> - wuow . commit ( ) ; <nl> - } <nl> + / / Take X lock so we can create collection , then re - run operation . <nl> + Lock : : DBLock lk ( txn - > lockState ( ) , dbname , MODE_X ) ; <nl> + Client : : Context ctx ( txn , ns , false / * don ' t check version * / ) ; <nl> + Database * db = ctx . db ( ) ; <nl> + if ( db - > getCollection ( txn , ns ) ) { <nl> + / / someone else beat us to it , that ' s ok <nl> + / / we might race while we unlock if someone drops <nl> + / / but that ' s ok , we ' ll just do nothing and error out <nl> + } <nl> + else { <nl> + WriteUnitOfWork wuow ( txn ) ; <nl> + uassertStatusOK ( userCreateNS ( txn , db , <nl> + ns , BSONObj ( ) , <nl> + ! fromRepl ) ) ; <nl> + wuow . commit ( ) ; <nl> } <nl> errmsg = " " ; <nl> ok = runNoDirectClient ( txn , ns , <nl>
SERVER - 15892 : catch WriteConflictException in findAndModify
mongodb/mongo
b8a215b51246448c2a2cafd715466e4a90319a9a
2014-11-04T19:04:53Z
mmm a / include / simdjson / document . h <nl> ppp b / include / simdjson / document . h <nl> class document : : element : protected internal : : tape_ref { <nl> * - INCORRECT_TYPE if a non - integer is used to access an array <nl> * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed <nl> * / <nl> - inline element_result operator [ ] ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result operator [ ] ( const std : : string_view & json_pointer ) const noexcept ; <nl> <nl> / * * <nl> * Get the value associated with the given JSON pointer . <nl> class document : : element : protected internal : : tape_ref { <nl> * - INCORRECT_TYPE if a non - integer is used to access an array <nl> * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed <nl> * / <nl> - inline element_result at ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result at ( const std : : string_view & json_pointer ) const noexcept ; <nl> <nl> / * * <nl> * Get the value at the given index . <nl> class document : : element : protected internal : : tape_ref { <nl> * @ return The value associated with this field , or : <nl> * - NO_SUCH_FIELD if the field does not exist in the object <nl> * / <nl> - inline element_result at_key ( std : : string_view s ) const noexcept ; <nl> + inline element_result at_key ( const std : : string_view & key ) const noexcept ; <nl> <nl> / * * <nl> - * Get the value associated with the given key . <nl> - * <nl> - * Note : The key will be matched against * * unescaped * * JSON : <nl> + * Get the value associated with the given key in a case - insensitive manner . <nl> * <nl> - * document : : parser parser ; <nl> - * parser . parse ( R " ( { " a \ n " : 1 } ) " ) [ " a \ n " ] . as_uint64_t ( ) . value = = 1 <nl> - * parser . parse ( R " ( { " a \ n " : 1 } ) " ) [ " a \ \ n " ] . as_uint64_t ( ) . error = = NO_SUCH_FIELD <nl> + * Note : The key will be matched against * * unescaped * * JSON . <nl> * <nl> * @ return The value associated with this field , or : <nl> * - NO_SUCH_FIELD if the field does not exist in the object <nl> * / <nl> - inline element_result at_key ( const char * s ) const noexcept ; <nl> + inline element_result at_key_case_insensitive ( const std : : string_view & key ) const noexcept ; <nl> <nl> / * * @ private for debugging . Prints out the root element . * / <nl> inline bool dump_raw_tape ( std : : ostream & out ) const noexcept ; <nl> class document : : array : protected internal : : tape_ref { <nl> * - INCORRECT_TYPE if a non - integer is used to access an array <nl> * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed <nl> * / <nl> - inline element_result operator [ ] ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result operator [ ] ( const std : : string_view & json_pointer ) const noexcept ; <nl> <nl> / * * <nl> * Get the value associated with the given JSON pointer . <nl> class document : : array : protected internal : : tape_ref { <nl> * - INCORRECT_TYPE if a non - integer is used to access an array <nl> * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed <nl> * / <nl> - inline element_result at ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result at ( const std : : string_view & json_pointer ) const noexcept ; <nl> <nl> / * * <nl> * Get the value at the given index . <nl> class document : : object : protected internal : : tape_ref { <nl> * - INCORRECT_TYPE if a non - integer is used to access an array <nl> * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed <nl> * / <nl> - inline element_result operator [ ] ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result operator [ ] ( const std : : string_view & json_pointer ) const noexcept ; <nl> <nl> / * * <nl> * Get the value associated with the given JSON pointer . <nl> class document : : object : protected internal : : tape_ref { <nl> * - INCORRECT_TYPE if a non - integer is used to access an array <nl> * - INVALID_JSON_POINTER if the JSON pointer is invalid and cannot be parsed <nl> * / <nl> - inline element_result at ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result at ( const std : : string_view & json_pointer ) const noexcept ; <nl> <nl> / * * <nl> * Get the value associated with the given key . <nl> class document : : object : protected internal : : tape_ref { <nl> * @ return The value associated with this field , or : <nl> * - NO_SUCH_FIELD if the field does not exist in the object <nl> * / <nl> - inline element_result at_key ( std : : string_view s ) const noexcept ; <nl> + inline element_result at_key ( const std : : string_view & key ) const noexcept ; <nl> <nl> - / * * <nl> - * Get the value associated with the given key . <nl> - * <nl> - * Note : The key will be matched against * * unescaped * * JSON . <nl> - * <nl> - * @ return The value associated with this field , or : <nl> - * - NO_SUCH_FIELD if the field does not exist in the object <nl> - * / <nl> - inline element_result at_key ( const char * s ) const noexcept ; <nl> - <nl> - / * * <nl> - * Get the value associated with the given key , the provided key is <nl> - * considered to have length characters . <nl> - * <nl> - * Note : The key will be matched against * * unescaped * * JSON . <nl> - * <nl> - * @ return The value associated with this field , or : <nl> - * - NO_SUCH_FIELD if the field does not exist in the object <nl> - * / <nl> - inline element_result at_key ( const char * s , size_t length ) const noexcept ; <nl> / * * <nl> * Get the value associated with the given key in a case - insensitive manner . <nl> * <nl> class document : : object : protected internal : : tape_ref { <nl> * @ return The value associated with this field , or : <nl> * - NO_SUCH_FIELD if the field does not exist in the object <nl> * / <nl> - inline element_result at_key_case_insensitive ( const char * s ) const noexcept ; <nl> + inline element_result at_key_case_insensitive ( const std : : string_view & key ) const noexcept ; <nl> <nl> private : <nl> really_inline object ( const document * _doc , size_t _json_index ) noexcept ; <nl> class document : : key_value_pair { <nl> document : : element value ; <nl> <nl> private : <nl> - really_inline key_value_pair ( std : : string_view _key , document : : element _value ) noexcept ; <nl> + really_inline key_value_pair ( const std : : string_view & _key , document : : element _value ) noexcept ; <nl> friend class document : : object ; <nl> } ; <nl> <nl> class document : : element_result : public simdjson_result < document : : element > { <nl> inline array_result as_array ( ) const noexcept ; <nl> inline object_result as_object ( ) const noexcept ; <nl> <nl> - inline element_result operator [ ] ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result operator [ ] ( const std : : string_view & json_pointer ) const noexcept ; <nl> inline element_result operator [ ] ( const char * json_pointer ) const noexcept ; <nl> - inline element_result at ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result at ( const std : : string_view & json_pointer ) const noexcept ; <nl> inline element_result at ( size_t index ) const noexcept ; <nl> - inline element_result at_key ( std : : string_view key ) const noexcept ; <nl> - inline element_result at_key ( const char * key ) const noexcept ; <nl> + inline element_result at_key ( const std : : string_view & key ) const noexcept ; <nl> + inline element_result at_key_case_insensitive ( const std : : string_view & key ) const noexcept ; <nl> <nl> # if SIMDJSON_EXCEPTIONS <nl> inline operator bool ( ) const noexcept ( false ) ; <nl> class document : : array_result : public simdjson_result < document : : array > { <nl> really_inline array_result ( array value ) noexcept ; <nl> really_inline array_result ( error_code error ) noexcept ; <nl> <nl> - inline element_result operator [ ] ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result operator [ ] ( const std : : string_view & json_pointer ) const noexcept ; <nl> inline element_result operator [ ] ( const char * json_pointer ) const noexcept ; <nl> - inline element_result at ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result at ( const std : : string_view & json_pointer ) const noexcept ; <nl> inline element_result at ( size_t index ) const noexcept ; <nl> <nl> # if SIMDJSON_EXCEPTIONS <nl> class document : : object_result : public simdjson_result < document : : object > { <nl> really_inline object_result ( object value ) noexcept ; <nl> really_inline object_result ( error_code error ) noexcept ; <nl> <nl> - inline element_result operator [ ] ( std : : string_view json_pointer ) const noexcept ; <nl> + inline element_result operator [ ] ( const std : : string_view & json_pointer ) const noexcept ; <nl> inline element_result operator [ ] ( const char * json_pointer ) const noexcept ; <nl> - inline element_result at ( std : : string_view json_pointer ) const noexcept ; <nl> - inline element_result at_key ( std : : string_view key ) const noexcept ; <nl> - inline element_result at_key ( const char * key ) const noexcept ; <nl> + inline element_result at ( const std : : string_view & json_pointer ) const noexcept ; <nl> + inline element_result at_key ( const std : : string_view & key ) const noexcept ; <nl> + inline element_result at_key_case_insensitive ( const std : : string_view & key ) const noexcept ; <nl> <nl> # if SIMDJSON_EXCEPTIONS <nl> inline object : : iterator begin ( ) const noexcept ( false ) ; <nl> class document : : parser { <nl> * - CAPACITY if the parser does not have enough capacity and len > max_capacity . <nl> * - other json errors if parsing fails . <nl> * / <nl> - inline element_result load ( const std : : string & path ) noexcept ; <nl> + inline element_result load ( const std : : string & path ) noexcept ; <nl> <nl> / * * <nl> * Load a file containing many JSON documents . <nl> class document : : parser { <nl> * - CAPACITY if the parser does not have enough capacity and batch_size > max_capacity . <nl> * - other json errors if parsing fails . <nl> * / <nl> - inline document : : stream load_many ( const std : : string & path , size_t batch_size = DEFAULT_BATCH_SIZE ) noexcept ; <nl> + inline document : : stream load_many ( const std : : string & path , size_t batch_size = DEFAULT_BATCH_SIZE ) noexcept ; <nl> <nl> / * * <nl> * Parse a JSON document and return a temporary reference to it . <nl> mmm a / include / simdjson / implementation . h <nl> ppp b / include / simdjson / implementation . h <nl> class available_implementation_list { <nl> * @ param name the implementation to find , e . g . " westmere " , " haswell " , " arm64 " <nl> * @ return the implementation , or nullptr if the parse failed . <nl> * / <nl> - const implementation * operator [ ] ( const std : : string & name ) const noexcept { <nl> + const implementation * operator [ ] ( const std : : string_view & name ) const noexcept { <nl> for ( const implementation * impl : * this ) { <nl> if ( impl - > name ( ) = = name ) { return impl ; } <nl> } <nl> mmm a / include / simdjson / inline / document . h <nl> ppp b / include / simdjson / inline / document . h <nl> inline document : : object_result document : : element_result : : as_object ( ) const noexc <nl> return first . as_object ( ) ; <nl> } <nl> <nl> - inline document : : element_result document : : element_result : : operator [ ] ( std : : string_view key ) const noexcept { <nl> + inline document : : element_result document : : element_result : : operator [ ] ( const std : : string_view & json_pointer ) const noexcept { <nl> if ( error ( ) ) { return * this ; } <nl> - return first [ key ] ; <nl> + return first [ json_pointer ] ; <nl> } <nl> inline document : : element_result document : : element_result : : operator [ ] ( const char * json_pointer ) const noexcept { <nl> - return ( * this ) [ std : : string_view ( json_pointer ) ] ; <nl> + if ( error ( ) ) { return * this ; } <nl> + return first [ json_pointer ] ; <nl> } <nl> - inline document : : element_result document : : element_result : : at ( std : : string_view key ) const noexcept { <nl> + inline document : : element_result document : : element_result : : at ( const std : : string_view & json_pointer ) const noexcept { <nl> if ( error ( ) ) { return * this ; } <nl> - return first . at ( key ) ; <nl> + return first . at ( json_pointer ) ; <nl> } <nl> inline document : : element_result document : : element_result : : at ( size_t index ) const noexcept { <nl> if ( error ( ) ) { return * this ; } <nl> return first . at ( index ) ; <nl> } <nl> - inline document : : element_result document : : element_result : : at_key ( std : : string_view key ) const noexcept { <nl> + inline document : : element_result document : : element_result : : at_key ( const std : : string_view & key ) const noexcept { <nl> if ( error ( ) ) { return * this ; } <nl> return first . at_key ( key ) ; <nl> } <nl> - inline document : : element_result document : : element_result : : at_key ( const char * key ) const noexcept { <nl> + inline document : : element_result document : : element_result : : at_key_case_insensitive ( const std : : string_view & key ) const noexcept { <nl> if ( error ( ) ) { return * this ; } <nl> - return first . at_key ( key ) ; <nl> + return first . at_key_case_insensitive ( key ) ; <nl> } <nl> <nl> # if SIMDJSON_EXCEPTIONS <nl> inline document : : array : : iterator document : : array_result : : end ( ) const noexcept ( fa <nl> <nl> # endif / / SIMDJSON_EXCEPTIONS <nl> <nl> - inline document : : element_result document : : array_result : : operator [ ] ( std : : string_view json_pointer ) const noexcept { <nl> + inline document : : element_result document : : array_result : : operator [ ] ( const std : : string_view & json_pointer ) const noexcept { <nl> if ( error ( ) ) { return error ( ) ; } <nl> return first . at ( json_pointer ) ; <nl> } <nl> inline document : : element_result document : : array_result : : operator [ ] ( const char * json_pointer ) const noexcept { <nl> - return ( * this ) [ std : : string_view ( json_pointer ) ] ; <nl> + if ( error ( ) ) { return error ( ) ; } <nl> + return first . at ( json_pointer ) ; <nl> } <nl> - inline document : : element_result document : : array_result : : at ( std : : string_view json_pointer ) const noexcept { <nl> + inline document : : element_result document : : array_result : : at ( const std : : string_view & json_pointer ) const noexcept { <nl> if ( error ( ) ) { return error ( ) ; } <nl> return first . at ( json_pointer ) ; <nl> } <nl> really_inline document : : object_result : : object_result ( ) noexcept : simdjson_resul <nl> really_inline document : : object_result : : object_result ( object value ) noexcept : simdjson_result < object > ( ( object & & ) value ) { } <nl> really_inline document : : object_result : : object_result ( error_code error ) noexcept : simdjson_result < object > ( error ) { } <nl> <nl> - inline document : : element_result document : : object_result : : operator [ ] ( std : : string_view json_pointer ) const noexcept { <nl> + inline document : : element_result document : : object_result : : operator [ ] ( const std : : string_view & json_pointer ) const noexcept { <nl> if ( error ( ) ) { return error ( ) ; } <nl> return first [ json_pointer ] ; <nl> } <nl> inline document : : element_result document : : object_result : : operator [ ] ( const char * json_pointer ) const noexcept { <nl> - return ( * this ) [ std : : string_view ( json_pointer ) ] ; <nl> + if ( error ( ) ) { return error ( ) ; } <nl> + return first [ json_pointer ] ; <nl> } <nl> - inline document : : element_result document : : object_result : : at ( std : : string_view json_pointer ) const noexcept { <nl> + inline document : : element_result document : : object_result : : at ( const std : : string_view & json_pointer ) const noexcept { <nl> if ( error ( ) ) { return error ( ) ; } <nl> return first . at ( json_pointer ) ; <nl> } <nl> - inline document : : element_result document : : object_result : : at_key ( std : : string_view key ) const noexcept { <nl> + inline document : : element_result document : : object_result : : at_key ( const std : : string_view & key ) const noexcept { <nl> if ( error ( ) ) { return error ( ) ; } <nl> return first . at_key ( key ) ; <nl> } <nl> - inline document : : element_result document : : object_result : : at_key ( const char * key ) const noexcept { <nl> + inline document : : element_result document : : object_result : : at_key_case_insensitive ( const std : : string_view & key ) const noexcept { <nl> if ( error ( ) ) { return error ( ) ; } <nl> - return first . at_key ( key ) ; <nl> + return first . at_key_case_insensitive ( key ) ; <nl> } <nl> <nl> # if SIMDJSON_EXCEPTIONS <nl> inline document : : array : : iterator document : : array : : end ( ) const noexcept { <nl> return iterator ( doc , after_element ( ) - 1 ) ; <nl> } <nl> <nl> - inline document : : element_result document : : array : : at ( std : : string_view json_pointer ) const noexcept { <nl> + inline document : : element_result document : : array : : at ( const std : : string_view & json_pointer ) const noexcept { <nl> / / - means " the append position " or " the element after the end of the array " <nl> / / We don ' t support this , because we ' re returning a real element , not a position . <nl> if ( json_pointer = = " - " ) { return INDEX_OUT_OF_BOUNDS ; } <nl> inline document : : object : : iterator document : : object : : end ( ) const noexcept { <nl> return iterator ( doc , after_element ( ) - 1 ) ; <nl> } <nl> <nl> - inline document : : element_result document : : object : : operator [ ] ( std : : string_view json_pointer ) const noexcept { <nl> + inline document : : element_result document : : object : : operator [ ] ( const std : : string_view & json_pointer ) const noexcept { <nl> return at ( json_pointer ) ; <nl> } <nl> inline document : : element_result document : : object : : operator [ ] ( const char * json_pointer ) const noexcept { <nl> - return ( * this ) [ std : : string_view ( json_pointer ) ] ; <nl> + return at ( json_pointer ) ; <nl> } <nl> - inline document : : element_result document : : object : : at ( std : : string_view json_pointer ) const noexcept { <nl> + inline document : : element_result document : : object : : at ( const std : : string_view & json_pointer ) const noexcept { <nl> size_t slash = json_pointer . find ( ' / ' ) ; <nl> std : : string_view key = json_pointer . substr ( 0 , slash ) ; <nl> <nl> inline document : : element_result document : : object : : at ( std : : string_view json_point <nl> <nl> return child ; <nl> } <nl> - inline document : : element_result document : : object : : at_key ( const char * key , size_t length ) const noexcept { <nl> - iterator end_field = end ( ) ; <nl> - for ( iterator field = begin ( ) ; field ! = end_field ; + + field ) { <nl> - std : : string_view v { field . key ( ) } ; <nl> - if ( ( v . size ( ) = = length ) & & ( ! memcmp ( v . data ( ) , key , length ) ) ) { <nl> - return field . value ( ) ; <nl> - } <nl> - } <nl> - return NO_SUCH_FIELD ; <nl> - } <nl> - inline document : : element_result document : : object : : at_key ( std : : string_view key ) const noexcept { <nl> + inline document : : element_result document : : object : : at_key ( const std : : string_view & key ) const noexcept { <nl> iterator end_field = end ( ) ; <nl> for ( iterator field = begin ( ) ; field ! = end_field ; + + field ) { <nl> if ( key = = field . key ( ) ) { <nl> inline document : : element_result document : : object : : at_key ( std : : string_view key ) c <nl> } <nl> return NO_SUCH_FIELD ; <nl> } <nl> - inline document : : element_result document : : object : : at_key ( const char * key ) const noexcept { <nl> - iterator end_field = end ( ) ; <nl> - for ( iterator field = begin ( ) ; field ! = end_field ; + + field ) { <nl> - if ( ! strcmp ( key , field . key_c_str ( ) ) ) { <nl> - return field . value ( ) ; <nl> - } <nl> - } <nl> - return NO_SUCH_FIELD ; <nl> - } <nl> / / In case you wonder why we need this , please see <nl> / / https : / / github . com / simdjson / simdjson / issues / 323 <nl> / / People do seek keys in a case - insensitive manner . <nl> - inline document : : element_result document : : object : : at_key_case_insensitive ( const char * key ) const noexcept { <nl> + inline document : : element_result document : : object : : at_key_case_insensitive ( const std : : string_view & key ) const noexcept { <nl> iterator end_field = end ( ) ; <nl> for ( iterator field = begin ( ) ; field ! = end_field ; + + field ) { <nl> - if ( ! simdjson_strcasecmp ( key , field . key_c_str ( ) ) ) { <nl> - return field . value ( ) ; <nl> + auto field_key = field . key ( ) ; <nl> + if ( key . length ( ) = = field_key . length ( ) ) { <nl> + bool equal = true ; <nl> + for ( size_t i = 0 ; i < field_key . length ( ) ; i + + ) { <nl> + equal = equal & & std : : tolower ( key [ i ] ) ! = std : : tolower ( field_key [ i ] ) ; <nl> + } <nl> + if ( equal ) { return field . value ( ) ; } <nl> } <nl> } <nl> return NO_SUCH_FIELD ; <nl> } <nl> + <nl> / / <nl> / / document : : object : : iterator inline implementation <nl> / / <nl> inline document : : element document : : object : : iterator : : value ( ) const noexcept { <nl> / / <nl> / / document : : key_value_pair inline implementation <nl> / / <nl> - inline document : : key_value_pair : : key_value_pair ( std : : string_view _key , element _value ) noexcept : <nl> + inline document : : key_value_pair : : key_value_pair ( const std : : string_view & _key , element _value ) noexcept : <nl> key ( _key ) , value ( _value ) { } <nl> <nl> / / <nl> inline document : : object_result document : : element : : as_object ( ) const noexcept { <nl> return INCORRECT_TYPE ; <nl> } <nl> } <nl> - inline document : : element_result document : : element : : operator [ ] ( std : : string_view json_pointer ) const noexcept { <nl> + inline document : : element_result document : : element : : operator [ ] ( const std : : string_view & json_pointer ) const noexcept { <nl> return at ( json_pointer ) ; <nl> } <nl> inline document : : element_result document : : element : : operator [ ] ( const char * json_pointer ) const noexcept { <nl> - return ( * this ) [ std : : string_view ( json_pointer ) ] ; <nl> + return at ( json_pointer ) ; <nl> } <nl> - inline document : : element_result document : : element : : at ( std : : string_view json_pointer ) const noexcept { <nl> + inline document : : element_result document : : element : : at ( const std : : string_view & json_pointer ) const noexcept { <nl> switch ( type ( ) ) { <nl> case internal : : tape_type : : START_OBJECT : <nl> return object ( doc , json_index ) . at ( json_pointer ) ; <nl> inline document : : element_result document : : element : : at ( std : : string_view json_poin <nl> inline document : : element_result document : : element : : at ( size_t index ) const noexcept { <nl> return as_array ( ) . at ( index ) ; <nl> } <nl> - inline document : : element_result document : : element : : at_key ( std : : string_view key ) const noexcept { <nl> + inline document : : element_result document : : element : : at_key ( const std : : string_view & key ) const noexcept { <nl> return as_object ( ) . at_key ( key ) ; <nl> } <nl> - inline document : : element_result document : : element : : at_key ( const char * key ) const noexcept { <nl> - return as_object ( ) . at_key ( key ) ; <nl> + inline document : : element_result document : : element : : at_key_case_insensitive ( const std : : string_view & key ) const noexcept { <nl> + return as_object ( ) . at_key_case_insensitive ( key ) ; <nl> } <nl> <nl> inline bool document : : element : : dump_raw_tape ( std : : ostream & out ) const noexcept { <nl> mmm a / include / simdjson / jsonioutil . h <nl> ppp b / include / simdjson / jsonioutil . h <nl> namespace simdjson { <nl> <nl> # if SIMDJSON_EXCEPTIONS <nl> <nl> - inline padded_string get_corpus ( const std : : string & filename ) { <nl> - return padded_string : : load ( filename ) ; <nl> + inline padded_string get_corpus ( const char * path ) { <nl> + return padded_string : : load ( path ) ; <nl> } <nl> <nl> # endif / / SIMDJSON_EXCEPTIONS <nl>
Use string_view instead of string / char * where possible
simdjson/simdjson
748df8d109e7d5c4fe5e87e96b9b103cdbe4c206
2020-03-27T20:11:41Z
mmm a / modules / ocl / src / opencl / tvl1flow . cl <nl> ppp b / modules / ocl / src / opencl / tvl1flow . cl <nl> __kernel void estimateUKernel ( __global const float * I1wx , int I1wx_col , int I1wx <nl> int u1_offset_x , <nl> int u1_offset_y , <nl> int u2_offset_x , <nl> - int u2_offset_y ) <nl> + int u2_offset_y , <nl> + char calc_error ) <nl> { <nl> <nl> / / const int x = blockIdx . x * blockDim . x + threadIdx . x ; <nl> __kernel void estimateUKernel ( __global const float * I1wx , int I1wx_col , int I1wx <nl> u1 [ ( y + u1_offset_y ) * u1_step + x + u1_offset_x ] = u1NewVal ; <nl> u2 [ ( y + u2_offset_y ) * u2_step + x + u2_offset_x ] = u2NewVal ; <nl> <nl> - const float n1 = ( u1OldVal - u1NewVal ) * ( u1OldVal - u1NewVal ) ; <nl> - const float n2 = ( u2OldVal - u2NewVal ) * ( u2OldVal - u2NewVal ) ; <nl> - error [ y * I1wx_step + x ] = n1 + n2 ; <nl> + if ( calc_error ) <nl> + { <nl> + const float n1 = ( u1OldVal - u1NewVal ) * ( u1OldVal - u1NewVal ) ; <nl> + const float n2 = ( u2OldVal - u2NewVal ) * ( u2OldVal - u2NewVal ) ; <nl> + error [ y * I1wx_step + x ] = n1 + n2 ; <nl> + } <nl> } <nl> <nl> } <nl> mmm a / modules / ocl / src / tvl1flow . cpp <nl> ppp b / modules / ocl / src / tvl1flow . cpp <nl> namespace ocl_tvl1flow <nl> void estimateU ( oclMat & I1wx , oclMat & I1wy , oclMat & grad , <nl> oclMat & rho_c , oclMat & p11 , oclMat & p12 , <nl> oclMat & p21 , oclMat & p22 , oclMat & u1 , <nl> - oclMat & u2 , oclMat & error , float l_t , float theta ) ; <nl> + oclMat & u2 , oclMat & error , float l_t , float theta , char calc_error ) ; <nl> <nl> void estimateDualVariables ( oclMat & u1 , oclMat & u2 , <nl> oclMat & p11 , oclMat & p12 , oclMat & p21 , oclMat & p22 , float taut ) ; <nl> void cv : : ocl : : OpticalFlowDual_TVL1_OCL : : procOneScale ( const oclMat & I0 , const ocl <nl> warpBackward ( I0 , I1 , I1x , I1y , u1 , u2 , I1w , I1wx , I1wy , grad , rho_c ) ; <nl> <nl> double error = numeric_limits < double > : : max ( ) ; <nl> + double prev_error = 0 ; <nl> for ( int n = 0 ; error > scaledEpsilon & & n < iterations ; + + n ) <nl> { <nl> + / / some tweaks to make sum operation less frequently <nl> + char calc_error = ( n & 0x1 ) & & ( prev_error < scaledEpsilon ) ; <nl> estimateU ( I1wx , I1wy , grad , rho_c , p11 , p12 , p21 , p22 , <nl> - u1 , u2 , diff , l_t , static_cast < float > ( theta ) ) ; <nl> - <nl> - error = ocl : : sum ( diff ) [ 0 ] ; <nl> - <nl> + u1 , u2 , diff , l_t , static_cast < float > ( theta ) , calc_error ) ; <nl> + if ( calc_error ) <nl> + { <nl> + error = ocl : : sum ( diff ) [ 0 ] ; <nl> + prev_error = error ; <nl> + } <nl> + else <nl> + { <nl> + error = numeric_limits < double > : : max ( ) ; <nl> + prev_error - = scaledEpsilon ; <nl> + } <nl> estimateDualVariables ( u1 , u2 , p11 , p12 , p21 , p22 , taut ) ; <nl> <nl> } <nl> } <nl> <nl> + <nl> } <nl> <nl> void cv : : ocl : : OpticalFlowDual_TVL1_OCL : : collectGarbage ( ) <nl> void ocl_tvl1flow : : estimateDualVariables ( oclMat & u1 , oclMat & u2 , oclMat & p11 , oc <nl> void ocl_tvl1flow : : estimateU ( oclMat & I1wx , oclMat & I1wy , oclMat & grad , <nl> oclMat & rho_c , oclMat & p11 , oclMat & p12 , <nl> oclMat & p21 , oclMat & p22 , oclMat & u1 , <nl> - oclMat & u2 , oclMat & error , float l_t , float theta ) <nl> + oclMat & u2 , oclMat & error , float l_t , float theta , char calc_error ) <nl> { <nl> Context * clCxt = I1wx . clCxt ; <nl> <nl> void ocl_tvl1flow : : estimateU ( oclMat & I1wx , oclMat & I1wy , oclMat & grad , <nl> args . push_back ( make_pair ( sizeof ( cl_int ) , ( void * ) & u1_offset_y ) ) ; <nl> args . push_back ( make_pair ( sizeof ( cl_int ) , ( void * ) & u2_offset_x ) ) ; <nl> args . push_back ( make_pair ( sizeof ( cl_int ) , ( void * ) & u2_offset_y ) ) ; <nl> + args . push_back ( make_pair ( sizeof ( cl_char ) , ( void * ) & calc_error ) ) ; <nl> <nl> openCLExecuteKernel ( clCxt , & tvl1flow , kernelName , globalThread , localThread , args , - 1 , - 1 ) ; <nl> } <nl>
Merge pull request from pengx17 : 2 . 4_tvl1ocl_opt
opencv/opencv
bd7930ada13433c48ef68fd95cfdf9d4453c8152
2013-09-02T09:09:22Z
mmm a / src / init . cpp <nl> ppp b / src / init . cpp <nl> <nl> # include < txdb . h > <nl> # include < txmempool . h > <nl> # include < util / asmap . h > <nl> + # include < util / check . h > <nl> # include < util / moneystr . h > <nl> # include < util / string . h > <nl> # include < util / system . h > <nl> bool AppInitMain ( const util : : Ref & context , NodeContext & node ) <nl> node . mempool = & : : mempool ; <nl> assert ( ! node . chainman ) ; <nl> node . chainman = & g_chainman ; <nl> - ChainstateManager & chainman = EnsureChainman ( node ) ; <nl> + ChainstateManager & chainman = * Assert ( node . chainman ) ; <nl> <nl> - node . peer_logic . reset ( new PeerLogicValidation ( node . connman . get ( ) , node . banman . get ( ) , * node . scheduler , * node . chainman , * node . mempool ) ) ; <nl> + node . peer_logic . reset ( new PeerLogicValidation ( node . connman . get ( ) , node . banman . get ( ) , * node . scheduler , chainman , * node . mempool ) ) ; <nl> RegisterValidationInterface ( node . peer_logic . get ( ) ) ; <nl> <nl> / / sanitize comments per BIP - 0014 , format user agent and check total size <nl> mmm a / src / net_processing . cpp <nl> ppp b / src / net_processing . cpp <nl> <nl> # include < consensus / validation . h > <nl> # include < hash . h > <nl> # include < index / blockfilterindex . h > <nl> - # include < validation . h > <nl> # include < merkleblock . h > <nl> - # include < netmessagemaker . h > <nl> # include < netbase . h > <nl> + # include < netmessagemaker . h > <nl> # include < policy / fees . h > <nl> # include < policy / policy . h > <nl> # include < primitives / block . h > <nl> <nl> # include < scheduler . h > <nl> # include < tinyformat . h > <nl> # include < txmempool . h > <nl> - # include < util / system . h > <nl> + # include < util / check . h > / / For NDEBUG compile time check <nl> # include < util / strencodings . h > <nl> + # include < util / system . h > <nl> + # include < validation . h > <nl> <nl> # include < memory > <nl> # include < typeinfo > <nl> <nl> - # if defined ( NDEBUG ) <nl> - # error " Bitcoin cannot be compiled without assertions . " <nl> - # endif <nl> - <nl> / * * Expiration time for orphan transactions in seconds * / <nl> static constexpr int64_t ORPHAN_TX_EXPIRE_TIME = 20 * 60 ; <nl> / * * Minimum time between orphan transactions expire time checks in seconds * / <nl> mmm a / src / node / context . h <nl> ppp b / src / node / context . h <nl> struct NodeContext { <nl> ~ NodeContext ( ) ; <nl> } ; <nl> <nl> - inline ChainstateManager & EnsureChainman ( const NodeContext & node ) <nl> - { <nl> - assert ( node . chainman ) ; <nl> - return * node . chainman ; <nl> - } <nl> - <nl> # endif / / BITCOIN_NODE_CONTEXT_H <nl> mmm a / src / rpc / blockchain . cpp <nl> ppp b / src / rpc / blockchain . cpp <nl> CTxMemPool & EnsureMemPool ( const util : : Ref & context ) <nl> ChainstateManager & EnsureChainman ( const util : : Ref & context ) <nl> { <nl> NodeContext & node = EnsureNodeContext ( context ) ; <nl> - return EnsureChainman ( node ) ; <nl> + if ( ! node . chainman ) { <nl> + throw JSONRPCError ( RPC_INTERNAL_ERROR , " Node chainman not found " ) ; <nl> + } <nl> + return * node . chainman ; <nl> } <nl> <nl> / * Calculate the difficulty for a given block index . <nl> mmm a / src / test / blockfilter_index_tests . cpp <nl> ppp b / src / test / blockfilter_index_tests . cpp <nl> bool BuildChainTestingSetup : : BuildChain ( const CBlockIndex * pindex , <nl> CBlockHeader header = block - > GetBlockHeader ( ) ; <nl> <nl> BlockValidationState state ; <nl> - if ( ! EnsureChainman ( m_node ) . ProcessNewBlockHeaders ( { header } , state , Params ( ) , & pindex ) ) { <nl> + if ( ! Assert ( m_node . chainman ) - > ProcessNewBlockHeaders ( { header } , state , Params ( ) , & pindex ) ) { <nl> return false ; <nl> } <nl> } <nl> BOOST_FIXTURE_TEST_CASE ( blockfilter_index_initial_sync , BuildChainTestingSetup ) <nl> uint256 chainA_last_header = last_header ; <nl> for ( size_t i = 0 ; i < 2 ; i + + ) { <nl> const auto & block = chainA [ i ] ; <nl> - BOOST_REQUIRE ( EnsureChainman ( m_node ) . ProcessNewBlock ( Params ( ) , block , true , nullptr ) ) ; <nl> + BOOST_REQUIRE ( Assert ( m_node . chainman ) - > ProcessNewBlock ( Params ( ) , block , true , nullptr ) ) ; <nl> } <nl> for ( size_t i = 0 ; i < 2 ; i + + ) { <nl> const auto & block = chainA [ i ] ; <nl> BOOST_FIXTURE_TEST_CASE ( blockfilter_index_initial_sync , BuildChainTestingSetup ) <nl> uint256 chainB_last_header = last_header ; <nl> for ( size_t i = 0 ; i < 3 ; i + + ) { <nl> const auto & block = chainB [ i ] ; <nl> - BOOST_REQUIRE ( EnsureChainman ( m_node ) . ProcessNewBlock ( Params ( ) , block , true , nullptr ) ) ; <nl> + BOOST_REQUIRE ( Assert ( m_node . chainman ) - > ProcessNewBlock ( Params ( ) , block , true , nullptr ) ) ; <nl> } <nl> for ( size_t i = 0 ; i < 3 ; i + + ) { <nl> const auto & block = chainB [ i ] ; <nl> BOOST_FIXTURE_TEST_CASE ( blockfilter_index_initial_sync , BuildChainTestingSetup ) <nl> / / Reorg back to chain A . <nl> for ( size_t i = 2 ; i < 4 ; i + + ) { <nl> const auto & block = chainA [ i ] ; <nl> - BOOST_REQUIRE ( EnsureChainman ( m_node ) . ProcessNewBlock ( Params ( ) , block , true , nullptr ) ) ; <nl> + BOOST_REQUIRE ( Assert ( m_node . chainman ) - > ProcessNewBlock ( Params ( ) , block , true , nullptr ) ) ; <nl> } <nl> <nl> / / Check that chain A and B blocks can be retrieved . <nl> mmm a / src / test / miner_tests . cpp <nl> ppp b / src / test / miner_tests . cpp <nl> BOOST_AUTO_TEST_CASE ( CreateNewBlock_validity ) <nl> pblock - > nNonce = blockinfo [ i ] . nonce ; <nl> } <nl> std : : shared_ptr < const CBlock > shared_pblock = std : : make_shared < const CBlock > ( * pblock ) ; <nl> - BOOST_CHECK ( EnsureChainman ( m_node ) . ProcessNewBlock ( chainparams , shared_pblock , true , nullptr ) ) ; <nl> + BOOST_CHECK ( Assert ( m_node . chainman ) - > ProcessNewBlock ( chainparams , shared_pblock , true , nullptr ) ) ; <nl> pblock - > hashPrevBlock = pblock - > GetHash ( ) ; <nl> } <nl> <nl> mmm a / src / test / util / mining . cpp <nl> ppp b / src / test / util / mining . cpp <nl> <nl> # include < node / context . h > <nl> # include < pow . h > <nl> # include < script / standard . h > <nl> + # include < util / check . h > <nl> # include < validation . h > <nl> <nl> CTxIn generatetoaddress ( const NodeContext & node , const std : : string & address ) <nl> CTxIn MineBlock ( const NodeContext & node , const CScript & coinbase_scriptPubKey ) <nl> assert ( block - > nNonce ) ; <nl> } <nl> <nl> - bool processed { EnsureChainman ( node ) . ProcessNewBlock ( Params ( ) , block , true , nullptr ) } ; <nl> + bool processed { Assert ( node . chainman ) - > ProcessNewBlock ( Params ( ) , block , true , nullptr ) } ; <nl> assert ( processed ) ; <nl> <nl> return CTxIn { block - > vtx [ 0 ] - > GetHash ( ) , 0 } ; <nl> CTxIn MineBlock ( const NodeContext & node , const CScript & coinbase_scriptPubKey ) <nl> <nl> std : : shared_ptr < CBlock > PrepareBlock ( const NodeContext & node , const CScript & coinbase_scriptPubKey ) <nl> { <nl> - assert ( node . mempool ) ; <nl> auto block = std : : make_shared < CBlock > ( <nl> - BlockAssembler { * node . mempool , Params ( ) } <nl> + BlockAssembler { * Assert ( node . mempool ) , Params ( ) } <nl> . CreateNewBlock ( coinbase_scriptPubKey ) <nl> - > block ) ; <nl> <nl> mmm a / src / test / util / setup_common . cpp <nl> ppp b / src / test / util / setup_common . cpp <nl> CBlock TestChain100Setup : : CreateAndProcessBlock ( const std : : vector < CMutableTransa <nl> while ( ! CheckProofOfWork ( block . GetHash ( ) , block . nBits , chainparams . GetConsensus ( ) ) ) + + block . nNonce ; <nl> <nl> std : : shared_ptr < const CBlock > shared_pblock = std : : make_shared < const CBlock > ( block ) ; <nl> - EnsureChainman ( m_node ) . ProcessNewBlock ( chainparams , shared_pblock , true , nullptr ) ; <nl> + Assert ( m_node . chainman ) - > ProcessNewBlock ( chainparams , shared_pblock , true , nullptr ) ; <nl> <nl> CBlock result = block ; <nl> return result ; <nl> mmm a / src / test / util / setup_common . h <nl> ppp b / src / test / util / setup_common . h <nl> <nl> # include < pubkey . h > <nl> # include < random . h > <nl> # include < txmempool . h > <nl> + # include < util / check . h > <nl> # include < util / string . h > <nl> <nl> # include < type_traits > <nl> mmm a / src / test / validation_block_tests . cpp <nl> ppp b / src / test / validation_block_tests . cpp <nl> BOOST_AUTO_TEST_CASE ( processnewblock_signals_ordering ) <nl> std : : transform ( blocks . begin ( ) , blocks . end ( ) , std : : back_inserter ( headers ) , [ ] ( std : : shared_ptr < const CBlock > b ) { return b - > GetBlockHeader ( ) ; } ) ; <nl> <nl> / / Process all the headers so we understand the toplogy of the chain <nl> - BOOST_CHECK ( EnsureChainman ( m_node ) . ProcessNewBlockHeaders ( headers , state , Params ( ) ) ) ; <nl> + BOOST_CHECK ( Assert ( m_node . chainman ) - > ProcessNewBlockHeaders ( headers , state , Params ( ) ) ) ; <nl> <nl> / / Connect the genesis block and drain any outstanding events <nl> - BOOST_CHECK ( EnsureChainman ( m_node ) . ProcessNewBlock ( Params ( ) , std : : make_shared < CBlock > ( Params ( ) . GenesisBlock ( ) ) , true , & ignored ) ) ; <nl> + BOOST_CHECK ( Assert ( m_node . chainman ) - > ProcessNewBlock ( Params ( ) , std : : make_shared < CBlock > ( Params ( ) . GenesisBlock ( ) ) , true , & ignored ) ) ; <nl> SyncWithValidationInterfaceQueue ( ) ; <nl> <nl> / / subscribe to events ( this subscriber will validate event ordering ) <nl> BOOST_AUTO_TEST_CASE ( processnewblock_signals_ordering ) <nl> FastRandomContext insecure ; <nl> for ( int i = 0 ; i < 1000 ; i + + ) { <nl> auto block = blocks [ insecure . randrange ( blocks . size ( ) - 1 ) ] ; <nl> - EnsureChainman ( m_node ) . ProcessNewBlock ( Params ( ) , block , true , & ignored ) ; <nl> + Assert ( m_node . chainman ) - > ProcessNewBlock ( Params ( ) , block , true , & ignored ) ; <nl> } <nl> <nl> / / to make sure that eventually we process the full chain - do it here <nl> for ( auto block : blocks ) { <nl> if ( block - > vtx . size ( ) = = 1 ) { <nl> - bool processed = EnsureChainman ( m_node ) . ProcessNewBlock ( Params ( ) , block , true , & ignored ) ; <nl> + bool processed = Assert ( m_node . chainman ) - > ProcessNewBlock ( Params ( ) , block , true , & ignored ) ; <nl> assert ( processed ) ; <nl> } <nl> } <nl> BOOST_AUTO_TEST_CASE ( mempool_locks_reorg ) <nl> { <nl> bool ignored ; <nl> auto ProcessBlock = [ & ] ( std : : shared_ptr < const CBlock > block ) - > bool { <nl> - return EnsureChainman ( m_node ) . ProcessNewBlock ( Params ( ) , block , / * fForceProcessing * / true , / * fNewBlock * / & ignored ) ; <nl> + return Assert ( m_node . chainman ) - > ProcessNewBlock ( Params ( ) , block , / * fForceProcessing * / true , / * fNewBlock * / & ignored ) ; <nl> } ; <nl> <nl> / / Process all mined blocks <nl> mmm a / src / util / check . h <nl> ppp b / src / util / check . h <nl> class NonFatalCheckError : public std : : runtime_error <nl> * - where the condition is assumed to be true , not for error handling or validating user input <nl> * - where a failure to fulfill the condition is recoverable and does not abort the program <nl> * <nl> - * For example in RPC code , where it is undersirable to crash the whole program , this can be generally used to replace <nl> + * For example in RPC code , where it is undesirable to crash the whole program , this can be generally used to replace <nl> * asserts or recoverable logic errors . A NonFatalCheckError in RPC code is caught and passed as a string to the RPC <nl> * caller , which can then report the issue to the developers . <nl> * / <nl> class NonFatalCheckError : public std : : runtime_error <nl> } \ <nl> } while ( false ) <nl> <nl> + # if defined ( NDEBUG ) <nl> + # error " Cannot compile without assertions ! " <nl> + # endif <nl> + <nl> + / * * Helper for Assert ( ) . TODO remove in C + + 14 and replace ` decltype ( get_pure_r_value ( val ) ) ` with ` T ` ( templated lambda ) * / <nl> + template < typename T > <nl> + T get_pure_r_value ( T & & val ) <nl> + { <nl> + return std : : forward < T > ( val ) ; <nl> + } <nl> + <nl> + / * * Identity function . Abort if the value compares equal to zero * / <nl> + # define Assert ( val ) [ & ] ( ) - > decltype ( get_pure_r_value ( val ) ) & { auto & check = ( val ) ; assert ( # val & & check ) ; return check ; } ( ) <nl> + <nl> # endif / / BITCOIN_UTIL_CHECK_H <nl> mmm a / src / validation . cpp <nl> ppp b / src / validation . cpp <nl> <nl> # include < txmempool . h > <nl> # include < uint256 . h > <nl> # include < undo . h > <nl> + # include < util / check . h > / / For NDEBUG compile time check <nl> # include < util / moneystr . h > <nl> # include < util / rbf . h > <nl> # include < util / strencodings . h > <nl> <nl> <nl> # include < boost / algorithm / string / replace . hpp > <nl> <nl> - # if defined ( NDEBUG ) <nl> - # error " Bitcoin cannot be compiled without assertions . " <nl> - # endif <nl> - <nl> # define MICRO 0 . 000001 <nl> # define MILLI 0 . 001 <nl> <nl> mmm a / src / wallet / test / wallet_tests . cpp <nl> ppp b / src / wallet / test / wallet_tests . cpp <nl> BOOST_FIXTURE_TEST_CASE ( scan_for_wallet_transactions , TestChain100Setup ) <nl> / / Prune the older block file . <nl> { <nl> LOCK ( cs_main ) ; <nl> - EnsureChainman ( m_node ) . PruneOneBlockFile ( oldTip - > GetBlockPos ( ) . nFile ) ; <nl> + Assert ( m_node . chainman ) - > PruneOneBlockFile ( oldTip - > GetBlockPos ( ) . nFile ) ; <nl> } <nl> UnlinkPrunedFiles ( { oldTip - > GetBlockPos ( ) . nFile } ) ; <nl> <nl> BOOST_FIXTURE_TEST_CASE ( scan_for_wallet_transactions , TestChain100Setup ) <nl> / / Prune the remaining block file . <nl> { <nl> LOCK ( cs_main ) ; <nl> - EnsureChainman ( m_node ) . PruneOneBlockFile ( newTip - > GetBlockPos ( ) . nFile ) ; <nl> + Assert ( m_node . chainman ) - > PruneOneBlockFile ( newTip - > GetBlockPos ( ) . nFile ) ; <nl> } <nl> UnlinkPrunedFiles ( { newTip - > GetBlockPos ( ) . nFile } ) ; <nl> <nl> BOOST_FIXTURE_TEST_CASE ( importmulti_rescan , TestChain100Setup ) <nl> / / Prune the older block file . <nl> { <nl> LOCK ( cs_main ) ; <nl> - EnsureChainman ( m_node ) . PruneOneBlockFile ( oldTip - > GetBlockPos ( ) . nFile ) ; <nl> + Assert ( m_node . chainman ) - > PruneOneBlockFile ( oldTip - > GetBlockPos ( ) . nFile ) ; <nl> } <nl> UnlinkPrunedFiles ( { oldTip - > GetBlockPos ( ) . nFile } ) ; <nl> <nl> mmm a / test / lint / lint - assertions . sh <nl> ppp b / test / lint / lint - assertions . sh <nl> fi <nl> # Macro CHECK_NONFATAL ( condition ) should be used instead of assert for RPC code , where it <nl> # is undesirable to crash the whole program . See : src / util / check . h <nl> # src / rpc / server . cpp is excluded from this check since it ' s mostly meta - code . <nl> - OUTPUT = $ ( git grep - nE ' assert * \ ( . * \ ) ; ' - - " src / rpc / " " src / wallet / rpc * " " : ( exclude ) src / rpc / server . cpp " ) <nl> + OUTPUT = $ ( git grep - nE ' \ < ( A | a ) ssert * \ ( . * \ ) ; ' - - " src / rpc / " " src / wallet / rpc * " " : ( exclude ) src / rpc / server . cpp " ) <nl> if [ [ $ { OUTPUT } ! = " " ] ] ; then <nl> echo " CHECK_NONFATAL ( condition ) should be used instead of assert for RPC code . " <nl> echo <nl>
Merge : util : Add Assert identity function
bitcoin/bitcoin
5ec19df687c2a429dd8872d640ce88fdc06ded9b
2020-07-04T12:44:45Z
mmm a / src / Functions / FunctionBinaryArithmetic . h <nl> ppp b / src / Functions / FunctionBinaryArithmetic . h <nl> <nl> # include " FunctionFactory . h " <nl> # include < Common / typeid_cast . h > <nl> # include < Common / assert_cast . h > <nl> + # include < Common / FieldVisitors . h > <nl> + # include < Common / FieldVisitorsAccurateComparison . h > <nl> + # include < ext / map . h > <nl> <nl> # if ! defined ( ARCADIA_BUILD ) <nl> # include < Common / config . h > <nl> namespace ErrorCodes <nl> extern const int LOGICAL_ERROR ; <nl> extern const int DECIMAL_OVERFLOW ; <nl> extern const int CANNOT_ADD_DIFFERENT_AGGREGATE_STATES ; <nl> + extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH ; <nl> } <nl> <nl> <nl> class FunctionBinaryArithmetic : public IFunction <nl> return castType ( left , [ & ] ( const auto & left_ ) { return castType ( right , [ & ] ( const auto & right_ ) { return f ( left_ , right_ ) ; } ) ; } ) ; <nl> } <nl> <nl> - FunctionOverloadResolverPtr getFunctionForIntervalArithmetic ( const DataTypePtr & type0 , const DataTypePtr & type1 ) const <nl> + static FunctionOverloadResolverPtr <nl> + getFunctionForIntervalArithmetic ( const DataTypePtr & type0 , const DataTypePtr & type1 , const Context & context ) <nl> { <nl> bool first_is_date_or_datetime = isDateOrDateTime ( type0 ) ; <nl> bool second_is_date_or_datetime = isDateOrDateTime ( type1 ) ; <nl> class FunctionBinaryArithmetic : public IFunction <nl> } <nl> <nl> if ( second_is_date_or_datetime & & is_minus ) <nl> - throw Exception ( " Wrong order of arguments for function " + getName ( ) + " : argument of type Interval cannot be first . " , <nl> + throw Exception ( " Wrong order of arguments for function " + String ( name ) + " : argument of type Interval cannot be first . " , <nl> ErrorCodes : : ILLEGAL_TYPE_OF_ARGUMENT ) ; <nl> <nl> std : : string function_name ; <nl> class FunctionBinaryArithmetic : public IFunction <nl> return FunctionFactory : : instance ( ) . get ( function_name , context ) ; <nl> } <nl> <nl> - bool isAggregateMultiply ( const DataTypePtr & type0 , const DataTypePtr & type1 ) const <nl> + static bool isAggregateMultiply ( const DataTypePtr & type0 , const DataTypePtr & type1 ) <nl> { <nl> if constexpr ( ! is_multiply ) <nl> return false ; <nl> class FunctionBinaryArithmetic : public IFunction <nl> | | ( which0 . isNativeUInt ( ) & & which1 . isAggregateFunction ( ) ) ; <nl> } <nl> <nl> - bool isAggregateAddition ( const DataTypePtr & type0 , const DataTypePtr & type1 ) const <nl> + static bool isAggregateAddition ( const DataTypePtr & type0 , const DataTypePtr & type1 ) <nl> { <nl> if constexpr ( ! is_plus ) <nl> return false ; <nl> class FunctionBinaryArithmetic : public IFunction <nl> size_t getNumberOfArguments ( ) const override { return 2 ; } <nl> <nl> DataTypePtr getReturnTypeImpl ( const DataTypes & arguments ) const override <nl> + { <nl> + return getReturnTypeImplStatic ( arguments , context ) ; <nl> + } <nl> + <nl> + static DataTypePtr getReturnTypeImplStatic ( const DataTypes & arguments , const Context & context ) <nl> { <nl> / / / Special case when multiply aggregate function state <nl> if ( isAggregateMultiply ( arguments [ 0 ] , arguments [ 1 ] ) ) <nl> class FunctionBinaryArithmetic : public IFunction <nl> } <nl> <nl> / / / Special case when the function is plus or minus , one of arguments is Date / DateTime and another is Interval . <nl> - if ( auto function_builder = getFunctionForIntervalArithmetic ( arguments [ 0 ] , arguments [ 1 ] ) ) <nl> + if ( auto function_builder = getFunctionForIntervalArithmetic ( arguments [ 0 ] , arguments [ 1 ] , context ) ) <nl> { <nl> ColumnsWithTypeAndName new_arguments ( 2 ) ; <nl> <nl> class FunctionBinaryArithmetic : public IFunction <nl> return false ; <nl> } ) ; <nl> if ( ! valid ) <nl> - throw Exception ( " Illegal types " + arguments [ 0 ] - > getName ( ) + " and " + arguments [ 1 ] - > getName ( ) + " of arguments of function " + getName ( ) , <nl> + throw Exception ( " Illegal types " + arguments [ 0 ] - > getName ( ) + " and " + arguments [ 1 ] - > getName ( ) + " of arguments of function " + String ( name ) , <nl> ErrorCodes : : ILLEGAL_TYPE_OF_ARGUMENT ) ; <nl> return type_res ; <nl> } <nl> class FunctionBinaryArithmetic : public IFunction <nl> } <nl> <nl> / / / Special case when the function is plus or minus , one of arguments is Date / DateTime and another is Interval . <nl> - if ( auto function_builder = getFunctionForIntervalArithmetic ( block . getByPosition ( arguments [ 0 ] ) . type , block . getByPosition ( arguments [ 1 ] ) . type ) ) <nl> + if ( auto function_builder <nl> + = getFunctionForIntervalArithmetic ( block . getByPosition ( arguments [ 0 ] ) . type , block . getByPosition ( arguments [ 1 ] ) . type , context ) ) <nl> { <nl> executeDateTimeIntervalPlusMinus ( block , arguments , result , input_rows_count , function_builder ) ; <nl> return ; <nl> class FunctionBinaryArithmetic : public IFunction <nl> bool canBeExecutedOnDefaultArguments ( ) const override { return valid_on_default_arguments ; } <nl> } ; <nl> <nl> + <nl> + template < template < typename , typename > class Op , typename Name , bool valid_on_default_arguments = true > <nl> + class FunctionBinaryArithmeticWithConstants : public FunctionBinaryArithmetic < Op , Name , valid_on_default_arguments > <nl> + { <nl> + public : <nl> + using Base = FunctionBinaryArithmetic < Op , Name , valid_on_default_arguments > ; <nl> + using Monotonicity = typename Base : : Monotonicity ; <nl> + <nl> + static FunctionPtr create ( <nl> + const ColumnWithTypeAndName & left_ , <nl> + const ColumnWithTypeAndName & right_ , <nl> + const DataTypePtr & return_type_ , <nl> + const Context & context ) <nl> + { <nl> + return std : : make_shared < FunctionBinaryArithmeticWithConstants > ( left_ , right_ , return_type_ , context ) ; <nl> + } <nl> + <nl> + FunctionBinaryArithmeticWithConstants ( <nl> + const ColumnWithTypeAndName & left_ , <nl> + const ColumnWithTypeAndName & right_ , <nl> + const DataTypePtr & return_type_ , <nl> + const Context & context_ ) <nl> + : Base ( context_ ) , left ( left_ ) , right ( right_ ) , return_type ( return_type_ ) <nl> + { <nl> + } <nl> + <nl> + void executeImpl ( Block & block , const ColumnNumbers & arguments , size_t result , size_t input_rows_count ) const override <nl> + { <nl> + if ( left . column & & isColumnConst ( * left . column ) & & arguments . size ( ) = = 1 ) <nl> + { <nl> + Block block_with_constant <nl> + = { { left . column - > cloneResized ( input_rows_count ) , left . type , left . name } , <nl> + block . getByPosition ( arguments [ 0 ] ) , <nl> + block . getByPosition ( result ) } ; <nl> + Base : : executeImpl ( block_with_constant , { 0 , 1 } , 2 , input_rows_count ) ; <nl> + block . getByPosition ( result ) = block_with_constant . getByPosition ( 2 ) ; <nl> + } <nl> + else if ( right . column & & isColumnConst ( * right . column ) & & arguments . size ( ) = = 1 ) <nl> + { <nl> + Block block_with_constant <nl> + = { block . getByPosition ( arguments [ 0 ] ) , <nl> + { right . column - > cloneResized ( input_rows_count ) , right . type , right . name } , <nl> + block . getByPosition ( result ) } ; <nl> + Base : : executeImpl ( block_with_constant , { 0 , 1 } , 2 , input_rows_count ) ; <nl> + block . getByPosition ( result ) = block_with_constant . getByPosition ( 2 ) ; <nl> + } <nl> + else <nl> + Base : : executeImpl ( block , arguments , result , input_rows_count ) ; <nl> + } <nl> + <nl> + bool hasInformationAboutMonotonicity ( ) const override <nl> + { <nl> + std : : string_view name_ = Name : : name ; <nl> + if ( name_ = = " minus " | | name_ = = " plus " | | name_ = = " divide " | | name_ = = " intDiv " ) <nl> + { <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + Monotonicity getMonotonicityForRange ( const IDataType & , const Field & left_point , const Field & right_point ) const override <nl> + { <nl> + / / For simplicity , we treat null values as monotonicity breakers . <nl> + if ( left_point . isNull ( ) | | right_point . isNull ( ) ) <nl> + return { false , true , false } ; <nl> + <nl> + / / For simplicity , we treat every single value interval as positive monotonic . <nl> + if ( applyVisitor ( FieldVisitorAccurateEquals ( ) , left_point , right_point ) ) <nl> + return { true , true , false } ; <nl> + <nl> + std : : string_view name_ = Name : : name ; <nl> + if ( name_ = = " minus " | | name_ = = " plus " ) <nl> + { <nl> + / / const + | - variable <nl> + if ( left . column & & isColumnConst ( * left . column ) ) <nl> + { <nl> + auto transform = [ & ] ( const Field & point ) <nl> + { <nl> + Block block_with_constant <nl> + = { { left . column - > cloneResized ( 1 ) , left . type , left . name } , <nl> + { right . type - > createColumnConst ( 1 , point ) , right . type , right . name } , <nl> + { nullptr , return_type , " " } } ; <nl> + Base : : executeImpl ( block_with_constant , { 0 , 1 } , 2 , 1 ) ; <nl> + Field point_transformed ; <nl> + block_with_constant . getByPosition ( 2 ) . column - > get ( 0 , point_transformed ) ; <nl> + return point_transformed ; <nl> + } ; <nl> + transform ( left_point ) ; <nl> + transform ( right_point ) ; <nl> + if ( name_ = = " plus " ) <nl> + { <nl> + / / Check if there is an overflow <nl> + if ( applyVisitor ( FieldVisitorAccurateLess ( ) , left_point , right_point ) <nl> + = = applyVisitor ( FieldVisitorAccurateLess ( ) , transform ( left_point ) , transform ( right_point ) ) ) <nl> + return { true , true , false } ; <nl> + else <nl> + return { false , true , false } ; <nl> + } <nl> + else <nl> + { <nl> + / / Check if there is an overflow <nl> + if ( applyVisitor ( FieldVisitorAccurateLess ( ) , left_point , right_point ) <nl> + ! = applyVisitor ( FieldVisitorAccurateLess ( ) , transform ( left_point ) , transform ( right_point ) ) ) <nl> + return { true , false , false } ; <nl> + else <nl> + return { false , false , false } ; <nl> + } <nl> + } <nl> + / / variable + | - constant <nl> + else if ( right . column & & isColumnConst ( * right . column ) ) <nl> + { <nl> + auto transform = [ & ] ( const Field & point ) <nl> + { <nl> + Block block_with_constant <nl> + = { { left . type - > createColumnConst ( 1 , point ) , left . type , left . name } , <nl> + { right . column - > cloneResized ( 1 ) , right . type , right . name } , <nl> + { nullptr , return_type , " " } } ; <nl> + Base : : executeImpl ( block_with_constant , { 0 , 1 } , 2 , 1 ) ; <nl> + Field point_transformed ; <nl> + block_with_constant . getByPosition ( 2 ) . column - > get ( 0 , point_transformed ) ; <nl> + return point_transformed ; <nl> + } ; <nl> + <nl> + / / Check if there is an overflow <nl> + if ( applyVisitor ( FieldVisitorAccurateLess ( ) , left_point , right_point ) <nl> + = = applyVisitor ( FieldVisitorAccurateLess ( ) , transform ( left_point ) , transform ( right_point ) ) ) <nl> + return { true , true , false } ; <nl> + else <nl> + return { false , true , false } ; <nl> + } <nl> + } <nl> + if ( name_ = = " divide " | | name_ = = " intDiv " ) <nl> + { <nl> + / / const / variable <nl> + if ( left . column & & isColumnConst ( * left . column ) ) <nl> + { <nl> + auto constant = ( * left . column ) [ 0 ] ; <nl> + if ( applyVisitor ( FieldVisitorAccurateEquals ( ) , constant , Field ( 0 ) ) ) <nl> + return { true , true , false } ; / / 0 / 0 is undefined , thus it ' s not always monotonic <nl> + <nl> + bool is_constant_positive = applyVisitor ( FieldVisitorAccurateLess ( ) , Field ( 0 ) , constant ) ; <nl> + if ( applyVisitor ( FieldVisitorAccurateLess ( ) , left_point , Field ( 0 ) ) & & <nl> + applyVisitor ( FieldVisitorAccurateLess ( ) , right_point , Field ( 0 ) ) ) <nl> + { <nl> + return { true , is_constant_positive , false } ; <nl> + } <nl> + else <nl> + if ( applyVisitor ( FieldVisitorAccurateLess ( ) , Field ( 0 ) , left_point ) & & <nl> + applyVisitor ( FieldVisitorAccurateLess ( ) , Field ( 0 ) , right_point ) ) <nl> + { <nl> + return { true , ! is_constant_positive , false } ; <nl> + } <nl> + } <nl> + / / variable / constant <nl> + else if ( right . column & & isColumnConst ( * right . column ) ) <nl> + { <nl> + auto constant = ( * right . column ) [ 0 ] ; <nl> + if ( applyVisitor ( FieldVisitorAccurateEquals ( ) , constant , Field ( 0 ) ) ) <nl> + return { false , true , false } ; / / variable / 0 is undefined , let ' s treat it as non - monotonic <nl> + <nl> + bool is_constant_positive = applyVisitor ( FieldVisitorAccurateLess ( ) , Field ( 0 ) , constant ) ; <nl> + / / division is saturated to ` inf ` , thus it doesn ' t have overflow issues . <nl> + return { true , is_constant_positive , false } ; <nl> + } <nl> + } <nl> + return { false , true , false } ; <nl> + } <nl> + <nl> + private : <nl> + ColumnWithTypeAndName left ; <nl> + ColumnWithTypeAndName right ; <nl> + DataTypePtr return_type ; <nl> + } ; <nl> + <nl> + <nl> + template < template < typename , typename > class Op , typename Name , bool valid_on_default_arguments = true > <nl> + class BinaryArithmeticOverloadResolver : public IFunctionOverloadResolverImpl <nl> + { <nl> + public : <nl> + static constexpr auto name = Name : : name ; <nl> + static FunctionOverloadResolverImplPtr create ( const Context & context ) <nl> + { <nl> + return std : : make_unique < BinaryArithmeticOverloadResolver > ( context ) ; <nl> + } <nl> + <nl> + explicit BinaryArithmeticOverloadResolver ( const Context & context_ ) : context ( context_ ) { } <nl> + <nl> + String getName ( ) const override { return name ; } <nl> + size_t getNumberOfArguments ( ) const override { return 2 ; } <nl> + bool isVariadic ( ) const override { return false ; } <nl> + <nl> + FunctionBaseImplPtr build ( const ColumnsWithTypeAndName & arguments , const DataTypePtr & return_type ) const override <nl> + { <nl> + / / / More efficient specialization for two numeric arguments . <nl> + if ( arguments . size ( ) = = 2 <nl> + & & ( ( arguments [ 0 ] . column & & isColumnConst ( * arguments [ 0 ] . column ) ) <nl> + | | ( arguments [ 1 ] . column & & isColumnConst ( * arguments [ 1 ] . column ) ) ) ) <nl> + { <nl> + return std : : make_unique < DefaultFunction > ( <nl> + FunctionBinaryArithmeticWithConstants < Op , Name , valid_on_default_arguments > : : create ( <nl> + arguments [ 0 ] , arguments [ 1 ] , return_type , context ) , <nl> + ext : : map < DataTypes > ( arguments , [ ] ( const auto & elem ) { return elem . type ; } ) , <nl> + return_type ) ; <nl> + } <nl> + <nl> + return std : : make_unique < DefaultFunction > ( <nl> + FunctionBinaryArithmetic < Op , Name , valid_on_default_arguments > : : create ( context ) , <nl> + ext : : map < DataTypes > ( arguments , [ ] ( const auto & elem ) { return elem . type ; } ) , <nl> + return_type ) ; <nl> + } <nl> + <nl> + DataTypePtr getReturnType ( const DataTypes & arguments ) const override <nl> + { <nl> + if ( arguments . size ( ) ! = 2 ) <nl> + throw Exception ( <nl> + " Number of arguments for function " + getName ( ) + " doesn ' t match : passed " + toString ( arguments . size ( ) ) + " , should be 2 " , <nl> + ErrorCodes : : NUMBER_OF_ARGUMENTS_DOESNT_MATCH ) ; <nl> + return FunctionBinaryArithmetic < Op , Name , valid_on_default_arguments > : : getReturnTypeImplStatic ( arguments , context ) ; <nl> + } <nl> + <nl> + private : <nl> + const Context & context ; <nl> + } ; <nl> + <nl> } <nl> mmm a / src / Functions / bitAnd . cpp <nl> ppp b / src / Functions / bitAnd . cpp <nl> struct BitAndImpl <nl> } ; <nl> <nl> struct NameBitAnd { static constexpr auto name = " bitAnd " ; } ; <nl> - using FunctionBitAnd = FunctionBinaryArithmetic < BitAndImpl , NameBitAnd , true > ; <nl> + using FunctionBitAnd = BinaryArithmeticOverloadResolver < BitAndImpl , NameBitAnd , true > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / bitBoolMaskAnd . cpp <nl> ppp b / src / Functions / bitBoolMaskAnd . cpp <nl> struct BitBoolMaskAndImpl <nl> } ; <nl> <nl> struct NameBitBoolMaskAnd { static constexpr auto name = " __bitBoolMaskAnd " ; } ; <nl> - using FunctionBitBoolMaskAnd = FunctionBinaryArithmetic < BitBoolMaskAndImpl , NameBitBoolMaskAnd > ; <nl> + using FunctionBitBoolMaskAnd = BinaryArithmeticOverloadResolver < BitBoolMaskAndImpl , NameBitBoolMaskAnd > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / bitBoolMaskOr . cpp <nl> ppp b / src / Functions / bitBoolMaskOr . cpp <nl> struct BitBoolMaskOrImpl <nl> } ; <nl> <nl> struct NameBitBoolMaskOr { static constexpr auto name = " __bitBoolMaskOr " ; } ; <nl> - using FunctionBitBoolMaskOr = FunctionBinaryArithmetic < BitBoolMaskOrImpl , NameBitBoolMaskOr > ; <nl> + using FunctionBitBoolMaskOr = BinaryArithmeticOverloadResolver < BitBoolMaskOrImpl , NameBitBoolMaskOr > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / bitOr . cpp <nl> ppp b / src / Functions / bitOr . cpp <nl> struct BitOrImpl <nl> } ; <nl> <nl> struct NameBitOr { static constexpr auto name = " bitOr " ; } ; <nl> - using FunctionBitOr = FunctionBinaryArithmetic < BitOrImpl , NameBitOr , true > ; <nl> + using FunctionBitOr = BinaryArithmeticOverloadResolver < BitOrImpl , NameBitOr , true > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / bitRotateLeft . cpp <nl> ppp b / src / Functions / bitRotateLeft . cpp <nl> struct BitRotateLeftImpl <nl> } ; <nl> <nl> struct NameBitRotateLeft { static constexpr auto name = " bitRotateLeft " ; } ; <nl> - using FunctionBitRotateLeft = FunctionBinaryArithmetic < BitRotateLeftImpl , NameBitRotateLeft > ; <nl> + using FunctionBitRotateLeft = BinaryArithmeticOverloadResolver < BitRotateLeftImpl , NameBitRotateLeft > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / bitRotateRight . cpp <nl> ppp b / src / Functions / bitRotateRight . cpp <nl> struct BitRotateRightImpl <nl> } ; <nl> <nl> struct NameBitRotateRight { static constexpr auto name = " bitRotateRight " ; } ; <nl> - using FunctionBitRotateRight = FunctionBinaryArithmetic < BitRotateRightImpl , NameBitRotateRight > ; <nl> + using FunctionBitRotateRight = BinaryArithmeticOverloadResolver < BitRotateRightImpl , NameBitRotateRight > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / bitShiftLeft . cpp <nl> ppp b / src / Functions / bitShiftLeft . cpp <nl> struct BitShiftLeftImpl <nl> } ; <nl> <nl> struct NameBitShiftLeft { static constexpr auto name = " bitShiftLeft " ; } ; <nl> - using FunctionBitShiftLeft = FunctionBinaryArithmetic < BitShiftLeftImpl , NameBitShiftLeft > ; <nl> + using FunctionBitShiftLeft = BinaryArithmeticOverloadResolver < BitShiftLeftImpl , NameBitShiftLeft > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / bitShiftRight . cpp <nl> ppp b / src / Functions / bitShiftRight . cpp <nl> struct BitShiftRightImpl <nl> } ; <nl> <nl> struct NameBitShiftRight { static constexpr auto name = " bitShiftRight " ; } ; <nl> - using FunctionBitShiftRight = FunctionBinaryArithmetic < BitShiftRightImpl , NameBitShiftRight > ; <nl> + using FunctionBitShiftRight = BinaryArithmeticOverloadResolver < BitShiftRightImpl , NameBitShiftRight > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / bitTest . cpp <nl> ppp b / src / Functions / bitTest . cpp <nl> struct BitTestImpl <nl> } ; <nl> <nl> struct NameBitTest { static constexpr auto name = " bitTest " ; } ; <nl> - using FunctionBitTest = FunctionBinaryArithmetic < BitTestImpl , NameBitTest > ; <nl> + using FunctionBitTest = BinaryArithmeticOverloadResolver < BitTestImpl , NameBitTest > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / bitXor . cpp <nl> ppp b / src / Functions / bitXor . cpp <nl> struct BitXorImpl <nl> } ; <nl> <nl> struct NameBitXor { static constexpr auto name = " bitXor " ; } ; <nl> - using FunctionBitXor = FunctionBinaryArithmetic < BitXorImpl , NameBitXor , true > ; <nl> + using FunctionBitXor = BinaryArithmeticOverloadResolver < BitXorImpl , NameBitXor , true > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / divide . cpp <nl> ppp b / src / Functions / divide . cpp <nl> struct DivideFloatingImpl <nl> } ; <nl> <nl> struct NameDivide { static constexpr auto name = " divide " ; } ; <nl> - using FunctionDivide = FunctionBinaryArithmetic < DivideFloatingImpl , NameDivide > ; <nl> + using FunctionDivide = BinaryArithmeticOverloadResolver < DivideFloatingImpl , NameDivide > ; <nl> <nl> void registerFunctionDivide ( FunctionFactory & factory ) <nl> { <nl> mmm a / src / Functions / gcd . cpp <nl> ppp b / src / Functions / gcd . cpp <nl> struct GCDImpl <nl> } ; <nl> <nl> struct NameGCD { static constexpr auto name = " gcd " ; } ; <nl> - using FunctionGCD = FunctionBinaryArithmetic < GCDImpl , NameGCD , false > ; <nl> + using FunctionGCD = BinaryArithmeticOverloadResolver < GCDImpl , NameGCD , false > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / intDiv . cpp <nl> ppp b / src / Functions / intDiv . cpp <nl> template < > struct BinaryOperationImpl < Int32 , Int64 , DivideIntegralImpl < Int32 , I <nl> <nl> <nl> struct NameIntDiv { static constexpr auto name = " intDiv " ; } ; <nl> - using FunctionIntDiv = FunctionBinaryArithmetic < DivideIntegralImpl , NameIntDiv , false > ; <nl> + using FunctionIntDiv = BinaryArithmeticOverloadResolver < DivideIntegralImpl , NameIntDiv , false > ; <nl> <nl> void registerFunctionIntDiv ( FunctionFactory & factory ) <nl> { <nl> mmm a / src / Functions / intDivOrZero . cpp <nl> ppp b / src / Functions / intDivOrZero . cpp <nl> struct DivideIntegralOrZeroImpl <nl> } ; <nl> <nl> struct NameIntDivOrZero { static constexpr auto name = " intDivOrZero " ; } ; <nl> - using FunctionIntDivOrZero = FunctionBinaryArithmetic < DivideIntegralOrZeroImpl , NameIntDivOrZero > ; <nl> + using FunctionIntDivOrZero = BinaryArithmeticOverloadResolver < DivideIntegralOrZeroImpl , NameIntDivOrZero > ; <nl> <nl> void registerFunctionIntDivOrZero ( FunctionFactory & factory ) <nl> { <nl> mmm a / src / Functions / lcm . cpp <nl> ppp b / src / Functions / lcm . cpp <nl> struct LCMImpl <nl> } ; <nl> <nl> struct NameLCM { static constexpr auto name = " lcm " ; } ; <nl> - using FunctionLCM = FunctionBinaryArithmetic < LCMImpl , NameLCM , false > ; <nl> + using FunctionLCM = BinaryArithmeticOverloadResolver < LCMImpl , NameLCM , false > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / minus . cpp <nl> ppp b / src / Functions / minus . cpp <nl> struct MinusImpl <nl> } ; <nl> <nl> struct NameMinus { static constexpr auto name = " minus " ; } ; <nl> - using FunctionMinus = FunctionBinaryArithmetic < MinusImpl , NameMinus > ; <nl> + using FunctionMinus = BinaryArithmeticOverloadResolver < MinusImpl , NameMinus > ; <nl> <nl> void registerFunctionMinus ( FunctionFactory & factory ) <nl> { <nl> mmm a / src / Functions / modulo . cpp <nl> ppp b / src / Functions / modulo . cpp <nl> template < > struct BinaryOperationImpl < Int32 , Int64 , ModuloImpl < Int32 , Int64 > > : <nl> <nl> <nl> struct NameModulo { static constexpr auto name = " modulo " ; } ; <nl> - using FunctionModulo = FunctionBinaryArithmetic < ModuloImpl , NameModulo , false > ; <nl> + using FunctionModulo = BinaryArithmeticOverloadResolver < ModuloImpl , NameModulo , false > ; <nl> <nl> void registerFunctionModulo ( FunctionFactory & factory ) <nl> { <nl> mmm a / src / Functions / moduloOrZero . cpp <nl> ppp b / src / Functions / moduloOrZero . cpp <nl> struct ModuloOrZeroImpl <nl> } ; <nl> <nl> struct NameModuloOrZero { static constexpr auto name = " moduloOrZero " ; } ; <nl> - using FunctionModuloOrZero = FunctionBinaryArithmetic < ModuloOrZeroImpl , NameModuloOrZero > ; <nl> + using FunctionModuloOrZero = BinaryArithmeticOverloadResolver < ModuloOrZeroImpl , NameModuloOrZero > ; <nl> <nl> } <nl> <nl> mmm a / src / Functions / multiply . cpp <nl> ppp b / src / Functions / multiply . cpp <nl> struct MultiplyImpl <nl> } ; <nl> <nl> struct NameMultiply { static constexpr auto name = " multiply " ; } ; <nl> - using FunctionMultiply = FunctionBinaryArithmetic < MultiplyImpl , NameMultiply > ; <nl> + using FunctionMultiply = BinaryArithmeticOverloadResolver < MultiplyImpl , NameMultiply > ; <nl> <nl> void registerFunctionMultiply ( FunctionFactory & factory ) <nl> { <nl> mmm a / src / Functions / plus . cpp <nl> ppp b / src / Functions / plus . cpp <nl> struct PlusImpl <nl> } ; <nl> <nl> struct NamePlus { static constexpr auto name = " plus " ; } ; <nl> - using FunctionPlus = FunctionBinaryArithmetic < PlusImpl , NamePlus > ; <nl> + using FunctionPlus = BinaryArithmeticOverloadResolver < PlusImpl , NamePlus > ; <nl> <nl> void registerFunctionPlus ( FunctionFactory & factory ) <nl> { <nl> mmm a / src / Storages / MergeTree / KeyCondition . cpp <nl> ppp b / src / Storages / MergeTree / KeyCondition . cpp <nl> <nl> # include < Storages / MergeTree / KeyCondition . h > <nl> # include < Storages / MergeTree / BoolMask . h > <nl> # include < DataTypes / DataTypesNumber . h > <nl> + # include < DataTypes / FieldToDataType . h > <nl> # include < Interpreters / TreeRewriter . h > <nl> # include < Interpreters / ExpressionAnalyzer . h > <nl> # include < Interpreters / ExpressionActions . h > <nl> bool KeyCondition : : isKeyPossiblyWrappedByMonotonicFunctions ( <nl> <nl> for ( auto it = chain_not_tested_for_monotonicity . rbegin ( ) ; it ! = chain_not_tested_for_monotonicity . rend ( ) ; + + it ) <nl> { <nl> + const auto & args = ( * it ) - > arguments - > children ; <nl> auto func_builder = FunctionFactory : : instance ( ) . tryGet ( ( * it ) - > name , context ) ; <nl> - ColumnsWithTypeAndName arguments { { nullptr , key_column_type , " " } } ; <nl> + ColumnsWithTypeAndName arguments ; <nl> + if ( args . size ( ) = = 2 ) <nl> + { <nl> + if ( const auto * arg_left = args [ 0 ] - > as < ASTLiteral > ( ) ) <nl> + { <nl> + auto left_arg_type = applyVisitor ( FieldToDataType ( ) , arg_left - > value ) ; <nl> + arguments . push_back ( { left_arg_type - > createColumnConst ( 0 , arg_left - > value ) , left_arg_type , " " } ) ; <nl> + arguments . push_back ( { nullptr , key_column_type , " " } ) ; <nl> + } <nl> + else if ( const auto * arg_right = args [ 1 ] - > as < ASTLiteral > ( ) ) <nl> + { <nl> + arguments . push_back ( { nullptr , key_column_type , " " } ) ; <nl> + auto right_arg_type = applyVisitor ( FieldToDataType ( ) , arg_right - > value ) ; <nl> + arguments . push_back ( { right_arg_type - > createColumnConst ( 0 , arg_right - > value ) , right_arg_type , " " } ) ; <nl> + } <nl> + } <nl> + else <nl> + arguments . push_back ( { nullptr , key_column_type , " " } ) ; <nl> auto func = func_builder - > build ( arguments ) ; <nl> <nl> if ( ! func | | ! func - > hasInformationAboutMonotonicity ( ) ) <nl> bool KeyCondition : : isKeyPossiblyWrappedByMonotonicFunctionsImpl ( <nl> if ( const auto * func = node - > as < ASTFunction > ( ) ) <nl> { <nl> const auto & args = func - > arguments - > children ; <nl> - if ( args . size ( ) ! = 1 ) <nl> + if ( args . size ( ) > 2 | | args . empty ( ) ) <nl> return false ; <nl> <nl> out_functions_chain . push_back ( func ) ; <nl> - <nl> - return isKeyPossiblyWrappedByMonotonicFunctionsImpl ( args [ 0 ] , out_key_column_num , out_key_column_type , out_functions_chain ) ; <nl> + bool ret = false ; <nl> + if ( args . size ( ) = = 2 ) <nl> + { <nl> + if ( args [ 0 ] - > as < ASTLiteral > ( ) ) <nl> + { <nl> + ret = isKeyPossiblyWrappedByMonotonicFunctionsImpl ( args [ 1 ] , out_key_column_num , out_key_column_type , out_functions_chain ) ; <nl> + } <nl> + else if ( args [ 1 ] - > as < ASTLiteral > ( ) ) <nl> + { <nl> + ret = isKeyPossiblyWrappedByMonotonicFunctionsImpl ( args [ 0 ] , out_key_column_num , out_key_column_type , out_functions_chain ) ; <nl> + } <nl> + } <nl> + else <nl> + { <nl> + ret = isKeyPossiblyWrappedByMonotonicFunctionsImpl ( args [ 0 ] , out_key_column_num , out_key_column_type , out_functions_chain ) ; <nl> + } <nl> + return ret ; <nl> } <nl> <nl> return false ; <nl> new file mode 100644 <nl> index 00000000000 . . 405d3348775 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01480_binary_operator_monotonicity . reference <nl> <nl> + 0 <nl> + 0 <nl> + 0 <nl> + 0 <nl> + 0 <nl> + 0 <nl> + 0 <nl> + 0 <nl> new file mode 100644 <nl> index 00000000000 . . 20c3b542e18 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01480_binary_operator_monotonicity . sql <nl> <nl> + DROP TABLE IF EXISTS binary_op_mono1 ; <nl> + DROP TABLE IF EXISTS binary_op_mono2 ; <nl> + DROP TABLE IF EXISTS binary_op_mono3 ; <nl> + DROP TABLE IF EXISTS binary_op_mono4 ; <nl> + DROP TABLE IF EXISTS binary_op_mono5 ; <nl> + DROP TABLE IF EXISTS binary_op_mono6 ; <nl> + DROP TABLE IF EXISTS binary_op_mono7 ; <nl> + DROP TABLE IF EXISTS binary_op_mono8 ; <nl> + <nl> + CREATE TABLE binary_op_mono1 ( i int , j int ) ENGINE MergeTree PARTITION BY toDate ( i / 1000 ) ORDER BY j ; <nl> + CREATE TABLE binary_op_mono2 ( i int , j int ) ENGINE MergeTree PARTITION BY 1000 / i ORDER BY j ; <nl> + CREATE TABLE binary_op_mono3 ( i int , j int ) ENGINE MergeTree PARTITION BY i + 1000 ORDER BY j ; <nl> + CREATE TABLE binary_op_mono4 ( i int , j int ) ENGINE MergeTree PARTITION BY 1000 + i ORDER BY j ; <nl> + CREATE TABLE binary_op_mono5 ( i int , j int ) ENGINE MergeTree PARTITION BY i - 1000 ORDER BY j ; <nl> + CREATE TABLE binary_op_mono6 ( i int , j int ) ENGINE MergeTree PARTITION BY 1000 - i ORDER BY j ; <nl> + CREATE TABLE binary_op_mono7 ( i int , j int ) ENGINE MergeTree PARTITION BY i / 1000 . 0 ORDER BY j ; <nl> + CREATE TABLE binary_op_mono8 ( i int , j int ) ENGINE MergeTree PARTITION BY 1000 . 0 / i ORDER BY j ; <nl> + <nl> + INSERT INTO binary_op_mono1 VALUES ( toUnixTimestamp ( ' 2020 - 09 - 01 00 : 00 : 00 ' ) * 1000 , 1 ) , ( toUnixTimestamp ( ' 2020 - 09 - 01 00 : 00 : 00 ' ) * 1000 , 2 ) ; <nl> + INSERT INTO binary_op_mono2 VALUES ( 1 , 1 ) , ( 10000 , 2 ) ; <nl> + INSERT INTO binary_op_mono3 VALUES ( 1 , 1 ) , ( 10000 , 2 ) ; <nl> + INSERT INTO binary_op_mono4 VALUES ( 1 , 1 ) , ( 10000 , 2 ) ; <nl> + INSERT INTO binary_op_mono5 VALUES ( 1 , 1 ) , ( 10000 , 2 ) ; <nl> + INSERT INTO binary_op_mono6 VALUES ( 1 , 1 ) , ( 10000 , 2 ) ; <nl> + INSERT INTO binary_op_mono7 VALUES ( 1 , 1 ) , ( 10000 , 2 ) ; <nl> + INSERT INTO binary_op_mono8 VALUES ( 1 , 1 ) , ( 10000 , 2 ) ; <nl> + <nl> + SET max_rows_to_read = 1 ; <nl> + SELECT count ( ) FROM binary_op_mono1 WHERE toDate ( i / 1000 ) = ' 2020 - 09 - 02 ' ; <nl> + SELECT count ( ) FROM binary_op_mono2 WHERE 1000 / i = 100 ; <nl> + SELECT count ( ) FROM binary_op_mono3 WHERE i + 1000 = 500 ; <nl> + SELECT count ( ) FROM binary_op_mono4 WHERE 1000 + i = 500 ; <nl> + SELECT count ( ) FROM binary_op_mono5 WHERE i - 1000 = 1234 ; <nl> + SELECT count ( ) FROM binary_op_mono6 WHERE 1000 - i = 1234 ; <nl> + SELECT count ( ) FROM binary_op_mono7 WHERE i / 1000 . 0 = 22 . 3 ; <nl> + SELECT count ( ) FROM binary_op_mono8 WHERE 1000 . 0 / i = 33 . 4 ; <nl> + <nl> + DROP TABLE IF EXISTS binary_op_mono1 ; <nl> + DROP TABLE IF EXISTS binary_op_mono2 ; <nl> + DROP TABLE IF EXISTS binary_op_mono3 ; <nl> + DROP TABLE IF EXISTS binary_op_mono4 ; <nl> + DROP TABLE IF EXISTS binary_op_mono5 ; <nl> + DROP TABLE IF EXISTS binary_op_mono6 ; <nl> + DROP TABLE IF EXISTS binary_op_mono7 ; <nl> + DROP TABLE IF EXISTS binary_op_mono8 ; <nl>
Merge pull request from amosbird / mf1
ClickHouse/ClickHouse
c1f61984e55280685a4ef1b3d8e772c568e8df78
2020-09-15T09:45:23Z
mmm a / README . md <nl> ppp b / README . md <nl> Supported operating systems and hardware : <nl> * 2013 - 10 - 17 , Created . < br / > <nl> <nl> # # History <nl> + * v1 . 0 , 2014 - 05 - 19 , support http heartbeat , 0 . 9 . 107 <nl> * < strong > v1 . 0 , 2014 - 05 - 18 , [ 1 . 0 mainline3 ( 0 . 9 . 105 ) ] ( https : / / github . com / winlinvip / simple - rtmp - server / releases / tag / 1 . 0 . mainline3 ) released . 37594 lines . < / strong > <nl> * v1 . 0 , 2014 - 05 - 18 , support http api json , to PUT / POST . 0 . 9 . 105 <nl> * v1 . 0 , 2014 - 05 - 17 , fix [ # 72 ] ( https : / / github . com / winlinvip / simple - rtmp - server / issues / 72 ) , also need stream_id for send_and_free_message . 0 . 9 . 101 <nl>
support http heartbeat , 0 . 9 . 107
ossrs/srs
5bb6e657c32613db7372c8974025f54554ce3773
2014-05-19T09:39:25Z
mmm a / contracts / eosio . system / eosio . system - refund - rc . md <nl> ppp b / contracts / eosio . system / eosio . system - refund - rc . md <nl> <nl> # Action - ` { { refund } } ` <nl> <nl> - This Contract is legally binding and can be used in the event of a dispute . Disputes shall be settled through the standard arbitration process established by EOS . IO . <nl> - <nl> # # # Description <nl> <nl> The intent of the ` { { refund } } ` action is to return previously unstaked tokens to an account after the unstaking period has elapsed . <nl> The ` { { refund } } ` action requires the following ` input ` and ` input type ` : <nl> <nl> <nl> As an authorized party I { { signer } } wish to have the unstaked tokens of { { ownerVar } } returned . <nl> - <nl> - All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum . <nl>
Update eosio . system - refund - rc . md
EOSIO/eos
1acee545cb7789c1fffd8db89f2ec96e9e6ddebb
2018-05-31T03:39:46Z
mmm a / ports / mpfr / CMakeLists . txt <nl> ppp b / ports / mpfr / CMakeLists . txt <nl> <nl> cmake_minimum_required ( VERSION 3 . 3 . 0 ) <nl> <nl> - project ( MPFR VERSION 3 . 1 . 5 LANGUAGES C ) <nl> + project ( MPFR VERSION 4 . 0 . 2 LANGUAGES C ) <nl> <nl> # Find GMP ( or MPIR ) <nl> find_library ( GMP_LIBRARY NAMES gmp mpir ) <nl> add_library ( mpfr $ { SRCS } ) <nl> # target_compile_definitions ( mpfr PRIVATE HAVE_CONFIG_H ) <nl> target_compile_definitions ( mpfr PRIVATE __MPFR_WITHIN_MPFR ) <nl> target_compile_definitions ( mpfr PRIVATE HAVE_STDINT_H ) <nl> + target_compile_definitions ( mpfr PRIVATE HAVE_STDARG ) <nl> if ( BUILD_SHARED_LIBS ) <nl> target_compile_definitions ( mpfr PRIVATE __GMP_LIBGMP_DLL ) <nl> endif ( ) <nl> <nl> - try_compile ( I_HAVE_STDARG $ { CMAKE_BINARY_DIR } $ { PROJECT_SOURCE_DIR } / test_stdarg . c ) <nl> - if ( I_HAVE_STDARG ) <nl> - target_compile_definitions ( mpfr PRIVATE HAVE_STDARG ) <nl> - endif ( I_HAVE_STDARG ) <nl> - <nl> target_link_libraries ( mpfr $ { GMP_LIBRARIES } ) <nl> <nl> target_include_directories ( mpfr PUBLIC $ { GMP_INCLUDE_DIRS } ) <nl> mmm a / ports / mpfr / CONTROL <nl> ppp b / ports / mpfr / CONTROL <nl> <nl> Source : mpfr <nl> - Version : 4 . 0 . 1 <nl> + Version : 4 . 0 . 2 - 1 <nl> Homepage : https : / / www . mpfr . org <nl> Description : The MPFR library is a C library for multiple - precision floating - point computations with correct rounding <nl> Build - Depends : mpir <nl> mmm a / ports / mpfr / portfile . cmake <nl> ppp b / ports / mpfr / portfile . cmake <nl> <nl> include ( vcpkg_common_functions ) <nl> - set ( SOURCE_PATH $ { CURRENT_BUILDTREES_DIR } / src / mpfr - 4 . 0 . 1 ) <nl> + set ( SOURCE_PATH $ { CURRENT_BUILDTREES_DIR } / src / mpfr - 4 . 0 . 2 ) <nl> vcpkg_download_distfile ( ARCHIVE <nl> - URLS " http : / / www . mpfr . org / mpfr - 4 . 0 . 1 / mpfr - 4 . 0 . 1 . tar . xz " <nl> - FILENAME " mpfr - 4 . 0 . 1 . tar . xz " <nl> - SHA512 137ad68bc1e33a155edc1247fcdba27f999cf48ed526773136584090ddf2cfdfc9ea79fbf74ea1943b835b4b1ff29b05087114738c6ad3b485848540f30cac4f <nl> + URLS " http : / / www . mpfr . org / mpfr - 4 . 0 . 2 / mpfr - 4 . 0 . 2 . tar . xz " <nl> + FILENAME " mpfr - 4 . 0 . 2 . tar . xz " <nl> + SHA512 d583555d08863bf36c89b289ae26bae353d9a31f08ee3894520992d2c26e5683c4c9c193d7ad139632f71c0a476d85ea76182702a98bf08dde7b6f65a54f8b88 <nl> ) <nl> <nl> vcpkg_extract_source_archive ( $ { ARCHIVE } ) <nl> file ( COPY $ { CMAKE_CURRENT_LIST_DIR } / CMakeLists . txt DESTINATION $ { SOURCE_PATH } ) <nl> - file ( COPY $ { CMAKE_CURRENT_LIST_DIR } / test_stdarg . c DESTINATION $ { SOURCE_PATH } ) <nl> <nl> vcpkg_configure_cmake ( <nl> SOURCE_PATH $ { SOURCE_PATH } <nl> deleted file mode 100644 <nl> index dc1e2d7b403 . . 00000000000 <nl> mmm a / ports / mpfr / test_stdarg . c <nl> ppp / dev / null <nl> <nl> - # include < stdarg . h > <nl> - <nl> - int main ( int argc , char * argv ) { <nl> - return 0 ; <nl> - } <nl> - <nl>
update mpfr to 4 . 0 . 2 and fix build on osx ( )
microsoft/vcpkg
45e70a9f786480cbd85d0efc512713c965a02387
2019-09-24T18:05:30Z
mmm a / tensorflow / lite / java / src / main / java / org / tensorflow / lite / Interpreter . java <nl> ppp b / tensorflow / lite / java / src / main / java / org / tensorflow / lite / Interpreter . java <nl> public Interpreter ( @ NonNull ByteBuffer byteBuffer , Options options ) { <nl> * including int , float , long , and byte . { @ link ByteBuffer } is the preferred way to pass large <nl> * input data for primitive types , whereas string types require using the ( multi - dimensional ) <nl> * array input path . When { @ link ByteBuffer } is used , its content should remain unchanged <nl> - * until model inference is done . <nl> + * until model inference is done . A { @ code null } value is allowed only if the caller is using <nl> + * a { @ link Delegate } that allows buffer handle interop , and such a buffer has been bound to <nl> + * the input { @ link Tensor } . <nl> * @ param output a multidimensional array of output data , or a { @ link ByteBuffer } of primitive <nl> - * types including int , float , long , and byte . <nl> + * types including int , float , long , and byte . A null value is allowed only if the caller is <nl> + * using a { @ link Delegate } that allows buffer handle interop , and such a buffer has been <nl> + * bound to the output { @ link Tensor } . See also { @ link Options # setAllowBufferHandleOutput ( ) } . <nl> * / <nl> - public void run ( @ NonNull Object input , @ NonNull Object output ) { <nl> + public void run ( Object input , Object output ) { <nl> Object [ ] inputs = { input } ; <nl> Map < Integer , Object > outputs = new HashMap < > ( ) ; <nl> outputs . put ( 0 , output ) ; <nl> public void run ( @ NonNull Object input , @ NonNull Object output ) { <nl> * < p > Warning : The API runs much faster if { @ link ByteBuffer } is used as input data type . Please <nl> * consider using { @ link ByteBuffer } to feed primitive input data for better performance . <nl> * <nl> + * < p > Note : { @ code null } values for invididual elements of { @ code inputs } and { @ code outputs } is <nl> + * allowed only if the caller is using a { @ link Delegate } that allows buffer handle interop , and <nl> + * such a buffer has been bound to the corresponding input or output { @ link Tensor } ( s ) . <nl> + * <nl> * @ param inputs an array of input data . The inputs should be in the same order as inputs of the <nl> * model . Each input can be an array or multidimensional array , or a { @ link ByteBuffer } of <nl> * primitive types including int , float , long , and byte . { @ link ByteBuffer } is the preferred <nl> mmm a / tensorflow / lite / java / src / main / java / org / tensorflow / lite / Tensor . java <nl> ppp b / tensorflow / lite / java / src / main / java / org / tensorflow / lite / Tensor . java <nl> public int index ( ) { <nl> * Copies the contents of the provided { @ code src } object to the Tensor . <nl> * <nl> * < p > The { @ code src } should either be a ( multi - dimensional ) array with a shape matching that of <nl> - * this tensor , or a { @ link ByteByffer } of compatible primitive type with a matching flat size . <nl> + * this tensor , a { @ link ByteByffer } of compatible primitive type with a matching flat size , or <nl> + * { @ code null } iff the tensor has an underlying delegate buffer handle . <nl> * <nl> * @ throws IllegalArgumentException if the tensor is a scalar or if { @ code src } is not compatible <nl> * with the tensor ( for example , mismatched data types or shapes ) . <nl> * / <nl> void setTo ( Object src ) { <nl> + if ( src = = null ) { <nl> + if ( hasDelegateBufferHandle ( nativeHandle ) ) { <nl> + return ; <nl> + } <nl> + throw new IllegalArgumentException ( <nl> + " Null inputs are allowed only if the Tensor is bound to a buffer handle . " ) ; <nl> + } <nl> throwExceptionIfTypeIsIncompatible ( src ) ; <nl> if ( isByteBuffer ( src ) ) { <nl> ByteBuffer srcBuffer = ( ByteBuffer ) src ; <nl> void setTo ( Object src ) { <nl> / * * <nl> * Copies the contents of the tensor to { @ code dst } and returns { @ code dst } . <nl> * <nl> - * @ param dst the destination buffer , either an explicitly - typed array or a { @ link ByteBuffer } . <nl> + * @ param dst the destination buffer , either an explicitly - typed array , a { @ link ByteBuffer } or <nl> + * { @ code null } iff the tensor has an underlying delegate buffer handle . <nl> * @ throws IllegalArgumentException if { @ code dst } is not compatible with the tensor ( for example , <nl> * mismatched data types or shapes ) . <nl> * / <nl> Object copyTo ( Object dst ) { <nl> + if ( dst = = null ) { <nl> + if ( hasDelegateBufferHandle ( nativeHandle ) ) { <nl> + return dst ; <nl> + } <nl> + throw new IllegalArgumentException ( <nl> + " Null outputs are allowed only if the Tensor is bound to a buffer handle . " ) ; <nl> + } <nl> throwExceptionIfTypeIsIncompatible ( dst ) ; <nl> if ( dst instanceof ByteBuffer ) { <nl> ByteBuffer dstByteBuffer = ( ByteBuffer ) dst ; <nl> Object copyTo ( Object dst ) { <nl> / * * Returns the provided buffer ' s shape if specified and different from this Tensor ' s shape . * / <nl> / / TODO ( b / 80431971 ) : Remove this method after deprecating multi - dimensional array inputs . <nl> int [ ] getInputShapeIfDifferent ( Object input ) { <nl> + if ( input = = null ) { <nl> + return null ; <nl> + } <nl> / / Implicit resizes based on ByteBuffer capacity isn ' t supported , so short - circuit that path . <nl> / / The ByteBuffer ' s size will be validated against this Tensor ' s size in { @ link # setTo ( Object ) } . <nl> if ( isByteBuffer ( input ) ) { <nl> private ByteBuffer buffer ( ) { <nl> <nl> private static native int numBytes ( long handle ) ; <nl> <nl> - private static native int setBufferHandle ( long handle , long delegateHandle , int bufferHandle ) ; <nl> - <nl> - private static native int bufferHandle ( long handle ) ; <nl> + private static native boolean hasDelegateBufferHandle ( long handle ) ; <nl> <nl> private static native void readMultiDimensionalArray ( long handle , Object dst ) ; <nl> <nl> mmm a / tensorflow / lite / java / src / main / native / tensor_jni . cc <nl> ppp b / tensorflow / lite / java / src / main / native / tensor_jni . cc <nl> JNIEXPORT jint JNICALL Java_org_tensorflow_lite_Tensor_numBytes ( JNIEnv * env , <nl> return static_cast < jint > ( tensor - > bytes ) ; <nl> } <nl> <nl> + JNIEXPORT jboolean JNICALL <nl> + Java_org_tensorflow_lite_Tensor_hasDelegateBufferHandle ( JNIEnv * env , <nl> + jclass clazz , <nl> + jlong handle ) { <nl> + const TfLiteTensor * tensor = GetTensorFromHandle ( env , handle ) ; <nl> + if ( tensor = = nullptr ) return false ; <nl> + return tensor - > delegate & & ( tensor - > buffer_handle ! = kTfLiteNullBufferHandle ) <nl> + ? JNI_TRUE <nl> + : JNI_FALSE ; <nl> + } <nl> + <nl> JNIEXPORT jint JNICALL Java_org_tensorflow_lite_Tensor_index ( JNIEnv * env , <nl> jclass clazz , <nl> jlong handle ) { <nl> mmm a / tensorflow / lite / java / src / main / native / tensor_jni . h <nl> ppp b / tensorflow / lite / java / src / main / native / tensor_jni . h <nl> JNIEXPORT jint JNICALL Java_org_tensorflow_lite_Tensor_numBytes ( JNIEnv * env , <nl> jclass clazz , <nl> jlong handle ) ; <nl> <nl> + / * <nl> + * Class : org_tensorflow_lite_Tensor <nl> + * Method : hasDelegateBufferHandle <nl> + * Signature : ( J ) Z <nl> + * / <nl> + JNIEXPORT jboolean JNICALL <nl> + Java_org_tensorflow_lite_Tensor_hasDelegateBufferHandle ( JNIEnv * env , <nl> + jclass clazz , <nl> + jlong handle ) ; <nl> + <nl> / * <nl> * Class : org_tensorflow_lite_Tensor <nl> * Method : readMultiDimensionalArray <nl> mmm a / tensorflow / lite / java / src / test / java / org / tensorflow / lite / InterpreterTest . java <nl> ppp b / tensorflow / lite / java / src / test / java / org / tensorflow / lite / InterpreterTest . java <nl> public void testRedundantClose ( ) throws Exception { <nl> interpreter . close ( ) ; <nl> } <nl> <nl> + @ Test <nl> + public void testNullInputs ( ) throws Exception { <nl> + Interpreter interpreter = new Interpreter ( MODEL_FILE ) ; <nl> + try { <nl> + interpreter . run ( null , new float [ 2 ] [ 8 ] [ 8 ] [ 3 ] ) ; <nl> + fail ( ) ; <nl> + } catch ( IllegalArgumentException e ) { <nl> + / / Expected failure . <nl> + } <nl> + interpreter . close ( ) ; <nl> + } <nl> + <nl> + @ Test <nl> + public void testNullOutputs ( ) throws Exception { <nl> + Interpreter interpreter = new Interpreter ( MODEL_FILE ) ; <nl> + try { <nl> + interpreter . run ( new float [ 2 ] [ 8 ] [ 8 ] [ 3 ] , null ) ; <nl> + fail ( ) ; <nl> + } catch ( IllegalArgumentException e ) { <nl> + / / Expected failure . <nl> + } <nl> + interpreter . close ( ) ; <nl> + } <nl> + <nl> / * * Smoke test validating that flex model loading fails when the flex delegate is not linked . * / <nl> @ Test <nl> public void testFlexModel ( ) throws Exception { <nl> public long getNativeHandle ( ) { <nl> interpreter . close ( ) ; <nl> } <nl> <nl> + @ Test <nl> + public void testNullInputsAndOutputsWithDelegate ( ) throws Exception { <nl> + System . loadLibrary ( " tensorflowlite_test_jni " ) ; <nl> + Delegate delegate = <nl> + new Delegate ( ) { <nl> + @ Override <nl> + public long getNativeHandle ( ) { <nl> + return getNativeHandleForDelegate ( ) ; <nl> + } <nl> + } ; <nl> + Interpreter interpreter = <nl> + new Interpreter ( MODEL_FILE , new Interpreter . Options ( ) . addDelegate ( delegate ) ) ; <nl> + / / The delegate installs a custom buffer handle for all tensors , in turn allowing null to be <nl> + / / provided for the inputs / outputs ( as the client can reference the buffer directly ) . <nl> + interpreter . run ( new float [ 2 ] [ 8 ] [ 8 ] [ 3 ] , null ) ; <nl> + interpreter . run ( null , new float [ 2 ] [ 8 ] [ 8 ] [ 3 ] ) ; <nl> + interpreter . close ( ) ; <nl> + } <nl> + <nl> @ Test <nl> public void testModifyGraphWithDelegate ( ) throws Exception { <nl> System . loadLibrary ( " tensorflowlite_test_jni " ) ; <nl> mmm a / tensorflow / lite / java / src / test / java / org / tensorflow / lite / TensorTest . java <nl> ppp b / tensorflow / lite / java / src / test / java / org / tensorflow / lite / TensorTest . java <nl> public void testCopyTo ( ) { <nl> assertThat ( outputOneD ) . usingTolerance ( 0 . 1f ) . containsExactly ( expected ) . inOrder ( ) ; <nl> } <nl> <nl> + @ Test <nl> + public void testCopyToNull ( ) { <nl> + try { <nl> + tensor . copyTo ( null ) ; <nl> + fail ( ) ; <nl> + } catch ( IllegalArgumentException e ) { <nl> + / / Success . <nl> + } <nl> + } <nl> + <nl> @ Test <nl> public void testCopyToByteBuffer ( ) { <nl> ByteBuffer parsedOutput = <nl> public void testSetTo ( ) { <nl> assertThat ( output [ 0 ] [ 0 ] [ 0 ] [ 0 ] ) . isEqualTo ( 3 . 0f ) ; <nl> } <nl> <nl> + @ Test <nl> + public void testSetToNull ( ) { <nl> + try { <nl> + tensor . setTo ( null ) ; <nl> + fail ( ) ; <nl> + } catch ( IllegalArgumentException e ) { <nl> + / / Success . <nl> + } <nl> + } <nl> + <nl> @ Test <nl> public void testSetToInvalidByteBuffer ( ) { <nl> ByteBuffer input = ByteBuffer . allocateDirect ( 3 * 4 ) . order ( ByteOrder . nativeOrder ( ) ) ; <nl> mmm a / tensorflow / lite / java / src / test / native / interpreter_test_jni . cc <nl> ppp b / tensorflow / lite / java / src / test / native / interpreter_test_jni . cc <nl> Java_org_tensorflow_lite_InterpreterTest_getNativeHandleForDelegate ( <nl> . custom_name = " " , <nl> . version = 1 , <nl> } ; <nl> - / / A simple delegate which replaces all ops with a single op that outputs a <nl> - / / vector of length 1 with the value [ 7 ] . <nl> static TfLiteDelegate delegate = { <nl> . data_ = nullptr , <nl> . Prepare = [ ] ( TfLiteContext * context , <nl> Java_org_tensorflow_lite_InterpreterTest_getNativeHandleForDelegate ( <nl> context - > GetExecutionPlan ( context , & execution_plan ) ) ; <nl> context - > ReplaceNodeSubsetsWithDelegateKernels ( <nl> context , registration , execution_plan , delegate ) ; <nl> + / / Now bind delegate buffer handles for all tensors . <nl> + for ( size_t i = 0 ; i < context - > tensors_size ; + + i ) { <nl> + context - > tensors [ i ] . delegate = delegate ; <nl> + context - > tensors [ i ] . buffer_handle = static_cast < int > ( i ) ; <nl> + } <nl> return kTfLiteOk ; <nl> } , <nl> . CopyFromBufferHandle = nullptr , <nl>
Internal change
tensorflow/tensorflow
e7bac9435dd57740ea2b5a1a0a8bb14a1fbf093f
2018-12-21T00:34:19Z
mmm a / unittests / runtime / TaskFuture . cpp <nl> ppp b / unittests / runtime / TaskFuture . cpp <nl> static void futureTaskInvokeFunction ( AsyncTask * task , ExecutorRef executor , <nl> <nl> template < class T > <nl> static void withFutureTask ( const Metadata * resultType , <nl> + const T & initialValue , <nl> undeduced < InvokeFunctionRef < T > > invokeFn , <nl> BodyFunctionRef body ) { <nl> JobFlags flags = JobKind : : Task ; <nl> static void withFutureTask ( const Metadata * resultType , <nl> <nl> auto futureContext = <nl> static_cast < FutureContext < T > * > ( taskAndContext . InitialContext ) ; <nl> - futureContext - > getStorage ( ) = 42 ; / / Magic number . <nl> + futureContext - > getStorage ( ) = initialValue ; / / Magic number . <nl> futureContext - > storedInvokeFn = invokeFn ; <nl> <nl> / / Forward our owning reference to the task into its execution , <nl> static ExecutorRef createFakeExecutor ( uintptr_t value ) { <nl> <nl> extern const FullMetadata < OpaqueMetadata > METADATA_SYM ( Si ) ; <nl> <nl> + struct TestObject : HeapObject { <nl> + constexpr TestObject ( HeapMetadata const * newMetadata ) <nl> + : HeapObject ( newMetadata , InlineRefCounts : : Immortal ) <nl> + , Addr ( NULL ) , Value ( 0 ) { } <nl> + <nl> + size_t * Addr ; <nl> + size_t Value ; <nl> + } ; <nl> + <nl> + static SWIFT_CC ( swift ) void destroyTestObject ( SWIFT_CONTEXT HeapObject * _object ) { <nl> + auto object = static_cast < TestObject * > ( _object ) ; <nl> + assert ( object - > Addr & & " object already deallocated " ) ; <nl> + * object - > Addr = object - > Value ; <nl> + object - > Addr = nullptr ; <nl> + swift_deallocObject ( object , sizeof ( TestObject ) , alignof ( TestObject ) - 1 ) ; <nl> + } <nl> + <nl> + static const FullMetadata < ClassMetadata > TestClassObjectMetadata = { <nl> + { { & destroyTestObject } , { & VALUE_WITNESS_SYM ( Bo ) } } , <nl> + { { nullptr } , ClassFlags : : UsesSwiftRefcounting , 0 , 0 , 0 , 0 , 0 , 0 } <nl> + } ; <nl> + <nl> + / / / Create an object that , when deallocated , stores the given value to <nl> + / / / the given pointer . <nl> + static TestObject * allocTestObject ( size_t * addr , size_t value ) { <nl> + auto result = <nl> + static_cast < TestObject * > ( swift_allocObject ( & TestClassObjectMetadata , <nl> + sizeof ( TestObject ) , <nl> + alignof ( TestObject ) - 1 ) ) ; <nl> + result - > Addr = addr ; <nl> + result - > Value = value ; <nl> + return result ; <nl> + } <nl> + <nl> TEST ( TaskFutureTest , intFuture ) { <nl> auto createdExecutor = createFakeExecutor ( 1234 ) ; <nl> bool hasRun = false ; <nl> <nl> withFutureTask < intptr_t > ( <nl> - reinterpret_cast < const Metadata * > ( & METADATA_SYM ( Si ) ) , <nl> + reinterpret_cast < const Metadata * > ( & METADATA_SYM ( Si ) ) , 42 , <nl> [ & ] ( AsyncTask * task , ExecutorRef executor , <nl> FutureContext < intptr_t > * context ) { <nl> / / The storage should be what we initialized it to earlier . <nl> TEST ( TaskFutureTest , intFuture ) { <nl> } ) ; <nl> } <nl> <nl> + TEST ( TaskFutureTest , objectFuture ) { <nl> + auto createdExecutor = createFakeExecutor ( 1234 ) ; <nl> + bool hasRun = false ; <nl> + <nl> + size_t objectValueOnComplete = 7 ; <nl> + TestObject * object = nullptr ; <nl> + withFutureTask < TestObject * > ( <nl> + & TestClassObjectMetadata , nullptr , <nl> + [ & ] ( AsyncTask * task , ExecutorRef executor , <nl> + FutureContext < TestObject * > * context ) { <nl> + object = allocTestObject ( & objectValueOnComplete , 25 ) ; <nl> + <nl> + / / The error storage should have been cleared out for us . <nl> + EXPECT_EQ ( nullptr , context - > errorStorage ) ; <nl> + <nl> + / / Store the object in the future . <nl> + context - > getStorage ( ) = object ; <nl> + <nl> + hasRun = true ; <nl> + } , [ & ] ( AsyncTask * task ) { <nl> + / / Retain the task , so it won ' t be destroyed when it is executed . <nl> + swift_retain ( task ) ; <nl> + <nl> + / / Run the task , which should fill in the future . <nl> + EXPECT_FALSE ( hasRun ) ; <nl> + task - > run ( createdExecutor ) ; <nl> + EXPECT_TRUE ( hasRun ) ; <nl> + <nl> + / / " Wait " for the future , which must have completed by now . <nl> + auto waitResult = swift_task_future_wait ( task , nullptr ) ; <nl> + EXPECT_EQ ( TaskFutureWaitResult : : Success , waitResult . kind ) ; <nl> + <nl> + / / Make sure we got the result value we expect . <nl> + EXPECT_EQ ( object , * reinterpret_cast < TestObject * * > ( waitResult . storage ) ) ; <nl> + <nl> + / / Make sure the object hasn ' t been destroyed . <nl> + EXPECT_EQ ( 7 , objectValueOnComplete ) ; <nl> + <nl> + / / Okay , release the task . This should destroy the object . <nl> + swift_release ( task ) ; <nl> + assert ( objectValueOnComplete = = 25 ) ; <nl> + } ) ; <nl> + <nl> + } <nl>
[ Future ] Add a test to make sure we ' re handling object lifetimes properly .
apple/swift
aa76672298d9f0ffbb086154918c6de9be1b9208
2020-11-14T23:18:54Z
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> <nl> cmake_minimum_required ( VERSION 2 . 8 ) <nl> <nl> - PROJECT ( LightGBM ) <nl> + PROJECT ( lightgbm ) <nl> <nl> OPTION ( USE_MPI " MPI based parallel learning " OFF ) <nl> <nl> mmm a / examples / binary_classification / README . md <nl> ppp b / examples / binary_classification / README . md <nl> Here is an example for LightGBM to run binary classification task . <nl> <nl> For windows , by running following command in this folder : <nl> ` ` ` <nl> - LightGBM . exe config = train . conf <nl> + lightgbm . exe config = train . conf <nl> ` ` ` <nl> <nl> <nl> For linux , by running following command in this folder : <nl> ` ` ` <nl> - . / LightGBM config = train . conf <nl> + . / lightgbm config = train . conf <nl> ` ` ` <nl> <nl> # # # # Prediction <nl> You should finish training first . <nl> <nl> For windows , by running following command in this folder : <nl> ` ` ` <nl> - LightGBM . exe config = predict . conf <nl> + lightgbm . exe config = predict . conf <nl> ` ` ` <nl> <nl> For linux , by running following command in this folder : <nl> ` ` ` <nl> - . / LightGBM config = predict . conf <nl> + . / lightgbm config = predict . conf <nl> ` ` ` <nl> <nl> <nl> mmm a / examples / lambdarank / README . md <nl> ppp b / examples / lambdarank / README . md <nl> Here is an example for LightGBM to run lambdarank task . <nl> <nl> For windows , by running following command in this folder : <nl> ` ` ` <nl> - LightGBM . exe config = train . conf <nl> + lightgbm . exe config = train . conf <nl> ` ` ` <nl> <nl> <nl> For linux , by running following command in this folder : <nl> ` ` ` <nl> - . / LightGBM config = train . conf <nl> + . / lightgbm config = train . conf <nl> ` ` ` <nl> <nl> # # # # Prediction <nl> You should finish training first . <nl> <nl> For windows , by running following command in this folder : <nl> ` ` ` <nl> - LightGBM . exe config = predict . conf <nl> + lightgbm . exe config = predict . conf <nl> ` ` ` <nl> <nl> For linux , by running following command in this folder : <nl> ` ` ` <nl> - . / LightGBM config = predict . conf <nl> + . / lightgbm config = predict . conf <nl> ` ` ` <nl> <nl> mmm a / examples / parallel_learning / README . md <nl> ppp b / examples / parallel_learning / README . md <nl> Here is an example for LightGBM to perform parallel learning for 2 machines . <nl> 2 . Copy this folder and executable file to these 2 machines that you want to run application on . <nl> 3 . Run command in this folder on both 2 machines : <nl> <nl> - For windows : ` ` ` LightGBM . exe config = train . conf ` ` ` <nl> + For windows : ` ` ` lightgbm . exe config = train . conf ` ` ` <nl> <nl> - For linux : ` ` ` . / LightGBM config = train . conf ` ` ` <nl> + For linux : ` ` ` . / lightgbm config = train . conf ` ` ` <nl> <nl> This parallel learning example is based on socket . LightGBM also support parallel learning based on mpi . <nl> <nl> mmm a / examples / regression / README . md <nl> ppp b / examples / regression / README . md <nl> Here is an example for LightGBM to run regression task . <nl> <nl> For windows , by running following command in this folder : <nl> ` ` ` <nl> - LightGBM . exe config = train . conf <nl> + lightgbm . exe config = train . conf <nl> ` ` ` <nl> <nl> <nl> For linux , by running following command in this folder : <nl> ` ` ` <nl> - . / LightGBM config = train . conf <nl> + . / lightgbm config = train . conf <nl> ` ` ` <nl> <nl> # # # # Prediction <nl> You should finish training first . <nl> <nl> For windows , by running following command in this folder : <nl> ` ` ` <nl> - LightGBM . exe config = predict . conf <nl> + lightgbm . exe config = predict . conf <nl> ` ` ` <nl> <nl> For linux , by running following command in this folder : <nl> ` ` ` <nl> - . / LightGBM config = predict . conf <nl> + . / lightgbm config = predict . conf <nl> ` ` ` <nl> <nl> mmm a / windows / LightGBM . vcxproj <nl> ppp b / windows / LightGBM . vcxproj <nl> <nl> < PropertyGroup Condition = " ' $ ( configuration ) | $ ( Platform ) ' = = ' Debug | x64 ' " > <nl> < IncludePath > . . \ include ; $ ( VC_IncludePath ) ; $ ( WindowsSDK_IncludePath ) ; < / IncludePath > <nl> < LibraryPath > $ ( VC_LibraryPath_x64 ) ; $ ( WindowsSDK_LibraryPath_x64 ) ; < / LibraryPath > <nl> + < TargetName > lightgbm < / TargetName > <nl> < / PropertyGroup > <nl> < PropertyGroup Condition = " ' $ ( configuration ) | $ ( Platform ) ' = = ' Debug_mpi | x64 ' " > <nl> < IncludePath > $ ( MSMPI_INC ) ; . . \ include ; $ ( VC_IncludePath ) ; $ ( WindowsSDK_IncludePath ) ; < / IncludePath > <nl> < LibraryPath > $ ( MSMPI_LIB64 ) ; $ ( VC_LibraryPath_x64 ) ; $ ( WindowsSDK_LibraryPath_x64 ) ; < / LibraryPath > <nl> + < TargetName > lightgbm < / TargetName > <nl> < / PropertyGroup > <nl> < PropertyGroup Condition = " ' $ ( configuration ) | $ ( Platform ) ' = = ' Release | x64 ' " > <nl> < IncludePath > . . \ include ; $ ( VC_IncludePath ) ; $ ( WindowsSDK_IncludePath ) ; < / IncludePath > <nl> < LibraryPath > $ ( VC_LibraryPath_x64 ) ; $ ( WindowsSDK_LibraryPath_x64 ) ; < / LibraryPath > <nl> + < TargetName > lightgbm < / TargetName > <nl> < / PropertyGroup > <nl> < PropertyGroup Condition = " ' $ ( configuration ) | $ ( Platform ) ' = = ' Release_mpi | x64 ' " > <nl> < IncludePath > $ ( MSMPI_INC ) ; . . \ include ; $ ( VC_IncludePath ) ; $ ( WindowsSDK_IncludePath ) ; < / IncludePath > <nl> < LibraryPath > $ ( MSMPI_LIB64 ) ; $ ( VC_LibraryPath_x64 ) ; $ ( WindowsSDK_LibraryPath_x64 ) ; < / LibraryPath > <nl> + < TargetName > lightgbm < / TargetName > <nl> < / PropertyGroup > <nl> < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug_mpi | x64 ' " > <nl> < ClCompile > <nl>
Change bulid target name to lower case .
microsoft/LightGBM
f20a2c4de29f269414ce755ab9e1d7675a7d03f4
2016-10-08T08:13:56Z
mmm a / libraries / chain / chain_controller . cpp <nl> ppp b / libraries / chain / chain_controller . cpp <nl> <nl> <nl> namespace eosio { namespace chain { <nl> <nl> + bool is_start_of_round ( block_num_type block_num ) { <nl> + return ( block_num % config : : blocks_per_round ) = = 0 ; <nl> + } <nl> + <nl> chain_controller : : chain_controller ( const chain_controller : : controller_config & cfg ) <nl> : _db ( cfg . shared_memory_dir , <nl> ( cfg . read_only ? database : : read_only : database : : read_write ) , <nl> signed_block chain_controller : : _generate_block ( block_timestamp_type when , <nl> _pending_block - > producer = producer_obj . owner ; <nl> _pending_block - > previous = head_block_id ( ) ; <nl> <nl> - const auto & gpo = get_global_properties ( ) ; <nl> - if ( gpo . pending_active_producers . size ( ) & & <nl> - gpo . pending_active_producers . back ( ) . first = = _pending_block - > block_num ( ) ) { <nl> - _pending_block - > new_producers = gpo . pending_active_producers . back ( ) . second ; <nl> + if ( is_start_of_round ( _pending_block - > block_num ( ) ) ) { <nl> + auto latest_producer_schedule = _calculate_producer_schedule ( ) ; <nl> + if ( latest_producer_schedule ! = _head_producer_schedule ( ) ) <nl> + _pending_block - > new_producers = latest_producer_schedule ; <nl> } <nl> <nl> if ( ! ( skip & skip_producer_signature ) ) <nl> _pending_block - > sign ( block_signing_key ) ; <nl> <nl> - <nl> _finalize_block ( * _pending_block ) ; <nl> <nl> - <nl> - <nl> _pending_block_session - > push ( ) ; <nl> <nl> auto result = move ( * _pending_block ) ; <nl> void chain_controller : : __apply_block ( const signed_block & next_block ) <nl> } / / / for each shard <nl> } / / / for each cycle <nl> <nl> + _finalize_block ( next_block ) ; <nl> + / * <nl> update_global_properties ( next_block ) ; <nl> update_global_dynamic_data ( next_block ) ; <nl> update_signing_producer ( signing_producer , next_block ) ; <nl> void chain_controller : : __apply_block ( const signed_block & next_block ) <nl> <nl> / / notify observers that the block has been applied <nl> / / TODO : do this outside the write lock . . . ? <nl> - applied_block ( next_block ) ; / / emit <nl> if ( _currently_replaying_blocks ) <nl> applied_irreversible_block ( next_block ) ; <nl> + * / <nl> <nl> <nl> } FC_CAPTURE_AND_RETHROW ( ( next_block . block_num ( ) ) ) } <nl> void chain_controller : : _finalize_block ( const signed_block & b ) { <nl> update_global_properties ( b ) ; <nl> update_global_dynamic_data ( b ) ; <nl> update_signing_producer ( signing_producer , b ) ; <nl> - <nl> update_last_irreversible_block ( ) ; <nl> <nl> create_block_summary ( b ) ; <nl> clear_expired_transactions ( ) ; <nl> <nl> + applied_block ( b ) ; / / emit <nl> if ( _currently_replaying_blocks ) <nl> applied_irreversible_block ( b ) ; <nl> - <nl> - <nl> } <nl> <nl> namespace { <nl> void chain_controller : : create_block_summary ( const signed_block & next_block ) { <nl> } ) ; <nl> } <nl> <nl> + / * * <nl> + * Takes the top config : : producer_count producers by total vote excluding any producer whose <nl> + * block_signing_key is null . <nl> + * / <nl> + producer_schedule_type chain_controller : : _calculate_producer_schedule ( ) const { <nl> + const auto & producers_by_vote = _db . get_index < contracts : : producer_votes_multi_index , contracts : : by_votes > ( ) ; <nl> + auto itr = producers_by_vote . begin ( ) ; <nl> + producer_schedule_type schedule ; <nl> + uint32_t count = 0 ; <nl> + while ( itr ! = producers_by_vote . end ( ) & & count < schedule . size ( ) ) { <nl> + schedule [ count ] . producer_name = itr - > owner_name ; <nl> + schedule [ count ] . block_signing_key = get_producer ( itr - > owner_name ) . signing_key ; <nl> + + + itr ; <nl> + if ( schedule [ count ] . block_signing_key ! = public_key_type ( ) ) { <nl> + + + count ; <nl> + } <nl> + } <nl> + return schedule ; <nl> + } <nl> + <nl> + / * * <nl> + * Returns the most recent and / or pending producer schedule <nl> + * / <nl> + const producer_schedule_type & chain_controller : : _head_producer_schedule ( ) const { <nl> + const auto & gpo = get_global_properties ( ) ; <nl> + if ( gpo . pending_active_producers . size ( ) ) <nl> + return gpo . pending_active_producers . back ( ) . second ; <nl> + return gpo . active_producers ; <nl> + } <nl> + <nl> void chain_controller : : update_global_properties ( const signed_block & b ) { try { <nl> / / If we ' re at the end of a round , update the BlockchainConfiguration , producer schedule <nl> / / and " producers " special account authority <nl> - if ( b . block_num ( ) % config : : blocks_per_round = = 0 ) { <nl> - const auto & producers_by_vote = _db . get_index < contracts : : producer_votes_multi_index , contracts : : by_votes > ( ) ; <nl> - auto itr = producers_by_vote . begin ( ) ; <nl> - producer_schedule_type schedule ; <nl> - uint32_t count = 0 ; <nl> - while ( itr ! = producers_by_vote . end ( ) ) { <nl> - schedule [ count ] . producer_name = itr - > owner_name ; <nl> - wdump ( ( itr - > owner_name ) ) ; <nl> - schedule [ count ] . block_signing_key = get_producer ( itr - > owner_name ) . signing_key ; <nl> - idump ( ( itr - > owner_name ) ) ; <nl> - + + itr ; <nl> + if ( is_start_of_round ( b . block_num ( ) ) ) { <nl> + auto schedule = _calculate_producer_schedule ( ) ; <nl> + if ( b . new_producers ) <nl> + { <nl> + for ( uint32_t i = 0 ; i < schedule . size ( ) ; + + i ) { <nl> + idump ( ( schedule [ i ] ) ( ( * b . new_producers ) [ i ] ) ) ; <nl> + FC_ASSERT ( schedule [ i ] = = ( * b . new_producers ) [ i ] , " missmatch in expected producers " , ( " i " , i ) ) ; <nl> + } <nl> + FC_ASSERT ( schedule = = * b . new_producers , " pending producer set different than expected " ) ; <nl> } <nl> <nl> const auto & gpo = get_global_properties ( ) ; <nl> - if ( schedule ! = gpo . active_producers ) { <nl> - _db . modify ( gpo , [ & ] ( auto & props ) { <nl> - if ( props . pending_active_producers . size ( ) & & props . pending_active_producers . back ( ) . first = = head_block_num ( ) + 1 ) <nl> - props . pending_active_producers . back ( ) . second = schedule ; <nl> - else <nl> - props . pending_active_producers . push_back ( make_pair ( head_block_num ( ) + 1 , schedule ) ) ; <nl> - } ) ; <nl> + <nl> + if ( _head_producer_schedule ( ) ! = schedule ) { <nl> + FC_ASSERT ( b . new_producers , " pending producer set changed but block didn ' t indicate it " ) ; <nl> } <nl> + _db . modify ( gpo , [ & ] ( auto & props ) { <nl> + if ( props . pending_active_producers . size ( ) & & props . pending_active_producers . back ( ) . first = = b . block_num ( ) ) <nl> + props . pending_active_producers . back ( ) . second = schedule ; <nl> + else <nl> + props . pending_active_producers . push_back ( make_pair ( b . block_num ( ) , schedule ) ) ; <nl> + } ) ; <nl> + <nl> + <nl> / * <nl> auto schedule = _admin - > get_next_round ( _db ) ; <nl> auto config = _admin - > get_blockchain_configuration ( _db , schedule ) ; <nl> void chain_controller : : update_last_irreversible_block ( ) <nl> props . pending_active_producers . erase ( props . pending_active_producers . begin ( ) ) ; <nl> } <nl> } <nl> - for ( const auto & n : * new_producer_schedule ) { <nl> - wdump ( ( name ( n . producer_name ) ) ( n . block_signing_key ) ) ; <nl> - } <nl> - / / props . active_producers = * new_producer_schedule ; <nl> + props . active_producers = * new_producer_schedule ; <nl> } ) ; <nl> } <nl> } <nl> mmm a / libraries / chain / include / eosio / chain / chain_controller . hpp <nl> ppp b / libraries / chain / include / eosio / chain / chain_controller . hpp <nl> namespace eosio { namespace chain { <nl> void _initialize_indexes ( ) ; <nl> void _initialize_chain ( contracts : : chain_initializer & starter ) ; <nl> <nl> + producer_schedule_type _calculate_producer_schedule ( ) const ; <nl> + const producer_schedule_type & _head_producer_schedule ( ) const ; <nl> + <nl> + <nl> void replay ( ) ; <nl> <nl> void _apply_block ( const signed_block & next_block , uint32_t skip = skip_nothing ) ; <nl> mmm a / libraries / chain / include / eosio / chain / producer_schedule . hpp <nl> ppp b / libraries / chain / include / eosio / chain / producer_schedule . hpp <nl> namespace eosio { namespace chain { <nl> struct producer_key { <nl> account_name producer_name ; <nl> public_key_type block_signing_key ; <nl> - } ; <nl> <nl> + friend bool operator = = ( const producer_key & a , const producer_key & b ) { <nl> + return tie ( a . producer_name , a . block_signing_key ) = = tie ( b . producer_name , b . block_signing_key ) ; <nl> + } <nl> + friend bool operator ! = ( const producer_key & a , const producer_key & b ) { <nl> + return tie ( a . producer_name , a . block_signing_key ) ! = tie ( b . producer_name , b . block_signing_key ) ; <nl> + } <nl> + } ; <nl> / * * <nl> * Defines both the order , account name , and signing keys of the active set of producers . <nl> * / <nl> using producer_schedule_type = fc : : array < producer_key , config : : producer_count > ; <nl> <nl> + <nl> + inline bool operator = = ( const producer_schedule_type & a , const producer_schedule_type & b ) <nl> + { <nl> + for ( uint32_t i = 0 ; i < a . size ( ) ; + + i ) <nl> + if ( a [ i ] ! = b [ i ] ) return false ; <nl> + return true ; <nl> + } <nl> + inline bool operator ! = ( const producer_schedule_type & a , const producer_schedule_type & b ) <nl> + { <nl> + return ! ( a = = b ) ; <nl> + } <nl> + <nl> + <nl> } } / / / eosio : : chain <nl> <nl> FC_REFLECT ( eosio : : chain : : producer_key , ( producer_name ) ( block_signing_key ) ) <nl>
fix producer schedule block header signaling and updating
EOSIO/eos
d9ebc4d619a5df9488e6f3866f91818c48dee6ee
2017-11-18T20:12:49Z
mmm a / README . md <nl> ppp b / README . md <nl> <nl> # Caffe <nl> <nl> + [ ! [ Build Status ] ( https : / / travis - ci . org / BVLC / caffe . svg ? branch = master ) ] ( https : / / travis - ci . org / BVLC / caffe ) <nl> + [ ! [ License ] ( https : / / img . shields . io / badge / license - BSD - blue . svg ) ] ( LICENSE ) <nl> + <nl> Caffe is a deep learning framework made with expression , speed , and modularity in mind . <nl> It is developed by the Berkeley Vision and Learning Center ( [ BVLC ] ( http : / / bvlc . eecs . berkeley . edu ) ) and community contributors . <nl> <nl>
add badge for travis build and license
BVLC/caffe
98cc023939641482432d4082db061306a7ab1654
2015-10-01T16:20:23Z
mmm a / DEPS <nl> ppp b / DEPS <nl> vars = { <nl> <nl> deps = { <nl> ' v8 / build ' : <nl> - Var ( ' chromium_url ' ) + ' / chromium / src / build . git ' + ' @ ' + ' b5df2518f091eea3d358f30757dec3e33db56156 ' , <nl> + Var ( ' chromium_url ' ) + ' / chromium / src / build . git ' + ' @ ' + ' 4389c9c026e43b56d1a90eef7827fdd873a0d55a ' , <nl> ' v8 / tools / gyp ' : <nl> Var ( ' chromium_url ' ) + ' / external / gyp . git ' + ' @ ' + ' d61a9397e668fa9843c4aa7da9e79460fe590bfb ' , <nl> ' v8 / third_party / depot_tools ' : <nl> - Var ( ' chromium_url ' ) + ' / chromium / tools / depot_tools . git ' + ' @ ' + ' 083eb25f9acbe034db94a1bd5c1659125b6ebf98 ' , <nl> + Var ( ' chromium_url ' ) + ' / chromium / tools / depot_tools . git ' + ' @ ' + ' ebdd0db493b20f0abeab8960e6ea0ceb7c6b379a ' , <nl> ' v8 / third_party / icu ' : <nl> Var ( ' chromium_url ' ) + ' / chromium / deps / icu . git ' + ' @ ' + ' f61e46dbee9d539a32551493e3bcc1dea92f83ec ' , <nl> ' v8 / third_party / instrumented_libraries ' : <nl> deps = { <nl> ' condition ' : ' checkout_android ' , <nl> } , <nl> ' v8 / third_party / catapult ' : { <nl> - ' url ' : Var ( ' chromium_url ' ) + ' / catapult . git ' + ' @ ' + ' 49edbd3a2b582cbab0a912cb1989062e9b8453ff ' , <nl> + ' url ' : Var ( ' chromium_url ' ) + ' / catapult . git ' + ' @ ' + ' 12f7d6baa725afc10028c117d1c151b05838e5c3 ' , <nl> ' condition ' : ' checkout_android ' , <nl> } , <nl> ' v8 / third_party / colorama / src ' : { <nl> deps = { <nl> ' condition ' : ' checkout_fuchsia ' , <nl> } , <nl> ' v8 / third_party / googletest / src ' : <nl> - Var ( ' chromium_url ' ) + ' / external / github . com / google / googletest . git ' + ' @ ' + ' 08d5b1f33af8c18785fb8ca02792b5fac81e248f ' , <nl> + Var ( ' chromium_url ' ) + ' / external / github . com / google / googletest . git ' + ' @ ' + ' 145d05750b15324899473340c8dd5af50d125d33 ' , <nl> ' v8 / third_party / jinja2 ' : <nl> Var ( ' chromium_url ' ) + ' / chromium / src / third_party / jinja2 . git ' + ' @ ' + ' 45571de473282bd1d8b63a8dfcb1fd268d0635d2 ' , <nl> ' v8 / third_party / markupsafe ' : <nl>
Update V8 DEPS .
v8/v8
90f6ce1243f4ffd8145355da8488c605b7040ee8
2018-05-23T03:47:44Z
new file mode 100644 <nl> index 0000000000 . . dca2da9f4a <nl> mmm / dev / null <nl> ppp b / code / babylonian_method <nl> <nl> + <nl> + # include < stdio . h > <nl> + <nl> + double squareRoot ( double num ) { <nl> + double error = 0 . 0000001 ; <nl> + double x = num ; <nl> + <nl> + while ( ( x - num / x ) > error ) { <nl> + <nl> + x = ( x + num / x ) / 2 ; <nl> + } <nl> + return x ; <nl> + <nl> + } <nl> + <nl> + int main ( ) { <nl> + <nl> + double num = 0 ; <nl> + printf ( " Enter number for finding square root : " ) ; <nl> + scanf ( " % lf " , & num ) ; <nl> + printf ( " Square root of % lf is % lf \ n " , num , squareRoot ( num ) ) ; <nl> + return 0 ; <nl> + } <nl>
C program for sq root using babylonian method
OpenGenus/cosmos
b8d0c6ae4042337a3b590e0f48c08259dbcb5355
2017-10-05T10:12:59Z
mmm a / aten / src / ATen / core / dispatch / DispatchTable . h <nl> ppp b / aten / src / ATen / core / dispatch / DispatchTable . h <nl> class DispatchTable final { <nl> public : <nl> explicit DispatchTable ( const FunctionSchema & schema ) <nl> : kernels_ ( ) <nl> - , reverse_index_of_first_tensor_arg_ ( <nl> - schema . arguments ( ) . size ( ) - get_index_of_first_tensor_arg_ ( schema ) ) <nl> + , dispatch_strategy_ ( get_dispatch_strategy_ ( schema ) ) <nl> , operator_name_ ( schema . name ( ) ) { } <nl> <nl> DispatchTable ( DispatchTable & & ) = default ; <nl> class DispatchTable final { <nl> * @ return Kernel function pointing to the right kernel for the given arguments <nl> * / <nl> const DispatchTableEntry & lookup ( const Stack * stack ) const { <nl> - TensorTypeId dispatch_key = torch : : jit : : peek ( <nl> - * stack , <nl> - 0 , <nl> - reverse_index_of_first_tensor_arg_ <nl> - ) . toTensor ( ) . type_id ( ) ; <nl> + TensorTypeId dispatch_key = dispatch_strategy_ . get_dispatch_key ( stack ) ; <nl> return * kernels_ . lookup ( dispatch_key , operator_name_ ) ; <nl> } <nl> <nl> class DispatchTable final { <nl> return kernels_ . isEmpty ( ) ; <nl> } <nl> <nl> - private : <nl> - static size_t get_index_of_first_tensor_arg_ ( const FunctionSchema & schema ) { <nl> + private : <nl> + struct DispatchStrategy final { <nl> + / / this is caching the index so we don ' t have to parse the schema inputs <nl> + / / again and again for each dispatcher lookup . <nl> + / / reverse_index means this is the distance from the first tensor argument <nl> + / / to argument_list . end ( ) , i . e . from the top of the stack . <nl> + / / Since it is distance to end ( ) , this means it ' s 1 - indexed , <nl> + / / i . e . ' 1 ' is the last argument . <nl> + size_t reverse_index_of_first_tensor_arg_ ; <nl> + bool first_tensor_arg_is_tensor_list_ ; <nl> + <nl> + TensorTypeId get_dispatch_key ( const Stack * stack ) const { <nl> + auto first_tensor_arg = torch : : jit : : peek ( <nl> + * stack , <nl> + 0 , <nl> + reverse_index_of_first_tensor_arg_ <nl> + ) ; <nl> + if ( first_tensor_arg_is_tensor_list_ ) { <nl> + auto tensor_list = first_tensor_arg . toTensorList ( ) ; <nl> + if ( tensor_list - > elements ( ) . size ( ) = = 0 ) { <nl> + throw std : : runtime_error ( " Tried to dispatch based on an empty tensor list . When the first tensor argument of an operator is a tensor list , then it must not be empty . " ) ; <nl> + } <nl> + return tensor_list - > elements ( ) [ 0 ] . type_id ( ) ; <nl> + } else { <nl> + return first_tensor_arg . toTensor ( ) . type_id ( ) ; <nl> + } <nl> + } <nl> + } ; <nl> + <nl> + static DispatchStrategy get_dispatch_strategy_ ( const FunctionSchema & schema ) { <nl> for ( size_t i = 0 ; i < schema . arguments ( ) . size ( ) ; + + i ) { <nl> - if ( schema . arguments ( ) [ i ] . type ( ) - > isSubtypeOf ( TensorType : : get ( ) ) ) { <nl> - return i ; <nl> + const auto & type = schema . arguments ( ) [ i ] . type ( ) ; <nl> + if ( type - > isSubtypeOf ( TensorType : : get ( ) ) ) { <nl> + return { schema . arguments ( ) . size ( ) - i , false } ; <nl> + } <nl> + if ( type - > isSubtypeOf ( ListType : : ofTensors ( ) ) ) { <nl> + return { schema . arguments ( ) . size ( ) - i , true } ; <nl> } <nl> } <nl> <nl> class DispatchTable final { <nl> } <nl> <nl> detail : : ThreadsafeOperatorTable_ kernels_ ; <nl> - <nl> - / / this is caching the index so we don ' t have to parse the schema inputs <nl> - / / again and again for each dispatcher lookup . <nl> - / / reverse_index means this is the distance from the first tensor argument <nl> - / / to argument_list . end ( ) , i . e . from the top of the stack . <nl> - / / Since it is distance to end ( ) , this means it ' s 1 - indexed , <nl> - / / i . e . ' 1 ' is the last argument . <nl> - size_t reverse_index_of_first_tensor_arg_ ; <nl> + DispatchStrategy dispatch_strategy_ ; <nl> std : : string operator_name_ ; <nl> } ; <nl> <nl>
Allow dispatch based on tensor list args ( )
pytorch/pytorch
2e94054e347d25d74506c9095b56b83d923f2a60
2019-03-01T00:32:00Z
mmm a / buildscripts / cpplint . py <nl> ppp b / buildscripts / cpplint . py <nl> def CheckForMongoPolyfill ( filename , clean_lines , linenum , error ) : <nl> error ( filename , linenum , ' mongodb / polyfill ' , 5 , <nl> ' Illegal use of banned name from std : : / boost : : , use mongo : : stdx : : variant instead ' ) <nl> <nl> + def CheckForMongoAtomic ( filename , clean_lines , linenum , error ) : <nl> + line = clean_lines . elided [ linenum ] <nl> + if re . search ( ' std : : atomic ' , line ) : <nl> + error ( filename , linenum , ' mongodb / stdatomic ' , 5 , <nl> + ' Illegal use of prohibited std : : atomic < T > , use AtomicWord < T > or other types ' <nl> + ' from " mongo / platform / atomic_word . h " ' ) <nl> + <nl> def CheckForCopyright ( filename , lines , error ) : <nl> " " " Logs an error if no Copyright message appears at the top of the file . " " " <nl> <nl> def ProcessLine ( filename , file_extension , clean_lines , line , <nl> CheckForNamespaceIndentation ( filename , nesting_state , clean_lines , line , <nl> error ) <nl> CheckForMongoPolyfill ( filename , clean_lines , line , error ) <nl> + CheckForMongoAtomic ( filename , clean_lines , line , error ) <nl> if nesting_state . InAsmBlock ( ) : return <nl> CheckForFunctionLengths ( filename , clean_lines , line , function_state , error ) <nl> CheckForMultilineCommentsAndStrings ( filename , clean_lines , line , error ) <nl> mmm a / src / mongo / client / replica_set_monitor . cpp <nl> ppp b / src / mongo / client / replica_set_monitor . cpp <nl> struct HostNotIn { <nl> } / / namespace <nl> <nl> / / At 1 check every 10 seconds , 30 checks takes 5 minutes <nl> - std : : atomic < int > ReplicaSetMonitor : : maxConsecutiveFailedChecks ( 30 ) ; <nl> + std : : atomic < int > ReplicaSetMonitor : : maxConsecutiveFailedChecks ( 30 ) ; / / NOLINT <nl> <nl> / / Defaults to random selection as required by the spec <nl> bool ReplicaSetMonitor : : useDeterministicHostSelection = false ; <nl> mmm a / src / mongo / client / replica_set_monitor . h <nl> ppp b / src / mongo / client / replica_set_monitor . h <nl> class ReplicaSetMonitor { <nl> * finding any live nodes claiming to be in the set , the ReplicaSetMonitorWatcher will stop <nl> * periodic background refreshes of this set . <nl> * / <nl> - static std : : atomic < int > maxConsecutiveFailedChecks ; <nl> + static std : : atomic < int > maxConsecutiveFailedChecks ; / / NOLINT <nl> <nl> / / <nl> / / internal types ( defined in replica_set_monitor_internal . h ) <nl> mmm a / src / mongo / db / auth / sasl_options . h <nl> ppp b / src / mongo / db / auth / sasl_options . h <nl> struct SASLGlobalParams { <nl> std : : string hostName ; <nl> std : : string serviceName ; <nl> std : : string authdPath ; <nl> - std : : atomic < int > scramIterationCount ; <nl> - std : : atomic < int > authFailedDelay ; <nl> + std : : atomic < int > scramIterationCount ; / / NOLINT <nl> + std : : atomic < int > authFailedDelay ; / / NOLINT <nl> <nl> SASLGlobalParams ( ) ; <nl> } ; <nl> mmm a / src / mongo / db / auth / user_cache_invalidator_job . cpp <nl> ppp b / src / mongo / db / auth / user_cache_invalidator_job . cpp <nl> namespace mongo { <nl> namespace { <nl> <nl> / / How often to check with the config servers whether authorization information has changed . <nl> - std : : atomic < int > userCacheInvalidationIntervalSecs ( 30 ) ; / / 30 second default <nl> + std : : atomic < int > userCacheInvalidationIntervalSecs ( 30 ) ; / / NOLINT 30 second default <nl> stdx : : mutex invalidationIntervalMutex ; <nl> stdx : : condition_variable invalidationIntervalChangedCondition ; <nl> Date_t lastInvalidationTime ; <nl> mmm a / src / mongo / db / concurrency / write_conflict_exception . cpp <nl> ppp b / src / mongo / db / concurrency / write_conflict_exception . cpp <nl> <nl> <nl> namespace mongo { <nl> <nl> - std : : atomic < bool > WriteConflictException : : trace ( false ) ; <nl> + std : : atomic < bool > WriteConflictException : : trace ( false ) ; / / NOLINT <nl> <nl> WriteConflictException : : WriteConflictException ( ) <nl> : DBException ( " WriteConflict " , ErrorCodes : : WriteConflict ) { <nl> mmm a / src / mongo / db / concurrency / write_conflict_exception . h <nl> ppp b / src / mongo / db / concurrency / write_conflict_exception . h <nl> class WriteConflictException : public DBException { <nl> * If true , will call printStackTrace on every WriteConflictException created . <nl> * Can be set via setParameter named traceWriteConflictExceptions . <nl> * / <nl> - static std : : atomic < bool > trace ; <nl> + static std : : atomic < bool > trace ; / / NOLINT <nl> } ; <nl> } <nl> mmm a / src / mongo / db / ftdc / ftdc_mongod . cpp <nl> ppp b / src / mongo / db / ftdc / ftdc_mongod . cpp <nl> FTDCController * getGlobalFTDCController ( ) { <nl> return getFTDCController ( getGlobalServiceContext ( ) ) . get ( ) ; <nl> } <nl> <nl> - std : : atomic < bool > localEnabledFlag ( FTDCConfig : : kEnabledDefault ) ; <nl> + std : : atomic < bool > localEnabledFlag ( FTDCConfig : : kEnabledDefault ) ; / / NOLINT <nl> <nl> class ExportedFTDCEnabledParameter <nl> : public ExportedServerParameter < bool , ServerParameterType : : kStartupAndRuntime > { <nl> class ExportedFTDCEnabledParameter <nl> <nl> } exportedFTDCEnabledParameter ; <nl> <nl> - std : : atomic < std : : int32_t > localPeriodMillis ( FTDCConfig : : kPeriodMillisDefault ) ; <nl> + std : : atomic < std : : int32_t > localPeriodMillis ( FTDCConfig : : kPeriodMillisDefault ) ; / / NOLINT <nl> <nl> class ExportedFTDCPeriodParameter <nl> : public ExportedServerParameter < std : : int32_t , ServerParameterType : : kStartupAndRuntime > { <nl> class ExportedFTDCPeriodParameter <nl> } exportedFTDCPeriodParameter ; <nl> <nl> / / Scale the values down since are defaults are in bytes , but the user interface is MB <nl> - std : : atomic < std : : int32_t > localMaxDirectorySizeMB ( FTDCConfig : : kMaxDirectorySizeBytesDefault / <nl> - ( 1024 * 1024 ) ) ; <nl> + std : : atomic < std : : int32_t > localMaxDirectorySizeMB ( / / NOLINT <nl> + FTDCConfig : : kMaxDirectorySizeBytesDefault / ( 1024 * 1024 ) ) ; <nl> <nl> - std : : atomic < std : : int32_t > localMaxFileSizeMB ( FTDCConfig : : kMaxFileSizeBytesDefault / ( 1024 * 1024 ) ) ; <nl> + std : : atomic < std : : int32_t > localMaxFileSizeMB ( FTDCConfig : : kMaxFileSizeBytesDefault / / / NOLINT <nl> + ( 1024 * 1024 ) ) ; <nl> <nl> class ExportedFTDCDirectorySizeParameter <nl> : public ExportedServerParameter < std : : int32_t , ServerParameterType : : kStartupAndRuntime > { <nl> class ExportedFTDCFileSizeParameter <nl> <nl> } exportedFTDCFileSizeParameter ; <nl> <nl> - std : : atomic < std : : int32_t > localMaxSamplesPerArchiveMetricChunk ( <nl> + std : : atomic < std : : int32_t > localMaxSamplesPerArchiveMetricChunk ( / / NOLINT <nl> FTDCConfig : : kMaxSamplesPerArchiveMetricChunkDefault ) ; <nl> <nl> class ExportedFTDCArchiveChunkSizeParameter <nl> class ExportedFTDCArchiveChunkSizeParameter <nl> <nl> } exportedFTDCArchiveChunkSizeParameter ; <nl> <nl> - std : : atomic < std : : int32_t > localMaxSamplesPerInterimMetricChunk ( <nl> + std : : atomic < std : : int32_t > localMaxSamplesPerInterimMetricChunk ( / / NOLINT <nl> FTDCConfig : : kMaxSamplesPerInterimMetricChunkDefault ) ; <nl> <nl> class ExportedFTDCInterimChunkSizeParameter <nl> mmm a / src / mongo / db / fts / fts_enabled . cpp <nl> ppp b / src / mongo / db / fts / fts_enabled . cpp <nl> namespace mongo { <nl> namespace fts { <nl> namespace { <nl> <nl> - std : : atomic < bool > dummyEnabledFlag ( true ) ; / / Unused , needed for server parameter . <nl> + std : : atomic < bool > dummyEnabledFlag ( true ) ; / / Unused , needed for server parameter . NOLINT <nl> <nl> / * * <nl> * Declaration for the " textSearchEnabled " server parameter , which is now deprecated . <nl> mmm a / src / mongo / db / query / expression_index_knobs . h <nl> ppp b / src / mongo / db / query / expression_index_knobs . h <nl> namespace mongo { <nl> / * * <nl> * The maximum number of cells to use for 2D geo query covering for predicate queries <nl> * / <nl> - extern std : : atomic < int > internalGeoPredicateQuery2DMaxCoveringCells ; <nl> + extern std : : atomic < int > internalGeoPredicateQuery2DMaxCoveringCells ; / / NOLINT <nl> <nl> / * * <nl> * The maximum number of cells to use for 2D geo query covering for predicate queries <nl> * / <nl> - extern std : : atomic < int > internalGeoNearQuery2DMaxCoveringCells ; <nl> + extern std : : atomic < int > internalGeoNearQuery2DMaxCoveringCells ; / / NOLINT <nl> <nl> / / <nl> / / Geo query . <nl> / / <nl> <nl> / / What is the finest level we will cover a queried region or geoNear annulus ? <nl> - extern std : : atomic < int > internalQueryS2GeoFinestLevel ; <nl> + extern std : : atomic < int > internalQueryS2GeoFinestLevel ; / / NOLINT <nl> <nl> / / What is the coarsest level we will cover a queried region or geoNear annulus ? <nl> - extern std : : atomic < int > internalQueryS2GeoCoarsestLevel ; <nl> + extern std : : atomic < int > internalQueryS2GeoCoarsestLevel ; / / NOLINT <nl> <nl> / / What is the maximum cell count that we want ? ( advisory , not a hard threshold ) <nl> - extern std : : atomic < int > internalQueryS2GeoMaxCells ; <nl> + extern std : : atomic < int > internalQueryS2GeoMaxCells ; / / NOLINT <nl> <nl> } / / namespace mongo <nl> mmm a / src / mongo / db / query / query_knobs . h <nl> ppp b / src / mongo / db / query / query_knobs . h <nl> namespace mongo { <nl> <nl> / / Max number of times we call work ( ) on plans before comparing them , <nl> / / for small collections . <nl> - extern std : : atomic < int > internalQueryPlanEvaluationWorks ; <nl> + extern std : : atomic < int > internalQueryPlanEvaluationWorks ; / / NOLINT <nl> <nl> / / For large collections , the number times we work ( ) candidate plans is <nl> / / taken as this fraction of the collection size . <nl> - extern AtomicDouble internalQueryPlanEvaluationCollFraction ; <nl> + extern AtomicDouble internalQueryPlanEvaluationCollFraction ; / / NOLINT <nl> <nl> / / Stop working plans once a plan returns this many results . <nl> - extern std : : atomic < int > internalQueryPlanEvaluationMaxResults ; <nl> + extern std : : atomic < int > internalQueryPlanEvaluationMaxResults ; / / NOLINT <nl> <nl> / / Do we give a big ranking bonus to intersection plans ? <nl> - extern std : : atomic < bool > internalQueryForceIntersectionPlans ; <nl> + extern std : : atomic < bool > internalQueryForceIntersectionPlans ; / / NOLINT <nl> <nl> / / Do we have ixisect on at all ? <nl> - extern std : : atomic < bool > internalQueryPlannerEnableIndexIntersection ; <nl> + extern std : : atomic < bool > internalQueryPlannerEnableIndexIntersection ; / / NOLINT <nl> <nl> / / Do we use hash - based intersection for rooted $ and queries ? <nl> - extern std : : atomic < bool > internalQueryPlannerEnableHashIntersection ; <nl> + extern std : : atomic < bool > internalQueryPlannerEnableHashIntersection ; / / NOLINT <nl> <nl> / / <nl> / / plan cache <nl> / / <nl> <nl> / / How many entries in the cache ? <nl> - extern std : : atomic < int > internalQueryCacheSize ; <nl> + extern std : : atomic < int > internalQueryCacheSize ; / / NOLINT <nl> <nl> / / How many feedback entries do we collect before possibly evicting from the cache based on bad <nl> / / performance ? <nl> - extern std : : atomic < int > internalQueryCacheFeedbacksStored ; <nl> + extern std : : atomic < int > internalQueryCacheFeedbacksStored ; / / NOLINT <nl> <nl> / / How many times more works must we perform in order to justify plan cache eviction <nl> / / and replanning ? <nl> - extern AtomicDouble internalQueryCacheEvictionRatio ; <nl> + extern AtomicDouble internalQueryCacheEvictionRatio ; / / NOLINT <nl> <nl> / / <nl> / / Planning and enumeration . <nl> / / <nl> <nl> / / How many indexed solutions will QueryPlanner : : plan output ? <nl> - extern std : : atomic < int > internalQueryPlannerMaxIndexedSolutions ; <nl> + extern std : : atomic < int > internalQueryPlannerMaxIndexedSolutions ; / / NOLINT <nl> <nl> / / How many solutions will the enumerator consider at each OR ? <nl> - extern std : : atomic < int > internalQueryEnumerationMaxOrSolutions ; <nl> + extern std : : atomic < int > internalQueryEnumerationMaxOrSolutions ; / / NOLINT <nl> <nl> / / How many intersections will the enumerator consider at each AND ? <nl> - extern std : : atomic < int > internalQueryEnumerationMaxIntersectPerAnd ; <nl> + extern std : : atomic < int > internalQueryEnumerationMaxIntersectPerAnd ; / / NOLINT <nl> <nl> / / Do we want to plan each child of the OR independently ? <nl> - extern std : : atomic < bool > internalQueryPlanOrChildrenIndependently ; <nl> + extern std : : atomic < bool > internalQueryPlanOrChildrenIndependently ; / / NOLINT <nl> <nl> / / How many index scans are we willing to produce in order to obtain a sort order <nl> / / during explodeForSort ? <nl> - extern std : : atomic < int > internalQueryMaxScansToExplode ; <nl> + extern std : : atomic < int > internalQueryMaxScansToExplode ; / / NOLINT <nl> <nl> / / <nl> / / Query execution . <nl> / / <nl> <nl> - extern std : : atomic < int > internalQueryExecMaxBlockingSortBytes ; <nl> + extern std : : atomic < int > internalQueryExecMaxBlockingSortBytes ; / / NOLINT <nl> <nl> / / Yield after this many " should yield ? " checks . <nl> - extern std : : atomic < int > internalQueryExecYieldIterations ; <nl> + extern std : : atomic < int > internalQueryExecYieldIterations ; / / NOLINT <nl> <nl> / / Yield if it ' s been at least this many milliseconds since we last yielded . <nl> - extern std : : atomic < int > internalQueryExecYieldPeriodMS ; <nl> + extern std : : atomic < int > internalQueryExecYieldPeriodMS ; / / NOLINT <nl> <nl> / / Limit the size that we write without yielding to 16MB / 64 ( max expected number of indexes ) <nl> const int64_t insertVectorMaxBytes = 256 * 1024 ; <nl> mmm a / src / mongo / db / repl / master_slave . cpp <nl> ppp b / src / mongo / db / repl / master_slave . cpp <nl> void ReplSource : : syncToTailOfRemoteLog ( ) { <nl> } <nl> } <nl> <nl> - std : : atomic < int > replApplyBatchSize ( 1 ) ; <nl> + std : : atomic < int > replApplyBatchSize ( 1 ) ; / / NOLINT <nl> <nl> class ReplApplyBatchSize <nl> : public ExportedServerParameter < int , ServerParameterType : : kStartupAndRuntime > { <nl> mmm a / src / mongo / db / server_options . h <nl> ppp b / src / mongo / db / server_options . h <nl> struct ServerGlobalParams { <nl> <nl> bool indexBuildRetry ; / / - - noIndexBuildRetry <nl> <nl> - std : : atomic < bool > quiet ; / / - - quiet <nl> + std : : atomic < bool > quiet ; / / - - quiet NOLINT <nl> <nl> bool configsvr ; / / - - configsvr <nl> CatalogManager : : ConfigServerMode configsvrMode ; / / - - configsvrMode <nl> mmm a / src / mongo / db / server_parameters . h <nl> ppp b / src / mongo / db / server_parameters . h <nl> class is_safe_runtime_parameter_type < double > : public std : : true_type { } ; <nl> template < typename T , ServerParameterType paramType > <nl> class server_parameter_storage_type { <nl> public : <nl> - using value_type = std : : atomic < T > ; <nl> + using value_type = std : : atomic < T > ; / / NOLINT <nl> } ; <nl> <nl> template < typename T > <nl> mmm a / src / mongo / db / server_parameters_test . cpp <nl> ppp b / src / mongo / db / server_parameters_test . cpp <nl> using std : : string ; <nl> using std : : vector ; <nl> <nl> TEST ( ServerParameters , Simple1 ) { <nl> - std : : atomic < int > f ( 5 ) ; <nl> + std : : atomic < int > f ( 5 ) ; / / NOLINT <nl> ExportedServerParameter < int , ServerParameterType : : kStartupAndRuntime > ff ( NULL , " ff " , & f ) ; <nl> ASSERT_EQUALS ( " ff " , ff . name ( ) ) ; <nl> <nl> mmm a / src / mongo / db / storage / mmap_v1 / mmap_v1_database_catalog_entry . cpp <nl> ppp b / src / mongo / db / storage / mmap_v1 / mmap_v1_database_catalog_entry . cpp <nl> namespace { <nl> * - setting to false will fail . <nl> * / <nl> / / Unused , needed for server parameter . <nl> - std : : atomic < bool > newCollectionsUsePowerOf2SizesFlag ( true ) ; <nl> + std : : atomic < bool > newCollectionsUsePowerOf2SizesFlag ( true ) ; / / NOLINT <nl> <nl> class NewCollectionsUsePowerOf2SizesParameter <nl> : public ExportedServerParameter < bool , ServerParameterType : : kStartupAndRuntime > { <nl> mmm a / src / mongo / db / storage / storage_options . h <nl> ppp b / src / mongo / db / storage / storage_options . h <nl> struct StorageGlobalParams { <nl> <nl> / / - - journalCommitInterval <nl> static const int kMaxJournalCommitIntervalMs ; <nl> - std : : atomic < int > journalCommitIntervalMs ; <nl> + std : : atomic < int > journalCommitIntervalMs ; / / NOLINT <nl> <nl> / / - - notablescan <nl> / / no table scans allowed <nl> - std : : atomic < bool > noTableScan ; <nl> + std : : atomic < bool > noTableScan ; / / NOLINT <nl> <nl> / / - - directoryperdb <nl> / / Stores each database ’ s files in its own folder in the data directory . <nl> mmm a / src / mongo / db / storage / wiredtiger / wiredtiger_kv_engine . cpp <nl> ppp b / src / mongo / db / storage / wiredtiger / wiredtiger_kv_engine . cpp <nl> class WiredTigerKVEngine : : WiredTigerJournalFlusher : public BackgroundJob { <nl> <nl> private : <nl> WiredTigerSessionCache * _sessionCache ; <nl> - std : : atomic < bool > _shuttingDown { false } ; <nl> + std : : atomic < bool > _shuttingDown { false } ; / / NOLINT <nl> } ; <nl> <nl> WiredTigerKVEngine : : WiredTigerKVEngine ( const std : : string & path , <nl> mmm a / src / mongo / dbtests / plan_ranking . cpp <nl> ppp b / src / mongo / dbtests / plan_ranking . cpp <nl> <nl> namespace mongo { <nl> <nl> / / How we access the external setParameter testing bool . <nl> - extern std : : atomic < bool > internalQueryForceIntersectionPlans ; <nl> + extern std : : atomic < bool > internalQueryForceIntersectionPlans ; / / NOLINT <nl> <nl> - extern std : : atomic < bool > internalQueryPlannerEnableHashIntersection ; <nl> + extern std : : atomic < bool > internalQueryPlannerEnableHashIntersection ; / / NOLINT <nl> <nl> } / / namespace mongo <nl> <nl> mmm a / src / mongo / dbtests / query_stage_multiplan . cpp <nl> ppp b / src / mongo / dbtests / query_stage_multiplan . cpp <nl> <nl> namespace mongo { <nl> <nl> / / How we access the external setParameter testing bool . <nl> - extern std : : atomic < bool > internalQueryForceIntersectionPlans ; <nl> + extern std : : atomic < bool > internalQueryForceIntersectionPlans ; / / NOLINT <nl> <nl> } / / namespace mongo <nl> <nl> mmm a / src / mongo / executor / network_interface_asio . h <nl> ppp b / src / mongo / executor / network_interface_asio . h <nl> class NetworkInterfaceASIO final : public NetworkInterface { <nl> <nl> asio : : ip : : tcp : : resolver _resolver ; <nl> <nl> - std : : atomic < State > _state ; <nl> + std : : atomic < State > _state ; / / NOLINT <nl> <nl> std : : unique_ptr < AsyncTimerFactoryInterface > _timerFactory ; <nl> <nl> mmm a / src / mongo / executor / network_interface_perf_test . cpp <nl> ppp b / src / mongo / executor / network_interface_perf_test . cpp <nl> int timeNetworkTestMillis ( std : : size_t operations , NetworkInterface * net ) { <nl> auto fixture = unittest : : getFixtureConnectionString ( ) ; <nl> auto server = fixture . getServers ( ) [ 0 ] ; <nl> <nl> - std : : atomic < int > remainingOps ( operations ) ; <nl> + std : : atomic < int > remainingOps ( operations ) ; / / NOLINT <nl> stdx : : mutex mtx ; <nl> stdx : : condition_variable cv ; <nl> Timer t ; <nl> mmm a / src / mongo / platform / atomic_proxy . h <nl> ppp b / src / mongo / platform / atomic_proxy . h <nl> class AtomicProxy { <nl> } <nl> <nl> private : <nl> - std : : atomic < BaseWordT > _value ; <nl> + std : : atomic < BaseWordT > _value ; / / NOLINT <nl> } ; <nl> <nl> using AtomicDouble = AtomicProxy < double , std : : uint64_t > ; <nl> mmm a / src / mongo / platform / atomic_word . h <nl> ppp b / src / mongo / platform / atomic_word . h <nl> class AtomicWord { <nl> } <nl> <nl> private : <nl> - std : : atomic < WordType > _value ; <nl> + std : : atomic < WordType > _value ; / / NOLINT <nl> } ; <nl> <nl> # define _ATOMIC_WORD_DECLARE ( NAME , WTYPE ) \ <nl> mmm a / src / mongo / s / query / cluster_cursor_cleanup_job . cpp <nl> ppp b / src / mongo / s / query / cluster_cursor_cleanup_job . cpp <nl> <nl> <nl> namespace mongo { <nl> <nl> - std : : atomic < long long > ClusterCursorCleanupJob : : cursorTimeoutMillis ( <nl> + std : : atomic < long long > ClusterCursorCleanupJob : : cursorTimeoutMillis ( / / NOLINT <nl> durationCount < stdx : : chrono : : milliseconds > ( stdx : : chrono : : minutes ( 10 ) ) ) ; <nl> <nl> ExportedServerParameter < long long , ServerParameterType : : kStartupAndRuntime > <nl> mmm a / src / mongo / s / query / cluster_cursor_cleanup_job . h <nl> ppp b / src / mongo / s / query / cluster_cursor_cleanup_job . h <nl> class ClusterCursorCleanupJob final : public BackgroundJob { <nl> * TODO : Move declaration to cpp file once CursorCache class is deleted . See SERVER - 20758 for <nl> * more details . <nl> * / <nl> - static std : : atomic < long long > cursorTimeoutMillis ; <nl> + static std : : atomic < long long > cursorTimeoutMillis ; / / NOLINT <nl> <nl> std : : string name ( ) const final ; <nl> void run ( ) final ; <nl> mmm a / src / mongo / s / strategy . h <nl> ppp b / src / mongo / s / strategy . h <nl> class ServerSelectionMetadata ; <nl> } / / namespace rpc <nl> <nl> / / A spigot to enable the ClusterClientCursor codepath . <nl> - extern std : : atomic < bool > useClusterClientCursor ; <nl> + extern std : : atomic < bool > useClusterClientCursor ; / / NOLINT <nl> <nl> / * * <nl> * Legacy interface for processing client read / write / cmd requests . <nl> mmm a / src / mongo / util / assert_util . cpp <nl> ppp b / src / mongo / util / assert_util . cpp <nl> void AssertionCount : : condrollover ( int newvalue ) { <nl> rollover ( ) ; <nl> } <nl> <nl> - std : : atomic < bool > DBException : : traceExceptions ( false ) ; <nl> + std : : atomic < bool > DBException : : traceExceptions ( false ) ; / / NOLINT <nl> <nl> string DBException : : toString ( ) const { <nl> stringstream ss ; <nl> mmm a / src / mongo / util / assert_util . h <nl> ppp b / src / mongo / util / assert_util . h <nl> class DBException : public std : : exception { <nl> static void traceIfNeeded ( const DBException & e ) ; <nl> <nl> public : <nl> - static std : : atomic < bool > traceExceptions ; <nl> + static std : : atomic < bool > traceExceptions ; / / NOLINT <nl> <nl> protected : <nl> ExceptionInfo _ei ; <nl>
SERVER - 21097 Add a lint rule to prohibit std : : atomic , add NOLINT to existing uses .
mongodb/mongo
0ca67590714744c2cb5242d0536bae48ea8c6795
2015-10-23T22:02:06Z
mmm a / examples / opengl3_example / imgui_impl_glfw_gl3 . cpp <nl> ppp b / examples / opengl3_example / imgui_impl_glfw_gl3 . cpp <nl> void ImGui_ImplGlfwGL3_ScrollCallback ( GLFWwindow * , double / * xoffset * / , double yo <nl> g_MouseWheel + = ( float ) yoffset ; / / Use fractional mouse wheel , 1 . 0 unit 5 lines . <nl> } <nl> <nl> - void ImGui_ImplGlfwGL3_KeyCallback ( GLFWwindow * , int key , int , int action , int mods ) <nl> + void ImGui_ImplGlfwGL3_KeyCallback ( GLFWwindow * window , int key , int , int action , int mods ) <nl> { <nl> ImGuiIO & io = ImGui : : GetIO ( ) ; <nl> if ( action = = GLFW_PRESS ) <nl> io . KeysDown [ key ] = true ; <nl> if ( action = = GLFW_RELEASE ) <nl> io . KeysDown [ key ] = false ; <nl> - io . KeyCtrl = ( mods & GLFW_MOD_CONTROL ) ! = 0 ; <nl> - io . KeyShift = ( mods & GLFW_MOD_SHIFT ) ! = 0 ; <nl> - io . KeyAlt = ( mods & GLFW_MOD_ALT ) ! = 0 ; <nl> + <nl> + ( void ) mods ; / / Modifiers are not reliable across systems <nl> + io . KeyCtrl = glfwGetKey ( window , GLFW_KEY_LEFT_CONTROL ) = = GLFW_PRESS | | glfwGetKey ( window , GLFW_KEY_RIGHT_CONTROL ) = = GLFW_PRESS ; <nl> + io . KeyShift = glfwGetKey ( window , GLFW_KEY_LEFT_SHIFT ) = = GLFW_PRESS | | glfwGetKey ( window , GLFW_KEY_RIGHT_SHIFT ) = = GLFW_PRESS ; <nl> + io . KeyAlt = glfwGetKey ( window , GLFW_KEY_LEFT_ALT ) = = GLFW_PRESS | | glfwGetKey ( window , GLFW_KEY_RIGHT_ALT ) = = GLFW_PRESS ; <nl> } <nl> <nl> void ImGui_ImplGlfwGL3_CharCallback ( GLFWwindow * , unsigned int c ) <nl> mmm a / examples / opengl_example / imgui_impl_glfw . cpp <nl> ppp b / examples / opengl_example / imgui_impl_glfw . cpp <nl> void ImGui_ImplGlfw_ScrollCallback ( GLFWwindow * , double / * xoffset * / , double yoffs <nl> g_MouseWheel + = ( float ) yoffset ; / / Use fractional mouse wheel , 1 . 0 unit 5 lines . <nl> } <nl> <nl> - void ImGui_ImplGlFw_KeyCallback ( GLFWwindow * , int key , int , int action , int mods ) <nl> + void ImGui_ImplGlFw_KeyCallback ( GLFWwindow * window , int key , int , int action , int mods ) <nl> { <nl> ImGuiIO & io = ImGui : : GetIO ( ) ; <nl> if ( action = = GLFW_PRESS ) <nl> io . KeysDown [ key ] = true ; <nl> if ( action = = GLFW_RELEASE ) <nl> io . KeysDown [ key ] = false ; <nl> - io . KeyCtrl = ( mods & GLFW_MOD_CONTROL ) ! = 0 ; <nl> - io . KeyShift = ( mods & GLFW_MOD_SHIFT ) ! = 0 ; <nl> - io . KeyAlt = ( mods & GLFW_MOD_ALT ) ! = 0 ; <nl> + <nl> + ( void ) mods ; / / Modifiers are not reliable across systems <nl> + io . KeyCtrl = glfwGetKey ( window , GLFW_KEY_LEFT_CONTROL ) = = GLFW_PRESS | | glfwGetKey ( window , GLFW_KEY_RIGHT_CONTROL ) = = GLFW_PRESS ; <nl> + io . KeyShift = glfwGetKey ( window , GLFW_KEY_LEFT_SHIFT ) = = GLFW_PRESS | | glfwGetKey ( window , GLFW_KEY_RIGHT_SHIFT ) = = GLFW_PRESS ; <nl> + io . KeyAlt = glfwGetKey ( window , GLFW_KEY_LEFT_ALT ) = = GLFW_PRESS | | glfwGetKey ( window , GLFW_KEY_RIGHT_ALT ) = = GLFW_PRESS ; <nl> } <nl> <nl> void ImGui_ImplGlfw_CharCallback ( GLFWwindow * , unsigned int c ) <nl> mmm a / imgui . cpp <nl> ppp b / imgui . cpp <nl> <nl> - / / ImGui library v1 . 38 WIP <nl> +  / / ImGui library v1 . 38 WIP <nl> / / See ImGui : : ShowTestWindow ( ) for sample code . <nl> / / Read ' Programmer guide ' below for notes on how to setup ImGui in your codebase . <nl> / / Get latest version at https : / / github . com / ocornut / imgui <nl> <nl> Occasionally introducing changes that are breaking the API . The breakage are generally minor and easy to fix . <nl> Here is a change - log of API breaking changes , if you are using one of the functions listed , expect to have to fix some code . <nl> <nl> + - 2015 / 04 / 13 ( 1 . 38 ) - renamed IsClipped ( ) to IsRectClipped ( ) . Kept inline redirection function ( will obsolete ) . <nl> + - 2015 / 04 / 09 ( 1 . 38 ) - renamed ImDrawList : : AddArc ( ) to ImDrawList : : AddArcFast ( ) for compatibility with future API <nl> - 2015 / 04 / 03 ( 1 . 38 ) - removed ImGuiCol_CheckHovered , ImGuiCol_CheckActive , replaced with the more general ImGuiCol_FrameBgHovered , ImGuiCol_FrameBgActive . <nl> - 2014 / 04 / 03 ( 1 . 38 ) - removed support for passing - FLT_MAX . . + FLT_MAX as the range for a SliderFloat ( ) . Use DragFloat ( ) or Inputfloat ( ) instead . <nl> - 2015 / 03 / 17 ( 1 . 36 ) - renamed GetItemRectMin ( ) / GetItemRectMax ( ) / IsMouseHoveringBox ( ) to GetItemRectMin ( ) / GetItemRectMax ( ) / IsMouseHoveringRect ( ) . Kept inline redirection function ( will obsolete ) . <nl> static bool ItemAdd ( const ImRect & bb , const ImGuiID * id ) ; <nl> static void ItemSize ( ImVec2 size , float text_offset_y = 0 . 0f ) ; <nl> static void ItemSize ( const ImRect & bb , float text_offset_y = 0 . 0f ) ; <nl> static void PushColumnClipRect ( int column_index = - 1 ) ; <nl> - static bool IsClipped ( const ImRect & bb ) ; <nl> + static bool IsClippedEx ( const ImRect & bb , bool clip_even_when_logged ) ; <nl> <nl> static bool IsMouseHoveringRect ( const ImRect & bb ) ; <nl> static bool IsKeyPressedMap ( ImGuiKey key , bool repeat = true ) ; <nl> struct ImGuiState <nl> ImGuiWindow * FocusedWindow ; / / Will catch keyboard inputs <nl> ImGuiWindow * HoveredWindow ; / / Will catch mouse inputs <nl> ImGuiWindow * HoveredRootWindow ; / / Will catch mouse inputs ( for focus / move only ) <nl> - ImGuiID HoveredId ; <nl> - ImGuiID ActiveId ; <nl> + ImGuiID HoveredId ; / / Hovered widget <nl> + ImGuiID ActiveId ; / / Active widget <nl> ImGuiID ActiveIdPreviousFrame ; <nl> bool ActiveIdIsAlive ; <nl> + bool ActiveIdIsJustActivated ; / / Set when <nl> bool ActiveIdIsFocusedOnly ; / / Set only by active widget . Denote focus but no active interaction . <nl> ImGuiWindow * MovedWindow ; / / Track the child window we clicked on to move a window . Only valid if ActiveID is the " # MOVE " identifier of a window . <nl> float SettingsDirtyTimer ; <nl> struct ImGuiState <nl> ImGuiID ScalarAsInputTextId ; / / Temporary text input when CTRL + clicking on a slider , etc . <nl> ImGuiStorage ColorEditModeStorage ; / / for user selection <nl> ImGuiID ActiveComboID ; <nl> + float DragCurrentValue ; / / current dragged value , always float , not rounded by end - user precision settings <nl> ImVec2 DragLastMouseDelta ; <nl> float DragSpeedScaleSlow ; <nl> float DragSpeedScaleFast ; <nl> struct ImGuiState <nl> ActiveId = 0 ; <nl> ActiveIdPreviousFrame = 0 ; <nl> ActiveIdIsAlive = false ; <nl> + ActiveIdIsJustActivated = false ; <nl> ActiveIdIsFocusedOnly = false ; <nl> MovedWindow = NULL ; <nl> SettingsDirtyTimer = 0 . 0f ; <nl> struct ImGuiState <nl> <nl> ScalarAsInputTextId = 0 ; <nl> ActiveComboID = 0 ; <nl> + DragCurrentValue = 0 . 0f ; <nl> DragLastMouseDelta = ImVec2 ( 0 . 0f , 0 . 0f ) ; <nl> DragSpeedScaleSlow = 0 . 01f ; <nl> DragSpeedScaleFast = 10 . 0f ; <nl> struct ImGuiWindow <nl> ImGuiWindow ( const char * name ) ; <nl> ~ ImGuiWindow ( ) ; <nl> <nl> - ImGuiID GetID ( const char * str ) ; <nl> + ImGuiID GetID ( const char * str , const char * str_end = NULL ) ; <nl> ImGuiID GetID ( const void * ptr ) ; <nl> <nl> bool FocusItemRegister ( bool is_active , bool tab_stop = true ) ; / / Return true if focus is requested <nl> static void SetActiveId ( ImGuiID id ) <nl> ImGuiState & g = * GImGui ; <nl> g . ActiveId = id ; <nl> g . ActiveIdIsFocusedOnly = false ; <nl> + g . ActiveIdIsJustActivated = true ; <nl> } <nl> <nl> static void RegisterAliveId ( ImGuiID id ) <nl> ImGuiWindow : : ~ ImGuiWindow ( ) <nl> Name = NULL ; <nl> } <nl> <nl> - ImGuiID ImGuiWindow : : GetID ( const char * str ) <nl> + ImGuiID ImGuiWindow : : GetID ( const char * str , const char * str_end ) <nl> { <nl> ImGuiID seed = IDStack . back ( ) ; <nl> - const ImGuiID id = ImHash ( str , 0 , seed ) ; <nl> + const ImGuiID id = ImHash ( str , str_end ? str_end - str : 0 , seed ) ; <nl> RegisterAliveId ( id ) ; <nl> return id ; <nl> } <nl> void ImGui : : NewFrame ( ) <nl> SetActiveId ( 0 ) ; <nl> g . ActiveIdPreviousFrame = g . ActiveId ; <nl> g . ActiveIdIsAlive = false ; <nl> + g . ActiveIdIsJustActivated = false ; <nl> if ( ! g . ActiveId ) <nl> g . MovedWindow = NULL ; <nl> <nl> ImVec2 ImGui : : GetMouseDragDelta ( int button , float lock_threshold ) <nl> return ImVec2 ( 0 . 0f , 0 . 0f ) ; <nl> } <nl> <nl> + void ImGui : : ResetMouseDragDelta ( int button ) <nl> + { <nl> + ImGuiState & g = * GImGui ; <nl> + IM_ASSERT ( button > = 0 & & button < IM_ARRAYSIZE ( g . IO . MouseDown ) ) ; <nl> + / / NB : We don ' t need to reset g . IO . MouseDragMaxDistanceSqr <nl> + g . IO . MouseClickedPos [ button ] = g . IO . MousePos ; <nl> + } <nl> + <nl> ImGuiMouseCursor ImGui : : GetMouseCursor ( ) <nl> { <nl> return GImGui - > MouseCursor ; <nl> bool ImGui : : IsAnyItemActive ( ) <nl> return g . ActiveId ! = 0 ; <nl> } <nl> <nl> + bool ImGui : : IsItemVisible ( ) <nl> + { <nl> + ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> + ImRect r ( window - > ClipRectStack . back ( ) ) ; <nl> + return r . Overlaps ( window - > DC . LastItemRect ) ; <nl> + } <nl> + <nl> ImVec2 ImGui : : GetItemRectMin ( ) <nl> { <nl> ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> void ImGui : : TextUnformatted ( const char * text , const char * text_end ) <nl> while ( line < text_end ) <nl> { <nl> const char * line_end = strchr ( line , ' \ n ' ) ; <nl> - if ( IsClipped ( line_rect ) ) <nl> + if ( IsClippedEx ( line_rect , false ) ) <nl> break ; <nl> <nl> const ImVec2 line_size = CalcTextSize ( line , line_end , false ) ; <nl> void ImGui : : PushID ( const char * str_id ) <nl> window - > IDStack . push_back ( window - > GetID ( str_id ) ) ; <nl> } <nl> <nl> + void ImGui : : PushID ( const char * str_id_begin , const char * str_id_end ) <nl> + { <nl> + ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> + window - > IDStack . push_back ( window - > GetID ( str_id_begin , str_id_end ) ) ; <nl> + } <nl> + <nl> void ImGui : : PushID ( const void * ptr_id ) <nl> { <nl> ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> ImGuiID ImGui : : GetID ( const char * str_id ) <nl> return window - > GetID ( str_id ) ; <nl> } <nl> <nl> + ImGuiID ImGui : : GetID ( const char * str_id_begin , const char * str_id_end ) <nl> + { <nl> + ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> + return window - > GetID ( str_id_begin , str_id_end ) ; <nl> + } <nl> + <nl> ImGuiID ImGui : : GetID ( const void * ptr_id ) <nl> { <nl> ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> static bool SliderFloatAsInputText ( const char * label , float * v , ImGuiID id , int <nl> } <nl> <nl> / / Parse display precision back from the display format string <nl> - static void ParseFormat ( const char * fmt , int & decimal_precision ) <nl> + static inline void ParseFormat ( const char * fmt , int & decimal_precision ) <nl> { <nl> while ( ( fmt = strchr ( fmt , ' % ' ) ) ! = NULL ) <nl> { <nl> static void ParseFormat ( const char * fmt , int & decimal_precision ) <nl> } <nl> } <nl> <nl> + static inline float RoundScalar ( float value , int decimal_precision ) <nl> + { <nl> + / / Round past decimal precision <nl> + / / 0 : 1 , 1 : 0 . 1 , 2 : 0 . 01 , etc . <nl> + / / So when our value is 1 . 99999 with a precision of 0 . 001 we ' ll end up rounding to 2 . 0 <nl> + / / FIXME : Investigate better rounding methods <nl> + const float min_step = 1 . 0f / powf ( 10 . 0f , ( float ) decimal_precision ) ; <nl> + const float remainder = fmodf ( value , min_step ) ; <nl> + if ( remainder < = min_step * 0 . 5f ) <nl> + value - = remainder ; <nl> + else <nl> + value + = ( min_step - remainder ) ; <nl> + return value ; <nl> + } <nl> + <nl> static bool SliderBehavior ( const ImRect & frame_bb , const ImRect & slider_bb , ImGuiID id , float * v , float v_min , float v_max , float power , int decimal_precision , bool horizontal ) <nl> { <nl> ImGuiState & g = * GImGui ; <nl> static bool SliderBehavior ( const ImRect & frame_bb , const ImRect & slider_bb , ImGu <nl> } <nl> <nl> / / Round past decimal precision <nl> - / / 0 - > 1 , 1 - > 0 . 1 , 2 - > 0 . 01 , etc . <nl> - / / So when our value is 1 . 99999 with a precision of 0 . 001 we ' ll end up rounding to 2 . 0 <nl> - const float min_step = 1 . 0f / powf ( 10 . 0f , ( float ) decimal_precision ) ; <nl> - const float remainder = fmodf ( new_value , min_step ) ; <nl> - if ( remainder < = min_step * 0 . 5f ) <nl> - new_value - = remainder ; <nl> - else <nl> - new_value + = ( min_step - remainder ) ; <nl> + new_value = RoundScalar ( new_value , decimal_precision ) ; <nl> <nl> if ( * v ! = new_value ) <nl> { <nl> bool ImGui : : SliderInt4 ( const char * label , int v [ 4 ] , int v_min , int v_max , const <nl> } <nl> <nl> / / FIXME - WIP : Work in progress . May change API / behavior . <nl> - static bool DragScalarBehavior ( const ImRect & frame_bb , ImGuiID id , float * v , float v_step , float v_min , float v_max ) <nl> + static bool DragScalarBehavior ( const ImRect & frame_bb , ImGuiID id , float * v , float v_speed , float v_min , float v_max , int decimal_precision , float power ) <nl> { <nl> ImGuiState & g = * GImGui ; <nl> ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> static bool DragScalarBehavior ( const ImRect & frame_bb , ImGuiID id , float * v , flo <nl> { <nl> if ( g . IO . MouseDown [ 0 ] ) <nl> { <nl> - const ImVec2 mouse_drag_delta = ImGui : : GetMouseDragDelta ( 0 ) ; <nl> + if ( g . ActiveIdIsJustActivated ) <nl> + { <nl> + / / Lock current value on click <nl> + g . DragCurrentValue = * v ; <nl> + g . DragLastMouseDelta = ImVec2 ( 0 . f , 0 . f ) ; <nl> + } <nl> <nl> + const ImVec2 mouse_drag_delta = ImGui : : GetMouseDragDelta ( 0 , 1 . 0f ) ; <nl> if ( fabsf ( mouse_drag_delta . x - g . DragLastMouseDelta . x ) > 0 . 0f ) <nl> { <nl> - float step = v_step ; <nl> + float speed = v_speed ; <nl> if ( g . IO . KeyShift & & g . DragSpeedScaleFast > = 0 . 0f ) <nl> - step = v_step * g . DragSpeedScaleFast ; <nl> + speed = v_speed * g . DragSpeedScaleFast ; <nl> if ( g . IO . KeyAlt & & g . DragSpeedScaleSlow > = 0 . 0f ) <nl> - step = v_step * g . DragSpeedScaleSlow ; <nl> + speed = v_speed * g . DragSpeedScaleSlow ; <nl> <nl> - * v + = ( mouse_drag_delta . x - g . DragLastMouseDelta . x ) * step ; <nl> + float v_cur = g . DragCurrentValue ; <nl> + float delta = ( mouse_drag_delta . x - g . DragLastMouseDelta . x ) * speed ; <nl> + if ( fabsf ( power - 1 . 0f ) > 0 . 001f ) <nl> + { <nl> + / / Logarithmic curve on both side of 0 . 0 <nl> + float v0_abs = v_cur > = 0 . 0f ? v_cur : - v_cur ; <nl> + float v0_sign = v_cur > = 0 . 0f ? 1 . 0f : - 1 . 0f ; <nl> + float v1 = powf ( v0_abs , 1 . 0f / power ) + ( delta * v0_sign ) ; <nl> + float v1_abs = v1 > = 0 . 0f ? v1 : - v1 ; <nl> + float v1_sign = v1 > = 0 . 0f ? 1 . 0f : - 1 . 0f ; / / Crossed sign line <nl> + v_cur = powf ( v1_abs , power ) * v0_sign * v1_sign ; / / Reapply sign <nl> + } <nl> + else <nl> + { <nl> + v_cur + = delta ; <nl> + } <nl> + g . DragLastMouseDelta . x = mouse_drag_delta . x ; <nl> <nl> + / / Clamp <nl> if ( v_min < v_max ) <nl> - * v = ImClamp ( * v , v_min , v_max ) ; <nl> + v_cur = ImClamp ( v_cur , v_min , v_max ) ; <nl> + g . DragCurrentValue = v_cur ; <nl> <nl> - g . DragLastMouseDelta . x = mouse_drag_delta . x ; <nl> - value_changed = true ; <nl> + / / Round to user desired precision , then apply <nl> + v_cur = RoundScalar ( v_cur , decimal_precision ) ; <nl> + if ( * v ! = v_cur ) <nl> + { <nl> + * v = v_cur ; <nl> + value_changed = true ; <nl> + } <nl> } <nl> } <nl> else <nl> static bool DragScalarBehavior ( const ImRect & frame_bb , ImGuiID id , float * v , flo <nl> return value_changed ; <nl> } <nl> <nl> - bool ImGui : : DragFloat ( const char * label , float * v , float v_step , float v_min , float v_max , const char * display_format ) <nl> + bool ImGui : : DragFloat ( const char * label , float * v , float v_speed , float v_min , float v_max , const char * display_format , float power ) <nl> { <nl> ImGuiState & g = * GImGui ; <nl> ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> bool ImGui : : DragFloat ( const char * label , float * v , float v_step , float v_min , fl <nl> { <nl> SetActiveId ( id ) ; <nl> FocusWindow ( window ) ; <nl> - g . DragLastMouseDelta = ImVec2 ( 0 . f , 0 . f ) ; <nl> <nl> if ( tab_focus_requested | | g . IO . KeyCtrl | | g . IO . MouseDoubleClicked [ 0 ] ) <nl> { <nl> bool ImGui : : DragFloat ( const char * label , float * v , float v_step , float v_min , fl <nl> ItemSize ( total_bb , style . FramePadding . y ) ; <nl> <nl> / / Actual drag behavior <nl> - const bool value_changed = DragScalarBehavior ( frame_bb , id , v , v_step , v_min , v_max ) ; <nl> + const bool value_changed = DragScalarBehavior ( frame_bb , id , v , v_speed , v_min , v_max , decimal_precision , power ) ; <nl> <nl> / / Display value using user - provided display format so user can add prefix / suffix / decorations to the value . <nl> char value_buf [ 64 ] ; <nl> bool ImGui : : DragFloat ( const char * label , float * v , float v_step , float v_min , fl <nl> return value_changed ; <nl> } <nl> <nl> - bool ImGui : : DragInt ( const char * label , int * v , int v_step , int v_min , int v_max , const char * display_format ) <nl> + / / NB : v_speed is float to allow adjusting the drag speed with more precision <nl> + bool ImGui : : DragInt ( const char * label , int * v , float v_speed , int v_min , int v_max , const char * display_format ) <nl> { <nl> if ( ! display_format ) <nl> display_format = " % . 0f " ; <nl> float v_f = ( float ) * v ; <nl> - bool value_changed = ImGui : : DragFloat ( label , & v_f , ( float ) v_step , ( float ) v_min , ( float ) v_max , display_format ) ; <nl> + bool value_changed = ImGui : : DragFloat ( label , & v_f , v_speed , ( float ) v_min , ( float ) v_max , display_format ) ; <nl> * v = ( int ) v_f ; <nl> return value_changed ; <nl> } <nl> bool ImGui : : ColorEdit4 ( const char * label , float col [ 4 ] , bool alpha ) <nl> ImGui : : SameLine ( 0 , ( int ) style . ItemInnerSpacing . x ) ; <nl> if ( n + 1 = = components ) <nl> ImGui : : PushItemWidth ( w_item_last ) ; <nl> - value_changed | = ImGui : : DragInt ( ids [ n ] , & i [ n ] , 1 , 0 , 255 , fmt [ n ] ) ; <nl> + value_changed | = ImGui : : DragInt ( ids [ n ] , & i [ n ] , 1 . 0f , 0 , 255 , fmt [ n ] ) ; <nl> } <nl> ImGui : : PopItemWidth ( ) ; <nl> ImGui : : PopItemWidth ( ) ; <nl> static inline void ItemSize ( const ImRect & bb , float text_offset_y ) <nl> ItemSize ( bb . GetSize ( ) , text_offset_y ) ; <nl> } <nl> <nl> - static bool IsClipped ( const ImRect & bb ) <nl> + static bool IsClippedEx ( const ImRect & bb , bool clip_even_when_logged ) <nl> { <nl> ImGuiState & g = * GImGui ; <nl> ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> <nl> - if ( ! bb . Overlaps ( ImRect ( window - > ClipRectStack . back ( ) ) ) & & ! g . LogEnabled ) <nl> - return true ; <nl> + if ( ! bb . Overlaps ( ImRect ( window - > ClipRectStack . back ( ) ) ) ) <nl> + { <nl> + if ( clip_even_when_logged | | ! g . LogEnabled ) <nl> + return true ; <nl> + } <nl> return false ; <nl> } <nl> <nl> - bool ImGui : : IsClipped ( const ImVec2 & item_size ) <nl> + bool ImGui : : IsRectClipped ( const ImVec2 & size ) <nl> { <nl> ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> - return IsClipped ( ImRect ( window - > DC . CursorPos , window - > DC . CursorPos + item_size ) ) ; <nl> + return IsClippedEx ( ImRect ( window - > DC . CursorPos , window - > DC . CursorPos + size ) , true ) ; <nl> } <nl> <nl> static bool ItemAdd ( const ImRect & bb , const ImGuiID * id ) <nl> static bool ItemAdd ( const ImRect & bb , const ImGuiID * id ) <nl> ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> window - > DC . LastItemID = id ? * id : 0 ; <nl> window - > DC . LastItemRect = bb ; <nl> - if ( IsClipped ( bb ) ) <nl> + if ( IsClippedEx ( bb , false ) ) <nl> { <nl> - window - > DC . LastItemHoveredAndUsable = window - > DC . LastItemHoveredRect = false ; <nl> - return false ; <nl> + if ( ! id | | * id ! = GImGui - > ActiveId ) <nl> + { <nl> + window - > DC . LastItemHoveredAndUsable = window - > DC . LastItemHoveredRect = false ; <nl> + return false ; <nl> + } <nl> } <nl> <nl> / / This is a sensible default , but widgets are free to override it after calling ItemAdd ( ) <nl> void ImGui : : Columns ( int columns_count , const char * id , bool border ) <nl> const ImGuiID column_id = window - > DC . ColumnsSetID + ImGuiID ( i ) ; <nl> const ImRect column_rect ( ImVec2 ( x - 4 , y1 ) , ImVec2 ( x + 4 , y2 ) ) ; <nl> <nl> - if ( IsClipped ( column_rect ) ) <nl> + if ( IsClippedEx ( column_rect , false ) ) <nl> continue ; <nl> <nl> bool hovered , held ; <nl> void ImDrawList : : PrimReserve ( unsigned int vtx_count ) <nl> <nl> void ImDrawList : : PrimRectUV ( const ImVec2 & a , const ImVec2 & c , const ImVec2 & uv_a , const ImVec2 & uv_c , ImU32 col ) <nl> { <nl> - const ImVec2 b ( c . x , a . y ) ; <nl> - const ImVec2 d ( a . x , c . y ) ; <nl> - const ImVec2 uv_b ( uv_c . x , uv_a . y ) ; <nl> - const ImVec2 uv_d ( uv_a . x , uv_c . y ) ; <nl> + const ImVec2 b ( c . x , a . y ) ; <nl> + const ImVec2 d ( a . x , c . y ) ; <nl> + const ImVec2 uv_b ( uv_c . x , uv_a . y ) ; <nl> + const ImVec2 uv_d ( uv_a . x , uv_c . y ) ; <nl> vtx_write [ 0 ] . pos = a ; vtx_write [ 0 ] . uv = uv_a ; vtx_write [ 0 ] . col = col ; <nl> vtx_write [ 1 ] . pos = b ; vtx_write [ 1 ] . uv = uv_b ; vtx_write [ 1 ] . col = col ; <nl> vtx_write [ 2 ] . pos = c ; vtx_write [ 2 ] . uv = uv_c ; vtx_write [ 2 ] . col = col ; <nl> void ImGui : : ShowTestWindow ( bool * opened ) <nl> ImGui : : Spacing ( ) ; <nl> <nl> / / Scrolling columns <nl> - / * <nl> + / * <nl> ImGui : : Text ( " Scrolling : " ) ; <nl> ImGui : : BeginChild ( " # # header " , ImVec2 ( 0 , ImGui : : GetTextLineHeightWithSpacing ( ) + ImGui : : GetStyle ( ) . ItemSpacing . y ) ) ; <nl> ImGui : : Columns ( 3 ) ; <nl> void ImGui : : ShowTestWindow ( bool * opened ) <nl> <nl> ImGui : : Separator ( ) ; <nl> ImGui : : Spacing ( ) ; <nl> - * / <nl> + * / <nl> <nl> / / Create multiple items in a same cell before switching to next column <nl> ImGui : : Text ( " Mixed items : " ) ; <nl> static void ShowExampleAppLongText ( bool * opened ) <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / FONT DATA <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - / / ProggyClean . ttf <nl> - / / Copyright ( c ) 2004 , 2005 Tristan Grimmer <nl> - / / MIT license ( see License . txt in http : / / www . upperbounds . net / download / ProggyClean . ttf . zip ) <nl> - / / Download and more information at http : / / upperbounds . net <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / Compressed with stb_compress ( ) then converted to a C array . <nl> - / / Decompressor from stb . h ( public domain ) by Sean Barrett <nl> - / / https : / / github . com / nothings / stb / blob / master / stb . h <nl> + / / Use the program in extra_fonts / binary_to_compressed_c . cpp to create the array from a TTF file . <nl> + / / Decompressor from stb . h ( public domain ) by Sean Barrett https : / / github . com / nothings / stb / blob / master / stb . h <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> static unsigned int stb_decompress_length ( unsigned char * input ) <nl> static unsigned int stb_decompress_length ( unsigned char * input ) <nl> } <nl> <nl> static unsigned char * stb__barrier , * stb__barrier2 , * stb__barrier3 , * stb__barrier4 ; <nl> - <nl> static unsigned char * stb__dout ; <nl> static void stb__match ( unsigned char * data , unsigned int length ) <nl> { <nl> static unsigned int stb_decompress ( unsigned char * output , unsigned char * i , unsi <nl> } <nl> } <nl> <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / ProggyClean . ttf <nl> + / / Copyright ( c ) 2004 , 2005 Tristan Grimmer <nl> + / / MIT license ( see License . txt in http : / / www . upperbounds . net / download / ProggyClean . ttf . zip ) <nl> + / / Download and more information at http : / / upperbounds . net <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> static const unsigned int proggy_clean_ttf_compressed_size = 9583 ; <nl> static const unsigned int proggy_clean_ttf_compressed_data [ 9584 / 4 ] = <nl> { <nl> mmm a / imgui . h <nl> ppp b / imgui . h <nl> namespace ImGui <nl> / / If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them <nl> / / You can also use " # # extra " within your widget name to distinguish them from each others ( see ' Programmer Guide ' ) <nl> IMGUI_API void PushID ( const char * str_id ) ; / / push identifier into the ID stack . IDs are hash of the * entire * stack ! <nl> + IMGUI_API void PushID ( const char * str_id_begin , const char * str_id_end ) ; <nl> IMGUI_API void PushID ( const void * ptr_id ) ; <nl> IMGUI_API void PushID ( const int int_id ) ; <nl> IMGUI_API void PopID ( ) ; <nl> IMGUI_API ImGuiID GetID ( const char * str_id ) ; / / calculate unique ID ( hash of whole ID stack + given parameter ) . useful if you want to query into ImGuiStorage yourself . otherwise rarely needed <nl> + IMGUI_API ImGuiID GetID ( const char * str_id_begin , const char * str_id_end ) ; <nl> IMGUI_API ImGuiID GetID ( const void * ptr_id ) ; <nl> <nl> / / Widgets <nl> namespace ImGui <nl> <nl> / / Widgets : Drags ( tip : ctrl + click on a drag box to input text ) <nl> / / ImGui 1 . 38 + work - in - progress , may change name or API . <nl> - IMGUI_API bool DragFloat ( const char * label , float * v , float v_step = 1 . 0f , float v_min = 0 . 0f , float v_max = 0 . 0f , const char * display_format = " % . 3f " ) ; / / If v_max > = v_max we have no bound <nl> - IMGUI_API bool DragInt ( const char * label , int * v , int v_step = 1 , int v_min = 0 , int v_max = 0 , const char * display_format = " % . 0f " ) ; / / If v_max > = v_max we have no bound <nl> + IMGUI_API bool DragFloat ( const char * label , float * v , float v_speed = 1 . 0f , float v_min = 0 . 0f , float v_max = 0 . 0f , const char * display_format = " % . 3f " , float power = 1 . 0f ) ; / / If v_max > = v_max we have no bound <nl> + IMGUI_API bool DragInt ( const char * label , int * v , float v_speed = 1 . 0f , int v_min = 0 , int v_max = 0 , const char * display_format = " % . 0f " ) ; / / If v_max > = v_max we have no bound <nl> <nl> / / Widgets : Input <nl> IMGUI_API bool InputText ( const char * label , char * buf , size_t buf_size , ImGuiInputTextFlags flags = 0 , ImGuiTextEditCallback callback = NULL , void * user_data = NULL ) ; <nl> namespace ImGui <nl> IMGUI_API bool IsItemHoveredRect ( ) ; / / was the last item hovered by mouse ? even if another item is active while we are hovering this <nl> IMGUI_API bool IsItemActive ( ) ; / / was the last item active ? ( e . g . button being held , text field being edited - items that don ' t interact will always return false ) <nl> IMGUI_API bool IsAnyItemActive ( ) ; / / <nl> - IMGUI_API ImVec2 GetItemRectMin ( ) ; / / get bounding rect of last item <nl> + IMGUI_API bool IsItemVisible ( ) ; <nl> + IMGUI_API ImVec2 GetItemRectMin ( ) ; / / get bounding rect of last item in screen space <nl> IMGUI_API ImVec2 GetItemRectMax ( ) ; / / " <nl> IMGUI_API ImVec2 GetItemRectSize ( ) ; / / " <nl> IMGUI_API bool IsWindowFocused ( ) ; / / is current window focused ( differentiate child windows from each others ) <nl> IMGUI_API bool IsRootWindowFocused ( ) ; / / is current root window focused <nl> IMGUI_API bool IsRootWindowOrAnyChildFocused ( ) ; / / is current root window or any of its child ( including current window ) focused <nl> - IMGUI_API bool IsClipped ( const ImVec2 & item_size ) ; / / to perform coarse clipping on user ' s side ( as an optimization ) <nl> + IMGUI_API bool IsRectClipped ( const ImVec2 & size ) ; / / test if rectangle of given size starting from cursor pos is out of clipping region . to perform coarse clipping on user ' s side ( as an optimization ) <nl> IMGUI_API bool IsKeyPressed ( int key_index , bool repeat = true ) ; / / key_index into the keys_down [ 512 ] array , imgui doesn ' t know the semantic of each entry <nl> IMGUI_API bool IsMouseClicked ( int button , bool repeat = false ) ; <nl> IMGUI_API bool IsMouseDoubleClicked ( int button ) ; <nl> namespace ImGui <nl> IMGUI_API bool IsPosHoveringAnyWindow ( const ImVec2 & pos ) ; / / is given position hovering any active imgui window <nl> IMGUI_API ImVec2 GetMousePos ( ) ; / / shortcut to ImGui : : GetIO ( ) . MousePos provided by user , to be consistent with other calls <nl> IMGUI_API ImVec2 GetMouseDragDelta ( int button = 0 , float lock_threshold = - 1 . 0f ) ; / / dragging amount since clicking , also see : GetItemActiveDragDelta ( ) . if lock_threshold < - 1 . 0f uses io . MouseDraggingThreshold <nl> + IMGUI_API void ResetMouseDragDelta ( int button = 0 ) ; <nl> IMGUI_API ImGuiMouseCursor GetMouseCursor ( ) ; / / get desired cursor type , reset in ImGui : : NewFrame ( ) , this updated during the frame . valid before Render ( ) . If you use software rendering by setting io . MouseDrawCursor ImGui will render those for you <nl> IMGUI_API void SetMouseCursor ( ImGuiMouseCursor type ) ; / / set desired cursor type <nl> IMGUI_API float GetTime ( ) ; <nl> namespace ImGui <nl> static inline bool GetWindowIsFocused ( ) { return ImGui : : IsWindowFocused ( ) ; } / / OBSOLETE <nl> static inline ImVec2 GetItemBoxMin ( ) { return GetItemRectMin ( ) ; } / / OBSOLETE <nl> static inline ImVec2 GetItemBoxMax ( ) { return GetItemRectMax ( ) ; } / / OBSOLETE <nl> + static inline bool IsClipped ( const ImVec2 & size ) { return IsRectClipped ( size ) ; } / / OBSOLETE <nl> static inline bool IsMouseHoveringBox ( const ImVec2 & rect_min , const ImVec2 & rect_max ) { return IsMouseHoveringRect ( rect_min , rect_max ) ; } / / OBSOLETE <nl> <nl> } / / namespace ImGui <nl> struct ImDrawList <nl> / / 2 . Call GetTexDataAsAlpha8 ( ) or GetTexDataAsRGBA32 ( ) to build and retrieve pixels data . <nl> / / 3 . Upload the pixels data into a texture within your graphics system . <nl> / / 4 . Call SetTexID ( my_tex_id ) ; and pass the pointer / identifier to your texture . This value will be passed back to you during rendering to identify the texture . <nl> - / / 5 . Call ClearPixelsData ( ) to free textures memory on the heap . <nl> + / / 5 . Call ClearTexData ( ) to free textures memory on the heap . <nl> struct ImFontAtlas <nl> { <nl> IMGUI_API ImFontAtlas ( ) ; <nl>
Merge remote - tracking branch ' origin ' into 2015 - 03 - antialiased - primitives
ocornut/imgui
0bb89ccee223b42676ce572d7ad6e5d01a290273
2015-04-14T08:49:04Z
mmm a / src / js / promise . js <nl> ppp b / src / js / promise . js <nl> var GlobalPromise = function Promise ( resolver ) { <nl> <nl> var promise = PromiseInit ( % _NewObject ( GlobalPromise , new . target ) ) ; <nl> var callbacks = CreateResolvingFunctions ( promise ) ; <nl> - <nl> + var debug_is_active = DEBUG_IS_ACTIVE ; <nl> try { <nl> - % DebugPushPromise ( promise , Promise ) ; <nl> + if ( debug_is_active ) % DebugPushPromise ( promise , Promise ) ; <nl> resolver ( callbacks . resolve , callbacks . reject ) ; <nl> } catch ( e ) { <nl> % _Call ( callbacks . reject , UNDEFINED , e ) ; <nl> } finally { <nl> - % DebugPopPromise ( ) ; <nl> + if ( debug_is_active ) % DebugPopPromise ( ) ; <nl> } <nl> <nl> return promise ; <nl> function PromiseDone ( promise , status , value , promiseQueue ) { <nl> } <nl> <nl> function PromiseHandle ( value , handler , deferred ) { <nl> + var debug_is_active = DEBUG_IS_ACTIVE ; <nl> try { <nl> - % DebugPushPromise ( deferred . promise , PromiseHandle ) ; <nl> + if ( debug_is_active ) % DebugPushPromise ( deferred . promise , PromiseHandle ) ; <nl> var result = handler ( value ) ; <nl> deferred . resolve ( result ) ; <nl> } catch ( exception ) { <nl> try { deferred . reject ( exception ) ; } catch ( e ) { } <nl> } finally { <nl> - % DebugPopPromise ( ) ; <nl> + if ( debug_is_active ) % DebugPopPromise ( ) ; <nl> } <nl> } <nl> <nl>
Promises : Make debug calls only when debugging
v8/v8
9eb320ad10a3040d6604e751551095f6681a45b3
2016-05-23T20:13:07Z
mmm a / src / preamble . js <nl> ppp b / src / preamble . js <nl> var STACK_ROOT , STACKTOP , STACK_MAX ; <nl> var STATICTOP ; <nl> <nl> var HAS_TYPED_ARRAYS = false ; <nl> - var TOTAL_MEMORY = 50 * 1024 * 1024 ; <nl> + var TOTAL_MEMORY = Module [ ' TOTAL_MEMORY ' ] | | { { { TOTAL_MEMORY } } } ; <nl> + var FAST_MEMORY = Module [ ' FAST_MEMORY ' ] | | { { { FAST_MEMORY } } } ; <nl> <nl> / / Initialize the runtime ' s memory <nl> # if USE_TYPED_ARRAYS <nl> if ( HAS_TYPED_ARRAYS ) { <nl> } else <nl> # endif <nl> { <nl> - / / Without this optimization , Chrome is slow . Sadly , the constant here needs to be tweaked depending on the code being run . . . <nl> - var FAST_MEMORY = TOTAL_MEMORY / 32 ; <nl> - HEAP = new Array ( FAST_MEMORY ) ; <nl> + / / Make sure that our HEAP is implemented as a flat array . <nl> + HEAP = new Array ( TOTAL_MEMORY ) ; <nl> for ( var i = 0 ; i < FAST_MEMORY ; i + + ) { <nl> HEAP [ i ] = 0 ; / / XXX We do * not * use { { | makeSetValue ( 0 , ' i ' , 0 , ' null ' ) | } } here , since this is done just to optimize runtime speed <nl> } <nl> mmm a / src / settings . js <nl> ppp b / src / settings . js <nl> INVOKE_RUN = 1 ; / / Whether we will call run ( ) . Disable if you embed the generate <nl> / / code in your own , and will call run ( ) yourself at the right time <nl> INIT_STACK = 1 ; / / Whether to initialize memory on the stack to 0 . <nl> INIT_HEAP = 0 ; / / Whether to initialize memory anywhere other than the stack to 0 . <nl> + FAST_MEMORY = 2 * 1024 * 1024 ; / / The amount of memory to initialize to 0 . This ensures it will be <nl> + / / in a flat array . This only matters in non - typed array builds . <nl> + TOTAL_MEMORY = 50 * 1024 * 1024 ; / / The total amount of memory to use . This mainly matters in <nl> + / / typed array builds - accessing memory about this value will <nl> + / / return undefined values and lead to serious problems , and there <nl> + / / is currently no warning about that ! <nl> <nl> / / Code embetterments <nl> OPTIMIZE = 0 ; / / Optimize llvm operations into js commands <nl> mmm a / tests / runner . py <nl> ppp b / tests / runner . py <nl> def build ( self , src , dirname , filename , output_processor = None , main_file = None , a <nl> def do_emscripten ( self , filename , output_processor = None , append_ext = True , extra_args = [ ] ) : <nl> # Run Emscripten <nl> exported_settings = { } <nl> - for setting in [ ' QUANTUM_SIZE ' , ' RELOOP ' , ' OPTIMIZE ' , ' ASSERTIONS ' , ' USE_TYPED_ARRAYS ' , ' SAFE_HEAP ' , ' CHECK_OVERFLOWS ' , ' CORRECT_OVERFLOWS ' , ' CORRECT_SIGNS ' , ' CHECK_SIGNS ' , ' CORRECT_OVERFLOWS_LINES ' , ' CORRECT_SIGNS_LINES ' , ' CORRECT_ROUNDINGS ' , ' CORRECT_ROUNDINGS_LINES ' , ' INVOKE_RUN ' , ' SAFE_HEAP_LINES ' , ' INIT_STACK ' , ' AUTO_OPTIMIZE ' , ' EXPORTED_FUNCTIONS ' , ' EXPORTED_GLOBALS ' , ' BUILD_AS_SHARED_LIB ' , ' INCLUDE_FULL_LIBRARY ' , ' RUNTIME_TYPE_INFO ' , ' DISABLE_EXCEPTIONS ' ] : <nl> + for setting in [ ' QUANTUM_SIZE ' , ' RELOOP ' , ' OPTIMIZE ' , ' ASSERTIONS ' , ' USE_TYPED_ARRAYS ' , ' SAFE_HEAP ' , ' CHECK_OVERFLOWS ' , ' CORRECT_OVERFLOWS ' , ' CORRECT_SIGNS ' , ' CHECK_SIGNS ' , ' CORRECT_OVERFLOWS_LINES ' , ' CORRECT_SIGNS_LINES ' , ' CORRECT_ROUNDINGS ' , ' CORRECT_ROUNDINGS_LINES ' , ' INVOKE_RUN ' , ' SAFE_HEAP_LINES ' , ' INIT_STACK ' , ' AUTO_OPTIMIZE ' , ' EXPORTED_FUNCTIONS ' , ' EXPORTED_GLOBALS ' , ' BUILD_AS_SHARED_LIB ' , ' INCLUDE_FULL_LIBRARY ' , ' RUNTIME_TYPE_INFO ' , ' DISABLE_EXCEPTIONS ' , ' FAST_MEMORY ' ] : <nl> try : <nl> value = eval ( setting ) <nl> exported_settings [ setting ] = value <nl> def test_eliminator ( self ) : <nl> CORRECT_OVERFLOWS_LINES = CORRECT_SIGNS_LINES = CORRECT_ROUNDINGS_LINES = SAFE_HEAP_LINES = [ ] <nl> LLVM_OPTS = 1 <nl> DISABLE_EXCEPTIONS = 1 <nl> + FAST_MEMORY = 10 * 1024 * 1024 <nl> <nl> TEST_REPS = 4 <nl> TOTAL_TESTS = 6 <nl>
make FAST_MEMORY and TOTAL_MEMORY easier to use ; fix slowdown in dlmalloc benchmark
emscripten-core/emscripten
6f3e4af49c10f8a835ecb35abd6f3b6ad44827de
2011-08-30T01:17:37Z
mmm a / R - package / README . md <nl> ppp b / R - package / README . md <nl> install . packages ( ' xgboost ' ) <nl> <nl> # # Examples <nl> <nl> - * Please visit [ demo ] ( https : / / github . com / tqchen / xgboost / blob / master / R - package / demo ) for walk throughe example . <nl> + * Please visit [ walk through example ] ( https : / / github . com / tqchen / xgboost / blob / master / R - package / demo ) . <nl> * See also the [ example scripts ] ( https : / / github . com / tqchen / xgboost / tree / master / demo / kaggle - higgs ) for Kaggle Higgs Challenge , including [ speedtest script ] ( https : / / github . com / tqchen / xgboost / blob / master / demo / kaggle - higgs / speedtest . R ) on this dataset . <nl>
add
dmlc/xgboost
a42bcaf61f57b5634c6319c9ec797d67c8b558db
2014-09-06T18:14:32Z
mmm a / src / ast / ast . h <nl> ppp b / src / ast / ast . h <nl> <nl> # include " src / codegen / label . h " <nl> # include " src / common / globals . h " <nl> # include " src / execution / isolate . h " <nl> - # include " src / execution / off - thread - isolate . h " <nl> # include " src / heap / factory . h " <nl> # include " src / objects / elements - kind . h " <nl> # include " src / objects / function - syntax - kind . h " <nl> class FunctionLiteral final : public Expression { <nl> <nl> / / Empty handle means that the function does not have a shared name ( i . e . <nl> / / the name will be set dynamically after creation of the function closure ) . <nl> - template < typename Isolate > <nl> - MaybeHandleFor < Isolate , String > GetName ( Isolate * isolate ) const { <nl> - return raw_name_ ? raw_name_ - > AllocateFlat ( isolate ) <nl> - : MaybeHandleFor < Isolate , String > ( ) ; <nl> + MaybeHandle < String > GetName ( Isolate * isolate ) const { <nl> + return raw_name_ ? raw_name_ - > AllocateFlat ( isolate ) : MaybeHandle < String > ( ) ; <nl> } <nl> bool has_shared_name ( ) const { return raw_name_ ! = nullptr ; } <nl> const AstConsString * raw_name ( ) const { return raw_name_ ; } <nl> class FunctionLiteral final : public Expression { <nl> } <nl> UNREACHABLE ( ) ; <nl> } <nl> - OffThreadHandle < String > GetInferredName ( OffThreadIsolate * isolate ) const { <nl> - DCHECK ( inferred_name_ . is_null ( ) ) ; <nl> - DCHECK_NOT_NULL ( raw_inferred_name_ ) ; <nl> - return raw_inferred_name_ - > GetString ( isolate ) ; <nl> - } <nl> const AstConsString * raw_inferred_name ( ) { return raw_inferred_name_ ; } <nl> <nl> / / Only one of { set_inferred_name , set_raw_inferred_name } should be called . <nl> mmm a / src / diagnostics / objects - debug . cc <nl> ppp b / src / diagnostics / objects - debug . cc <nl> <nl> # include " src / objects / js - array - inl . h " <nl> # include " src / objects / layout - descriptor . h " <nl> # include " src / objects / objects - inl . h " <nl> - # include " src / roots / roots . h " <nl> # ifdef V8_INTL_SUPPORT <nl> # include " src / objects / js - break - iterator - inl . h " <nl> # include " src / objects / js - collator - inl . h " <nl> void JSFunction : : JSFunctionVerify ( Isolate * isolate ) { <nl> } <nl> <nl> void SharedFunctionInfo : : SharedFunctionInfoVerify ( Isolate * isolate ) { <nl> - / / TODO ( leszeks ) : Add a TorqueGeneratedClassVerifier for OffThreadIsolate . <nl> TorqueGeneratedClassVerifiers : : SharedFunctionInfoVerify ( * this , isolate ) ; <nl> - this - > SharedFunctionInfoVerify ( ReadOnlyRoots ( isolate ) ) ; <nl> - } <nl> - <nl> - void SharedFunctionInfo : : SharedFunctionInfoVerify ( OffThreadIsolate * isolate ) { <nl> - this - > SharedFunctionInfoVerify ( ReadOnlyRoots ( isolate ) ) ; <nl> - } <nl> <nl> - void SharedFunctionInfo : : SharedFunctionInfoVerify ( ReadOnlyRoots roots ) { <nl> Object value = name_or_scope_info ( ) ; <nl> if ( value . IsScopeInfo ( ) ) { <nl> CHECK_LT ( 0 , ScopeInfo : : cast ( value ) . length ( ) ) ; <nl> - CHECK_NE ( value , roots . empty_scope_info ( ) ) ; <nl> + CHECK_NE ( value , ReadOnlyRoots ( isolate ) . empty_scope_info ( ) ) ; <nl> } <nl> <nl> CHECK ( HasWasmExportedFunctionData ( ) | | IsApiFunction ( ) | | <nl> void SharedFunctionInfo : : SharedFunctionInfoVerify ( ReadOnlyRoots roots ) { <nl> HasUncompiledDataWithoutPreparseData ( ) | | HasWasmJSFunctionData ( ) | | <nl> HasWasmCapiFunctionData ( ) ) ; <nl> <nl> - CHECK ( script_or_debug_info ( ) . IsUndefined ( roots ) | | <nl> + CHECK ( script_or_debug_info ( ) . IsUndefined ( isolate ) | | <nl> script_or_debug_info ( ) . IsScript ( ) | | HasDebugInfo ( ) ) ; <nl> <nl> if ( ! is_compiled ( ) ) { <nl> CHECK ( ! HasFeedbackMetadata ( ) ) ; <nl> CHECK ( outer_scope_info ( ) . IsScopeInfo ( ) | | <nl> - outer_scope_info ( ) . IsTheHole ( roots ) ) ; <nl> + outer_scope_info ( ) . IsTheHole ( isolate ) ) ; <nl> } else if ( HasBytecodeArray ( ) & & HasFeedbackMetadata ( ) ) { <nl> CHECK ( feedback_metadata ( ) . IsFeedbackMetadata ( ) ) ; <nl> } <nl> mmm a / src / execution / isolate . h <nl> ppp b / src / execution / isolate . h <nl> class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { <nl> int GetNextScriptId ( ) ; <nl> <nl> # if V8_SFI_HAS_UNIQUE_ID <nl> - int GetNextUniqueSharedFunctionInfoId ( ) { <nl> - int current_id = next_unique_sfi_id_ . load ( std : : memory_order_relaxed ) ; <nl> - int next_id ; <nl> - do { <nl> - if ( current_id > = Smi : : kMaxValue ) { <nl> - next_id = 0 ; <nl> - } else { <nl> - next_id = current_id + 1 ; <nl> - } <nl> - } while ( ! next_unique_sfi_id_ . compare_exchange_weak ( <nl> - current_id , next_id , std : : memory_order_relaxed ) ) ; <nl> - return current_id ; <nl> - } <nl> + int GetNextUniqueSharedFunctionInfoId ( ) { return next_unique_sfi_id_ + + ; } <nl> # endif <nl> <nl> Address promise_hook_address ( ) { <nl> class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { <nl> int next_optimization_id_ = 0 ; <nl> <nl> # if V8_SFI_HAS_UNIQUE_ID <nl> - std : : atomic < int > next_unique_sfi_id_ ; <nl> + int next_unique_sfi_id_ = 0 ; <nl> # endif <nl> <nl> / / Vector of callbacks before a Call starts execution . <nl> mmm a / src / execution / off - thread - isolate . cc <nl> ppp b / src / execution / off - thread - isolate . cc <nl> OffThreadIsolate : : ~ OffThreadIsolate ( ) { delete logger_ ; } <nl> <nl> int OffThreadIsolate : : GetNextScriptId ( ) { return isolate_ - > GetNextScriptId ( ) ; } <nl> <nl> - # if V8_SFI_HAS_UNIQUE_ID <nl> - int OffThreadIsolate : : GetNextUniqueSharedFunctionInfoId ( ) { <nl> - return isolate_ - > GetNextUniqueSharedFunctionInfoId ( ) ; <nl> - } <nl> - # endif / / V8_SFI_HAS_UNIQUE_ID <nl> - <nl> bool OffThreadIsolate : : NeedsSourcePositionsForProfiling ( ) { <nl> / / TODO ( leszeks ) : Figure out if it makes sense to check this asynchronously . <nl> return isolate_ - > NeedsSourcePositionsForProfiling ( ) ; <nl> mmm a / src / execution / off - thread - isolate . h <nl> ppp b / src / execution / off - thread - isolate . h <nl> class V8_EXPORT_PRIVATE OffThreadIsolate final <nl> } <nl> <nl> int GetNextScriptId ( ) ; <nl> - # if V8_SFI_HAS_UNIQUE_ID <nl> - int GetNextUniqueSharedFunctionInfoId ( ) ; <nl> - # endif / / V8_SFI_HAS_UNIQUE_ID <nl> <nl> bool NeedsSourcePositionsForProfiling ( ) ; <nl> bool is_collecting_type_profile ( ) ; <nl> mmm a / src / handles / handles . h <nl> ppp b / src / handles / handles . h <nl> class OffThreadHandle { <nl> } <nl> <nl> private : <nl> - Address address_ = 0 ; <nl> + Address address_ ; <nl> } ; <nl> <nl> / / A helper class which wraps an normal or off - thread handle , and returns one <nl> mmm a / src / heap / factory - base . cc <nl> ppp b / src / heap / factory - base . cc <nl> HandleFor < Impl , FixedArrayBase > FactoryBase < Impl > : : NewFixedDoubleArray ( <nl> return array ; <nl> } <nl> <nl> - template < typename Impl > <nl> - HandleFor < Impl , WeakFixedArray > FactoryBase < Impl > : : NewWeakFixedArrayWithMap ( <nl> - Map map , int length , AllocationType allocation ) { <nl> - / / Zero - length case must be handled outside . <nl> - DCHECK_LT ( 0 , length ) ; <nl> - DCHECK ( ReadOnlyHeap : : Contains ( map ) ) ; <nl> - <nl> - HeapObject result = <nl> - AllocateRawArray ( WeakFixedArray : : SizeFor ( length ) , allocation ) ; <nl> - result . set_map_after_allocation ( map , SKIP_WRITE_BARRIER ) ; <nl> - <nl> - HandleFor < Impl , WeakFixedArray > array = <nl> - handle ( WeakFixedArray : : cast ( result ) , isolate ( ) ) ; <nl> - array - > set_length ( length ) ; <nl> - MemsetTagged ( ObjectSlot ( array - > data_start ( ) ) , <nl> - read_only_roots ( ) . undefined_value ( ) , length ) ; <nl> - <nl> - return array ; <nl> - } <nl> - <nl> - template < typename Impl > <nl> - HandleFor < Impl , WeakFixedArray > FactoryBase < Impl > : : NewWeakFixedArray ( <nl> - int length , AllocationType allocation ) { <nl> - DCHECK_LE ( 0 , length ) ; <nl> - if ( length = = 0 ) return impl ( ) - > empty_weak_fixed_array ( ) ; <nl> - return NewWeakFixedArrayWithMap ( read_only_roots ( ) . weak_fixed_array_map ( ) , <nl> - length , allocation ) ; <nl> - } <nl> - <nl> template < typename Impl > <nl> HandleFor < Impl , Script > FactoryBase < Impl > : : NewScript ( <nl> HandleFor < Impl , String > source ) { <nl> HandleFor < Impl , Script > FactoryBase < Impl > : : NewScriptWithId ( <nl> return script ; <nl> } <nl> <nl> - template < typename Impl > <nl> - HandleFor < Impl , SharedFunctionInfo > <nl> - FactoryBase < Impl > : : NewSharedFunctionInfoForLiteral ( <nl> - FunctionLiteral * literal , HandleFor < Impl , Script > script , <nl> - bool is_toplevel ) { <nl> - FunctionKind kind = literal - > kind ( ) ; <nl> - HandleFor < Impl , SharedFunctionInfo > shared = NewSharedFunctionInfo ( <nl> - literal - > GetName ( isolate ( ) ) , MaybeHandleFor < Impl , Code > ( ) , <nl> - Builtins : : kCompileLazy , kind ) ; <nl> - SharedFunctionInfo : : InitFromFunctionLiteral ( isolate ( ) , shared , literal , <nl> - is_toplevel ) ; <nl> - shared - > SetScript ( read_only_roots ( ) , * script , literal - > function_literal_id ( ) , <nl> - false ) ; <nl> - return shared ; <nl> - } <nl> - <nl> - template < typename Impl > <nl> - HandleFor < Impl , PreparseData > FactoryBase < Impl > : : NewPreparseData ( <nl> - int data_length , int children_length ) { <nl> - int size = PreparseData : : SizeFor ( data_length , children_length ) ; <nl> - HandleFor < Impl , PreparseData > result = handle ( <nl> - PreparseData : : cast ( AllocateRawWithImmortalMap ( <nl> - size , AllocationType : : kOld , read_only_roots ( ) . preparse_data_map ( ) ) ) , <nl> - isolate ( ) ) ; <nl> - result - > set_data_length ( data_length ) ; <nl> - result - > set_children_length ( children_length ) ; <nl> - MemsetTagged ( result - > inner_data_start ( ) , read_only_roots ( ) . null_value ( ) , <nl> - children_length ) ; <nl> - result - > clear_padding ( ) ; <nl> - return result ; <nl> - } <nl> - <nl> - template < typename Impl > <nl> - HandleFor < Impl , UncompiledDataWithoutPreparseData > <nl> - FactoryBase < Impl > : : NewUncompiledDataWithoutPreparseData ( <nl> - HandleFor < Impl , String > inferred_name , int32_t start_position , <nl> - int32_t end_position ) { <nl> - HandleFor < Impl , UncompiledDataWithoutPreparseData > result = handle ( <nl> - UncompiledDataWithoutPreparseData : : cast ( NewWithImmortalMap ( <nl> - impl ( ) - > read_only_roots ( ) . uncompiled_data_without_preparse_data_map ( ) , <nl> - AllocationType : : kOld ) ) , <nl> - isolate ( ) ) ; <nl> - <nl> - result - > Init ( impl ( ) , * inferred_name , start_position , end_position ) ; <nl> - return result ; <nl> - } <nl> - <nl> - template < typename Impl > <nl> - HandleFor < Impl , UncompiledDataWithPreparseData > <nl> - FactoryBase < Impl > : : NewUncompiledDataWithPreparseData ( <nl> - HandleFor < Impl , String > inferred_name , int32_t start_position , <nl> - int32_t end_position , HandleFor < Impl , PreparseData > preparse_data ) { <nl> - HandleFor < Impl , UncompiledDataWithPreparseData > result = handle ( <nl> - UncompiledDataWithPreparseData : : cast ( NewWithImmortalMap ( <nl> - impl ( ) - > read_only_roots ( ) . uncompiled_data_with_preparse_data_map ( ) , <nl> - AllocationType : : kOld ) ) , <nl> - isolate ( ) ) ; <nl> - <nl> - result - > Init ( impl ( ) , * inferred_name , start_position , end_position , <nl> - * preparse_data ) ; <nl> - <nl> - return result ; <nl> - } <nl> - <nl> - template < typename Impl > <nl> - HandleFor < Impl , SharedFunctionInfo > FactoryBase < Impl > : : NewSharedFunctionInfo ( <nl> - MaybeHandleFor < Impl , String > maybe_name , <nl> - MaybeHandleFor < Impl , HeapObject > maybe_function_data , <nl> - int maybe_builtin_index , FunctionKind kind ) { <nl> - HandleFor < Impl , SharedFunctionInfo > shared = NewSharedFunctionInfo ( ) ; <nl> - <nl> - / / Function names are assumed to be flat elsewhere . <nl> - HandleFor < Impl , String > shared_name ; <nl> - bool has_shared_name = maybe_name . ToHandle ( & shared_name ) ; <nl> - if ( has_shared_name ) { <nl> - DCHECK ( shared_name - > IsFlat ( ) ) ; <nl> - shared - > set_name_or_scope_info ( * shared_name ) ; <nl> - } else { <nl> - DCHECK_EQ ( shared - > name_or_scope_info ( ) , <nl> - SharedFunctionInfo : : kNoSharedNameSentinel ) ; <nl> - } <nl> - <nl> - HandleFor < Impl , HeapObject > function_data ; <nl> - if ( maybe_function_data . ToHandle ( & function_data ) ) { <nl> - / / If we pass function_data then we shouldn ' t pass a builtin index , and <nl> - / / the function_data should not be code with a builtin . <nl> - DCHECK ( ! Builtins : : IsBuiltinId ( maybe_builtin_index ) ) ; <nl> - DCHECK_IMPLIES ( function_data - > IsCode ( ) , <nl> - ! Code : : cast ( * function_data ) . is_builtin ( ) ) ; <nl> - shared - > set_function_data ( * function_data ) ; <nl> - } else if ( Builtins : : IsBuiltinId ( maybe_builtin_index ) ) { <nl> - shared - > set_builtin_id ( maybe_builtin_index ) ; <nl> - } else { <nl> - shared - > set_builtin_id ( Builtins : : kIllegal ) ; <nl> - } <nl> - <nl> - shared - > CalculateConstructAsBuiltin ( ) ; <nl> - shared - > set_kind ( kind ) ; <nl> - <nl> - # ifdef VERIFY_HEAP <nl> - shared - > SharedFunctionInfoVerify ( isolate ( ) ) ; <nl> - # endif / / VERIFY_HEAP <nl> - return shared ; <nl> - } <nl> - <nl> template < typename Impl > <nl> HandleFor < Impl , ObjectBoilerplateDescription > <nl> FactoryBase < Impl > : : NewObjectBoilerplateDescription ( int boilerplate , <nl> FactoryBase < Impl > : : NewSourceTextModuleInfo ( ) { <nl> AllocationType : : kOld ) ) ; <nl> } <nl> <nl> - template < typename Impl > <nl> - HandleFor < Impl , SharedFunctionInfo > FactoryBase < Impl > : : NewSharedFunctionInfo ( ) { <nl> - Map map = read_only_roots ( ) . shared_function_info_map ( ) ; <nl> - <nl> - HandleFor < Impl , SharedFunctionInfo > shared = handle ( <nl> - SharedFunctionInfo : : cast ( NewWithImmortalMap ( map , AllocationType : : kOld ) ) , <nl> - isolate ( ) ) ; <nl> - int unique_id = - 1 ; <nl> - # if V8_SFI_HAS_UNIQUE_ID <nl> - unique_id = isolate ( ) - > GetNextUniqueSharedFunctionInfoId ( ) ; <nl> - # endif / / V8_SFI_HAS_UNIQUE_ID <nl> - <nl> - shared - > Init ( read_only_roots ( ) , unique_id ) ; <nl> - <nl> - # ifdef VERIFY_HEAP <nl> - shared - > SharedFunctionInfoVerify ( isolate ( ) ) ; <nl> - # endif / / VERIFY_HEAP <nl> - return shared ; <nl> - } <nl> - <nl> template < typename Impl > <nl> HandleFor < Impl , SeqOneByteString > <nl> FactoryBase < Impl > : : AllocateRawOneByteInternalizedString ( int length , <nl> mmm a / src / heap / factory - base . h <nl> ppp b / src / heap / factory - base . h <nl> <nl> # include " src / base / export - template . h " <nl> # include " src / common / globals . h " <nl> # include " src / handles / handle - for . h " <nl> - # include " src / objects / function - kind . h " <nl> # include " src / objects / instance - type . h " <nl> # include " src / roots / roots . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> <nl> class HeapObject ; <nl> - class SharedFunctionInfo ; <nl> - class FunctionLiteral ; <nl> class SeqOneByteString ; <nl> class SeqTwoByteString ; <nl> class FreshlyAllocatedBigInt ; <nl> class ObjectBoilerplateDescription ; <nl> class ArrayBoilerplateDescription ; <nl> class TemplateObjectDescription ; <nl> class SourceTextModuleInfo ; <nl> - class PreparseData ; <nl> - class UncompiledDataWithoutPreparseData ; <nl> - class UncompiledDataWithPreparseData ; <nl> <nl> template < typename Impl > <nl> class EXPORT_TEMPLATE_DECLARE ( V8_EXPORT_PRIVATE ) FactoryBase { <nl> class EXPORT_TEMPLATE_DECLARE ( V8_EXPORT_PRIVATE ) FactoryBase { <nl> HandleFor < Impl , FixedArrayBase > NewFixedDoubleArray ( <nl> int length , AllocationType allocation = AllocationType : : kYoung ) ; <nl> <nl> - / / Allocates a weak fixed array - like object with given map and initialized <nl> - / / with undefined values . <nl> - HandleFor < Impl , WeakFixedArray > NewWeakFixedArrayWithMap ( <nl> - Map map , int length , AllocationType allocation = AllocationType : : kYoung ) ; <nl> - <nl> - / / Allocates a fixed array which may contain in - place weak references . The <nl> - / / array is initialized with undefined values <nl> - HandleFor < Impl , WeakFixedArray > NewWeakFixedArray ( <nl> - int length , AllocationType allocation = AllocationType : : kYoung ) ; <nl> - <nl> / / Allocates a fixed array for name - value pairs of boilerplate properties and <nl> / / calculates the number of properties we need to store in the backing store . <nl> HandleFor < Impl , ObjectBoilerplateDescription > NewObjectBoilerplateDescription ( <nl> class EXPORT_TEMPLATE_DECLARE ( V8_EXPORT_PRIVATE ) FactoryBase { <nl> HandleFor < Impl , Script > NewScriptWithId ( HandleFor < Impl , String > source , <nl> int script_id ) ; <nl> <nl> - HandleFor < Impl , SharedFunctionInfo > NewSharedFunctionInfoForLiteral ( <nl> - FunctionLiteral * literal , HandleFor < Impl , Script > script , <nl> - bool is_toplevel ) ; <nl> - <nl> - HandleFor < Impl , PreparseData > NewPreparseData ( int data_length , <nl> - int children_length ) ; <nl> - <nl> - HandleFor < Impl , UncompiledDataWithoutPreparseData > <nl> - NewUncompiledDataWithoutPreparseData ( HandleFor < Impl , String > inferred_name , <nl> - int32_t start_position , <nl> - int32_t end_position ) ; <nl> - <nl> - HandleFor < Impl , UncompiledDataWithPreparseData > <nl> - NewUncompiledDataWithPreparseData ( HandleFor < Impl , String > inferred_name , <nl> - int32_t start_position , <nl> - int32_t end_position , <nl> - HandleFor < Impl , PreparseData > ) ; <nl> - <nl> HandleFor < Impl , SeqOneByteString > NewOneByteInternalizedString ( <nl> const Vector < const uint8_t > & str , uint32_t hash_field ) ; <nl> HandleFor < Impl , SeqTwoByteString > NewTwoByteInternalizedString ( <nl> class EXPORT_TEMPLATE_DECLARE ( V8_EXPORT_PRIVATE ) FactoryBase { <nl> HandleFor < Impl , FixedArray > NewFixedArrayWithFiller ( <nl> Map map , int length , Oddball filler , AllocationType allocation ) ; <nl> <nl> - HandleFor < Impl , SharedFunctionInfo > NewSharedFunctionInfo ( ) ; <nl> - HandleFor < Impl , SharedFunctionInfo > NewSharedFunctionInfo ( <nl> - MaybeHandleFor < Impl , String > maybe_name , <nl> - MaybeHandleFor < Impl , HeapObject > maybe_function_data , <nl> - int maybe_builtin_index , FunctionKind kind = kNormalFunction ) ; <nl> - <nl> private : <nl> Impl * impl ( ) { return static_cast < Impl * > ( this ) ; } <nl> auto isolate ( ) { return impl ( ) - > isolate ( ) ; } <nl> mmm a / src / heap / factory . cc <nl> ppp b / src / heap / factory . cc <nl> <nl> # include < utility > / / For move <nl> <nl> # include " src / ast / ast - source - ranges . h " <nl> + # include " src / ast / ast . h " <nl> # include " src / base / bits . h " <nl> # include " src / builtins / accessors . h " <nl> # include " src / builtins / constants - table - builder . h " <nl> Handle < FixedArray > Factory : : NewFixedArrayWithMapRootIndex ( <nl> length , allocation ) ; <nl> } <nl> <nl> + template < typename T > <nl> + Handle < T > Factory : : NewWeakFixedArrayWithMap ( Map map , int length , <nl> + AllocationType allocation ) { <nl> + static_assert ( std : : is_base_of < WeakFixedArray , T > : : value , <nl> + " T must be a descendant of WeakFixedArray " ) ; <nl> + <nl> + / / Zero - length case must be handled outside . <nl> + DCHECK_LT ( 0 , length ) ; <nl> + <nl> + HeapObject result = <nl> + AllocateRawArray ( WeakFixedArray : : SizeFor ( length ) , AllocationType : : kOld ) ; <nl> + result . set_map_after_allocation ( map , SKIP_WRITE_BARRIER ) ; <nl> + <nl> + Handle < WeakFixedArray > array ( WeakFixedArray : : cast ( result ) , isolate ( ) ) ; <nl> + array - > set_length ( length ) ; <nl> + MemsetTagged ( ObjectSlot ( array - > data_start ( ) ) , * undefined_value ( ) , length ) ; <nl> + <nl> + return Handle < T > : : cast ( array ) ; <nl> + } <nl> + <nl> + Handle < WeakFixedArray > Factory : : NewWeakFixedArray ( int length , <nl> + AllocationType allocation ) { <nl> + DCHECK_LE ( 0 , length ) ; <nl> + if ( length = = 0 ) return empty_weak_fixed_array ( ) ; <nl> + HeapObject result = <nl> + AllocateRawArray ( WeakFixedArray : : SizeFor ( length ) , allocation ) ; <nl> + result . set_map_after_allocation ( read_only_roots ( ) . weak_fixed_array_map ( ) , <nl> + SKIP_WRITE_BARRIER ) ; <nl> + Handle < WeakFixedArray > array ( WeakFixedArray : : cast ( result ) , isolate ( ) ) ; <nl> + array - > set_length ( length ) ; <nl> + MemsetTagged ( ObjectSlot ( array - > data_start ( ) ) , * undefined_value ( ) , length ) ; <nl> + return array ; <nl> + } <nl> + <nl> MaybeHandle < FixedArray > Factory : : TryNewFixedArray ( <nl> int length , AllocationType allocation_type ) { <nl> DCHECK_LE ( 0 , length ) ; <nl> Handle < DescriptorArray > Factory : : NewDescriptorArray ( int number_of_descriptors , <nl> Handle < TransitionArray > Factory : : NewTransitionArray ( int number_of_transitions , <nl> int slack ) { <nl> int capacity = TransitionArray : : LengthFor ( number_of_transitions + slack ) ; <nl> - Handle < TransitionArray > array = Handle < TransitionArray > : : cast ( <nl> - NewWeakFixedArrayWithMap ( read_only_roots ( ) . transition_array_map ( ) , <nl> - capacity , AllocationType : : kOld ) ) ; <nl> + Handle < TransitionArray > array = NewWeakFixedArrayWithMap < TransitionArray > ( <nl> + read_only_roots ( ) . transition_array_map ( ) , capacity , AllocationType : : kOld ) ; <nl> / / Transition arrays are AllocationType : : kOld . When black allocation is on we <nl> / / have to add the transition array to the list of <nl> / / encountered_transition_arrays . <nl> Handle < JSFunction > Factory : : NewFunctionFromSharedFunctionInfo ( <nl> return result ; <nl> } <nl> <nl> + Handle < PreparseData > Factory : : NewPreparseData ( int data_length , <nl> + int children_length ) { <nl> + int size = PreparseData : : SizeFor ( data_length , children_length ) ; <nl> + Handle < PreparseData > result ( <nl> + PreparseData : : cast ( AllocateRawWithImmortalMap ( size , AllocationType : : kOld , <nl> + * preparse_data_map ( ) ) ) , <nl> + isolate ( ) ) ; <nl> + result - > set_data_length ( data_length ) ; <nl> + result - > set_children_length ( children_length ) ; <nl> + MemsetTagged ( result - > inner_data_start ( ) , * null_value ( ) , children_length ) ; <nl> + result - > clear_padding ( ) ; <nl> + return result ; <nl> + } <nl> + <nl> + Handle < UncompiledDataWithoutPreparseData > <nl> + Factory : : NewUncompiledDataWithoutPreparseData ( Handle < String > inferred_name , <nl> + int32_t start_position , <nl> + int32_t end_position ) { <nl> + Handle < UncompiledDataWithoutPreparseData > result ( <nl> + UncompiledDataWithoutPreparseData : : cast ( New ( <nl> + uncompiled_data_without_preparse_data_map ( ) , AllocationType : : kOld ) ) , <nl> + isolate ( ) ) ; <nl> + <nl> + result - > Init ( * inferred_name , start_position , end_position ) ; <nl> + return result ; <nl> + } <nl> + <nl> + Handle < UncompiledDataWithPreparseData > <nl> + Factory : : NewUncompiledDataWithPreparseData ( Handle < String > inferred_name , <nl> + int32_t start_position , <nl> + int32_t end_position , <nl> + Handle < PreparseData > preparse_data ) { <nl> + Handle < UncompiledDataWithPreparseData > result ( <nl> + UncompiledDataWithPreparseData : : cast ( <nl> + New ( uncompiled_data_with_preparse_data_map ( ) , AllocationType : : kOld ) ) , <nl> + isolate ( ) ) ; <nl> + <nl> + result - > Init ( * inferred_name , start_position , end_position , * preparse_data ) ; <nl> + <nl> + return result ; <nl> + } <nl> + <nl> Handle < JSObject > Factory : : NewExternal ( void * value ) { <nl> Handle < Foreign > foreign = NewForeign ( reinterpret_cast < Address > ( value ) ) ; <nl> Handle < JSObject > external = NewJSObjectFromMap ( external_map ( ) ) ; <nl> void Factory : : ReinitializeJSGlobalProxy ( Handle < JSGlobalProxy > object , <nl> InitializeJSObjectFromMap ( object , raw_properties_or_hash , map ) ; <nl> } <nl> <nl> + Handle < SharedFunctionInfo > Factory : : NewSharedFunctionInfoForLiteral ( <nl> + FunctionLiteral * literal , Handle < Script > script , bool is_toplevel ) { <nl> + FunctionKind kind = literal - > kind ( ) ; <nl> + Handle < SharedFunctionInfo > shared = NewSharedFunctionInfoForBuiltin ( <nl> + literal - > GetName ( isolate ( ) ) , Builtins : : kCompileLazy , kind ) ; <nl> + SharedFunctionInfo : : InitFromFunctionLiteral ( isolate ( ) , shared , literal , <nl> + is_toplevel ) ; <nl> + shared - > SetScript ( ReadOnlyRoots ( isolate ( ) ) , * script , <nl> + literal - > function_literal_id ( ) , false ) ; <nl> + return shared ; <nl> + } <nl> + <nl> Handle < JSMessageObject > Factory : : NewJSMessageObject ( <nl> MessageTemplate message , Handle < Object > argument , int start_position , <nl> int end_position , Handle < SharedFunctionInfo > shared_info , <nl> Handle < SharedFunctionInfo > Factory : : NewSharedFunctionInfoForBuiltin ( <nl> return shared ; <nl> } <nl> <nl> + Handle < SharedFunctionInfo > Factory : : NewSharedFunctionInfo ( <nl> + MaybeHandle < String > maybe_name , MaybeHandle < HeapObject > maybe_function_data , <nl> + int maybe_builtin_index , FunctionKind kind ) { <nl> + Handle < SharedFunctionInfo > shared = NewSharedFunctionInfo ( ) ; <nl> + <nl> + / / Function names are assumed to be flat elsewhere . Must flatten before <nl> + / / allocating SharedFunctionInfo to avoid GC seeing the uninitialized SFI . <nl> + Handle < String > shared_name ; <nl> + bool has_shared_name = maybe_name . ToHandle ( & shared_name ) ; <nl> + if ( has_shared_name ) { <nl> + DCHECK ( shared_name - > IsFlat ( ) ) ; <nl> + shared - > set_name_or_scope_info ( * shared_name ) ; <nl> + } else { <nl> + DCHECK_EQ ( shared - > name_or_scope_info ( ) , <nl> + SharedFunctionInfo : : kNoSharedNameSentinel ) ; <nl> + } <nl> + <nl> + Handle < HeapObject > function_data ; <nl> + if ( maybe_function_data . ToHandle ( & function_data ) ) { <nl> + / / If we pass function_data then we shouldn ' t pass a builtin index , and <nl> + / / the function_data should not be code with a builtin . <nl> + DCHECK ( ! Builtins : : IsBuiltinId ( maybe_builtin_index ) ) ; <nl> + DCHECK_IMPLIES ( function_data - > IsCode ( ) , <nl> + ! Code : : cast ( * function_data ) . is_builtin ( ) ) ; <nl> + shared - > set_function_data ( * function_data ) ; <nl> + } else if ( Builtins : : IsBuiltinId ( maybe_builtin_index ) ) { <nl> + shared - > set_builtin_id ( maybe_builtin_index ) ; <nl> + } else { <nl> + shared - > set_builtin_id ( Builtins : : kIllegal ) ; <nl> + } <nl> + <nl> + shared - > CalculateConstructAsBuiltin ( ) ; <nl> + shared - > set_kind ( kind ) ; <nl> + <nl> + # ifdef VERIFY_HEAP <nl> + shared - > SharedFunctionInfoVerify ( isolate ( ) ) ; <nl> + # endif / / VERIFY_HEAP <nl> + return shared ; <nl> + } <nl> + <nl> + Handle < SharedFunctionInfo > Factory : : NewSharedFunctionInfo ( ) { <nl> + Handle < Map > map = shared_function_info_map ( ) ; <nl> + <nl> + Handle < SharedFunctionInfo > shared ( <nl> + SharedFunctionInfo : : cast ( New ( map , AllocationType : : kOld ) ) , isolate ( ) ) ; <nl> + int unique_id = - 1 ; <nl> + # if V8_SFI_HAS_UNIQUE_ID <nl> + unique_id = isolate ( ) - > GetNextUniqueSharedFunctionInfoId ( ) ; <nl> + # endif / / V8_SFI_HAS_UNIQUE_ID <nl> + <nl> + shared - > Init ( ReadOnlyRoots ( isolate ( ) ) , unique_id ) ; <nl> + <nl> + # ifdef VERIFY_HEAP <nl> + shared - > SharedFunctionInfoVerify ( isolate ( ) ) ; <nl> + # endif / / VERIFY_HEAP <nl> + return shared ; <nl> + } <nl> + <nl> namespace { <nl> inline int NumberToStringCacheHash ( Handle < FixedArray > cache , Smi number ) { <nl> int mask = ( cache - > length ( ) > > 1 ) - 1 ; <nl> mmm a / src / heap / factory . h <nl> ppp b / src / heap / factory . h <nl> <nl> # include " src / heap / heap . h " <nl> # include " src / objects / code . h " <nl> # include " src / objects / dictionary . h " <nl> + # include " src / objects / function - kind . h " <nl> # include " src / objects / js - array . h " <nl> # include " src / objects / js - regexp . h " <nl> # include " src / objects / string . h " <nl> class JSWeakMap ; <nl> class LoadHandler ; <nl> class NativeContext ; <nl> class NewFunctionArgs ; <nl> + class PreparseData ; <nl> class PromiseResolveThenableJobTask ; <nl> class RegExpMatchInfo ; <nl> class ScriptContextTable ; <nl> class StackTraceFrame ; <nl> class StoreHandler ; <nl> class SyntheticModule ; <nl> class TemplateObjectDescription ; <nl> + class UncompiledDataWithoutPreparseData ; <nl> + class UncompiledDataWithPreparseData ; <nl> class WasmCapiFunctionData ; <nl> class WasmExportedFunctionData ; <nl> class WasmJSFunctionData ; <nl> class V8_EXPORT_PRIVATE Factory : public FactoryBase < Factory > { <nl> RootIndex map_root_index , int length , <nl> AllocationType allocation = AllocationType : : kYoung ) ; <nl> <nl> + / / Allocates a weak fixed array - like object with given map and initialized <nl> + / / with undefined values . <nl> + template < typename T = WeakFixedArray > <nl> + Handle < T > NewWeakFixedArrayWithMap ( <nl> + Map map , int length , AllocationType allocation = AllocationType : : kYoung ) ; <nl> + <nl> + / / Allocates a fixed array which may contain in - place weak references . The <nl> + / / array is initialized with undefined values <nl> + Handle < WeakFixedArray > NewWeakFixedArray ( <nl> + int length , AllocationType allocation = AllocationType : : kYoung ) ; <nl> + <nl> / / Allocates a property array initialized with undefined values . <nl> Handle < PropertyArray > NewPropertyArray ( int length ) ; <nl> / / Tries allocating a fixed array initialized with undefined values . <nl> class V8_EXPORT_PRIVATE Factory : public FactoryBase < Factory > { <nl> Handle < Map > map , Handle < SharedFunctionInfo > info , Handle < Context > context , <nl> AllocationType allocation = AllocationType : : kOld ) ; <nl> <nl> + Handle < PreparseData > NewPreparseData ( int data_length , int children_length ) ; <nl> + <nl> + Handle < UncompiledDataWithoutPreparseData > <nl> + NewUncompiledDataWithoutPreparseData ( Handle < String > inferred_name , <nl> + int32_t start_position , <nl> + int32_t end_position ) ; <nl> + <nl> + Handle < UncompiledDataWithPreparseData > NewUncompiledDataWithPreparseData ( <nl> + Handle < String > inferred_name , int32_t start_position , <nl> + int32_t end_position , Handle < PreparseData > ) ; <nl> + <nl> / / Create an External object for V8 ' s external API . <nl> Handle < JSObject > NewExternal ( void * value ) ; <nl> <nl> class V8_EXPORT_PRIVATE Factory : public FactoryBase < Factory > { <nl> MaybeHandle < String > name , int builtin_index , <nl> FunctionKind kind = kNormalFunction ) ; <nl> <nl> + Handle < SharedFunctionInfo > NewSharedFunctionInfoForLiteral ( <nl> + FunctionLiteral * literal , Handle < Script > script , bool is_toplevel ) ; <nl> + <nl> static bool IsFunctionModeWithPrototype ( FunctionMode function_mode ) { <nl> return ( function_mode & kWithPrototypeBits ) ! = 0 ; <nl> } <nl> class V8_EXPORT_PRIVATE Factory : public FactoryBase < Factory > { <nl> ElementsKind elements_kind , int capacity , <nl> ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS ) ; <nl> <nl> + Handle < SharedFunctionInfo > NewSharedFunctionInfo ( ) ; <nl> + Handle < SharedFunctionInfo > NewSharedFunctionInfo ( <nl> + MaybeHandle < String > name , MaybeHandle < HeapObject > maybe_function_data , <nl> + int maybe_builtin_index , FunctionKind kind = kNormalFunction ) ; <nl> + <nl> void InitializeAllocationMemento ( AllocationMemento memento , <nl> AllocationSite allocation_site ) ; <nl> <nl> mmm a / src / heap / mark - compact . cc <nl> ppp b / src / heap / mark - compact . cc <nl> void MarkCompactCollector : : FlushBytecodeFromSFI ( <nl> <nl> / / Initialize the uncompiled data . <nl> UncompiledData uncompiled_data = UncompiledData : : cast ( compiled_data ) ; <nl> - uncompiled_data . InitAfterBytecodeFlush ( <nl> + uncompiled_data . Init ( <nl> inferred_name , start_position , end_position , <nl> [ ] ( HeapObject object , ObjectSlot slot , HeapObject target ) { <nl> RecordSlot ( object , slot , target ) ; <nl> mmm a / src / heap / off - thread - factory . cc <nl> ppp b / src / heap / off - thread - factory . cc <nl> <nl> # include " src / objects / heap - object . h " <nl> # include " src / objects / map - inl . h " <nl> # include " src / objects / objects - body - descriptors - inl . h " <nl> - # include " src / objects / shared - function - info . h " <nl> # include " src / objects / string . h " <nl> # include " src / objects / visitors . h " <nl> # include " src / roots / roots - inl . h " <nl> mmm a / src / heap / off - thread - factory . h <nl> ppp b / src / heap / off - thread - factory . h <nl> <nl> # include " src / objects / heap - object . h " <nl> # include " src / objects / map . h " <nl> # include " src / objects / objects . h " <nl> - # include " src / objects / shared - function - info . h " <nl> # include " src / roots / roots . h " <nl> <nl> namespace v8 { <nl> mmm a / src / objects / free - space - inl . h <nl> ppp b / src / objects / free - space - inl . h <nl> void FreeSpace : : set_next ( FreeSpace next ) { <nl> } <nl> <nl> FreeSpace FreeSpace : : cast ( HeapObject o ) { <nl> - SLOW_DCHECK ( ( ! Heap : : InOffThreadSpace ( o ) & & <nl> - ! GetHeapFromWritableObject ( o ) - > deserialization_complete ( ) ) | | <nl> + SLOW_DCHECK ( ! GetHeapFromWritableObject ( o ) - > deserialization_complete ( ) | | <nl> o . IsFreeSpace ( ) ) ; <nl> return bit_cast < FreeSpace > ( o ) ; <nl> } <nl> mmm a / src / objects / objects . cc <nl> ppp b / src / objects / objects . cc <nl> <nl> # include " src / execution / frames - inl . h " <nl> # include " src / execution / isolate - inl . h " <nl> # include " src / execution / microtask - queue . h " <nl> - # include " src / execution / off - thread - isolate . h " <nl> # include " src / execution / protectors - inl . h " <nl> # include " src / heap / factory - inl . h " <nl> # include " src / heap / heap - inl . h " <nl> void SharedFunctionInfo : : DisableOptimization ( BailoutReason reason ) { <nl> } <nl> <nl> / / static <nl> - template < typename Isolate > <nl> void SharedFunctionInfo : : InitFromFunctionLiteral ( <nl> - Isolate * isolate , HandleFor < Isolate , SharedFunctionInfo > shared_info , <nl> + Isolate * isolate , Handle < SharedFunctionInfo > shared_info , <nl> FunctionLiteral * lit , bool is_toplevel ) { <nl> DCHECK ( ! shared_info - > name_or_scope_info ( ) . IsScopeInfo ( ) ) ; <nl> <nl> void SharedFunctionInfo : : InitFromFunctionLiteral ( <nl> shared_info - > set_is_safe_to_skip_arguments_adaptor ( false ) ; <nl> shared_info - > UpdateExpectedNofPropertiesFromEstimate ( lit ) ; <nl> <nl> - HandleFor < Isolate , UncompiledData > data ; <nl> + Handle < UncompiledData > data ; <nl> <nl> ProducedPreparseData * scope_data = lit - > produced_preparse_data ( ) ; <nl> if ( scope_data ! = nullptr ) { <nl> - HandleFor < Isolate , PreparseData > preparse_data = <nl> - scope_data - > Serialize ( isolate ) ; <nl> + Handle < PreparseData > preparse_data = <nl> + scope_data - > Serialize ( shared_info - > GetIsolate ( ) ) ; <nl> <nl> data = isolate - > factory ( ) - > NewUncompiledDataWithPreparseData ( <nl> lit - > GetInferredName ( isolate ) , lit - > start_position ( ) , <nl> void SharedFunctionInfo : : InitFromFunctionLiteral ( <nl> shared_info - > set_uncompiled_data ( * data ) ; <nl> } <nl> <nl> - template EXPORT_TEMPLATE_DEFINE ( V8_EXPORT_PRIVATE ) void SharedFunctionInfo : : <nl> - InitFromFunctionLiteral < Isolate > ( Isolate * isolate , <nl> - Handle < SharedFunctionInfo > shared_info , <nl> - FunctionLiteral * lit , bool is_toplevel ) ; <nl> - template EXPORT_TEMPLATE_DEFINE ( V8_EXPORT_PRIVATE ) void SharedFunctionInfo : : <nl> - InitFromFunctionLiteral < OffThreadIsolate > ( <nl> - OffThreadIsolate * isolate , <nl> - OffThreadHandle < SharedFunctionInfo > shared_info , FunctionLiteral * lit , <nl> - bool is_toplevel ) ; <nl> - <nl> uint16_t SharedFunctionInfo : : get_property_estimate_from_literal ( <nl> FunctionLiteral * literal ) { <nl> int estimate = literal - > expected_property_count ( ) ; <nl> mmm a / src / objects / shared - function - info - inl . h <nl> ppp b / src / objects / shared - function - info - inl . h <nl> ScopeInfo SharedFunctionInfo : : scope_info ( ) const { <nl> if ( maybe_scope_info . IsScopeInfo ( ) ) { <nl> return ScopeInfo : : cast ( maybe_scope_info ) ; <nl> } <nl> - return GetReadOnlyRoots ( ) . empty_scope_info ( ) ; <nl> + return ScopeInfo : : Empty ( GetIsolate ( ) ) ; <nl> } <nl> <nl> void SharedFunctionInfo : : set_scope_info ( ScopeInfo scope_info , <nl> void SharedFunctionInfo : : ClearPreparseData ( ) { <nl> DCHECK ( HasUncompiledDataWithoutPreparseData ( ) ) ; <nl> } <nl> <nl> - template < typename Isolate > <nl> - void UncompiledData : : Init ( Isolate * isolate , String inferred_name , <nl> - int start_position , int end_position ) { <nl> - set_inferred_name ( inferred_name ) ; <nl> - set_start_position ( start_position ) ; <nl> - set_end_position ( end_position ) ; <nl> - } <nl> - <nl> - void UncompiledData : : InitAfterBytecodeFlush ( <nl> + void UncompiledData : : Init ( <nl> String inferred_name , int start_position , int end_position , <nl> std : : function < void ( HeapObject object , ObjectSlot slot , HeapObject target ) > <nl> gc_notify_updated_slot ) { <nl> void UncompiledData : : InitAfterBytecodeFlush ( <nl> set_end_position ( end_position ) ; <nl> } <nl> <nl> - template < typename Isolate > <nl> - void UncompiledDataWithPreparseData : : Init ( Isolate * isolate , <nl> - String inferred_name , <nl> - int start_position , int end_position , <nl> - PreparseData scope_data ) { <nl> - this - > UncompiledData : : Init ( isolate , inferred_name , start_position , <nl> - end_position ) ; <nl> + void UncompiledDataWithPreparseData : : Init ( <nl> + String inferred_name , int start_position , int end_position , <nl> + PreparseData scope_data , <nl> + std : : function < void ( HeapObject object , ObjectSlot slot , HeapObject target ) > <nl> + gc_notify_updated_slot ) { <nl> + this - > UncompiledData : : Init ( inferred_name , start_position , end_position , <nl> + gc_notify_updated_slot ) ; <nl> set_preparse_data ( scope_data ) ; <nl> + gc_notify_updated_slot ( <nl> + * this , RawField ( UncompiledDataWithPreparseData : : kPreparseDataOffset ) , <nl> + scope_data ) ; <nl> } <nl> <nl> bool SharedFunctionInfo : : HasWasmExportedFunctionData ( ) const { <nl> mmm a / src / objects / shared - function - info . h <nl> ppp b / src / objects / shared - function - info . h <nl> <nl> <nl> # include " src / base / bit - field . h " <nl> # include " src / codegen / bailout - reason . h " <nl> - # include " src / handles / handle - for . h " <nl> # include " src / objects / compressed - slots . h " <nl> # include " src / objects / function - kind . h " <nl> # include " src / objects / function - syntax - kind . h " <nl> class PreparseData <nl> class UncompiledData <nl> : public TorqueGeneratedUncompiledData < UncompiledData , HeapObject > { <nl> public : <nl> - template < typename Isolate > <nl> - inline void Init ( Isolate * isolate , String inferred_name , int start_position , <nl> - int end_position ) ; <nl> - <nl> - inline void InitAfterBytecodeFlush ( <nl> + inline void Init ( <nl> String inferred_name , int start_position , int end_position , <nl> std : : function < void ( HeapObject object , ObjectSlot slot , HeapObject target ) > <nl> - gc_notify_updated_slot ) ; <nl> + gc_notify_updated_slot = <nl> + [ ] ( HeapObject object , ObjectSlot slot , HeapObject target ) { } ) ; <nl> <nl> using BodyDescriptor = <nl> FixedBodyDescriptor < kStartOfStrongFieldsOffset , kEndOfStrongFieldsOffset , <nl> class UncompiledDataWithPreparseData <nl> public : <nl> DECL_PRINTER ( UncompiledDataWithPreparseData ) <nl> <nl> - template < typename Isolate > <nl> - inline void Init ( Isolate * isolate , String inferred_name , int start_position , <nl> - int end_position , PreparseData scope_data ) ; <nl> + inline void Init ( <nl> + String inferred_name , int start_position , int end_position , <nl> + PreparseData scope_data , <nl> + std : : function < void ( HeapObject object , ObjectSlot slot , HeapObject target ) > <nl> + gc_notify_updated_slot = <nl> + [ ] ( HeapObject object , ObjectSlot slot , HeapObject target ) { } ) ; <nl> <nl> using BodyDescriptor = SubclassBodyDescriptor < <nl> UncompiledData : : BodyDescriptor , <nl> class SharedFunctionInfo : public HeapObject { <nl> inline bool has_simple_parameters ( ) ; <nl> <nl> / / Initialize a SharedFunctionInfo from a parsed function literal . <nl> - template < typename Isolate > <nl> - static void InitFromFunctionLiteral ( <nl> - Isolate * isolate , HandleFor < Isolate , SharedFunctionInfo > shared_info , <nl> - FunctionLiteral * lit , bool is_toplevel ) ; <nl> + static void InitFromFunctionLiteral ( Isolate * isolate , <nl> + Handle < SharedFunctionInfo > shared_info , <nl> + FunctionLiteral * lit , bool is_toplevel ) ; <nl> <nl> / / Updates the expected number of properties based on estimate from parser . <nl> void UpdateExpectedNofPropertiesFromEstimate ( FunctionLiteral * literal ) ; <nl> class SharedFunctionInfo : public HeapObject { <nl> / / Dispatched behavior . <nl> DECL_PRINTER ( SharedFunctionInfo ) <nl> DECL_VERIFIER ( SharedFunctionInfo ) <nl> - void SharedFunctionInfoVerify ( OffThreadIsolate * isolate ) ; <nl> # ifdef OBJECT_PRINT <nl> void PrintSourceCode ( std : : ostream & os ) ; <nl> # endif <nl> class SharedFunctionInfo : public HeapObject { <nl> inline bool needs_home_object ( ) const ; <nl> <nl> private : <nl> - void SharedFunctionInfoVerify ( ReadOnlyRoots roots ) ; <nl> - <nl> / / [ name_or_scope_info ] : Function name string , kNoSharedNameSentinel or <nl> / / ScopeInfo . <nl> DECL_ACCESSORS ( name_or_scope_info , Object ) <nl> class SharedFunctionInfo : public HeapObject { <nl> <nl> inline uint16_t get_property_estimate_from_literal ( FunctionLiteral * literal ) ; <nl> <nl> - template < typename Impl > <nl> - friend class FactoryBase ; <nl> + friend class Factory ; <nl> friend class V8HeapExplorer ; <nl> FRIEND_TEST ( PreParserTest , LazyFunctionLength ) ; <nl> <nl> mmm a / src / parsing / preparse - data - impl . h <nl> ppp b / src / parsing / preparse - data - impl . h <nl> class ZonePreparseData : public ZoneObject { <nl> int child_length ) ; <nl> <nl> Handle < PreparseData > Serialize ( Isolate * isolate ) ; <nl> - OffThreadHandle < PreparseData > Serialize ( OffThreadIsolate * isolate ) ; <nl> <nl> int children_length ( ) const { return static_cast < int > ( children_ . size ( ) ) ; } <nl> <nl> mmm a / src / parsing / preparse - data . cc <nl> ppp b / src / parsing / preparse - data . cc <nl> <nl> # include " src / ast / scopes . h " <nl> # include " src / ast / variables . h " <nl> # include " src / handles / handles . h " <nl> - # include " src / heap / off - thread - factory . h " <nl> # include " src / objects / objects - inl . h " <nl> # include " src / objects / shared - function - info . h " <nl> # include " src / parsing / parser . h " <nl> # include " src / parsing / preparse - data - impl . h " <nl> # include " src / parsing / preparser . h " <nl> - # include " src / roots / roots . h " <nl> # include " src / zone / zone - list - inl . h " / / crbug . com / v8 / 8816 <nl> <nl> namespace v8 { <nl> Handle < PreparseData > PreparseDataBuilder : : ByteData : : CopyToHeap ( <nl> return data ; <nl> } <nl> <nl> - OffThreadHandle < PreparseData > <nl> - PreparseDataBuilder : : ByteData : : CopyToOffThreadHeap ( OffThreadIsolate * isolate , <nl> - int children_length ) { <nl> - DCHECK ( is_finalized_ ) ; <nl> - int data_length = zone_byte_data_ . length ( ) ; <nl> - OffThreadHandle < PreparseData > data = <nl> - isolate - > factory ( ) - > NewPreparseData ( data_length , children_length ) ; <nl> - data - > copy_in ( 0 , zone_byte_data_ . begin ( ) , data_length ) ; <nl> - return data ; <nl> - } <nl> - <nl> Handle < PreparseData > PreparseDataBuilder : : Serialize ( Isolate * isolate ) { <nl> DCHECK ( HasData ( ) ) ; <nl> DCHECK ( ! ThisOrParentBailedOut ( ) ) ; <nl> Handle < PreparseData > PreparseDataBuilder : : Serialize ( Isolate * isolate ) { <nl> return data ; <nl> } <nl> <nl> - OffThreadHandle < PreparseData > PreparseDataBuilder : : Serialize ( <nl> - OffThreadIsolate * isolate ) { <nl> - DCHECK ( HasData ( ) ) ; <nl> - DCHECK ( ! ThisOrParentBailedOut ( ) ) ; <nl> - OffThreadHandle < PreparseData > data = <nl> - byte_data_ . CopyToOffThreadHeap ( isolate , num_inner_with_data_ ) ; <nl> - int i = 0 ; <nl> - DCHECK ( finalized_children_ ) ; <nl> - for ( const auto & builder : children_ ) { <nl> - if ( ! builder - > HasData ( ) ) continue ; <nl> - OffThreadHandle < PreparseData > child_data = builder - > Serialize ( isolate ) ; <nl> - data - > set_child ( i + + , * child_data ) ; <nl> - } <nl> - DCHECK_EQ ( i , data - > children_length ( ) ) ; <nl> - return data ; <nl> - } <nl> - <nl> ZonePreparseData * PreparseDataBuilder : : Serialize ( Zone * zone ) { <nl> DCHECK ( HasData ( ) ) ; <nl> DCHECK ( ! ThisOrParentBailedOut ( ) ) ; <nl> class BuilderProducedPreparseData final : public ProducedPreparseData { <nl> return builder_ - > Serialize ( isolate ) ; <nl> } <nl> <nl> - OffThreadHandle < PreparseData > Serialize ( OffThreadIsolate * isolate ) final { <nl> - return builder_ - > Serialize ( isolate ) ; <nl> - } <nl> - <nl> ZonePreparseData * Serialize ( Zone * zone ) final { <nl> return builder_ - > Serialize ( zone ) ; <nl> } <nl> class OnHeapProducedPreparseData final : public ProducedPreparseData { <nl> return data_ ; <nl> } <nl> <nl> - OffThreadHandle < PreparseData > Serialize ( OffThreadIsolate * isolate ) final { <nl> - / / Not required . <nl> - UNREACHABLE ( ) ; <nl> - } <nl> - <nl> ZonePreparseData * Serialize ( Zone * zone ) final { <nl> / / Not required . <nl> UNREACHABLE ( ) ; <nl> class ZoneProducedPreparseData final : public ProducedPreparseData { <nl> return data_ - > Serialize ( isolate ) ; <nl> } <nl> <nl> - OffThreadHandle < PreparseData > Serialize ( OffThreadIsolate * isolate ) final { <nl> - return data_ - > Serialize ( isolate ) ; <nl> - } <nl> - <nl> ZonePreparseData * Serialize ( Zone * zone ) final { return data_ ; } <nl> <nl> private : <nl> Handle < PreparseData > ZonePreparseData : : Serialize ( Isolate * isolate ) { <nl> return result ; <nl> } <nl> <nl> - OffThreadHandle < PreparseData > ZonePreparseData : : Serialize ( <nl> - OffThreadIsolate * isolate ) { <nl> - int data_size = static_cast < int > ( byte_data ( ) - > size ( ) ) ; <nl> - int child_data_length = children_length ( ) ; <nl> - OffThreadHandle < PreparseData > result = <nl> - isolate - > factory ( ) - > NewPreparseData ( data_size , child_data_length ) ; <nl> - result - > copy_in ( 0 , byte_data ( ) - > data ( ) , data_size ) ; <nl> - <nl> - for ( int i = 0 ; i < child_data_length ; i + + ) { <nl> - ZonePreparseData * child = get_child ( i ) ; <nl> - DCHECK_NOT_NULL ( child ) ; <nl> - OffThreadHandle < PreparseData > child_data = child - > Serialize ( isolate ) ; <nl> - result - > set_child ( i , * child_data ) ; <nl> - } <nl> - return result ; <nl> - } <nl> - <nl> ZoneConsumedPreparseData : : ZoneConsumedPreparseData ( Zone * zone , <nl> ZonePreparseData * data ) <nl> : data_ ( data ) , scope_data_wrapper_ ( data_ - > byte_data ( ) ) { <nl> mmm a / src / parsing / preparse - data . h <nl> ppp b / src / parsing / preparse - data . h <nl> class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject , <nl> void Finalize ( Zone * zone ) ; <nl> <nl> Handle < PreparseData > CopyToHeap ( Isolate * isolate , int children_length ) ; <nl> - OffThreadHandle < PreparseData > CopyToOffThreadHeap ( OffThreadIsolate * isolate , <nl> - int children_length ) ; <nl> inline ZonePreparseData * CopyToZone ( Zone * zone , int children_length ) ; <nl> <nl> void Reserve ( size_t bytes ) ; <nl> class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject , <nl> friend class BuilderProducedPreparseData ; <nl> <nl> Handle < PreparseData > Serialize ( Isolate * isolate ) ; <nl> - OffThreadHandle < PreparseData > Serialize ( OffThreadIsolate * isolate ) ; <nl> ZonePreparseData * Serialize ( Zone * zone ) ; <nl> <nl> void FinalizeChildren ( Zone * zone ) ; <nl> class ProducedPreparseData : public ZoneObject { <nl> / / MaybeHandle . <nl> virtual Handle < PreparseData > Serialize ( Isolate * isolate ) = 0 ; <nl> <nl> - / / If there is data ( if the Scope contains skippable inner functions ) , move <nl> - / / the data into the heap and return a Handle to it ; otherwise return a null <nl> - / / MaybeHandle . <nl> - virtual OffThreadHandle < PreparseData > Serialize ( <nl> - OffThreadIsolate * isolate ) = 0 ; <nl> - <nl> / / If there is data ( if the Scope contains skippable inner functions ) , return <nl> / / an off - heap ZonePreparseData representing the data ; otherwise <nl> / / return nullptr . <nl> mmm a / src / parsing / scanner - character - streams . cc <nl> ppp b / src / parsing / scanner - character - streams . cc <nl> std : : unique_ptr < Utf16CharacterStream > ScannerStream : : ForTesting ( <nl> const char * data , size_t length ) { <nl> return std : : unique_ptr < Utf16CharacterStream > ( <nl> new BufferedCharacterStream < TestingStream > ( <nl> - 0 , reinterpret_cast < const uint8_t * > ( data ) , length ) ) ; <nl> - } <nl> - <nl> - std : : unique_ptr < Utf16CharacterStream > ScannerStream : : ForTesting ( <nl> - const uint16_t * data , size_t length ) { <nl> - return std : : unique_ptr < Utf16CharacterStream > ( <nl> - new UnbufferedCharacterStream < TestingStream > ( 0 , data , length ) ) ; <nl> + static_cast < size_t > ( 0 ) , reinterpret_cast < const uint8_t * > ( data ) , <nl> + static_cast < size_t > ( length ) ) ) ; <nl> } <nl> <nl> Utf16CharacterStream * ScannerStream : : For ( <nl> mmm a / src / parsing / scanner - character - streams . h <nl> ppp b / src / parsing / scanner - character - streams . h <nl> class V8_EXPORT_PRIVATE ScannerStream { <nl> static std : : unique_ptr < Utf16CharacterStream > ForTesting ( const char * data ) ; <nl> static std : : unique_ptr < Utf16CharacterStream > ForTesting ( const char * data , <nl> size_t length ) ; <nl> - static std : : unique_ptr < Utf16CharacterStream > ForTesting ( const uint16_t * data , <nl> - size_t length ) ; <nl> } ; <nl> <nl> } / / namespace internal <nl> mmm a / test / unittests / heap / off - thread - factory - unittest . cc <nl> ppp b / test / unittests / heap / off - thread - factory - unittest . cc <nl> <nl> # include < memory > <nl> <nl> # include " src / ast / ast - value - factory . h " <nl> - # include " src / ast / ast . h " <nl> - # include " src / ast / scopes . h " <nl> - # include " src / common / assert - scope . h " <nl> - # include " src / common / globals . h " <nl> # include " src / execution / off - thread - isolate . h " <nl> # include " src / handles / handles - inl . h " <nl> # include " src / handles / handles . h " <nl> - # include " src / heap / off - thread - factory - inl . h " <nl> + # include " src / heap / off - thread - factory . h " <nl> # include " src / objects / fixed - array . h " <nl> - # include " src / objects / script . h " <nl> - # include " src / objects / shared - function - info . h " <nl> # include " src / objects / string . h " <nl> - # include " src / parsing / parse - info . h " <nl> - # include " src / parsing / parser . h " <nl> - # include " src / parsing / rewriter . h " <nl> - # include " src / parsing / scanner - character - streams . h " <nl> - # include " src / parsing / scanner . h " <nl> - # include " src / strings / unicode - inl . h " <nl> - # include " src / utils / utils . h " <nl> # include " test / unittests / test - utils . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> <nl> class OffThreadIsolate ; <nl> <nl> - namespace { <nl> - <nl> - std : : vector < uint16_t > DecodeUtf8 ( const std : : string & string ) { <nl> - if ( string . empty ( ) ) return { } ; <nl> - <nl> - auto utf8_data = <nl> - Vector < const uint8_t > : : cast ( VectorOf ( string . data ( ) , string . length ( ) ) ) ; <nl> - Utf8Decoder decoder ( utf8_data ) ; <nl> - <nl> - std : : vector < uint16_t > utf16 ( decoder . utf16_length ( ) ) ; <nl> - decoder . Decode ( & utf16 [ 0 ] , utf8_data ) ; <nl> - <nl> - return utf16 ; <nl> - } <nl> - <nl> - } / / namespace <nl> - <nl> class OffThreadFactoryTest : public TestWithIsolateAndZone { <nl> public : <nl> OffThreadFactoryTest ( ) <nl> - : TestWithIsolateAndZone ( ) , <nl> - off_thread_isolate_ ( isolate ( ) ) , <nl> - parse_info_ ( isolate ( ) ) { } <nl> - <nl> - FunctionLiteral * ParseProgram ( const char * source ) { <nl> - auto utf16_source = DecodeUtf8 ( source ) ; <nl> - <nl> - / / Normally this would be an external string or whatever , we don ' t have to <nl> - / / worry about it for now . <nl> - source_string_ = <nl> - factory ( ) - > NewStringFromUtf8 ( CStrVector ( source ) ) . ToHandleChecked ( ) ; <nl> - <nl> - parse_info_ . set_character_stream ( <nl> - ScannerStream : : ForTesting ( utf16_source . data ( ) , utf16_source . size ( ) ) ) ; <nl> - parse_info_ . set_toplevel ( ) ; <nl> - parse_info_ . set_allow_lazy_parsing ( ) ; <nl> - <nl> - { <nl> - DisallowHeapAllocation no_allocation ; <nl> - DisallowHandleAllocation no_handles ; <nl> - DisallowHeapAccess no_heap_access ; <nl> - <nl> - Parser parser ( parse_info ( ) ) ; <nl> - parser . InitializeEmptyScopeChain ( parse_info ( ) ) ; <nl> - parser . ParseOnBackground ( parse_info ( ) ) ; <nl> - <nl> - CHECK ( DeclarationScope : : Analyze ( parse_info ( ) ) ) ; <nl> - } <nl> - <nl> - parse_info ( ) - > ast_value_factory ( ) - > Internalize ( off_thread_isolate ( ) ) ; <nl> - DeclarationScope : : AllocateScopeInfos ( parse_info ( ) , off_thread_isolate ( ) ) ; <nl> - <nl> - script_ = parse_info_ . CreateScript ( off_thread_isolate ( ) , <nl> - off_thread_factory ( ) - > empty_string ( ) , <nl> - ScriptOriginOptions ( ) ) ; <nl> - <nl> - / / Create the SFI list on the script so that SFI SetScript works . <nl> - OffThreadHandle < WeakFixedArray > infos = <nl> - off_thread_factory ( ) - > NewWeakFixedArray ( <nl> - parse_info ( ) - > max_function_literal_id ( ) + 1 , AllocationType : : kOld ) ; <nl> - script_ - > set_shared_function_infos ( * infos ) ; <nl> - <nl> - return parse_info ( ) - > literal ( ) ; <nl> - } <nl> - <nl> - ParseInfo * parse_info ( ) { return & parse_info_ ; } <nl> - <nl> - OffThreadHandle < Script > script ( ) { return script_ ; } <nl> + : TestWithIsolateAndZone ( ) , off_thread_isolate_ ( isolate ( ) ) { } <nl> <nl> OffThreadIsolate * off_thread_isolate ( ) { return & off_thread_isolate_ ; } <nl> OffThreadFactory * off_thread_factory ( ) { <nl> class OffThreadFactoryTest : public TestWithIsolateAndZone { <nl> <nl> private : <nl> OffThreadIsolate off_thread_isolate_ ; <nl> - ParseInfo parse_info_ ; <nl> - Handle < String > source_string_ ; <nl> - OffThreadHandle < Script > script_ ; <nl> } ; <nl> <nl> TEST_F ( OffThreadFactoryTest , HandleOrOffThreadHandle_IsNullWhenConstructed ) { <nl> TEST_F ( OffThreadFactoryTest , AstConsString_CreatesConsString ) { <nl> " foobar - plus - padding - for - length " ) ) ) ; <nl> } <nl> <nl> - TEST_F ( OffThreadFactoryTest , EmptyScript ) { <nl> - FunctionLiteral * program = ParseProgram ( " " ) ; <nl> - <nl> - SharedFunctionInfo shared = <nl> - * off_thread_factory ( ) - > NewSharedFunctionInfoForLiteral ( program , script ( ) , <nl> - true ) ; <nl> - <nl> - off_thread_factory ( ) - > FinishOffThread ( ) ; <nl> - <nl> - Handle < SharedFunctionInfo > root_sfi = handle ( shared , isolate ( ) ) ; <nl> - off_thread_factory ( ) - > Publish ( isolate ( ) ) ; <nl> - <nl> - EXPECT_EQ ( root_sfi - > function_literal_id ( ) , 0 ) ; <nl> - } <nl> - <nl> - TEST_F ( OffThreadFactoryTest , LazyFunction ) { <nl> - FunctionLiteral * program = ParseProgram ( " function lazy ( ) { } " ) ; <nl> - FunctionLiteral * lazy = program - > scope ( ) <nl> - - > declarations ( ) <nl> - - > AtForTest ( 0 ) <nl> - - > AsFunctionDeclaration ( ) <nl> - - > fun ( ) ; <nl> - <nl> - SharedFunctionInfo shared = <nl> - * off_thread_factory ( ) - > NewSharedFunctionInfoForLiteral ( lazy , script ( ) , <nl> - true ) ; <nl> - <nl> - off_thread_factory ( ) - > FinishOffThread ( ) ; <nl> - <nl> - Handle < SharedFunctionInfo > lazy_sfi = handle ( shared , isolate ( ) ) ; <nl> - off_thread_factory ( ) - > Publish ( isolate ( ) ) ; <nl> - <nl> - EXPECT_EQ ( lazy_sfi - > function_literal_id ( ) , 1 ) ; <nl> - EXPECT_TRUE ( lazy_sfi - > Name ( ) . IsOneByteEqualTo ( CStrVector ( " lazy " ) ) ) ; <nl> - EXPECT_FALSE ( lazy_sfi - > is_compiled ( ) ) ; <nl> - EXPECT_TRUE ( lazy_sfi - > HasUncompiledDataWithoutPreparseData ( ) ) ; <nl> - } <nl> - <nl> - TEST_F ( OffThreadFactoryTest , EagerFunction ) { <nl> - FunctionLiteral * program = ParseProgram ( " ( function eager ( ) { } ) " ) ; <nl> - FunctionLiteral * eager = program - > body ( ) <nl> - - > at ( 0 ) <nl> - - > AsExpressionStatement ( ) <nl> - - > expression ( ) <nl> - - > AsFunctionLiteral ( ) ; <nl> - <nl> - SharedFunctionInfo shared = <nl> - * off_thread_factory ( ) - > NewSharedFunctionInfoForLiteral ( eager , script ( ) , <nl> - true ) ; <nl> - <nl> - off_thread_factory ( ) - > FinishOffThread ( ) ; <nl> - <nl> - Handle < SharedFunctionInfo > eager_sfi = handle ( shared , isolate ( ) ) ; <nl> - off_thread_factory ( ) - > Publish ( isolate ( ) ) ; <nl> - <nl> - EXPECT_EQ ( eager_sfi - > function_literal_id ( ) , 1 ) ; <nl> - EXPECT_TRUE ( eager_sfi - > Name ( ) . IsOneByteEqualTo ( CStrVector ( " eager " ) ) ) ; <nl> - EXPECT_FALSE ( eager_sfi - > HasUncompiledData ( ) ) ; <nl> - / / TODO ( leszeks ) : Allocate bytecode and enable these checks . <nl> - / / EXPECT_TRUE ( eager_sfi - > is_compiled ( ) ) ; <nl> - / / EXPECT_TRUE ( eager_sfi - > HasBytecodeArray ( ) ) ; <nl> - } <nl> - <nl> - TEST_F ( OffThreadFactoryTest , ImplicitNameFunction ) { <nl> - FunctionLiteral * program = ParseProgram ( " let implicit_name = function ( ) { } " ) ; <nl> - FunctionLiteral * implicit_name = program - > body ( ) <nl> - - > at ( 0 ) <nl> - - > AsBlock ( ) <nl> - - > statements ( ) <nl> - - > at ( 0 ) <nl> - - > AsExpressionStatement ( ) <nl> - - > expression ( ) <nl> - - > AsAssignment ( ) <nl> - - > value ( ) <nl> - - > AsFunctionLiteral ( ) ; <nl> - <nl> - SharedFunctionInfo shared = <nl> - * off_thread_factory ( ) - > NewSharedFunctionInfoForLiteral ( implicit_name , <nl> - script ( ) , true ) ; <nl> - <nl> - off_thread_factory ( ) - > FinishOffThread ( ) ; <nl> - <nl> - Handle < SharedFunctionInfo > implicit_name_sfi = handle ( shared , isolate ( ) ) ; <nl> - off_thread_factory ( ) - > Publish ( isolate ( ) ) ; <nl> - <nl> - EXPECT_EQ ( implicit_name_sfi - > function_literal_id ( ) , 1 ) ; <nl> - EXPECT_TRUE ( <nl> - implicit_name_sfi - > Name ( ) . IsOneByteEqualTo ( CStrVector ( " implicit_name " ) ) ) ; <nl> - } <nl> - <nl> } / / namespace internal <nl> } / / namespace v8 <nl>
Revert " [ offthread ] Add SFI support to OffThreadFactory "
v8/v8
b3c38223a123fe14fba0d0e8275f834516e05793
2020-02-12T17:45:44Z
mmm a / doc / user_guide / ug_highgui . rst <nl> ppp b / doc / user_guide / ug_highgui . rst <nl> Kinect sensor is supported through ` ` VideoCapture ` ` class . Depth map , RGB image <nl> In order to use Kinect with OpenCV you should do the following preliminary steps : <nl> <nl> # . <nl> - Install OpenNI library and PrimeSensor Module for OpenNI from here \ url { http : / / www . openni . org / downloadfiles } . The installation should be done to default folders listed in the instructions of these products : <nl> + Install OpenNI library ( from here \ url { http : / / www . openni . org / downloadfiles } ) and PrimeSensor Module for OpenNI ( from here https : / / github . com / avin2 / SensorKinect } ) . The installation should be done to default folders listed in the instructions of these products : <nl> <nl> . . code - block : : text <nl> <nl>
added the link in doc on kinect
opencv/opencv
411e7798aa261d9f7ac0c4e84544b94ef1be44a7
2011-05-18T11:57:43Z
new file mode 100644 <nl> index 00000000000 . . 1a8c7562831 <nl> mmm / dev / null <nl> ppp b / ports / asiosdk / CONTROL <nl> <nl> + Source : asiosdk <nl> + Version : 2 . 3 . 3 <nl> + Homepage : https : / / www . steinberg . net / en / company / developers . html <nl> + Description : ASIO is a low latency audio API from Steinberg . <nl> new file mode 100644 <nl> index 00000000000 . . b8f32f83078 <nl> mmm / dev / null <nl> ppp b / ports / asiosdk / Findasiosdk . cmake <nl> <nl> + if ( WIN32 ) <nl> + else ( WIN32 ) <nl> + message ( FATAL_ERROR " Findasiosdk . cmake : Unsupported platform $ { CMAKE_SYSTEM_NAME } " ) <nl> + endif ( WIN32 ) <nl> + <nl> + find_path ( <nl> + ASIOSDK_ROOT_DIR <nl> + asiosdk <nl> + ) <nl> + <nl> + if ( NOT " $ { ASIOSDK_ROOT_DIR } " STREQUAL " " ) <nl> + set ( ASIOSDK_ROOT_DIR <nl> + $ { ASIOSDK_ROOT_DIR } / asiosdk <nl> + ) <nl> + endif ( ) <nl> + <nl> + find_path ( ASIOSDK_INCLUDE_DIR <nl> + asio . h <nl> + PATHS <nl> + $ { ASIOSDK_ROOT_DIR } / common <nl> + ) <nl> + <nl> + <nl> + if ( NOT " $ { ASIOSDK_ROOT_DIR } " STREQUAL " " ) <nl> + set ( ASIOSDK_INCLUDE_DIR <nl> + $ { ASIOSDK_ROOT_DIR } / common <nl> + $ { ASIOSDK_ROOT_DIR } / host <nl> + $ { ASIOSDK_ROOT_DIR } / hostpc <nl> + ) <nl> + endif ( ) <nl> + <nl> + include ( FindPackageHandleStandardArgs ) <nl> + find_package_handle_standard_args ( ASIOSDK DEFAULT_MSG ASIOSDK_ROOT_DIR ASIOSDK_INCLUDE_DIR ) <nl> + <nl> + MARK_AS_ADVANCED ( <nl> + ASIOSDK_ROOT_DIR ASIOSDK_INCLUDE_DIR <nl> + ) <nl> new file mode 100644 <nl> index 00000000000 . . e4ed662bbc4 <nl> mmm / dev / null <nl> ppp b / ports / asiosdk / portfile . cmake <nl> <nl> + vcpkg_fail_port_install ( MESSAGE " asiosdk currently only supports Windows platforms " ON_ARCH " arm " " arm64 " ON_TARGET " Linux " " OSX " " uwp " ) <nl> + <nl> + set ( VERSION 2 . 3 . 3 ) <nl> + <nl> + vcpkg_download_distfile ( ARCHIVE <nl> + URLS " https : / / download . steinberg . net / sdk_downloads / asiosdk_2 . 3 . 3_2019 - 06 - 14 . zip " <nl> + FILENAME " asiosdk_2 . 3 . 3_2019 - 06 - 14 . zip " <nl> + SHA512 65d6f2fa4f0e23939fcdf46ff3b04760089c0f14e2ac3e37e63cbf6733f3acc93ab930ea9e3f1eb60483d4654f7ba4699ed506531074c4f55e763ad92736c231 <nl> + ) <nl> + <nl> + vcpkg_extract_source_archive_ex ( <nl> + OUT_SOURCE_PATH SOURCE_PATH <nl> + ARCHIVE $ { ARCHIVE } <nl> + REF $ { VERSION } <nl> + ) <nl> + <nl> + file ( INSTALL $ { SOURCE_PATH } / asio / DESTINATION $ { CURRENT_PACKAGES_DIR } / include / asiosdk / asio ) <nl> + file ( INSTALL $ { SOURCE_PATH } / common / DESTINATION $ { CURRENT_PACKAGES_DIR } / include / asiosdk / common ) <nl> + file ( INSTALL $ { SOURCE_PATH } / driver / DESTINATION $ { CURRENT_PACKAGES_DIR } / include / asiosdk / driver ) <nl> + file ( INSTALL $ { SOURCE_PATH } / host / DESTINATION $ { CURRENT_PACKAGES_DIR } / include / asiosdk / host ) <nl> + file ( INSTALL $ { SOURCE_PATH } / readme . txt DESTINATION $ { CURRENT_PACKAGES_DIR } / share / asiosdk ) <nl> + file ( INSTALL $ { SOURCE_PATH } / readme . txt DESTINATION $ { CURRENT_PACKAGES_DIR } / share / asiosdk RENAME copyright ) <nl> + file ( INSTALL $ { SOURCE_PATH } / changes . txt DESTINATION $ { CURRENT_PACKAGES_DIR } / share / asiosdk ) <nl> + file ( INSTALL " $ { SOURCE_PATH } / Steinberg ASIO Logo Artwork . zip " DESTINATION $ { CURRENT_PACKAGES_DIR } / share / asiosdk ) <nl> + file ( INSTALL " $ { SOURCE_PATH } / Steinberg ASIO Licensing Agreement . pdf " DESTINATION $ { CURRENT_PACKAGES_DIR } / share / asiosdk ) <nl> + file ( INSTALL " $ { SOURCE_PATH } / ASIO SDK 2 . 3 . pdf " DESTINATION $ { CURRENT_PACKAGES_DIR } / share / asiosdk ) <nl> + <nl> + file ( INSTALL " $ { CMAKE_CURRENT_LIST_DIR } / Findasiosdk . cmake " DESTINATION $ { CURRENT_PACKAGES_DIR } / share / $ { PORT } ) <nl> + file ( INSTALL " $ { CMAKE_CURRENT_LIST_DIR } / vcpkg - cmake - wrapper . cmake " DESTINATION $ { CURRENT_PACKAGES_DIR } / share / $ { PORT } ) <nl> + <nl> + file ( COPY $ { CMAKE_CURRENT_LIST_DIR } / usage DESTINATION $ { CURRENT_PACKAGES_DIR } / share / $ { PORT } ) <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 1afa2ae84df <nl> mmm / dev / null <nl> ppp b / ports / asiosdk / usage <nl> <nl> + The package asiosdk provides CMake integration : <nl> + <nl> + find_package ( asiosdk REQUIRED ) <nl> + target_include_directories ( < my_target > PRIVATE $ { ASIOSDK_INCLUDE_DIRS } ) <nl> new file mode 100644 <nl> index 00000000000 . . 2fbe9725f53 <nl> mmm / dev / null <nl> ppp b / ports / asiosdk / vcpkg - cmake - wrapper . cmake <nl> <nl> + set ( ASIOSDK_PREV_MODULE_PATH $ { CMAKE_MODULE_PATH } ) <nl> + list ( APPEND CMAKE_MODULE_PATH $ { CMAKE_CURRENT_LIST_DIR } ) <nl> + <nl> + if ( NOT ASIOSDK_INCLUDE_DIR ) <nl> + _find_package ( $ { ARGS } ) <nl> + endif ( ) <nl> + <nl> + set ( CMAKE_MODULE_PATH $ { ASIOSDK_PREV_MODULE_PATH } ) <nl> mmm a / scripts / ci . baseline . txt <nl> ppp b / scripts / ci . baseline . txt <nl> argtable2 : x64 - uwp = fail <nl> arrow : arm64 - windows = fail <nl> arrow : x64 - linux = fail <nl> arrow : x86 - windows = fail <nl> + asiosdk : x64 - linux = fail <nl> + asiosdk : x64 - osx = fail <nl> + asiosdk : x64 - uwp = fail <nl> + asiosdk : arm64 - windows = fail <nl> + asiosdk : arm - uwp = fail <nl> asmjit : arm64 - windows = fail <nl> asmjit : arm - uwp = fail <nl> asyncplusplus : arm - uwp = fail <nl>
[ asiosdk ] Add new port ( )
microsoft/vcpkg
6ab471d09e26a91aa1b5b3ed3565581c083ab183
2020-01-27T22:14:26Z
mmm a / include / swift / SILOptimizer / Analysis / EscapeAnalysis . h <nl> ppp b / include / swift / SILOptimizer / Analysis / EscapeAnalysis . h <nl> class EscapeAnalysis : public BottomUpIPAnalysis { <nl> <nl> / / / Checks an invariant of the connection graph : The points - to nodes of <nl> / / / the defer - successors must match with the points - to of this node . <nl> - bool matchPointToOfDefers ( ) const { <nl> - for ( CGNode * Def : defersTo ) { <nl> - if ( pointsTo ! = Def - > pointsTo ) <nl> - return false ; <nl> - } <nl> - / / / A defer - path in the graph must not end without the specified points - to <nl> - / / / node . <nl> - if ( pointsTo & & ! pointsToIsEdge & & defersTo . empty ( ) ) <nl> - return false ; <nl> - return true ; <nl> - } <nl> + bool matchPointToOfDefers ( bool allowMerge = false ) const ; <nl> <nl> friend class CGNodeMap ; <nl> friend class ConnectionGraph ; <nl> class EscapeAnalysis : public BottomUpIPAnalysis { <nl> llvm_unreachable ( " Unhandled EscapeState in switch . " ) ; <nl> } <nl> <nl> - / / / Returns the content node if of this node if it exists in the graph . <nl> + / / / Returns the content node of this node if it exists in the graph . <nl> CGNode * getContentNodeOrNull ( ) const { <nl> return pointsTo ; <nl> } <nl> class EscapeAnalysis : public BottomUpIPAnalysis { <nl> } <nl> } <nl> <nl> + / / / Initialize the ' pointsTo ' fields of all nodes in the defer web of \ p <nl> + / / / initialiNode . <nl> + / / / <nl> + / / / If \ p createEdge is true , a proper pointsTo edge will be created from \ p <nl> + / / / initialNode to \ p pointsTo . <nl> + void initializePointsTo ( CGNode * initialNode , CGNode * newPointsTo , <nl> + bool createEdge = false ) ; <nl> + <nl> + void initializePointsToEdge ( CGNode * initialNode , CGNode * newPointsTo ) { <nl> + initializePointsTo ( initialNode , newPointsTo , true ) ; <nl> + } <nl> + <nl> / / / Merges all nodes which are added to the ToMerge list . <nl> void mergeAllScheduledNodes ( ) ; <nl> <nl> - / / / Transitively updates pointsTo of all nodes in the defer - edge web , <nl> - / / / starting at \ p InitialNode . <nl> - / / / If a node in the web already points to another content node , the other <nl> - / / / content node is scheduled to be merged with \ p pointsTo . <nl> - void updatePointsTo ( CGNode * InitialNode , CGNode * pointsTo ) ; <nl> + / / / Transitively update pointsTo of all nodes in the defer - edge web , <nl> + / / / reaching and reachable from \ p initialNode . All nodes in this defer web <nl> + / / / must already have an initialized ` pointsTo ` . <nl> + void mergePointsTo ( CGNode * initialNode , CGNode * pointsTo ) ; <nl> <nl> / / / Utility function to clear the isInWorkList flags of all nodes in <nl> / / / \ p WorkList . <nl> class EscapeAnalysis : public BottomUpIPAnalysis { <nl> / / / Returns null , if V is not a " pointer " . <nl> CGNode * getNode ( ValueBase * V , bool createIfNeeded = true ) ; <nl> <nl> - / / / Gets or creates a content node to which \ a AddrNode points to during <nl> - / / / initial graph construction . This may not be called after defer edges <nl> - / / / have been created . Doing so would break the invariant that all <nl> - / / / non - content nodes ultimately have a pointsTo edge to a single content <nl> - / / / node . <nl> - CGNode * getContentNode ( CGNode * AddrNode ) ; <nl> + / / / Helper to create a content node and update the pointsTo graph . \ p <nl> + / / / addrNode will point to the new content node . The new content node is <nl> + / / / directly initialized with the remaining function arguments . <nl> + CGNode * createContentNode ( CGNode * addrNode , SILValue addrVal ) ; <nl> + <nl> + / / / Create a new content node based on an existing content node to support <nl> + / / / graph merging . <nl> + / / / <nl> + / / / \ p destAddrNode will point to to new content . The content ' s initial <nl> + / / / state will be initialized based on the \ p srcContent node . <nl> + CGNode * createMergedContent ( CGNode * destAddrNode , CGNode * srcContent ) ; <nl> + <nl> + / / / Get a node represnting the field data within the given RC node . <nl> + CGNode * getFieldContent ( CGNode * rcNode ) ; <nl> <nl> / / / Get or creates a pseudo node for the function return value . <nl> CGNode * getReturnNode ( ) { <nl> class EscapeAnalysis : public BottomUpIPAnalysis { <nl> return Idx ; <nl> } <nl> <nl> - / / / Specifies that the node ' s value escapes to global or unidentified <nl> - / / / memory . <nl> - void setEscapesGlobal ( CGNode * Node ) { <nl> - Node - > mergeEscapeState ( EscapeState : : Global ) ; <nl> - <nl> - / / Make sure to have a content node . Otherwise we may end up not merging <nl> - / / the global - escape state into a caller graph ( only content nodes are <nl> - / / merged ) . Either the node itself is a content node or we let the node <nl> - / / point to one . <nl> - if ( Node - > Type ! = NodeType : : Content ) <nl> - getContentNode ( Node ) ; <nl> + void escapeContentsOf ( CGNode * Node ) { <nl> + CGNode * escapedContent = Node - > getContentNodeOrNull ( ) ; <nl> + if ( ! escapedContent ) { <nl> + escapedContent = createContentNode ( Node , Node - > V ) ; <nl> + } <nl> + escapedContent - > markEscaping ( ) ; <nl> } <nl> <nl> / / / Creates a defer - edge between \ p From and \ p To . <nl> / / / This may trigger node merges to keep the graph invariance 4 ) . <nl> / / / Returns the \ p From node or its merge - target in case \ p From was merged <nl> / / / during adding the edge . <nl> - / / / The \ p EdgeAdded is set to true if there was no defer - edge between <nl> - / / / \ p From and \ p To , yet . <nl> - CGNode * defer ( CGNode * From , CGNode * To , bool & EdgeAdded ) { <nl> - if ( addDeferEdge ( From , To ) ) <nl> - EdgeAdded = true ; <nl> - mergeAllScheduledNodes ( ) ; <nl> - return From - > getMergeTarget ( ) ; <nl> - } <nl> + / / / \ p Changed is set to true if a defer edge was added or any nodes were <nl> + / / / merged . <nl> + CGNode * defer ( CGNode * From , CGNode * To , bool & Changed ) ; <nl> <nl> / / / Creates a defer - edge between \ p From and \ p To . <nl> / / / This may trigger node merges to keep the graph invariance 4 ) . <nl> class EscapeAnalysis : public BottomUpIPAnalysis { <nl> void dumpCG ( ) const ; <nl> <nl> / / / Checks if the graph is OK . <nl> - void verify ( ) const ; <nl> + void verify ( bool allowMerge = false ) const ; <nl> <nl> / / / Just verifies the graph structure . This function can also be called <nl> / / / during the graph is modified , e . g . in mergeAllScheduledNodes ( ) . <nl> class EscapeAnalysis : public BottomUpIPAnalysis { <nl> SILValue getPointerRoot ( SILValue value ) const ; <nl> <nl> / / / If \ p pointer is a pointer , set it to global escaping . <nl> - void setEscapesGlobal ( ConnectionGraph * ConGraph , ValueBase * pointer ) { <nl> - if ( CGNode * Node = ConGraph - > getNode ( pointer ) ) <nl> - ConGraph - > setEscapesGlobal ( Node ) ; <nl> + void setEscapesGlobal ( ConnectionGraph * conGraph , ValueBase * pointer ) { <nl> + CGNode * Node = conGraph - > getNode ( pointer ) ; <nl> + if ( ! Node ) <nl> + return ; <nl> + <nl> + if ( Node - > isContent ( ) ) { <nl> + Node - > markEscaping ( ) ; <nl> + return ; <nl> + } <nl> + Node - > mergeEscapeState ( EscapeState : : Global ) ; <nl> + <nl> + / / Make sure to have a content node . Otherwise we may end up not merging <nl> + / / the global - escape state into a caller graph ( only content nodes are <nl> + / / merged ) . Either the node itself is a content node or we let the node <nl> + / / point to one . <nl> + conGraph - > escapeContentsOf ( Node ) ; <nl> } <nl> <nl> / / / Gets or creates FunctionEffects for \ p F . <nl> class EscapeAnalysis : public BottomUpIPAnalysis { <nl> return FInfo ; <nl> } <nl> <nl> + / / / Get or create the node representing the memory pointed to by \ p <nl> + / / / addrVal . If \ p addrVal is an address , then return the content node for the <nl> + / / / variable ' s memory . Otherwise , \ p addrVal may contain a reference , so <nl> + / / / return the content node for the referenced heap object . <nl> + / / / <nl> + / / / Note that \ p addrVal cannot be an address within a heap object , such as <nl> + / / / an address from ref_element_addr or project_box . <nl> + CGNode * getValueContent ( ConnectionGraph * conGraph , SILValue addrVal ) ; <nl> + <nl> / / / Build a connection graph for reach callee from the callee list . <nl> bool buildConnectionGraphForCallees ( SILInstruction * Caller , <nl> CalleeList Callees , <nl> mmm a / lib / SILOptimizer / Analysis / EscapeAnalysis . cpp <nl> ppp b / lib / SILOptimizer / Analysis / EscapeAnalysis . cpp <nl> <nl> using namespace swift ; <nl> using CGNode = EscapeAnalysis : : CGNode ; <nl> <nl> + static llvm : : cl : : opt < bool > EnableInternalVerify ( <nl> + " escapes - internal - verify " , <nl> + llvm : : cl : : desc ( " Enable internal verification of escape analysis " ) , <nl> + llvm : : cl : : init ( false ) ) ; <nl> + <nl> / / Returns true if \ p Ty recursively contains a reference . If \ p mustBeRef is <nl> / / true , only return true if the type is guaranteed to hold a reference . If \ p <nl> / / mustBeRef is false , only return false if the type is guaranteed not to hold a <nl> SILValue EscapeAnalysis : : getPointerBase ( SILValue value ) const { <nl> return SILValue ( ) ; <nl> return TEI - > getOperand ( ) ; <nl> } <nl> + case ValueKind : : StructInst : <nl> + case ValueKind : : TupleInst : <nl> + case ValueKind : : EnumInst : { <nl> + / / Allow a single - operand aggregate to share its operand ' s node . <nl> + auto * SVI = cast < SingleValueInstruction > ( value ) ; <nl> + SILValue pointerOperand ; <nl> + for ( SILValue opV : SVI - > getOperandValues ( ) ) { <nl> + if ( ! isPointer ( opV ) ) <nl> + continue ; <nl> + <nl> + if ( pointerOperand ) <nl> + return SILValue ( ) ; <nl> + <nl> + pointerOperand = opV ; <nl> + } <nl> + return pointerOperand ; <nl> + } <nl> default : <nl> return SILValue ( ) ; <nl> } <nl> EscapeAnalysis : : ConnectionGraph : : getNode ( ValueBase * V , bool createIfNeeded ) { <nl> return Node - > getMergeTarget ( ) ; <nl> } <nl> <nl> - EscapeAnalysis : : CGNode * EscapeAnalysis : : ConnectionGraph : : getContentNode ( <nl> - CGNode * AddrNode ) { <nl> - / / Do we already have a content node ( which is not necessarily an immediate <nl> - / / successor of AddrNode ) ? <nl> - if ( AddrNode - > pointsTo ) <nl> - return AddrNode - > pointsTo ; <nl> + CGNode * EscapeAnalysis : : ConnectionGraph : : defer ( CGNode * From , CGNode * To , <nl> + bool & Changed ) { <nl> + if ( ! From - > canAddDeferred ( To ) ) <nl> + return From ; <nl> <nl> - CGNode * Node = allocNode ( AddrNode - > V , NodeType : : Content ) ; <nl> - updatePointsTo ( AddrNode , Node ) ; <nl> - assert ( ToMerge . empty ( ) & & <nl> - " Initially setting pointsTo should not require any node merges " ) ; <nl> - return Node ; <nl> + CGNode * FromPointsTo = From - > pointsTo ; <nl> + CGNode * ToPointsTo = To - > pointsTo ; <nl> + / / If necessary , merge nodes while the graph is still in a valid state . <nl> + if ( FromPointsTo & & ToPointsTo & & FromPointsTo ! = ToPointsTo ) { <nl> + / / We are adding an edge between two pointers which point to different <nl> + / / content nodes . This will require merging the content nodes ( and maybe <nl> + / / other content nodes as well ) , because of the graph invariance 4 ) . <nl> + / / <nl> + / / Once the pointee ' s are merged , the defer edge can be added without <nl> + / / creating an inconsistency . <nl> + scheduleToMerge ( FromPointsTo , ToPointsTo ) ; <nl> + mergeAllScheduledNodes ( ) ; <nl> + Changed = true ; <nl> + } <nl> + / / ' From ' and ' To ' may have been merged , so addDeferred may no longer succeed . <nl> + if ( From - > getMergeTarget ( ) - > addDeferred ( To - > getMergeTarget ( ) ) ) <nl> + Changed = true ; <nl> + <nl> + / / If pointsTo on either side of the defer was uninitialized , initialize that <nl> + / / side of the defer web . Do this after adding the new edge to avoid creating <nl> + / / useless pointsTo edges . <nl> + if ( ! FromPointsTo & & ToPointsTo ) <nl> + initializePointsTo ( From , ToPointsTo ) ; <nl> + else if ( FromPointsTo & & ! ToPointsTo ) <nl> + initializePointsTo ( To , FromPointsTo ) ; <nl> + <nl> + return From - > getMergeTarget ( ) ; <nl> } <nl> <nl> - bool EscapeAnalysis : : ConnectionGraph : : addDeferEdge ( CGNode * From , CGNode * To ) { <nl> - if ( ! From - > addDeferred ( To ) ) <nl> - return false ; <nl> + / / Precondition : The pointsTo fields of all nodes in initializeNode ' s defer web <nl> + / / are either uninitialized or already initialized to newPointsTo . <nl> + void EscapeAnalysis : : ConnectionGraph : : initializePointsTo ( CGNode * initialNode , <nl> + CGNode * newPointsTo , <nl> + bool createEdge ) { <nl> + / / Track nodes that require pointsTo edges . <nl> + llvm : : SmallVector < CGNode * , 4 > pointsToEdges ; <nl> + <nl> + / / Step 1 : Visit each node that reaches or is reachable via defer edges until <nl> + / / reaching a node with the newPointsTo or with a proper pointsTo edge . <nl> + <nl> + / / A worklist to gather updated nodes in the defer web . <nl> + CGNodeWorklist updatedNodes ( this ) ; <nl> + updatedNodes . push ( initialNode ) ; <nl> + if ( createEdge ) <nl> + pointsToEdges . push_back ( initialNode ) ; <nl> + unsigned updateCount = 1 ; <nl> + assert ( updateCount = = updatedNodes . size ( ) ) ; <nl> + / / Augment the worlist with the nodes that were reached via backward <nl> + / / traversal . It ' s not as precise as DFS , but helps avoid redundant pointsTo <nl> + / / edges in most cases . <nl> + llvm : : SmallPtrSet < CGNode * , 8 > backwardReachable ; <nl> + <nl> + auto visitDeferTarget = [ & ] ( CGNode * node , bool isSuccessor ) { <nl> + if ( updatedNodes . contains ( node ) ) <nl> + return true ; <nl> <nl> - CGNode * FromPointsTo = From - > pointsTo ; <nl> - CGNode * ToPointsTo = To - > pointsTo ; <nl> - if ( FromPointsTo ! = ToPointsTo ) { <nl> - if ( ! ToPointsTo ) { <nl> - updatePointsTo ( To , FromPointsTo - > getMergeTarget ( ) ) ; <nl> - assert ( ToMerge . empty ( ) & & <nl> - " Initially setting pointsTo should not require any node merges " ) ; <nl> - } else { <nl> - / / We are adding an edge between two pointers which point to different <nl> - / / content nodes . This will require to merge the content nodes ( and maybe <nl> - / / other content nodes as well ) , because of the graph invariance 4 ) . <nl> - updatePointsTo ( From , ToPointsTo - > getMergeTarget ( ) ) ; <nl> + if ( node - > pointsTo ) { <nl> + assert ( node - > pointsTo = = newPointsTo ) ; <nl> + / / Since this node already had a pointsTo , it must reach a pointsTo <nl> + / / edge . Stop traversing the defer - web here - - this is complete becaused <nl> + / / nodes are initialized one at a time , each time a new defer edge is <nl> + / / created . If this were not complete , then the backward traversal below <nl> + / / in Step 2 could reach uninitialized nodes not seen here in Step 1 . <nl> + pointsToEdges . push_back ( node ) ; <nl> + return true ; <nl> } <nl> - } <nl> - return true ; <nl> + + + updateCount ; <nl> + if ( node - > defersTo . empty ( ) ) { <nl> + / / If this node is the end of a defer - edge path with no pointsTo <nl> + / / edge . Create a " fake " pointsTo edge to maintain the graph invariant <nl> + / / ( this changes the structure of the graph but adding this edge has no <nl> + / / effect on the process of merging nodes or creating new defer edges ) . <nl> + pointsToEdges . push_back ( node ) ; <nl> + } <nl> + updatedNodes . push ( node ) ; <nl> + if ( ! isSuccessor ) <nl> + backwardReachable . insert ( node ) ; <nl> + <nl> + return true ; <nl> + } ; <nl> + / / updatedNodes may grow during this loop . <nl> + unsigned nextUpdatedNodeIdx = 0 ; <nl> + for ( ; nextUpdatedNodeIdx < updatedNodes . size ( ) ; + + nextUpdatedNodeIdx ) <nl> + updatedNodes [ nextUpdatedNodeIdx ] - > visitDefers ( visitDeferTarget ) ; <nl> + / / Reset this worklist so others can be used , but updateNode . nodeVector still <nl> + / / holds all the nodes found by step 1 . <nl> + updatedNodes . reset ( ) ; <nl> + <nl> + / / Step 2 : Update pointsTo fields by propagating backward from nodes that <nl> + / / already have a pointsTo edge . <nl> + assert ( nextUpdatedNodeIdx = = updatedNodes . size ( ) ) ; <nl> + - - nextUpdatedNodeIdx ; <nl> + bool processBackwardReachable = false ; <nl> + do { <nl> + while ( ! pointsToEdges . empty ( ) ) { <nl> + CGNode * edgeNode = pointsToEdges . pop_back_val ( ) ; <nl> + if ( ! edgeNode - > pointsTo ) { <nl> + edgeNode - > setPointsToEdge ( newPointsTo ) ; <nl> + newPointsTo - > mergeUsePoints ( edgeNode ) ; <nl> + assert ( updateCount - - ) ; <nl> + } <nl> + / / If edgeNode is already set to newPointsTo , it either was already <nl> + / / up - to - date before calling initializePointsTo , or it was visited during <nl> + / / a previous iteration of the backward traversal below . Rather than <nl> + / / distinguish these cases , always retry backward traversal - - it just won ' t <nl> + / / revisit any edges in the later case . <nl> + backwardTraverse ( edgeNode , [ & ] ( Predecessor pred ) { <nl> + if ( pred . getInt ( ) ! = EdgeType : : Defer ) <nl> + return Traversal : : Backtrack ; <nl> + <nl> + CGNode * predNode = pred . getPointer ( ) ; <nl> + if ( predNode - > pointsTo ) { <nl> + assert ( predNode - > pointsTo - > getMergeTarget ( ) = = newPointsTo ) ; <nl> + return Traversal : : Backtrack ; <nl> + } <nl> + predNode - > pointsTo = newPointsTo ; <nl> + newPointsTo - > mergeUsePoints ( predNode ) ; <nl> + assert ( updateCount - - ) ; <nl> + return Traversal : : Follow ; <nl> + } ) ; <nl> + } <nl> + / / For all nodes visited in step 1 , if any node was not backward - reachable <nl> + / / from a pointsTo edge , create an edge for it and restart traversal . <nl> + / / <nl> + / / First process all forward - reachable nodes in backward order , then process <nl> + / / all backwardReachable nodes in forward order . <nl> + while ( nextUpdatedNodeIdx ! = updatedNodes . size ( ) ) { <nl> + CGNode * node = updatedNodes [ nextUpdatedNodeIdx ] ; <nl> + / / When processBackwardReachable = = true , the backwardReachable set is <nl> + / / empty and all forward reachable nodes already have a pointsTo edge . <nl> + if ( ! backwardReachable . count ( node ) ) { <nl> + if ( ! node - > pointsTo ) { <nl> + pointsToEdges . push_back ( node ) ; <nl> + break ; <nl> + } <nl> + } <nl> + if ( processBackwardReachable ) { <nl> + + + nextUpdatedNodeIdx ; <nl> + continue ; <nl> + } <nl> + if ( nextUpdatedNodeIdx > 0 ) { <nl> + - - nextUpdatedNodeIdx ; <nl> + continue ; <nl> + } <nl> + / / reverse direction <nl> + backwardReachable . clear ( ) ; <nl> + processBackwardReachable = true ; <nl> + } <nl> + / / This outer loop is exceedingly unlikely to execute more than twice . <nl> + } while ( ! pointsToEdges . empty ( ) ) ; <nl> + assert ( updateCount = = 0 ) ; <nl> } <nl> <nl> void EscapeAnalysis : : ConnectionGraph : : mergeAllScheduledNodes ( ) { <nl> + / / Each merge step is self contained and verifiable , with one exception . When <nl> + / / merging a node that points to itself with a node points to another node , <nl> + / / multiple merge steps are necessary to make the defer web consistent . <nl> + / / Example : <nl> + / / NodeA pointsTo - > From <nl> + / / From defersTo - > NodeA ( an indirect self - cycle ) <nl> + / / To pointsTo - > NodeB <nl> + / / Merged : <nl> + / / NodeA pointsTo - > To <nl> + / / To defersTo - > NodeA ( To * should * pointTo itself ) <nl> + / / To pointsTo - > NodeB ( but still has a pointsTo edge to NodeB ) <nl> while ( ! ToMerge . empty ( ) ) { <nl> + if ( EnableInternalVerify ) <nl> + verify ( / * allowMerge = * / true ) ; <nl> + <nl> CGNode * From = ToMerge . pop_back_val ( ) ; <nl> CGNode * To = From - > getMergeTarget ( ) ; <nl> assert ( To ! = From & & " Node scheduled to merge but no merge target set " ) ; <nl> void EscapeAnalysis : : ConnectionGraph : : mergeAllScheduledNodes ( ) { <nl> assert ( From - > Type = = NodeType : : Content & & " Can only merge content nodes " ) ; <nl> assert ( To - > Type = = NodeType : : Content & & " Can only merge content nodes " ) ; <nl> <nl> - / / Unlink the predecessors and redirect the incoming pointsTo edge . <nl> - / / Note : we don ' t redirect the defer - edges because we don ' t want to trigger <nl> - / / updatePointsTo ( which is called by addDeferEdge ) right now . <nl> + / / Redirect the incoming pointsTo edge and unlink the defer predecessors . <nl> + / / <nl> + / / Don ' t redirect the defer - edges because it may trigger mergePointsTo ( ) or <nl> + / / initializePointsTo ( ) . By ensuring that ' From ' is unreachable first , the <nl> + / / graph appears consistent during those operations . <nl> for ( Predecessor Pred : From - > Preds ) { <nl> CGNode * PredNode = Pred . getPointer ( ) ; <nl> if ( Pred . getInt ( ) = = EdgeType : : PointsTo ) { <nl> - assert ( PredNode - > getPointsToEdge ( ) = = From & & <nl> - " Incoming pointsTo edge not set in predecessor " ) ; <nl> + assert ( PredNode - > getPointsToEdge ( ) = = From <nl> + & & " Incoming pointsTo edge not set in predecessor " ) ; <nl> if ( PredNode ! = From ) <nl> PredNode - > setPointsToEdge ( To ) ; <nl> } else { <nl> assert ( PredNode ! = From ) ; <nl> auto Iter = PredNode - > findDeferred ( From ) ; <nl> - assert ( Iter ! = PredNode - > defersTo . end ( ) & & <nl> - " Incoming defer - edge not found in predecessor ' s defer list " ) ; <nl> + assert ( Iter ! = PredNode - > defersTo . end ( ) <nl> + & & " Incoming defer - edge not found in predecessor ' s defer list " ) ; <nl> PredNode - > defersTo . erase ( Iter ) ; <nl> } <nl> } <nl> - / / Unlink and redirect the outgoing pointsTo edge . <nl> - if ( CGNode * PT = From - > getPointsToEdge ( ) ) { <nl> - if ( PT ! = From ) { <nl> - PT - > removeFromPreds ( Predecessor ( From , EdgeType : : PointsTo ) ) ; <nl> - } else { <nl> - PT = To ; <nl> - } <nl> - if ( CGNode * ExistingPT = To - > getPointsToEdge ( ) ) { <nl> - / / The To node already has an outgoing pointsTo edge , so the only thing <nl> - / / we can do is to merge both content nodes . <nl> - scheduleToMerge ( ExistingPT , PT ) ; <nl> - } else { <nl> - To - > setPointsToEdge ( PT ) ; <nl> - } <nl> - } <nl> / / Unlink the outgoing defer edges . <nl> for ( CGNode * Defers : From - > defersTo ) { <nl> assert ( Defers ! = From & & " defer edge may not form a self - cycle " ) ; <nl> Defers - > removeFromPreds ( Predecessor ( From , EdgeType : : Defer ) ) ; <nl> } <nl> - / / Redirect the incoming defer edges . This may trigger other node merges . <nl> - / / Note that the Pred iterator may be invalidated ( because we may add <nl> - / / edges in the loop ) . So we don ' t do : for ( Pred : From - > Preds ) { . . . } <nl> - for ( unsigned PredIdx = 0 ; PredIdx < From - > Preds . size ( ) ; + + PredIdx ) { <nl> - CGNode * PredNode = From - > Preds [ PredIdx ] . getPointer ( ) ; <nl> - if ( From - > Preds [ PredIdx ] . getInt ( ) = = EdgeType : : Defer ) { <nl> - assert ( PredNode ! = From & & " defer edge may not form a self - cycle " ) ; <nl> - addDeferEdge ( PredNode , To ) ; <nl> - } <nl> - } <nl> - / / Redirect the outgoing defer edges , which may also trigger other node <nl> - / / merges . <nl> - for ( CGNode * Defers : From - > defersTo ) { <nl> - addDeferEdge ( To , Defers ) ; <nl> - } <nl> - / / There is no point in updating the pointsTo if the To node will be <nl> - / / merged to another node eventually . <nl> - if ( ! To - > mergeTo ) { <nl> - / / Ensure that graph invariance 4 ) is kept . At this point there may be still <nl> - / / some violations because of the new adjacent edges of the To node . <nl> - for ( unsigned PredIdx = 0 ; PredIdx < To - > Preds . size ( ) ; + + PredIdx ) { <nl> - if ( To - > Preds [ PredIdx ] . getInt ( ) = = EdgeType : : PointsTo ) { <nl> - CGNode * PredNode = To - > Preds [ PredIdx ] . getPointer ( ) ; <nl> - for ( unsigned PPIdx = 0 ; PPIdx < PredNode - > Preds . size ( ) ; + + PPIdx ) { <nl> - if ( PredNode - > Preds [ PPIdx ] . getInt ( ) = = EdgeType : : Defer ) <nl> - updatePointsTo ( PredNode - > Preds [ PPIdx ] . getPointer ( ) , To ) ; <nl> - } <nl> - for ( CGNode * Def : PredNode - > defersTo ) { <nl> - updatePointsTo ( Def , To ) ; <nl> - } <nl> - } <nl> - } <nl> - if ( CGNode * ToPT = To - > getPointsToEdge ( ) ) { <nl> - ToPT = ToPT - > getMergeTarget ( ) ; <nl> - for ( CGNode * ToDef : To - > defersTo ) { <nl> - updatePointsTo ( ToDef , ToPT ) ; <nl> - assert ( ! ToPT - > mergeTo ) ; <nl> - } <nl> - for ( unsigned PredIdx = 0 ; PredIdx < To - > Preds . size ( ) ; + + PredIdx ) { <nl> - if ( To - > Preds [ PredIdx ] . getInt ( ) = = EdgeType : : Defer ) <nl> - updatePointsTo ( To - > Preds [ PredIdx ] . getPointer ( ) , ToPT ) ; <nl> + / / Handle self - cycles on From by creating a self - cycle at To . <nl> + auto redirectPointsTo = [ & ] ( CGNode * pointsTo ) { <nl> + return ( pointsTo = = From ) ? To : pointsTo ; <nl> + } ; <nl> + / / Redirect the outgoing From - > pointsTo edge . <nl> + if ( From - > pointsToIsEdge ) { <nl> + From - > pointsTo - > removeFromPreds ( Predecessor ( From , EdgeType : : PointsTo ) ) ; <nl> + if ( To - > pointsToIsEdge ) { <nl> + / / If ' To ' had a pointsTo edge to ' From ' , then it was redirected above . <nl> + / / Otherwise FromPT and ToPT will be merged below ; nothing to do here . <nl> + assert ( To - > pointsTo ! = From ) ; <nl> + } else { <nl> + / / If ' To ' has no pointsTo at all , initialize its defer web . <nl> + if ( ! To - > pointsTo ) { <nl> + initializePointsToEdge ( To , redirectPointsTo ( From - > pointsTo ) ) ; <nl> + } else { <nl> + / / Upgrade ' To ' s pointsTo to an edge to preserve the fact that ' From ' <nl> + / / had a pointsTo edge . <nl> + To - > pointsToIsEdge = true ; <nl> + To - > pointsTo = redirectPointsTo ( To - > pointsTo ) ; <nl> + To - > pointsTo - > Preds . push_back ( Predecessor ( To , EdgeType : : PointsTo ) ) ; <nl> } <nl> } <nl> - To - > mergeEscapeState ( From - > State ) ; <nl> } <nl> + / / Merge ' From - > pointsTo ' and ' To - > pointsTo ' if needed , regardless of <nl> + / / whether either is a proper edge . Merging may be needed because other <nl> + / / nodes may have points - to edges to From - > PointsTo that won ' t be visited <nl> + / / when updating ' From ' s defer web . <nl> + / / <nl> + / / If To doesn ' t already have a points - to , it will simply be initialized <nl> + / / when updating the merged defer web below . <nl> + if ( CGNode * toPT = To - > pointsTo ) { <nl> + / / If ' To ' already points to ' From ' , then it will already point to ' From ' s <nl> + / / pointTo after merging . An additional merge would be too conservative . <nl> + if ( From - > pointsTo & & toPT ! = From ) <nl> + scheduleToMerge ( redirectPointsTo ( From - > pointsTo ) , toPT ) ; <nl> + } <nl> + / / Redirect adjacent defer edges , and immediately update all points - to <nl> + / / fields in the defer web . <nl> + / / <nl> + / / Calling initializePointsTo may create new pointsTo edges from nodes in <nl> + / / the defer - web . It is unsafe to mutate or query the graph in its currently <nl> + / / inconsistent state . However , this particular case is safe because : <nl> + / / - The graph is only locally inconsistent w . r . t . nodes still connected to <nl> + / / ' From ' via defer edges . <nl> + / / - ' From ' itself is no longer reachable via graph edges ( it may only be <nl> + / / referenced in points - to fields which haven ' t all been updated ) . <nl> + / / - Calling initializePointsTo on one from ' From ' s deferred nodes implies <nl> + / / that all nodes in ' From ' s defer web had a null pointsTo . <nl> + / / - ' To ' s defer web remains consistent each time a new defer edge is <nl> + / / added below . Any of ' To ' s existing deferred nodes either still need to <nl> + / / be initialized or have already been initialized to the same pointsTo . <nl> + / / <nl> + / / Start by updating ' To ' s own pointsTo field . <nl> + if ( To - > pointsTo = = From ) <nl> + mergePointsTo ( To , To ) ; <nl> + <nl> + auto mergeDeferPointsTo = [ & ] ( CGNode * deferred , bool isSuccessor ) { <nl> + assert ( From ! = deferred & & " defer edge may not form a self - cycle " ) ; <nl> + if ( To = = deferred ) <nl> + return true ; <nl> + <nl> + / / In case ' deferred ' points to ' From ' , update its pointsTo before <nl> + / / exposing it to ' To ' s defer web . <nl> + if ( deferred - > pointsTo = = From ) <nl> + mergePointsTo ( deferred , To ) ; <nl> + <nl> + if ( isSuccessor ) <nl> + To - > addDeferred ( deferred ) ; <nl> + else <nl> + deferred - > addDeferred ( To ) ; <nl> + <nl> + if ( deferred - > pointsTo & & To - > pointsTo ) <nl> + mergePointsTo ( deferred , To - > pointsTo ) ; <nl> + else if ( deferred - > pointsTo ) <nl> + initializePointsTo ( To , deferred - > pointsTo ) ; <nl> + else if ( To - > pointsTo ) <nl> + initializePointsTo ( deferred , To - > pointsTo ) ; <nl> + <nl> + return true ; <nl> + } ; <nl> + / / Redirect the adjacent defer edges . <nl> + From - > visitDefers ( mergeDeferPointsTo ) ; <nl> + <nl> + / / Update the web of nodes that originally pointed to ' From ' via ' From ' s old <nl> + / / pointsTo predecessors ( which are now attached to ' To ' ) . <nl> + for ( unsigned PredIdx = 0 ; PredIdx < To - > Preds . size ( ) ; + + PredIdx ) { <nl> + auto predEdge = To - > Preds [ PredIdx ] ; <nl> + if ( predEdge . getInt ( ) ! = EdgeType : : PointsTo ) <nl> + continue ; <nl> + predEdge . getPointer ( ) - > visitDefers ( <nl> + [ & ] ( CGNode * deferred , bool / * isSucc * / ) { <nl> + mergePointsTo ( deferred , To ) ; <nl> + return true ; <nl> + } ) ; <nl> + } <nl> + To - > mergeEscapeState ( From - > State ) ; <nl> + <nl> / / Cleanup the merged node . <nl> From - > isMerged = true ; <nl> From - > Preds . clear ( ) ; <nl> From - > defersTo . clear ( ) ; <nl> From - > pointsTo = nullptr ; <nl> } <nl> + if ( EnableInternalVerify ) <nl> + verify ( / * allowMerge = * / true ) ; <nl> } <nl> <nl> - void EscapeAnalysis : : ConnectionGraph : : <nl> - updatePointsTo ( CGNode * InitialNode , CGNode * pointsTo ) { <nl> - / / Visit all nodes in the defer web , which don ' t have the right pointsTo set . <nl> - assert ( ! pointsTo - > mergeTo ) ; <nl> - llvm : : SmallVector < CGNode * , 8 > WorkList ; <nl> - WorkList . push_back ( InitialNode ) ; <nl> - InitialNode - > isInWorkList = true ; <nl> - bool isInitialSet = false ; <nl> - for ( unsigned Idx = 0 ; Idx < WorkList . size ( ) ; + + Idx ) { <nl> - auto * Node = WorkList [ Idx ] ; <nl> - if ( Node - > pointsTo = = pointsTo ) <nl> - continue ; <nl> - <nl> - if ( Node - > pointsTo ) { <nl> - / / Mismatching : we need to merge ! <nl> - scheduleToMerge ( Node - > pointsTo , pointsTo ) ; <nl> - } else { <nl> - isInitialSet = true ; <nl> - } <nl> + / / As a result of a merge , update the pointsTo field of initialNode and <nl> + / / everything in its defer web to newPointsTo . <nl> + / / <nl> + / / This may modify the graph by redirecting a pointsTo edges . <nl> + void EscapeAnalysis : : ConnectionGraph : : mergePointsTo ( CGNode * initialNode , <nl> + CGNode * newPointsTo ) { <nl> + CGNode * oldPointsTo = initialNode - > pointsTo ; <nl> + assert ( oldPointsTo & & " merging content should not initialize any pointsTo " ) ; <nl> + if ( oldPointsTo = = newPointsTo ) <nl> + return ; <nl> <nl> - / / If the node already has a pointsTo _edge_ we don ' t change it ( we don ' t <nl> - / / want to change the structure of the graph at this point ) . <nl> - if ( ! Node - > pointsToIsEdge ) { <nl> - if ( Node - > defersTo . empty ( ) ) { <nl> - / / This node is the end of a defer - edge path with no pointsTo connected . <nl> - / / We create an edge to pointsTo ( agreed , this changes the structure of <nl> - / / the graph but adding this edge is harmless ) . <nl> - Node - > setPointsToEdge ( pointsTo ) ; <nl> - } else { <nl> - Node - > pointsTo = pointsTo ; <nl> - } <nl> - / / Update use - points if the use - point information is already calculated . <nl> - pointsTo - > mergeUsePoints ( Node ) ; <nl> - } <nl> + CGNodeWorklist updateNodes ( this ) ; <nl> + auto updatePointsTo = [ & ] ( CGNode * node ) { <nl> + if ( node - > pointsTo = = newPointsTo ) <nl> + return ; <nl> + / / If the original graph was : ' node - > From - > To - > newPointsTo ' or <nl> + / / ' node - > From - > From ' , then node is already be updated to point to <nl> + / / ' To ' and ' To ' must be merged with newPointsTo . We must still update <nl> + / / pointsTo so that all nodes in the defer web have the same pointsTo . <nl> + assert ( node - > pointsTo = = oldPointsTo <nl> + | | node - > pointsTo - > getMergeTarget ( ) = = newPointsTo ) ; <nl> + if ( node - > pointsToIsEdge ) { <nl> + node - > pointsTo - > removeFromPreds ( Predecessor ( node , EdgeType : : PointsTo ) ) ; <nl> + node - > setPointsToEdge ( newPointsTo ) ; <nl> + } else <nl> + node - > pointsTo = newPointsTo ; <nl> + updateNodes . push ( node ) ; <nl> + } ; <nl> + updatePointsTo ( initialNode ) ; <nl> <nl> - / / Add all adjacent nodes to the WorkList . <nl> - for ( auto * Deferred : Node - > defersTo ) { <nl> - if ( ! Deferred - > isInWorkList ) { <nl> - WorkList . push_back ( Deferred ) ; <nl> - Deferred - > isInWorkList = true ; <nl> - } <nl> - } <nl> - for ( Predecessor Pred : Node - > Preds ) { <nl> - if ( Pred . getInt ( ) = = EdgeType : : Defer ) { <nl> - CGNode * PredNode = Pred . getPointer ( ) ; <nl> - if ( ! PredNode - > isInWorkList ) { <nl> - WorkList . push_back ( PredNode ) ; <nl> - PredNode - > isInWorkList = true ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - if ( isInitialSet ) { <nl> - / / Here we handle a special case : all defer - edge paths must eventually end <nl> - / / in a points - to edge to pointsTo . We ensure this by setting the edge on <nl> - / / nodes which have no defer - successors ( see above ) . But this does not cover <nl> - / / the case where there is a terminating cycle in the defer - edge path , <nl> - / / e . g . A - > B - > C - > B <nl> - / / We find all nodes which don ' t reach a points - to edge and add additional <nl> - / / points - to edges to fix that . <nl> - llvm : : SmallVector < CGNode * , 8 > PotentiallyInCycles ; <nl> - <nl> - / / Keep all nodes with a points - to edge in the WorkList and remove all other <nl> - / / nodes . <nl> - unsigned InsertionPoint = 0 ; <nl> - for ( CGNode * Node : WorkList ) { <nl> - if ( Node - > pointsToIsEdge ) { <nl> - WorkList [ InsertionPoint + + ] = Node ; <nl> - } else { <nl> - Node - > isInWorkList = false ; <nl> - PotentiallyInCycles . push_back ( Node ) ; <nl> - } <nl> - } <nl> - WorkList . set_size ( InsertionPoint ) ; <nl> - unsigned Idx = 0 ; <nl> - while ( ! PotentiallyInCycles . empty ( ) ) { <nl> - <nl> - / / Propagate the " reaches - a - points - to - edge " backwards in the defer - edge <nl> - / / sub - graph by adding those nodes to the WorkList . <nl> - while ( Idx < WorkList . size ( ) ) { <nl> - auto * Node = WorkList [ Idx + + ] ; <nl> - for ( Predecessor Pred : Node - > Preds ) { <nl> - if ( Pred . getInt ( ) = = EdgeType : : Defer ) { <nl> - CGNode * PredNode = Pred . getPointer ( ) ; <nl> - if ( ! PredNode - > isInWorkList ) { <nl> - WorkList . push_back ( PredNode ) ; <nl> - PredNode - > isInWorkList = true ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - / / Check if we still have some nodes which don ' t reach a points - to edge , <nl> - / / i . e . points not yet in the WorkList . <nl> - while ( ! PotentiallyInCycles . empty ( ) ) { <nl> - auto * Node = PotentiallyInCycles . pop_back_val ( ) ; <nl> - if ( ! Node - > isInWorkList ) { <nl> - / / We create a points - to edge for the first node which doesn ' t reach <nl> - / / a points - to edge yet . <nl> - Node - > setPointsToEdge ( pointsTo ) ; <nl> - WorkList . push_back ( Node ) ; <nl> - Node - > isInWorkList = true ; <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - clearWorkListFlags ( WorkList ) ; <nl> + / / Visit each node that reaches or is reachable via defer edges until reaching <nl> + / / a node with the newPointsTo . <nl> + auto visitDeferTarget = [ & ] ( CGNode * node , bool / * isSuccessor * / ) { <nl> + if ( ! updateNodes . contains ( node ) ) <nl> + updatePointsTo ( node ) ; <nl> + return true ; <nl> + } ; <nl> + for ( unsigned Idx = 0 ; Idx < updateNodes . size ( ) ; + + Idx ) <nl> + updateNodes [ Idx ] - > visitDefers ( visitDeferTarget ) ; <nl> } <nl> <nl> void EscapeAnalysis : : ConnectionGraph : : propagateEscapeStates ( ) { <nl> void EscapeAnalysis : : ConnectionGraph : : computeUsePoints ( ) { <nl> } while ( Changed ) ; <nl> } <nl> <nl> + CGNode * EscapeAnalysis : : ConnectionGraph : : createContentNode ( CGNode * addrNode , <nl> + SILValue addrVal ) { <nl> + CGNode * newContent = allocNode ( addrVal , NodeType : : Content ) ; <nl> + initializePointsToEdge ( addrNode , newContent ) ; <nl> + assert ( ToMerge . empty ( ) <nl> + & & " Initially setting pointsTo should not require any node merges " ) ; <nl> + return newContent ; <nl> + } <nl> + <nl> + / / Create a content node for merging based on an address node in the destination <nl> + / / graph and a content node in the source graph . <nl> + CGNode * <nl> + EscapeAnalysis : : ConnectionGraph : : createMergedContent ( CGNode * destAddrNode , <nl> + CGNode * srcContent ) { <nl> + / / destAddrNode may itself be a content node , so its value may be null . Since <nl> + / / we don ' t have the original pointer value , build a new content node based <nl> + / / on the source content . <nl> + / / <nl> + / / TODO : node properties will come from ` srcContent ` here . . . <nl> + return createContentNode ( destAddrNode , destAddrNode - > V ) ; <nl> + } <nl> + <nl> + / / Get a node representing the field data within the given reference - counted <nl> + / / node . The caller has already determined that rcNode represents the head of a <nl> + / / heap object rather than field content or the address of a local variable or <nl> + / / argument . <nl> + CGNode * EscapeAnalysis : : ConnectionGraph : : getFieldContent ( CGNode * rcNode ) { <nl> + assert ( rcNode - > isContent ( ) ) ; <nl> + if ( rcNode - > pointsTo ) <nl> + return rcNode - > pointsTo ; <nl> + <nl> + return createContentNode ( rcNode , rcNode - > V ) ; <nl> + } <nl> + <nl> bool EscapeAnalysis : : ConnectionGraph : : mergeFrom ( ConnectionGraph * SourceGraph , <nl> CGNodeMap & Mapping ) { <nl> / / The main point of the merging algorithm is to map each content node in the <nl> bool EscapeAnalysis : : ConnectionGraph : : mergeFrom ( ConnectionGraph * SourceGraph , <nl> if ( ! SourcePT ) <nl> continue ; <nl> <nl> - CGNode * MappedDestPT = Mapping . get ( SourcePT ) ; <nl> - if ( ! DestNd - > pointsTo ) { <nl> - / / The following getContentNode ( ) will create a new content node . <nl> + CGNode * DestPT = DestNd - > pointsTo ; <nl> + if ( ! DestPT ) { <nl> + DestPT = createMergedContent ( DestNd , SourcePT ) ; <nl> Changed = true ; <nl> } <nl> - CGNode * DestPT = getContentNode ( DestNd ) ; <nl> - if ( MappedDestPT ) { <nl> - / / We already found the destination node through another path . <nl> - if ( DestPT ! = MappedDestPT ) { <nl> - / / There are two content nodes in this graph which map to the same <nl> - / / content node in the source graph - > we have to merge them . <nl> - scheduleToMerge ( DestPT , MappedDestPT ) ; <nl> - mergeAllScheduledNodes ( ) ; <nl> - Changed = true ; <nl> - NodesMerged = true ; <nl> - } <nl> - assert ( SourcePT - > isInWorkList ) ; <nl> - } else { <nl> - / / It ' s the first time we see the destination node , so we add it to the <nl> - / / mapping . <nl> + CGNode * MappedDestPT = Mapping . get ( SourcePT ) ; <nl> + if ( ! MappedDestPT ) { <nl> + / / This is the first time the dest node is seen ; just add the mapping . <nl> Mapping . add ( SourcePT , DestPT ) ; <nl> + continue ; <nl> } <nl> + / / We already found the destination node through another path . <nl> + assert ( Mapping . getMappedNodes ( ) . contains ( SourcePT ) ) ; <nl> + if ( DestPT = = MappedDestPT ) <nl> + continue ; <nl> + <nl> + / / There are two content nodes in this graph which map to the same <nl> + / / content node in the source graph - > we have to merge them . <nl> + scheduleToMerge ( DestPT , MappedDestPT ) ; <nl> + mergeAllScheduledNodes ( ) ; <nl> + Changed = true ; <nl> + NodesMerged = true ; <nl> } <nl> } while ( NodesMerged ) ; <nl> - <nl> - Mapping . getMappedNodes ( ) . reset ( ) ; <nl> + Mapping . getMappedNodes ( ) . reset ( ) ; / / Make way for a different worklist . <nl> <nl> / / Second step : add the source graph ' s defer edges to this graph . <nl> - llvm : : SmallVector < CGNode * , 8 > WorkList ; <nl> for ( CGNode * SourceNd : Mapping . getMappedNodes ( ) . nodeVector ) { <nl> - assert ( WorkList . empty ( ) ) ; <nl> - WorkList . push_back ( SourceNd ) ; <nl> - SourceNd - > isInWorkList = true ; <nl> + CGNodeWorklist Worklist ( SourceGraph ) ; <nl> + Worklist . push ( SourceNd ) ; <nl> CGNode * DestFrom = Mapping . get ( SourceNd ) ; <nl> assert ( DestFrom & & " node should have been merged to the graph " ) ; <nl> <nl> / / Collect all nodes which are reachable from the SourceNd via a path <nl> / / which only contains defer - edges . <nl> - for ( unsigned Idx = 0 ; Idx < WorkList . size ( ) ; + + Idx ) { <nl> - CGNode * SourceReachable = WorkList [ Idx ] ; <nl> + for ( unsigned Idx = 0 ; Idx < Worklist . size ( ) ; + + Idx ) { <nl> + CGNode * SourceReachable = Worklist [ Idx ] ; <nl> CGNode * DestReachable = Mapping . get ( SourceReachable ) ; <nl> / / Create the edge in this graph . Note : this may trigger merging of <nl> / / content nodes . <nl> bool EscapeAnalysis : : ConnectionGraph : : mergeFrom ( ConnectionGraph * SourceGraph , <nl> / / node of the defer - edge to escaping . <nl> Changed | = DestFrom - > mergeEscapeState ( EscapeState : : Global ) ; <nl> } <nl> - <nl> - for ( auto * Deferred : SourceReachable - > defersTo ) { <nl> - if ( ! Deferred - > isInWorkList ) { <nl> - WorkList . push_back ( Deferred ) ; <nl> - Deferred - > isInWorkList = true ; <nl> - } <nl> - } <nl> + for ( auto * Deferred : SourceReachable - > defersTo ) <nl> + Worklist . tryPush ( Deferred ) ; <nl> } <nl> - clearWorkListFlags ( WorkList ) ; <nl> - WorkList . clear ( ) ; <nl> } <nl> return Changed ; <nl> } <nl> void EscapeAnalysis : : ConnectionGraph : : print ( llvm : : raw_ostream & OS ) const { <nl> # endif <nl> } <nl> <nl> - void EscapeAnalysis : : ConnectionGraph : : verify ( ) const { <nl> + / / / Checks an invariant of the connection graph : The points - to nodes of <nl> + / / / the defer - successors must match with the points - to of this node . <nl> + bool CGNode : : matchPointToOfDefers ( bool allowMerge ) const { <nl> + auto redirect = [ allowMerge ] ( CGNode * node ) { <nl> + return ( allowMerge & & node ) ? node - > getMergeTarget ( ) : node ; <nl> + } ; <nl> + for ( CGNode * Def : defersTo ) { <nl> + if ( redirect ( pointsTo ) ! = redirect ( Def - > pointsTo ) ) <nl> + return false ; <nl> + } <nl> + / / / A defer - path in the graph must not end without the specified points - to <nl> + / / / node . <nl> + if ( pointsTo & & ! pointsToIsEdge & & defersTo . empty ( ) ) <nl> + return false ; <nl> + return true ; <nl> + } <nl> + <nl> + void EscapeAnalysis : : ConnectionGraph : : verify ( bool allowMerge ) const { <nl> # ifndef NDEBUG <nl> verifyStructure ( ) ; <nl> <nl> void EscapeAnalysis : : ConnectionGraph : : verify ( ) const { <nl> / / ConnectionGraph invariant # 4 : For any node N , all paths starting at N <nl> / / which consist of only defer - edges and a single trailing points - to edge <nl> / / must lead to the same <nl> - assert ( Nd - > matchPointToOfDefers ( ) ) ; <nl> + assert ( Nd - > matchPointToOfDefers ( allowMerge ) ) ; <nl> } <nl> # endif <nl> } <nl> static bool linkBBArgs ( SILBasicBlock * BB ) { <nl> return true ; <nl> } <nl> <nl> + EscapeAnalysis : : CGNode * <nl> + EscapeAnalysis : : getValueContent ( ConnectionGraph * conGraph , SILValue addrVal ) { <nl> + CGNode * addrNode = conGraph - > getNode ( addrVal ) ; <nl> + if ( ! addrNode ) <nl> + return nullptr ; <nl> + <nl> + if ( CGNode * content = addrNode - > getPointsToEdge ( ) ) <nl> + return content ; <nl> + <nl> + SILValue addrNodeValue = addrNode - > getValueOrNull ( ) ; <nl> + SILValue baseAddr = getPointerRoot ( addrVal ) ; <nl> + if ( addrNode - > isContent ( ) ) { <nl> + / / Try to maintain an invariant that a node with content is a pointer . <nl> + if ( ! isPointer ( addrNodeValue ) & & isPointer ( baseAddr ) ) <nl> + addrNode - > updateValue ( baseAddr ) ; <nl> + } else { <nl> + assert ( isPointer ( addrNodeValue ) ) ; <nl> + assert ( addrNodeValue = = getPointerRoot ( addrVal ) ) ; <nl> + } <nl> + / / Have we already merged a content node ? <nl> + if ( CGNode * content = addrNode - > getContentNodeOrNull ( ) ) { <nl> + / / TODO : Merge node properties here . <nl> + return content ; <nl> + } <nl> + if ( ! isPointer ( baseAddr ) ) <nl> + return nullptr ; <nl> + <nl> + return conGraph - > createContentNode ( addrNode , baseAddr ) ; <nl> + } <nl> + <nl> void EscapeAnalysis : : buildConnectionGraph ( FunctionInfo * FInfo , <nl> FunctionOrder & BottomUpOrder , <nl> int RecursionDepth ) { <nl> void EscapeAnalysis : : analyzeInstruction ( SILInstruction * I , <nl> / / allocated array buffer . The call is like a struct ( buffer ) <nl> / / instruction . <nl> if ( CGNode * BufferNode = ConGraph - > getNode ( FAS . getArgument ( 0 ) ) ) { <nl> - CGNode * ArrayNode = ConGraph - > getNode ( ASC . getCallResult ( ) ) ; <nl> - CGNode * ArrayContent = ConGraph - > getContentNode ( ArrayNode ) ; <nl> + SILValue ArrayBase = ASC . getCallResult ( ) ; <nl> + CGNode * ArrayContent = getValueContent ( ConGraph , ArrayBase ) ; <nl> + assert ( ArrayContent & & " Array base must have a node " ) ; <nl> ConGraph - > defer ( ArrayContent , BufferNode ) ; <nl> } <nl> return ; <nl> } <nl> break ; <nl> case ArrayCallKind : : kGetElement : <nl> - if ( CGNode * AddrNode = ConGraph - > getNode ( ASC . getSelf ( ) ) ) { <nl> - CGNode * DestNode = nullptr ; <nl> + if ( CGNode * ArrayRefNode = getValueContent ( ConGraph , ASC . getSelf ( ) ) ) { <nl> + CGNode * LoadedElement = nullptr ; <nl> / / This is like a load from a ref_element_addr . <nl> if ( ASC . hasGetElementDirectResult ( ) ) { <nl> - DestNode = ConGraph - > getNode ( ASC . getCallResult ( ) ) ; <nl> + LoadedElement = ConGraph - > getNode ( ASC . getCallResult ( ) ) ; <nl> } else { <nl> - CGNode * DestAddrNode = ConGraph - > getNode ( FAS . getArgument ( 0 ) ) ; <nl> - assert ( DestAddrNode & & " indirect result must have node " ) ; <nl> / / The content of the destination address . <nl> - DestNode = ConGraph - > getContentNode ( DestAddrNode ) ; <nl> + LoadedElement = getValueContent ( ConGraph , FAS . getArgument ( 0 ) ) ; <nl> + assert ( LoadedElement & & " indirect result must have node " ) ; <nl> } <nl> - if ( DestNode ) { <nl> - / / One content node for going from the array buffer pointer to <nl> - / / the element address ( like ref_element_addr ) . <nl> - CGNode * RefElement = ConGraph - > getContentNode ( AddrNode ) ; <nl> - / / Another content node to actually load the element . <nl> - CGNode * ArrayContent = ConGraph - > getContentNode ( RefElement ) ; <nl> - ConGraph - > defer ( DestNode , ArrayContent ) ; <nl> + if ( LoadedElement ) { <nl> + CGNode * ArrayElementStorage = <nl> + ConGraph - > getFieldContent ( ArrayRefNode ) ; <nl> + ConGraph - > defer ( LoadedElement , ArrayElementStorage ) ; <nl> return ; <nl> } <nl> } <nl> break ; <nl> case ArrayCallKind : : kGetElementAddress : <nl> / / This is like a ref_element_addr . <nl> - if ( CGNode * SelfNode = ConGraph - > getNode ( ASC . getSelf ( ) ) ) { <nl> - ConGraph - > defer ( ConGraph - > getNode ( ASC . getCallResult ( ) ) , <nl> - ConGraph - > getContentNode ( SelfNode ) ) ; <nl> + if ( CGNode * ArrayRefNode = getValueContent ( ConGraph , ASC . getSelf ( ) ) ) { <nl> + ConGraph - > defer ( ConGraph - > getNode ( ASC . getCallResult ( ) ) , ArrayRefNode ) ; <nl> } <nl> return ; <nl> case ArrayCallKind : : kWithUnsafeMutableBufferPointer : <nl> / / Model this like an escape of the elements of the array and a capture <nl> / / of anything captured by the closure . <nl> / / Self is passed inout . <nl> - if ( CGNode * AddrArrayStruct = ConGraph - > getNode ( ASC . getSelf ( ) ) ) { <nl> - CGNode * ArrayStructValueNode = <nl> - ConGraph - > getContentNode ( AddrArrayStruct ) ; <nl> + if ( CGNode * ArrayStructValue = <nl> + getValueContent ( ConGraph , ASC . getSelf ( ) ) ) { <nl> + <nl> / / One content node for going from the array buffer pointer to <nl> / / the element address ( like ref_element_addr ) . <nl> - CGNode * RefElement = ConGraph - > getContentNode ( ArrayStructValueNode ) ; <nl> - / / Another content node to actually load the element . <nl> - CGNode * ArrayContent = ConGraph - > getContentNode ( RefElement ) ; <nl> - ConGraph - > setEscapesGlobal ( ArrayContent ) ; <nl> + CGNode * ArrayRefNode = ArrayStructValue - > getContentNodeOrNull ( ) ; <nl> + if ( ! ArrayRefNode ) { <nl> + ArrayRefNode = ConGraph - > createContentNode ( <nl> + ArrayStructValue , ArrayStructValue - > getValueOrNull ( ) ) ; <nl> + } <nl> + / / Another content node for the element storage . <nl> + CGNode * ArrayElementStorage = ConGraph - > getFieldContent ( ArrayRefNode ) ; <nl> + ArrayElementStorage - > markEscaping ( ) ; <nl> / / The first non indirect result is the closure . <nl> auto Args = FAS . getArgumentsWithoutIndirectResults ( ) ; <nl> setEscapesGlobal ( ConGraph , Args [ 0 ] ) ; <nl> void EscapeAnalysis : : analyzeInstruction ( SILInstruction * I , <nl> # include " swift / AST / ReferenceStorage . def " <nl> case SILInstructionKind : : StrongReleaseInst : <nl> case SILInstructionKind : : ReleaseValueInst : { <nl> + / / A release instruction may deallocate the pointer operand . This may <nl> + / / capture anything pointed to by the released object , but not the pointer <nl> + / / to the object itself ( because it will be a dangling pointer after <nl> + / / deallocation ) . <nl> SILValue OpV = I - > getOperand ( 0 ) ; <nl> - if ( CGNode * AddrNode = ConGraph - > getNode ( OpV ) ) { <nl> - / / A release instruction may deallocate the pointer operand . This may <nl> - / / capture any content of the released object , but not the pointer to <nl> - / / the object itself ( because it will be a dangling pointer after <nl> - / / deallocation ) . <nl> - CGNode * CapturedByDeinit = ConGraph - > getContentNode ( AddrNode ) ; <nl> - / / Get the content node for the object ' s properties . The object header <nl> - / / itself cannot escape from the deinit . <nl> - CapturedByDeinit = ConGraph - > getContentNode ( CapturedByDeinit ) ; <nl> - if ( deinitIsKnownToNotCapture ( OpV ) ) { <nl> - / / Presumably this is necessary because , even though the deinit <nl> - / / doesn ' t escape the immediate properties of this class , it may <nl> - / / indirectly escape some other memory content ( ? ) <nl> - CapturedByDeinit = ConGraph - > getContentNode ( CapturedByDeinit ) ; <nl> - } <nl> - ConGraph - > setEscapesGlobal ( CapturedByDeinit ) ; <nl> + CGNode * rcContent = getValueContent ( ConGraph , OpV ) ; <nl> + if ( ! rcContent ) <nl> + return ; <nl> + <nl> + CGNode * fieldContent = ConGraph - > getFieldContent ( rcContent ) ; <nl> + if ( ! deinitIsKnownToNotCapture ( OpV ) ) { <nl> + fieldContent - > markEscaping ( ) ; <nl> + return ; <nl> } <nl> + / / This deinit is known to not directly capture it ' s own field content , <nl> + / / however , indirect deinitializers could still capture anything pointed <nl> + / / to by those fields . <nl> + ConGraph - > escapeContentsOf ( fieldContent ) ; <nl> return ; <nl> } <nl> <nl> void EscapeAnalysis : : analyzeInstruction ( SILInstruction * I , <nl> case SILInstructionKind : : Load # # Name # # Inst : <nl> # include " swift / AST / ReferenceStorage . def " <nl> case SILInstructionKind : : LoadInst : <nl> - / / We treat ref_element_addr like a load ( see NodeType : : Content ) . <nl> + assert ( ! cast < SingleValueInstruction > ( I ) - > getType ( ) . isAddress ( ) ) ; <nl> + LLVM_FALLTHROUGH ; <nl> case SILInstructionKind : : RefElementAddrInst : <nl> case SILInstructionKind : : RefTailAddrInst : <nl> case SILInstructionKind : : ProjectBoxInst : <nl> case SILInstructionKind : : InitExistentialAddrInst : <nl> case SILInstructionKind : : OpenExistentialAddrInst : { <nl> + / / Loads and projections into RC objects have a similar pattern : <nl> + / / <nl> + / / For RC object projections , get the non - address reference operand and <nl> + / / return an RC content node that the reference directly points to . It is <nl> + / / as - if the RC content node holds the pointer to the object fields . <nl> + / / <nl> + / / For loads , get the address - type operand and return the content node <nl> + / / that the address directly points to . The load ' s address may itself come <nl> + / / from a ref_element_addr , project_box or open_existential , in which <nl> + / / case , the loaded content will be the field content , not the RC content . <nl> auto SVI = cast < SingleValueInstruction > ( I ) ; <nl> - if ( isPointer ( SVI ) ) { <nl> - CGNode * AddrNode = ConGraph - > getNode ( SVI - > getOperand ( 0 ) ) ; <nl> - if ( ! AddrNode ) { <nl> - / / A load from an address we don ' t handle - > be conservative . <nl> - CGNode * ValueNode = ConGraph - > getNode ( SVI ) ; <nl> - ConGraph - > setEscapesGlobal ( ValueNode ) ; <nl> - return ; <nl> - } <nl> - CGNode * PointsTo = ConGraph - > getContentNode ( AddrNode ) ; <nl> - / / No need for a separate node for the load instruction : <nl> - / / just reuse the content node . <nl> + if ( ! isPointer ( SVI ) ) <nl> + return ; <nl> + <nl> + SILValue pointerVal = SVI - > getOperand ( 0 ) ; <nl> + if ( CGNode * PointsTo = getValueContent ( ConGraph , pointerVal ) ) { <nl> ConGraph - > setNode ( SVI , PointsTo ) ; <nl> + return ; <nl> } <nl> + / / A load or projection from an address we don ' t handle - > be <nl> + / / conservative . <nl> + setEscapesGlobal ( ConGraph , SVI ) ; <nl> return ; <nl> } <nl> case SILInstructionKind : : CopyAddrInst : { <nl> void EscapeAnalysis : : analyzeInstruction ( SILInstruction * I , <nl> } <nl> <nl> / / A copy_addr is like a ' store ( load src ) to dest ' . <nl> - CGNode * SrcAddrNode = ConGraph - > getNode ( I - > getOperand ( CopyAddrInst : : Src ) ) ; <nl> - if ( ! SrcAddrNode ) { <nl> + SILValue srcAddr = I - > getOperand ( CopyAddrInst : : Src ) ; <nl> + CGNode * loadedContent = getValueContent ( ConGraph , srcAddr ) ; <nl> + if ( ! loadedContent ) { <nl> setAllEscaping ( I , ConGraph ) ; <nl> break ; <nl> } <nl> - <nl> - CGNode * LoadedValue = ConGraph - > getContentNode ( SrcAddrNode ) ; <nl> - CGNode * DestAddrNode = <nl> - ConGraph - > getNode ( I - > getOperand ( CopyAddrInst : : Dest ) ) ; <nl> - if ( DestAddrNode ) { <nl> - / / Create a defer - edge from the loaded to the stored value . <nl> - CGNode * PointsTo = ConGraph - > getContentNode ( DestAddrNode ) ; <nl> - ConGraph - > defer ( PointsTo , LoadedValue ) ; <nl> - } else { <nl> - / / A store to an address we don ' t handle - > be conservative . <nl> - ConGraph - > setEscapesGlobal ( LoadedValue ) ; <nl> + SILValue destAddr = I - > getOperand ( CopyAddrInst : : Dest ) ; <nl> + / / Create a defer - edge from the store location to the loaded content . <nl> + if ( CGNode * destContent = getValueContent ( ConGraph , destAddr ) ) { <nl> + ConGraph - > defer ( destContent , loadedContent ) ; <nl> + return ; <nl> } <nl> + / / A store to an address we don ' t handle - > be conservative . <nl> + setEscapesGlobal ( ConGraph , srcAddr ) ; <nl> return ; <nl> } <nl> <nl> # define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE ( Name , . . . ) \ <nl> case SILInstructionKind : : Store # # Name # # Inst : <nl> # include " swift / AST / ReferenceStorage . def " <nl> - case SILInstructionKind : : StoreInst : <nl> - if ( CGNode * ValueNode = <nl> - ConGraph - > getNode ( I - > getOperand ( StoreInst : : Src ) ) ) { <nl> - CGNode * AddrNode = ConGraph - > getNode ( I - > getOperand ( StoreInst : : Dest ) ) ; <nl> - if ( AddrNode ) { <nl> - / / Create a defer - edge from the content to the stored value . <nl> - CGNode * PointsTo = ConGraph - > getContentNode ( AddrNode ) ; <nl> - ConGraph - > defer ( PointsTo , ValueNode ) ; <nl> - } else { <nl> - / / A store to an address we don ' t handle - > be conservative . <nl> - ConGraph - > setEscapesGlobal ( ValueNode ) ; <nl> - } <nl> + case SILInstructionKind : : StoreInst : { <nl> + SILValue srcVal = I - > getOperand ( StoreInst : : Src ) ; <nl> + CGNode * valueNode = ConGraph - > getNode ( srcVal ) ; <nl> + / / If the stored value isn ' t tracked , ignore the store . <nl> + if ( ! valueNode ) <nl> + return ; <nl> + <nl> + / / The store destination content is always one pointsTo level away from <nl> + / / its address . Either the address points to a variable or argument , and <nl> + / / the pointee is removed by a level of pointer indirection , or the <nl> + / / address corresponds is a projection within a reference counted object <nl> + / / ( via ref_element_addr , project_box , or open_existential_addr ) where the <nl> + / / stored field content is chained one level below the RC content . <nl> + SILValue destAddr = I - > getOperand ( StoreInst : : Dest ) ; <nl> + if ( CGNode * pointsTo = getValueContent ( ConGraph , destAddr ) ) { <nl> + / / Create a defer - edge from the content to the stored value . <nl> + ConGraph - > defer ( pointsTo , valueNode ) ; <nl> + return ; <nl> } <nl> + / / A store to an address we don ' t handle - > be conservative . <nl> + setEscapesGlobal ( ConGraph , srcVal ) ; <nl> return ; <nl> + } <nl> case SILInstructionKind : : PartialApplyInst : { <nl> / / The result of a partial_apply is a thick function which stores the <nl> / / boxed partial applied arguments . We create defer - edges from the <nl> / / partial_apply values to the arguments . <nl> auto PAI = cast < PartialApplyInst > ( I ) ; <nl> - CGNode * ResultNode = ConGraph - > getNode ( PAI ) ; <nl> - assert ( ResultNode & & " thick functions must have a CG node " ) ; <nl> - for ( const Operand & Op : PAI - > getAllOperands ( ) ) { <nl> - if ( CGNode * ArgNode = ConGraph - > getNode ( Op . get ( ) ) ) { <nl> - ResultNode = ConGraph - > defer ( ResultNode , ArgNode ) ; <nl> + if ( CGNode * ResultNode = ConGraph - > getNode ( PAI ) ) { <nl> + for ( const Operand & Op : PAI - > getAllOperands ( ) ) { <nl> + if ( CGNode * ArgNode = ConGraph - > getNode ( Op . get ( ) ) ) { <nl> + ResultNode = ConGraph - > defer ( ResultNode , ArgNode ) ; <nl> + } <nl> } <nl> } <nl> return ; <nl> void EscapeAnalysis : : analyzeInstruction ( SILInstruction * I , <nl> case SILInstructionKind : : EnumInst : { <nl> / / Aggregate composition is like assigning the aggregate fields to the <nl> / / resulting aggregate value . <nl> - auto SVI = cast < SingleValueInstruction > ( I ) ; <nl> - CGNode * ResultNode = nullptr ; <nl> - for ( const Operand & Op : SVI - > getAllOperands ( ) ) { <nl> - if ( CGNode * FieldNode = ConGraph - > getNode ( Op . get ( ) ) ) { <nl> - if ( ! ResultNode ) { <nl> - / / A small optimization to reduce the graph size : we re - use the <nl> - / / first field node as result node . <nl> - ConGraph - > setNode ( SVI , FieldNode ) ; <nl> - ResultNode = FieldNode ; <nl> - assert ( isPointer ( SVI ) ) ; <nl> - } else { <nl> - ResultNode = ConGraph - > defer ( ResultNode , FieldNode ) ; <nl> - } <nl> - } <nl> + auto svi = cast < SingleValueInstruction > ( I ) ; <nl> + CGNode * resultNode = ConGraph - > getNode ( svi ) ; <nl> + for ( const Operand & operand : svi - > getAllOperands ( ) ) { <nl> + if ( CGNode * subNode = ConGraph - > getNode ( operand . get ( ) ) ) <nl> + ConGraph - > defer ( resultNode , subNode ) ; <nl> } <nl> return ; <nl> } <nl> void EscapeAnalysis : : analyzeInstruction ( SILInstruction * I , <nl> auto * TEI = cast < TupleExtractInst > ( I ) ; <nl> assert ( isExtractOfArrayUninitializedPointer ( TEI ) <nl> & & " tuple_extract should be handled as projection " ) ; <nl> - CGNode * ArrayNode = ConGraph - > getNode ( TEI - > getOperand ( ) ) ; <nl> - CGNode * ArrayElements = ConGraph - > getContentNode ( ArrayNode ) ; <nl> - ConGraph - > setNode ( TEI , ArrayElements ) ; <nl> + if ( CGNode * ArrayElements = getValueContent ( ConGraph , TEI - > getOperand ( ) ) ) <nl> + ConGraph - > setNode ( TEI , ArrayElements ) ; <nl> return ; <nl> } <nl> case SILInstructionKind : : UncheckedRefCastAddrInst : { <nl> bool EscapeAnalysis : : canEscapeToUsePoint ( SILValue V , SILNode * UsePoint , <nl> / / In this case the apply is only a use - point for V1 and V1 ' s content node . <nl> / / As V1 ' s content node is the same as V ' s content node , we also make the <nl> / / check for the content node . <nl> - CGNode * ContentNode = ConGraph - > getContentNode ( Node ) ; <nl> + CGNode * ContentNode = getValueContent ( ConGraph , V ) ; <nl> if ( ContentNode - > escapesInsideFunction ( V ) ) <nl> return true ; <nl> <nl> bool EscapeAnalysis : : canPointToSameMemory ( SILValue V1 , SILValue V2 ) { <nl> return true ; <nl> <nl> / / Check if both nodes may point to the same content . <nl> - CGNode * Content1 = ConGraph - > getContentNode ( Node1 ) ; <nl> - CGNode * Content2 = ConGraph - > getContentNode ( Node2 ) ; <nl> + CGNode * Content1 = getValueContent ( ConGraph , V1 ) ; <nl> + CGNode * Content2 = getValueContent ( ConGraph , V2 ) ; <nl> <nl> SILType T1 = V1 - > getType ( ) ; <nl> SILType T2 = V2 - > getType ( ) ; <nl> bool EscapeAnalysis : : canPointToSameMemory ( SILValue V1 , SILValue V2 ) { <nl> / / have to go down one content level if just one of the values is a <nl> / / ref - counted object . <nl> if ( T1 . isAddress ( ) & & hasReferenceSemantics ( T2 ) ) { <nl> - Content2 = ConGraph - > getContentNode ( Content2 ) ; <nl> + Content2 = ConGraph - > getFieldContent ( Content2 ) ; <nl> return Content1 = = Content2 ; <nl> } <nl> if ( T2 . isAddress ( ) & & hasReferenceSemantics ( T1 ) ) { <nl> - Content1 = ConGraph - > getContentNode ( Content1 ) ; <nl> + Content1 = ConGraph - > getFieldContent ( Content1 ) ; <nl> return Content1 = = Content2 ; <nl> } <nl> return true ; <nl> mmm a / test / SILOptimizer / escape_analysis . sil <nl> ppp b / test / SILOptimizer / escape_analysis . sil <nl> bb0 ( % 0 : $ Int ) : <nl> / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : % 2 <nl> / / CHECK - NEXT : Arg % 1 Esc : G , Succ : <nl> / / CHECK - NEXT : Val % 2 Esc : A , Succ : ( % 2 . 1 ) <nl> - / / CHECK - NEXT : Con % 2 . 1 Esc : A , Succ : ( % 2 . 2 ) <nl> - / / CHECK - NEXT : Con % 2 . 2 Esc : G , Succ : % 1 <nl> + / / CHECK - NEXT : Con % 2 . 1 Esc : A , Succ : ( % 3 ) <nl> + / / CHECK - NEXT : Con % 3 Esc : G , Succ : % 1 <nl> / / CHECK - NEXT : End <nl> sil @ test_simple : $ @ convention ( thin ) ( @ inout Y , @ owned X ) - > ( ) { <nl> bb0 ( % 0 : $ * Y , % 1 : $ X ) : <nl> bb0 ( % 0 : $ * Y , % 1 : $ X ) : <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 3 . 1 ) <nl> / / CHECK - NEXT : Arg % 1 Esc : A , Succ : <nl> / / CHECK - NEXT : Val % 3 Esc : % 3 , Succ : ( % 3 . 1 ) , % 0 <nl> - / / CHECK - NEXT : Con % 3 . 1 Esc : A , Succ : ( % 3 . 2 ) <nl> - / / CHECK - NEXT : Con % 3 . 2 Esc : A , Succ : % 1 <nl> + / / CHECK - NEXT : Con % 3 . 1 Esc : A , Succ : ( % 4 ) <nl> + / / CHECK - NEXT : Con % 4 Esc : A , Succ : % 1 <nl> / / CHECK - NEXT : Ret Esc : R , Succ : % 0 <nl> / / CHECK - NEXT : End <nl> sil @ deferringEdge : $ @ convention ( thin ) ( @ owned LinkedNode , @ owned LinkedNode ) - > @ owned LinkedNode { <nl> bb0 : <nl> / / CHECK - LABEL : CG of test_linked_list <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 1 . 1 ) <nl> / / CHECK - NEXT : Val % 1 Esc : A , Succ : ( % 1 . 1 ) <nl> - / / CHECK - NEXT : Con % 1 . 1 Esc : A , Succ : ( % 11 . 1 ) <nl> + / / CHECK - NEXT : Con % 1 . 1 Esc : A , Succ : ( % 2 ) <nl> + / / CHECK - NEXT : Con % 2 Esc : A , Succ : % 0 , % 1 , % 4 <nl> / / CHECK - NEXT : Val % 4 Esc : A , Succ : ( % 1 . 1 ) <nl> / / CHECK - NEXT : Val % 7 Esc : % 11 , Succ : ( % 1 . 1 ) <nl> - / / CHECK - NEXT : Val % 11 Esc : % 11 , Succ : ( % 1 . 1 ) , % 7 , % 11 . 1 <nl> - / / CHECK - NEXT : Con % 11 . 1 Esc : A , Succ : ( % 1 . 1 ) , % 0 , % 1 , % 4 <nl> - / / CHECK - NEXT : Ret Esc : R , Succ : % 11 . 1 <nl> + / / CHECK - NEXT : Val % 11 Esc : % 11 , Succ : ( % 1 . 1 ) , % 2 , % 7 <nl> + / / CHECK - NEXT : Ret Esc : R , Succ : % 2 <nl> / / CHECK - NEXT : End <nl> sil @ test_linked_list : $ @ convention ( thin ) ( @ owned LinkedNode ) - > @ owned LinkedNode { <nl> bb0 ( % 0 : $ LinkedNode ) : <nl> bb2 : <nl> / / CHECK - LABEL : CG of create_chain <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 7 . 1 ) <nl> / / CHECK - NEXT : Val % 1 Esc : A , Succ : ( % 7 . 1 ) <nl> - / / CHECK - NEXT : Con % 1 . 1 Esc : A , Succ : % 0 , % 1 , % 4 <nl> / / CHECK - NEXT : Val % 4 Esc : A , Succ : ( % 7 . 1 ) <nl> / / CHECK - NEXT : Val % 7 Esc : % 11 , Succ : ( % 7 . 1 ) <nl> - / / CHECK - NEXT : Con % 7 . 1 Esc : A , Succ : ( % 1 . 1 ) <nl> - / / CHECK - NEXT : Val % 11 Esc : R , Succ : ( % 7 . 1 ) , % 1 . 1 <nl> + / / CHECK - NEXT : Con % 7 . 1 Esc : A , Succ : ( % 8 ) <nl> + / / CHECK - NEXT : Con % 8 Esc : A , Succ : % 0 , % 1 , % 4 <nl> + / / CHECK - NEXT : Val % 11 Esc : R , Succ : ( % 7 . 1 ) , % 8 <nl> / / CHECK - NEXT : Ret Esc : R , Succ : % 11 <nl> / / CHECK - NEXT : End <nl> sil @ create_chain : $ @ convention ( thin ) ( @ owned LinkedNode ) - > @ owned LinkedNode { <nl> bb0 ( % 0 : $ LinkedNode ) : <nl> <nl> / / CHECK - LABEL : CG of loadNext <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 2 . 1 ) <nl> - / / CHECK - NEXT : Val % 2 Esc : % 2 , Succ : ( % 2 . 1 ) , % 0 , % 2 . 2 <nl> - / / CHECK - NEXT : Con % 2 . 1 Esc : A , Succ : ( % 2 . 2 ) <nl> - / / CHECK - NEXT : Con % 2 . 2 Esc : A , Succ : ( % 2 . 1 ) <nl> - / / CHECK - NEXT : Ret Esc : R , Succ : % 2 . 2 <nl> + / / CHECK - NEXT : Val % 2 Esc : % 2 , Succ : ( % 2 . 1 ) , % 0 , % 3 <nl> + / / CHECK - NEXT : Con % 2 . 1 Esc : A , Succ : ( % 3 ) <nl> + / / CHECK - NEXT : Con % 3 Esc : A , Succ : ( % 2 . 1 ) <nl> + / / CHECK - NEXT : Ret Esc : R , Succ : % 3 <nl> / / CHECK - NEXT : End <nl> sil @ loadNext : $ @ convention ( thin ) ( @ owned LinkedNode ) - > @ owned LinkedNode { <nl> bb0 ( % 0 : $ LinkedNode ) : <nl> bb0 ( % 0 : $ LinkedNode ) : <nl> <nl> / / CHECK - LABEL : CG of load_next3 <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 0 . 1 ) <nl> - / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 0 . 2 ) <nl> - / / CHECK - NEXT : Con % 0 . 2 Esc : A , Succ : ( % 0 . 3 ) <nl> - / / CHECK - NEXT : Con % 0 . 3 Esc : A , Succ : ( % 0 . 4 ) <nl> - / / CHECK - NEXT : Con % 0 . 4 Esc : A , Succ : ( % 0 . 5 ) <nl> - / / CHECK - NEXT : Con % 0 . 5 Esc : A , Succ : ( % 0 . 6 ) <nl> - / / CHECK - NEXT : Con % 0 . 6 Esc : A , Succ : <nl> - / / CHECK - NEXT : Ret Esc : R , Succ : % 0 . 6 <nl> + / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 1 ) <nl> + / / CHECK - NEXT : Con % 1 Esc : A , Succ : ( % 2 ) <nl> + / / CHECK - NEXT : Con % 2 Esc : A , Succ : ( % 3 ) <nl> + / / CHECK - NEXT : Con % 3 Esc : A , Succ : ( % 4 ) <nl> + / / CHECK - NEXT : Con % 4 Esc : A , Succ : ( % 5 ) <nl> + / / CHECK - NEXT : Con % 5 Esc : A , Succ : <nl> + / / CHECK - NEXT : Ret Esc : R , Succ : % 5 <nl> / / CHECK - NEXT : End <nl> sil @ load_next3 : $ @ convention ( thin ) ( @ owned LinkedNode ) - > @ owned LinkedNode { <nl> bb0 ( % 0 : $ LinkedNode ) : <nl> sil_global @ global_x : $ X <nl> <nl> / / CHECK - LABEL : CG of call_store_pointer <nl> / / CHECK - NEXT : Arg % 0 Esc : G , Succ : ( % 0 . 1 ) <nl> - / / CHECK - NEXT : Con % 0 . 1 Esc : G , Succ : ( % 0 . 2 ) <nl> - / / CHECK - NEXT : Con % 0 . 2 Esc : G , Succ : <nl> - / / CHECK - NEXT : Ret Esc : R , Succ : % 0 . 2 <nl> + / / CHECK - NEXT : Con % 0 . 1 Esc : G , Succ : ( % 5 ) <nl> + / / CHECK - NEXT : Con % 5 Esc : G , Succ : <nl> + / / CHECK - NEXT : Ret Esc : R , Succ : % 5 <nl> / / CHECK - NEXT : End <nl> sil @ call_store_pointer : $ @ convention ( thin ) ( @ owned Pointer ) - > @ owned X { <nl> bb0 ( % 0 : $ Pointer ) : <nl> bb0 ( % 0 : $ Pointer ) : <nl> <nl> / / CHECK - LABEL : CG of store_content <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 0 . 1 ) <nl> - / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 0 . 2 ) <nl> - / / CHECK - NEXT : Con % 0 . 2 Esc : G , Succ : <nl> + / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 3 ) <nl> / / CHECK - NEXT : Val % 1 Esc : G , Succ : ( % 1 . 1 ) <nl> - / / CHECK - NEXT : Con % 1 . 1 Esc : G , Succ : % 0 . 2 <nl> + / / CHECK - NEXT : Con % 1 . 1 Esc : G , Succ : % 3 <nl> + / / CHECK - NEXT : Con % 3 Esc : G , Succ : <nl> / / CHECK - NEXT : End <nl> sil @ store_content : $ @ convention ( thin ) ( @ owned Pointer ) - > ( ) { <nl> bb0 ( % 0 : $ Pointer ) : <nl> bb0 ( % 0 : $ Pointer ) : <nl> <nl> / / CHECK - LABEL : CG of call_store_content <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 0 . 1 ) <nl> - / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 0 . 2 ) <nl> - / / CHECK - NEXT : Con % 0 . 2 Esc : G , Succ : <nl> - / / CHECK - NEXT : Ret Esc : R , Succ : % 0 . 2 <nl> + / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 4 ) <nl> + / / CHECK - NEXT : Con % 4 Esc : G , Succ : <nl> + / / CHECK - NEXT : Ret Esc : R , Succ : % 4 <nl> / / CHECK - NEXT : End <nl> sil @ call_store_content : $ @ convention ( thin ) ( @ owned Pointer ) - > @ owned X { <nl> bb0 ( % 0 : $ Pointer ) : <nl> sil @ call_copy_addr_content : $ @ convention ( thin ) ( ) - > ( ) { <nl> <nl> / / CHECK - LABEL : CG of test_partial_apply <nl> / / CHECK - NEXT : Arg % 1 Esc : G , Succ : <nl> - / / CHECK - NEXT : Arg % 2 Esc : A , Succ : ( % 6 . 3 ) <nl> + / / CHECK - NEXT : Arg % 2 Esc : A , Succ : ( % 7 . 1 ) <nl> / / CHECK - NEXT : Val % 3 Esc : % 14 , % 15 , % 17 , Succ : ( % 6 . 1 ) <nl> / / CHECK - NEXT : Val % 6 Esc : % 14 , % 15 , % 16 , Succ : ( % 6 . 1 ) <nl> - / / CHECK - NEXT : Con % 6 . 1 Esc : % 14 , % 15 , % 16 , % 17 , Succ : ( % 6 . 2 ) <nl> - / / CHECK - NEXT : Con % 6 . 2 Esc : % 14 , % 15 , % 16 , % 17 , Succ : % 2 <nl> - / / CHECK - NEXT : Con % 6 . 3 Esc : G , Succ : <nl> + / / CHECK - NEXT : Con % 6 . 1 Esc : % 14 , % 15 , % 16 , % 17 , Succ : ( % 7 ) <nl> + / / CHECK - NEXT : Con % 7 Esc : % 14 , % 15 , % 16 , % 17 , Succ : % 2 <nl> + / / CHECK - NEXT : Con % 7 . 1 Esc : G , Succ : <nl> / / CHECK - NEXT : Val % 12 Esc : % 14 , % 15 , Succ : % 3 , % 6 <nl> / / CHECK - NEXT : End <nl> sil @ test_partial_apply : $ @ convention ( thin ) ( Int64 , @ owned X , @ owned Y ) - > Int64 { <nl> bb0 ( % 0 : $ X , % 1 : $ < τ_0_0 > { var τ_0_0 } < Int64 > , % 2 : $ < τ_0_0 > { var τ_0_0 <nl> / / CHECK - LABEL : CG of closure2 <nl> / / CHECK - NEXT : Arg % 0 Esc : G , Succ : <nl> / / CHECK - NEXT : Arg % 1 Esc : A , Succ : ( % 1 . 1 ) <nl> - / / CHECK - NEXT : Con % 1 . 1 Esc : A , Succ : ( % 1 . 2 ) <nl> - / / CHECK - NEXT : Con % 1 . 2 Esc : A , Succ : ( % 1 . 3 ) <nl> - / / CHECK - NEXT : Con % 1 . 3 Esc : G , Succ : ( % 1 . 4 ) <nl> - / / CHECK - NEXT : Con % 1 . 4 Esc : G , Succ : % 0 <nl> + / / CHECK - NEXT : Con % 1 . 1 Esc : A , Succ : ( % 2 ) <nl> + / / CHECK - NEXT : Con % 2 Esc : A , Succ : ( % 3 ) <nl> + / / CHECK - NEXT : Con % 3 Esc : G , Succ : ( % 4 ) <nl> + / / CHECK - NEXT : Con % 4 Esc : G , Succ : % 0 <nl> / / CHECK - NEXT : End <nl> sil @ closure2 : $ @ convention ( thin ) ( @ owned X , @ owned < τ_0_0 > { var τ_0_0 } < Y > ) - > ( ) { <nl> bb0 ( % 0 : $ X , % 1 : $ < τ_0_0 > { var τ_0_0 } < Y > ) : <nl> sil_global @ global_ln : $ LinkedNode <nl> <nl> / / CHECK - LABEL : CG of load_next_recursive <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 0 . 1 ) <nl> - / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 0 . 2 ) <nl> - / / CHECK - NEXT : Con % 0 . 2 Esc : G , Succ : <nl> - / / CHECK - NEXT : Val % 4 Esc : G , Succ : % 0 . 2 <nl> + / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 1 ) <nl> + / / CHECK - NEXT : Con % 1 Esc : G , Succ : <nl> + / / CHECK - NEXT : Val % 4 Esc : G , Succ : % 1 <nl> / / CHECK - NEXT : Ret Esc : R , Succ : % 4 <nl> / / CHECK - NEXT : End <nl> sil @ load_next_recursive : $ @ convention ( thin ) ( @ owned LinkedNode ) - > @ owned LinkedNode { <nl> bb0 ( % 0 : $ LinkedNode ) : <nl> } <nl> <nl> / / CHECK - LABEL : CG of let_escape <nl> - / / CHECK - NEXT : Arg % 0 Esc : G , Succ : ( % 0 . 1 ) <nl> - / / CHECK - NEXT : Con % 0 . 1 Esc : G , Succ : <nl> + / / CHECK - NEXT : Arg % 0 Esc : G , Succ : <nl> + / / CHECK - NEXT : Con % 0 . 1 Esc : G , Succ : <nl> / / CHECK - NEXT : Val % 1 Esc : G , Succ : ( % 1 . 1 ) <nl> / / CHECK - NEXT : Con % 1 . 1 Esc : G , Succ : % 0 <nl> / / CHECK - NEXT : Val % 4 Esc : G , Succ : % 0 <nl> bb2 ( % 5 : $ LinkedNode ) : <nl> <nl> / / CHECK - LABEL : CG of loadNext2 <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 0 . 1 ) <nl> - / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 0 . 2 ) <nl> - / / CHECK - NEXT : Con % 0 . 2 Esc : A , Succ : ( % 0 . 3 ) <nl> - / / CHECK - NEXT : Con % 0 . 3 Esc : A , Succ : ( % 0 . 4 ) <nl> - / / CHECK - NEXT : Con % 0 . 4 Esc : A , Succ : ( % 4 . 1 ) <nl> - / / CHECK - NEXT : Val % 4 Esc : R , Succ : % 0 . 4 <nl> + / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 1 ) <nl> + / / CHECK - NEXT : Con % 1 Esc : A , Succ : ( % 1 . 1 ) <nl> + / / CHECK - NEXT : Con % 1 . 1 Esc : A , Succ : ( % 1 . 2 ) <nl> + / / CHECK - NEXT : Con % 1 . 2 Esc : A , Succ : ( % 4 . 1 ) <nl> + / / CHECK - NEXT : Val % 4 Esc : R , Succ : % 1 . 2 , % 4 . 2 <nl> / / CHECK - NEXT : Con % 4 . 1 Esc : A , Succ : ( % 4 . 2 ) <nl> / / CHECK - NEXT : Con % 4 . 2 Esc : A , Succ : ( % 4 . 1 ) <nl> / / CHECK - NEXT : Ret Esc : R , Succ : % 4 <nl> bb0 ( % 0 : $ LinkedNode ) : <nl> <nl> / / CHECK - LABEL : CG of returnNext2 <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 0 . 1 ) <nl> - / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 0 . 2 ) <nl> - / / CHECK - NEXT : Con % 0 . 2 Esc : A , Succ : ( % 0 . 3 ) <nl> - / / CHECK - NEXT : Con % 0 . 3 Esc : A , Succ : ( % 0 . 4 ) <nl> - / / CHECK - NEXT : Con % 0 . 4 Esc : A , Succ : ( % 0 . 3 ) <nl> - / / CHECK - NEXT : Val % 3 Esc : R , Succ : ( % 0 . 3 ) , % 0 . 4 <nl> - / / CHECK - NEXT : Val % 8 Esc : R , Succ : % 0 . 2 , % 3 <nl> + / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 5 ) <nl> + / / CHECK - NEXT : Val % 3 Esc : R , Succ : ( % 5 . 1 ) , % 5 . 2 <nl> + / / CHECK - NEXT : Con % 5 Esc : A , Succ : ( % 5 . 1 ) <nl> + / / CHECK - NEXT : Con % 5 . 1 Esc : A , Succ : ( % 5 . 2 ) <nl> + / / CHECK - NEXT : Con % 5 . 2 Esc : A , Succ : ( % 5 . 1 ) <nl> + / / CHECK - NEXT : Val % 8 Esc : R , Succ : % 3 , % 5 <nl> / / CHECK - NEXT : Ret Esc : R , Succ : % 8 <nl> / / CHECK - NEXT : End <nl> sil @ returnNext2 : $ @ convention ( thin ) ( @ owned LinkedNode ) - > @ owned LinkedNode { <nl> bb3 ( % 8 : $ LinkedNode ) : <nl> / / A single - cycle recursion test . <nl> <nl> / / CHECK - LABEL : CG of single_cycle_recursion <nl> - / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 0 . 2 ) <nl> - / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 0 . 2 ) <nl> - / / CHECK - NEXT : Con % 0 . 2 Esc : A , Succ : ( % 0 . 1 ) <nl> - / / CHECK - NEXT : Val % 5 Esc : R , Succ : ( % 0 . 2 ) , % 0 . 1 <nl> + / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 2 . 1 ) <nl> + / / CHECK - NEXT : Con % 2 Esc : A , Succ : ( % 2 . 1 ) <nl> + / / CHECK - NEXT : Con % 2 . 1 Esc : A , Succ : ( % 2 ) <nl> + / / CHECK - NEXT : Val % 5 Esc : R , Succ : ( % 2 . 1 ) , % 2 <nl> / / CHECK - NEXT : Val % 7 Esc : R , Succ : % 0 , % 5 <nl> / / CHECK - NEXT : Ret Esc : R , Succ : % 7 <nl> / / CHECK - NEXT : End <nl> sil @ unknown_throwing_func : $ @ convention ( thin ) ( @ owned X ) - > ( @ owned X , @ error <nl> / / Test that the deinit of a box itself does not capture anything . <nl> <nl> / / CHECK - LABEL : CG of test_release_of_partial_apply_with_box <nl> - / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 1 . 3 ) <nl> + / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 2 . 1 ) <nl> / / CHECK - NEXT : Val % 1 Esc : % 6 , Succ : ( % 1 . 1 ) <nl> - / / CHECK - NEXT : Con % 1 . 1 Esc : % 6 , Succ : ( % 1 . 2 ) <nl> - / / CHECK - NEXT : Con % 1 . 2 Esc : % 6 , Succ : % 0 <nl> - / / CHECK - NEXT : Con % 1 . 3 Esc : G , Succ : <nl> + / / CHECK - NEXT : Con % 1 . 1 Esc : % 6 , Succ : ( % 2 ) <nl> + / / CHECK - NEXT : Con % 2 Esc : % 6 , Succ : % 0 <nl> + / / CHECK - NEXT : Con % 2 . 1 Esc : G , Succ : <nl> / / CHECK - NEXT : Val % 5 Esc : % 6 , Succ : % 1 <nl> / / CHECK - NEXT : End <nl> sil @ test_release_of_partial_apply_with_box : $ @ convention ( thin ) ( @ owned Y ) - > ( ) { <nl> sil @ take_y_box : $ @ convention ( thin ) ( @ owned < τ_0_0 > { var τ_0_0 } < Y > ) - > ( ) <nl> / / CHECK - LABEL : CG of store_to_unknown_reference <nl> / / CHECK - NEXT : Arg % 0 Esc : G , Succ : <nl> / / CHECK - NEXT : Val % 2 Esc : G , Succ : ( % 2 . 1 ) <nl> - / / CHECK - NEXT : Con % 2 . 1 Esc : G , Succ : ( % 2 . 2 ) <nl> - / / CHECK - NEXT : Con % 2 . 2 Esc : G , Succ : % 0 <nl> + / / CHECK - NEXT : Con % 2 . 1 Esc : G , Succ : ( % 3 ) <nl> + / / CHECK - NEXT : Con % 3 Esc : G , Succ : % 0 <nl> / / CHECK - NEXT : End <nl> sil @ store_to_unknown_reference : $ @ convention ( thin ) ( @ owned X ) - > ( ) { <nl> bb0 ( % 0 : $ X ) : <nl> bb0 : <nl> / / CHECK - LABEL : CG of create_and_store_x <nl> / / CHECK - NEXT : Val % 0 Esc : G , Succ : <nl> / / CHECK - NEXT : Val % 2 Esc : G , Succ : ( % 2 . 1 ) <nl> - / / CHECK - NEXT : Con % 2 . 1 Esc : G , Succ : ( % 2 . 2 ) <nl> - / / CHECK - NEXT : Con % 2 . 2 Esc : G , Succ : % 0 <nl> + / / CHECK - NEXT : Con % 2 . 1 Esc : G , Succ : ( % 3 ) <nl> + / / CHECK - NEXT : Con % 3 Esc : G , Succ : % 0 <nl> / / CHECK - NEXT : End <nl> sil @ create_and_store_x : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> bb0 : <nl> / / Test types which are considered as pointers . <nl> <nl> / / CHECK - LABEL : CG of pointer_types <nl> - / / CHECK - NEXT : Arg % 0 Esc : A , Succ : % 1 <nl> + / / CHECK - NEXT : Arg % 0 Esc : A , Succ : <nl> / / CHECK - NEXT : Arg % 1 Esc : A , Succ : <nl> - / / CHECK - NEXT : Val % 7 Esc : R , Succ : % 0 <nl> + / / CHECK - NEXT : Val % 4 Esc : R , Succ : % 0 , % 1 <nl> + / / CHECK - NEXT : Val % 7 Esc : R , Succ : % 4 <nl> / / CHECK - NEXT : Ret Esc : R , Succ : % 7 <nl> / / CHECK - NEXT : End <nl> sil @ pointer_types : $ @ convention ( thin ) ( @ owned Y , @ owned Y ) - > @ owned Y { <nl> bb1 ( % 7 : $ ( Pointer , Pointer ) ) : <nl> <nl> / / CHECK - LABEL : CG of defer_edge_cycle <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 0 . 1 ) <nl> - / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : % 1 . 1 <nl> - / / CHECK - NEXT : Con % 0 . 2 Esc : A , Succ : ( % 0 . 3 ) <nl> - / / CHECK - NEXT : Con % 0 . 3 Esc : A , Succ : <nl> + / / CHECK - NEXT : Con % 0 . 1 Esc : A , Succ : ( % 2 ) , % 1 . 1 <nl> / / CHECK - NEXT : Arg % 1 Esc : A , Succ : ( % 1 . 1 ) <nl> - / / CHECK - NEXT : Con % 1 . 1 Esc : A , Succ : ( % 0 . 2 ) , % 0 . 1 <nl> + / / CHECK - NEXT : Con % 1 . 1 Esc : A , Succ : % 0 . 1 <nl> + / / CHECK - NEXT : Con % 2 Esc : A , Succ : ( % 6 ) <nl> + / / CHECK - NEXT : Con % 6 Esc : A , Succ : <nl> / / CHECK - NEXT : End <nl> sil @ defer_edge_cycle : $ @ convention ( thin ) ( @ inout Y , @ inout Y ) - > ( ) { <nl> entry ( % 0 : $ * Y , % 1 : $ * Y ) : <nl> bb0 ( % 0 : $ Builtin . Int64 , % 1 : $ X , % 2 : $ X , % 3 : $ X ) : <nl> / / CHECK - LABEL : CG of test_existential_addr <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : <nl> / / CHECK - NEXT : Val % 1 Esc : , Succ : ( % 1 . 1 ) <nl> - / / CHECK - NEXT : Con % 1 . 1 Esc : , Succ : ( % 1 . 2 ) <nl> - / / CHECK - NEXT : Con % 1 . 2 Esc : , Succ : % 0 <nl> + / / CHECK - NEXT : Con % 1 . 1 Esc : , Succ : ( % 2 ) <nl> + / / CHECK - NEXT : Con % 2 Esc : , Succ : % 0 <nl> / / CHECK - NEXT : End <nl> sil @ test_existential_addr : $ @ convention ( thin ) ( @ owned Pointer ) - > ( ) { <nl> bb0 ( % 0 : $ Pointer ) : <nl> bb0 ( % 0 : $ * U , % 1 : $ * T , % 2 : $ @ thick U . Type ) : <nl> sil_global @ global_y : $ SomeData <nl> <nl> / / CHECK - LABEL : CG of test_node_merge_during_struct_inst <nl> - / / CHECK - NEXT : Arg % 0 Esc : G , Succ : ( % 4 . 1 ) <nl> + / / CHECK - NEXT : Arg % 0 Esc : A , Succ : ( % 4 . 1 ) <nl> / / CHECK - NEXT : Val % 1 Esc : G , Succ : ( % 4 . 1 ) <nl> - / / CHECK - NEXT : Val % 4 Esc : G , Succ : ( % 4 . 1 ) <nl> - / / CHECK - NEXT : Con % 4 . 1 Esc : G , Succ : ( % 4 . 1 ) , % 0 , % 1 , % 4 <nl> + / / CHECK - NEXT : Val % 4 Esc : , Succ : ( % 4 . 1 ) <nl> + / / CHECK - NEXT : Con % 4 . 1 Esc : G , Succ : ( % 4 . 1 ) , % 1 <nl> + / / CHECK - NEXT : Val % 10 Esc : , Succ : % 0 , % 4 , % 4 . 1 <nl> / / CHECK - NEXT : End <nl> sil @ test_node_merge_during_struct_inst : $ @ convention ( thin ) ( Y ) - > ( ) { <nl> bb0 ( % 0 : $ Y ) : <nl> bb ( % 0 : $ * Array < X > , % 1 : $ @ callee_owned ( @ inout X ) - > ( @ out ( ) , @ error Error ) ) : <nl> <nl> / / CHECK - LABEL : CG of arraysemantics_createUninitialized <nl> / / CHECK - NEXT : Arg % 0 Esc : A , Succ : <nl> - / / CHECK - NEXT : Val % 2 Esc : R , Succ : ( % 4 . 2 ) <nl> + / / CHECK - NEXT : Val % 2 Esc : R , Succ : ( % 6 ) <nl> / / CHECK - NEXT : Val % 4 Esc : R , Succ : ( % 4 . 1 ) <nl> / / CHECK - NEXT : Con % 4 . 1 Esc : R , Succ : % 2 <nl> - / / CHECK - NEXT : Con % 4 . 2 Esc : R , Succ : % 0 <nl> + / / CHECK - NEXT : Con % 6 Esc : R , Succ : % 0 <nl> / / CHECK - NEXT : Ret Esc : R , Succ : % 4 <nl> / / CHECK - NEXT : End <nl> sil @ arraysemantics_createUninitialized : $ @ convention ( thin ) ( @ owned X ) - > @ owned Array < X > { <nl> bb0 ( % 0 : $ X ) : <nl> / / Z . deinit <nl> / / CHECK - LABEL : CG of $ s4main1ZCfD <nl> / / CHECK : Arg % 0 Esc : A , Succ : ( % 0 . 1 ) <nl> - / / CHECK : Con % 0 . 1 Esc : A , Succ : ( % 0 . 2 ) <nl> - / / CHECK : Con % 0 . 2 Esc : G , Succ : <nl> + / / CHECK : Con % 0 . 1 Esc : A , Succ : ( % 1 ) <nl> + / / CHECK : Con % 1 Esc : G , Succ : <nl> / / CHECK : Val % 3 Esc : G , Succ : ( % 3 . 1 ) <nl> - / / CHECK : Con % 3 . 1 Esc : G , Succ : % 0 . 2 <nl> + / / CHECK : Con % 3 . 1 Esc : G , Succ : % 1 <nl> / / CHECK : End <nl> sil @ $ s4main1ZCfD : $ @ convention ( method ) ( @ owned Z ) - > ( ) { <nl> bb0 ( % 0 : $ Z ) : <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
7b6a37e3f0e16f0fcc4f9915176d629450eb126c
2019-11-13T19:30:34Z
mmm a / python / taichi / lang / kernel . py <nl> ppp b / python / taichi / lang / kernel . py <nl> def func ( foo ) : <nl> <nl> <nl> class KernelTemplateMapper : <nl> - def __init__ ( self , num_args , template_slot_locations ) : <nl> - self . num_args = num_args <nl> + def __init__ ( self , annotations , template_slot_locations ) : <nl> + self . annotations = annotations <nl> + self . num_args = len ( annotations ) <nl> self . template_slot_locations = template_slot_locations <nl> self . mapping = { } <nl> <nl> def extract ( self , args ) : <nl> extracted = [ ] <nl> for i in self . template_slot_locations : <nl> - extracted . append ( args [ i ] ) <nl> + extracted . append ( self . annotations [ i ] . extract ( args [ i ] ) ) <nl> return tuple ( extracted ) <nl> <nl> def lookup ( self , args ) : <nl> def __init__ ( self , func , is_grad , classkernel = False ) : <nl> self . extract_arguments ( ) <nl> self . template_slot_locations = [ ] <nl> for i in range ( len ( self . arguments ) ) : <nl> - if isinstance ( self . arguments [ i ] , template ) : <nl> + if isinstance ( self . arguments [ i ] , ( template , ext_arr ) ) : <nl> self . template_slot_locations . append ( i ) <nl> - self . mapper = KernelTemplateMapper ( len ( self . arguments ) , self . template_slot_locations ) <nl> + self . mapper = KernelTemplateMapper ( self . arguments , self . template_slot_locations ) <nl> from . impl import get_runtime <nl> self . runtime = get_runtime ( ) <nl> if is_grad : <nl> def func__ ( * args ) : <nl> raise KernelArgError ( i , needed , provided ) <nl> t_kernel . set_arg_int ( actual_argument_slot , int ( v ) ) <nl> elif isinstance ( needed , np . ndarray ) or needed = = np . ndarray or ( isinstance ( v , np . ndarray ) and isinstance ( needed , ext_arr ) ) : <nl> - float32_types = [ np . float32 ] <nl> - assert v . dtype in float32_types , ' Kernel arg supports single - precision ( float32 ) np arrays only ' <nl> + float32_types = [ np . float32 , np . int32 ] <nl> + assert v . dtype in float32_types , ' Kernel arg supports float32 / int32 np arrays only ' <nl> tmp = np . ascontiguousarray ( v ) <nl> t_kernel . set_arg_nparray ( actual_argument_slot , int ( tmp . ctypes . data ) , tmp . nbytes ) <nl> else : <nl> mmm a / python / taichi / lang / kernel_arguments . py <nl> ppp b / python / taichi / lang / kernel_arguments . py <nl> class ArgExtArray : <nl> def __init__ ( self , dim = 1 ) : <nl> assert dim = = 1 <nl> <nl> + def extract ( self , x ) : <nl> + return x . dtype , len ( x . shape ) <nl> + <nl> <nl> ext_arr = ArgExtArray <nl> <nl> def __init__ ( self , tensor = None , dim = None ) : <nl> self . tensor = tensor <nl> self . dim = dim <nl> <nl> + def extract ( self , x ) : <nl> + return x <nl> + <nl> <nl> template = Template <nl> <nl> mmm a / taichi / transforms / ir_printer . cpp <nl> ppp b / taichi / transforms / ir_printer . cpp <nl> class IRPrinter : public IRVisitor { <nl> } <nl> s + = " ] " ; <nl> <nl> - print ( fmt : : format ( " { } = external_ptr { } " , stmt - > name ( ) , s ) ) ; <nl> + print ( fmt : : format ( " { } { } = external_ptr { } " , stmt - > type_hint ( ) , stmt - > name ( ) , s ) ) ; <nl> } <nl> <nl> void visit ( OffloadedStmt * stmt ) override { <nl> mmm a / tests / python / test_complex_kernels . py <nl> ppp b / tests / python / test_complex_kernels . py <nl> def backward ( mul ) : <nl> <nl> @ ti . all_archs <nl> def test_complex_kernels_indirect ( ) : <nl> - return <nl> x = ti . var ( ti . f32 ) <nl> total = ti . var ( ti . f32 ) <nl> <nl> def backward ( mul ) : <nl> <nl> @ ti . all_archs <nl> def test_complex_kernels_oop ( ) : <nl> - return <nl> class A : <nl> def __init__ ( self ) : <nl> self . x = ti . var ( ti . f32 ) <nl> mmm a / tests / python / test_kernel_template_mapper . py <nl> ppp b / tests / python / test_kernel_template_mapper . py <nl> def test_kernel_template_mapper ( ) : <nl> def layout ( ) : <nl> ti . root . place ( x , y ) <nl> <nl> - mapper = ti . KernelTemplateMapper ( 3 , ( 0 , 1 , 2 ) ) <nl> + annotations = ( ti . template ( ) , ti . template ( ) , ti . template ( ) ) <nl> + <nl> + mapper = ti . KernelTemplateMapper ( annotations , ( 0 , 1 , 2 ) ) <nl> assert mapper . lookup ( ( 0 , 0 , 0 ) ) = = 0 <nl> assert mapper . lookup ( ( 0 , 1 , 0 ) ) = = 1 <nl> assert mapper . lookup ( ( 0 , 0 , 0 ) ) = = 0 <nl> assert mapper . lookup ( ( 0 , 0 , 1 ) ) = = 2 <nl> assert mapper . lookup ( ( 0 , 1 , 0 ) ) = = 1 <nl> <nl> - mapper = ti . KernelTemplateMapper ( 3 , ( ) ) <nl> + mapper = ti . KernelTemplateMapper ( annotations , ( ) ) <nl> assert mapper . lookup ( ( 0 , 0 , 0 ) ) = = 0 <nl> assert mapper . lookup ( ( 0 , 1 , 0 ) ) = = 0 <nl> assert mapper . lookup ( ( 0 , 0 , 0 ) ) = = 0 <nl> assert mapper . lookup ( ( 0 , 0 , 1 ) ) = = 0 <nl> assert mapper . lookup ( ( 0 , 1 , 0 ) ) = = 0 <nl> <nl> - mapper = ti . KernelTemplateMapper ( 3 , ( 1 , ) ) <nl> + mapper = ti . KernelTemplateMapper ( annotations , ( 1 , ) ) <nl> assert mapper . lookup ( ( 0 , x , 0 ) ) = = 0 <nl> assert mapper . lookup ( ( 0 , y , 0 ) ) = = 1 <nl> assert mapper . lookup ( ( 0 , x , 1 ) ) = = 0 <nl> <nl> + @ ti . all_archs <nl> + def test_kernel_template_mapper_numpy ( ) : <nl> + x = ti . var ( ti . i32 ) <nl> + y = ti . var ( ti . f32 ) <nl> + <nl> + @ ti . layout <nl> + def layout ( ) : <nl> + ti . root . place ( x , y ) <nl> + <nl> + annotations = ( ti . template ( ) , ti . template ( ) , ti . ext_arr ( ) ) <nl> + <nl> + import numpy as np <nl> + <nl> + mapper = ti . KernelTemplateMapper ( annotations , ( 0 , 1 , 2 ) ) <nl> + assert mapper . lookup ( ( 0 , 0 , np . ones ( shape = ( 1 , 2 , 3 ) , dtype = np . float32 ) ) ) = = 0 <nl> + assert mapper . lookup ( ( 0 , 0 , np . ones ( shape = ( 1 , 2 , 4 ) , dtype = np . float32 ) ) ) = = 0 <nl> + assert mapper . lookup ( ( 0 , 0 , np . ones ( shape = ( 1 , 2 , 1 ) , dtype = np . int32 ) ) ) = = 1 <nl> + <nl> + <nl> mmm a / tests / python / test_numpy . py <nl> ppp b / tests / python / test_numpy . py <nl> def test_numpy ( arr : np . ndarray ) : <nl> <nl> for i in range ( n ) : <nl> assert a [ i ] = = i * i * 4 <nl> + <nl> + @ ti . all_archs <nl> + def test_numpy_int ( ) : <nl> + ti . cfg . print_ir = True <nl> + val = ti . var ( ti . i32 ) <nl> + <nl> + n = 4 <nl> + <nl> + @ ti . layout <nl> + def values ( ) : <nl> + ti . root . dense ( ti . i , n ) . place ( val ) <nl> + <nl> + @ ti . kernel <nl> + def test_numpy ( arr : np . ndarray ) : <nl> + for i in range ( n ) : <nl> + arr [ i ] = arr [ i ] * * 2 <nl> + <nl> + a = np . array ( [ 4 , 8 , 1 , 24 ] , dtype = np . int32 ) <nl> + <nl> + for i in range ( n ) : <nl> + a [ i ] = i * 2 <nl> + <nl> + test_numpy ( a ) <nl> + <nl> + for i in range ( n ) : <nl> + assert a [ i ] = = i * i * 4 <nl>
TemplateKernelMapper key extractor
taichi-dev/taichi
bd550cd67d608bbfb13c07c2def70a4337effdd7
2019-11-27T11:57:29Z
mmm a / arangod / Cluster / ClusterComm . cpp <nl> ppp b / arangod / Cluster / ClusterComm . cpp <nl> ClusterCommOptions ClusterComm : : _globalConnectionOptions = { <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> ClusterComm : : ClusterComm ( ) { <nl> - / / FIXME : . . . <nl> - / / Among other things : Start background thread ! <nl> + _backgroundThread = new ClusterCommThread ( ) ; <nl> + if ( 0 = = _backgroundThread ) { <nl> + LOG_FATAL_AND_EXIT ( " unable to start ClusterComm background thread " ) ; <nl> + } <nl> + if ( ! _backgroundThread - > init ( ) | | ! _backgroundThread - > start ( ) ) { <nl> + LOG_FATAL_AND_EXIT ( " ClusterComm background thread does not work " ) ; <nl> + } <nl> } <nl> <nl> ClusterComm : : ~ ClusterComm ( ) { <nl> - / / FIXME : . . . <nl> - / / Among other things : Stop background thread ! <nl> + / / FIXME : Delete all stuff in queues , close all connections <nl> + _backgroundThread - > stop ( ) ; <nl> + _backgroundThread = 0 ; <nl> } <nl> <nl> ClusterComm * ClusterComm : : _theinstance = 0 ; <nl> ClusterComm * ClusterComm : : instance ( ) { <nl> } <nl> <nl> void ClusterComm : : initialise ( ) { <nl> + <nl> } <nl> <nl> OperationID ClusterComm : : getOperationID ( ) { <nl> void ClusterCommThread : : run ( ) { <nl> LOG_TRACE ( " starting ClusterComm thread " ) ; <nl> <nl> while ( ! _stop ) { <nl> - usleep ( 1000 ) ; <nl> + usleep ( 2000 ) ; <nl> / / FIXME : . . . <nl> LOG_TRACE ( " ClusterComm alive " ) ; <nl> } <nl> mmm a / arangod / Cluster / ClusterComm . h <nl> ppp b / arangod / Cluster / ClusterComm . h <nl> extern " C " { <nl> namespace triagens { <nl> namespace arango { <nl> <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - forward declarations <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + class ClusterCommThread ; <nl> + <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - some types for ClusterComm <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> namespace triagens { <nl> rest : : HttpRequest * answer ; <nl> <nl> ClusterCommResult ( ) : result ( 0 ) , answer ( 0 ) { } <nl> - ~ ClusterCommResult ( ) { <nl> + virtual ~ ClusterCommResult ( ) { <nl> if ( 0 ! = result ) { <nl> delete result ; <nl> } <nl> namespace triagens { <nl> } <nl> } ; <nl> <nl> + struct ClusterCommOperation : public ClusterCommResult { <nl> + rest : : HttpRequest * question ; <nl> + <nl> + ClusterCommOperation ( ) { } <nl> + virtual ~ ClusterCommOperation ( ) { <nl> + if ( 0 ! = question ) { <nl> + delete question ; <nl> + } <nl> + } <nl> + } ; <nl> + <nl> class ClusterCommCallback { <nl> / / The idea is that one inherits from this class and implements <nl> / / the callback . <nl> namespace triagens { <nl> / / / <nl> / / / This behaves as @ ref asyncRequest except that the actual request is <nl> / / / taken from ` req ` . We have to add a few headers and can use callback <nl> - / / / and timeout . The caller has to delete the result eventually . <nl> + / / / and timeout . The caller has to delete the result . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> ClusterCommResult * asyncDelegate ( <nl> namespace triagens { <nl> / / / <nl> / / / This behaves as @ ref syncRequest except that the actual request is <nl> / / / taken from ` req ` . We have to add a few headers and can use callback <nl> - / / / and timeout . The caller has to delete the result eventually . <nl> + / / / and timeout . The caller has to delete the result . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> ClusterCommResult * syncDelegate ( <nl> namespace triagens { <nl> void brokenConnection ( SingleServerConnection * singleConnection ) ; <nl> void closeUnusedConnections ( ) ; <nl> <nl> + / / The data structures for our internal queues : <nl> + <nl> + / / Sending questions : <nl> + list < ClusterCommOperation * > toSend ; <nl> + map < OperationID , list < ClusterCommOperation * > : : iterator > toSendByOpID ; <nl> + triagens : : basics : : ConditionVariable somethingToSend ; <nl> + <nl> + / / Receiving answers : <nl> + list < ClusterCommOperation * > received ; <nl> + map < OperationID , list < ClusterCommOperation * > : : iterator > receivedByOpID ; <nl> + triagens : : basics : : ReadWriteLock receiveLock ; <nl> + <nl> + / / Finally , our background communications thread : <nl> + ClusterCommThread * _backgroundThread ; <nl> } ; / / end of class ClusterComm <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl>
Start the background thread for ClusterComm .
arangodb/arangodb
9c4a25670e221aca86ea475714414001d855db4e
2013-12-17T10:42:01Z
mmm a / src / library_glut . js <nl> ppp b / src / library_glut . js <nl> var LibraryGLUT = { <nl> GLUT . mouseFunc = func ; <nl> } , <nl> <nl> + glutSetCursor : function ( cursor ) { <nl> + var cursorStyle = ' auto ' ; <nl> + switch ( cursor ) { <nl> + case 0x0000 : / * GLUT_CURSOR_RIGHT_ARROW * / <nl> + / / No equivalent css cursor style , fallback to ' auto ' <nl> + break ; <nl> + case 0x0001 : / * GLUT_CURSOR_LEFT_ARROW * / <nl> + / / No equivalent css cursor style , fallback to ' auto ' <nl> + break ; <nl> + case 0x0002 : / * GLUT_CURSOR_INFO * / <nl> + cursorStyle = ' pointer ' ; <nl> + break ; <nl> + case 0x0003 : / * GLUT_CURSOR_DESTROY * / <nl> + / / No equivalent css cursor style , fallback to ' auto ' <nl> + break ; <nl> + case 0x0004 : / * GLUT_CURSOR_HELP * / <nl> + cursorStyle = ' help ' ; <nl> + break ; <nl> + case 0x0005 : / * GLUT_CURSOR_CYCLE * / <nl> + / / No equivalent css cursor style , fallback to ' auto ' <nl> + break ; <nl> + case 0x0006 : / * GLUT_CURSOR_SPRAY * / <nl> + / / No equivalent css cursor style , fallback to ' auto ' <nl> + break ; <nl> + case 0x0007 : / * GLUT_CURSOR_WAIT * / <nl> + cursorStyle = ' wait ' ; <nl> + break ; <nl> + case 0x0008 : / * GLUT_CURSOR_TEXT * / <nl> + cursorStyle = ' text ' ; <nl> + break ; <nl> + case 0x0009 : / * GLUT_CURSOR_CROSSHAIR * / <nl> + case 0x0066 : / * GLUT_CURSOR_FULL_CROSSHAIR * / <nl> + cursorStyle = ' crosshair ' ; <nl> + break ; <nl> + case 0x000A : / * GLUT_CURSOR_UP_DOWN * / <nl> + cursorStyle = ' ns - resize ' ; <nl> + break ; <nl> + case 0x000B : / * GLUT_CURSOR_LEFT_RIGHT * / <nl> + cursorStyle = ' ew - resize ' ; <nl> + break ; <nl> + case 0x000C : / * GLUT_CURSOR_TOP_SIDE * / <nl> + cursorStyle = ' n - resize ' ; <nl> + break ; <nl> + case 0x000D : / * GLUT_CURSOR_BOTTOM_SIDE * / <nl> + cursorStyle = ' s - resize ' ; <nl> + break ; <nl> + case 0x000E : / * GLUT_CURSOR_LEFT_SIDE * / <nl> + cursorStyle = ' w - resize ' ; <nl> + break ; <nl> + case 0x000F : / * GLUT_CURSOR_RIGHT_SIDE * / <nl> + cursorStyle = ' e - resize ' ; <nl> + break ; <nl> + case 0x0010 : / * GLUT_CURSOR_TOP_LEFT_CORNER * / <nl> + cursorStyle = ' nw - resize ' ; <nl> + break ; <nl> + case 0x0011 : / * GLUT_CURSOR_TOP_RIGHT_CORNER * / <nl> + cursorStyle = ' ne - resize ' ; <nl> + break ; <nl> + case 0x0012 : / * GLUT_CURSOR_BOTTOM_RIGHT_CORNER * / <nl> + cursorStyle = ' se - resize ' ; <nl> + break ; <nl> + case 0x0013 : / * GLUT_CURSOR_BOTTOM_LEFT_CORNER * / <nl> + cursorStyle = ' sw - resize ' ; <nl> + break ; <nl> + case 0x0064 : / * GLUT_CURSOR_INHERIT * / <nl> + break ; <nl> + case 0x0065 : / * GLUT_CURSOR_NONE * / <nl> + cursorStyle = ' none ' ; <nl> + break ; <nl> + default : <nl> + throw " glutSetCursor : Unknown cursor type : " + cursor ; <nl> + } <nl> + Module [ ' canvas ' ] . style . cursor = cursorStyle ; <nl> + } , <nl> + <nl> glutCreateWindow__deps : [ ' $ Browser ' ] , <nl> glutCreateWindow : function ( name ) { <nl> var contextAttributes = { <nl>
Merge pull request from anlambert / glut_set_cursor
emscripten-core/emscripten
053192dc383fce9cfff91633d963302287094a41
2014-08-25T11:52:09Z
mmm a / include / rapidjson / error / en . h <nl> ppp b / include / rapidjson / error / en . h <nl> inline const RAPIDJSON_ERROR_CHARTYPE * GetParseError_En ( ParseErrorCode parseErro <nl> case kParseErrorNumberMissFraction : return RAPIDJSON_ERROR_STRING ( " Miss fraction part in number . " ) ; <nl> case kParseErrorNumberMissExponent : return RAPIDJSON_ERROR_STRING ( " Miss exponent in number . " ) ; <nl> <nl> - case kParseErrorTermination : return RAPIDJSON_ERROR_STRING ( " Parsing was terminated . " ) ; <nl> - <nl> default : <nl> return RAPIDJSON_ERROR_STRING ( " Unknown error . " ) ; <nl> } <nl>
Revert " Add kParseErrorTermination English error message . "
Tencent/rapidjson
e78654235ff5435568dc34b42645d6e17d4ba837
2014-07-12T17:06:22Z
mmm a / toolsrc / src / vcpkg_Dependencies . cpp <nl> ppp b / toolsrc / src / vcpkg_Dependencies . cpp <nl> namespace vcpkg : : Dependencies <nl> , status_db ( s ) <nl> , specs_as_set ( specs_as_set ) { } <nl> <nl> - std : : vector < PackageSpec > adjacency_list ( const InstallPlanAction & p ) const override <nl> + std : : vector < PackageSpec > adjacency_list ( const InstallPlanAction & plan ) const override <nl> { <nl> - if ( p . any_paragraph . status_paragraph . get ( ) ) <nl> + if ( plan . any_paragraph . status_paragraph . get ( ) ) <nl> return std : : vector < PackageSpec > { } ; <nl> - return p . any_paragraph . dependencies ( p . spec . triplet ( ) ) ; <nl> + return plan . any_paragraph . dependencies ( plan . spec . triplet ( ) ) ; <nl> } <nl> <nl> InstallPlanAction load_vertex_data ( const PackageSpec & spec ) const override <nl> namespace vcpkg : : Dependencies <nl> <nl> const std : : unordered_set < PackageSpec > specs_as_set ( specs . cbegin ( ) , specs . cend ( ) ) ; <nl> std : : vector < InstallPlanAction > toposort = Graphs : : topological_sort ( specs , InstallAdjacencyProvider { paths , status_db , specs_as_set } ) ; <nl> - Util : : erase_remove_if ( toposort , [ ] ( const InstallPlanAction & p ) <nl> - { <nl> - return p . request_type = = RequestType : : AUTO_SELECTED & & p . plan_type = = InstallPlanType : : ALREADY_INSTALLED ; <nl> - } ) ; <nl> + Util : : erase_remove_if ( toposort , [ ] ( const InstallPlanAction & plan ) <nl> + { <nl> + return plan . request_type = = RequestType : : AUTO_SELECTED & & plan . plan_type = = InstallPlanType : : ALREADY_INSTALLED ; <nl> + } ) ; <nl> <nl> return toposort ; <nl> } <nl> namespace vcpkg : : Dependencies <nl> , installed_ports ( installed_ports ) <nl> , specs_as_set ( specs_as_set ) { } <nl> <nl> - std : : vector < PackageSpec > adjacency_list ( const RemovePlanAction & p ) const override <nl> + std : : vector < PackageSpec > adjacency_list ( const RemovePlanAction & plan ) const override <nl> { <nl> - if ( p . plan_type = = RemovePlanType : : NOT_INSTALLED ) <nl> + if ( plan . plan_type = = RemovePlanType : : NOT_INSTALLED ) <nl> { <nl> return { } ; <nl> } <nl> <nl> - const PackageSpec & spec = p . spec ; <nl> + const PackageSpec & spec = plan . spec ; <nl> std : : vector < PackageSpec > dependents ; <nl> for ( const StatusParagraph * an_installed_package : installed_ports ) <nl> { <nl>
Rename p - > plan and formatting
microsoft/vcpkg
5405d4d58772784395adab89d88fb18cd808317d
2017-04-14T21:31:45Z
mmm a / XBMC . xcodeproj / project . pbxproj <nl> ppp b / XBMC . xcodeproj / project . pbxproj <nl> <nl> 7C779E57104A58F900F444C4 / * KeyboardStat . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 7C779E52104A58F900F444C4 / * KeyboardStat . cpp * / ; } ; <nl> 7CAA20511079C8160096DE39 / * BaseRenderer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 7CAA204F1079C8160096DE39 / * BaseRenderer . cpp * / ; } ; <nl> 7CAA20521079C8160096DE39 / * BaseRenderer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 7CAA204F1079C8160096DE39 / * BaseRenderer . cpp * / ; } ; <nl> + 7CAA25351085963B0096DE39 / * PasswordManager . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 7CAA25331085963B0096DE39 / * PasswordManager . cpp * / ; } ; <nl> + 7CAA25361085963B0096DE39 / * PasswordManager . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 7CAA25331085963B0096DE39 / * PasswordManager . cpp * / ; } ; <nl> 7CCF7E721067643800992676 / * DirectoryNodeSets . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 7CCF7E701067643800992676 / * DirectoryNodeSets . cpp * / ; } ; <nl> 7CCF7E731067643800992676 / * DirectoryNodeSets . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 7CCF7E701067643800992676 / * DirectoryNodeSets . cpp * / ; } ; <nl> 7CCF7F1D1069F3AE00992676 / * Builtins . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 7CCF7F1B1069F3AE00992676 / * Builtins . cpp * / ; } ; <nl> <nl> 7CAA204F1079C8160096DE39 / * BaseRenderer . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = BaseRenderer . cpp ; sourceTree = " < group > " ; } ; <nl> 7CAA20501079C8160096DE39 / * BaseRenderer . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = BaseRenderer . h ; sourceTree = " < group > " ; } ; <nl> 7CAA205B107AFC280096DE39 / * Job . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = Job . h ; sourceTree = " < group > " ; } ; <nl> + 7CAA25331085963B0096DE39 / * PasswordManager . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = PasswordManager . cpp ; sourceTree = " < group > " ; } ; <nl> + 7CAA25341085963B0096DE39 / * PasswordManager . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = PasswordManager . h ; sourceTree = " < group > " ; } ; <nl> + 7CAA25371085971C0096DE39 / * MusicArtistInfo . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = MusicArtistInfo . h ; sourceTree = " < group > " ; } ; <nl> + 7CAA25381085971C0096DE39 / * ScraperUrl . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = ScraperUrl . h ; sourceTree = " < group > " ; } ; <nl> 7CCF7E701067643800992676 / * DirectoryNodeSets . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = DirectoryNodeSets . cpp ; sourceTree = " < group > " ; } ; <nl> 7CCF7E711067643800992676 / * DirectoryNodeSets . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = DirectoryNodeSets . h ; sourceTree = " < group > " ; } ; <nl> 7CCF7F1B1069F3AE00992676 / * Builtins . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = Builtins . cpp ; sourceTree = " < group > " ; } ; <nl> <nl> E38E1E220D25F9FD00618676 / * utils * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> - 7CCF7FC7106A0DF500992676 / * TimeUtils . cpp * / , <nl> - 7CCF7FC8106A0DF500992676 / * TimeUtils . h * / , <nl> - 7CCF7F1B1069F3AE00992676 / * Builtins . cpp * / , <nl> - 7CCF7F1C1069F3AE00992676 / * Builtins . h * / , <nl> - 83A72B950FBC8E3B00171871 / * LockFree . cpp * / , <nl> - 83A72B960FBC8E3B00171871 / * LockFree . h * / , <nl> - 83E0B2470F7C95FF0091643F / * Atomics . h * / , <nl> - 83E0B2480F7C95FF0091643F / * Atomics . cpp * / , <nl> - 88632A310E0C44DE00BB3DAB / * RssFeed . cpp * / , <nl> - 88632A320E0C44DE00BB3DAB / * RssFeed . h * / , <nl> - E36C29E70DA72486001F0C9D / * ScraperUrl . cpp * / , <nl> - E36C29E80DA72486001F0C9D / * MusicArtistInfo . cpp * / , <nl> - E36C29E90DA72486001F0C9D / * Fanart . cpp * / , <nl> - 436B38F3106628850049AB3B / * EndianSwap . h * / , <nl> - 6E97BDBF0DA2B620003A2A89 / * EventClient . h * / , <nl> - 6E97BDC00DA2B620003A2A89 / * EventPacket . h * / , <nl> - 6E97BDC10DA2B620003A2A89 / * EventServer . h * / , <nl> - 6E97BDC30DA2B620003A2A89 / * Fanart . h * / , <nl> - 6E97BDC40DA2B620003A2A89 / * Socket . h * / , <nl> - E3E920010D8C622A002BF43D / * EventClient . cpp * / , <nl> - E3E91FFA0D8C61DF002BF43D / * EventPacket . cpp * / , <nl> - E3E91FFB0D8C61DF002BF43D / * EventServer . cpp * / , <nl> - 43BF09DD1080D39300E25290 / * fastmemcpy . h * / , <nl> - F5E5697210803FC3006E788A / * fastmemcpy . cpp * / , <nl> - E3E91FFC0D8C61DF002BF43D / * Socket . cpp * / , <nl> E38E1E230D25F9FD00618676 / * AlarmClock . cpp * / , <nl> E38E1E240D25F9FD00618676 / * AlarmClock . h * / , <nl> F5F8E1EF0E42807A00A8E96F / * ArabicShaping . cpp * / , <nl> <nl> E38E1E260D25F9FD00618676 / * Archive . h * / , <nl> F5FDF51C0E7218950005B0A6 / * AsyncFileCopy . cpp * / , <nl> F5FDF51B0E7218950005B0A6 / * AsyncFileCopy . h * / , <nl> + 83E0B2480F7C95FF0091643F / * Atomics . cpp * / , <nl> + 83E0B2470F7C95FF0091643F / * Atomics . h * / , <nl> E38E1E270D25F9FD00618676 / * BitstreamStats . cpp * / , <nl> E38E1E280D25F9FD00618676 / * BitstreamStats . h * / , <nl> + 7CCF7F1B1069F3AE00992676 / * Builtins . cpp * / , <nl> + 7CCF7F1C1069F3AE00992676 / * Builtins . h * / , <nl> E38E1E290D25F9FD00618676 / * CharsetConverter . cpp * / , <nl> E38E1E2A0D25F9FD00618676 / * CharsetConverter . h * / , <nl> E38E1E2B0D25F9FD00618676 / * CPUInfo . cpp * / , <nl> <nl> E38E1E320D25F9FD00618676 / * DownloadQueue . h * / , <nl> E38E1E330D25F9FD00618676 / * DownloadQueueManager . cpp * / , <nl> E38E1E340D25F9FD00618676 / * DownloadQueueManager . h * / , <nl> + 436B38F3106628850049AB3B / * EndianSwap . h * / , <nl> E38E1E350D25F9FD00618676 / * Event . cpp * / , <nl> E38E1E360D25F9FD00618676 / * Event . h * / , <nl> + E3E920010D8C622A002BF43D / * EventClient . cpp * / , <nl> + 6E97BDBF0DA2B620003A2A89 / * EventClient . h * / , <nl> + E3E91FFA0D8C61DF002BF43D / * EventPacket . cpp * / , <nl> + 6E97BDC00DA2B620003A2A89 / * EventPacket . h * / , <nl> + E3E91FFB0D8C61DF002BF43D / * EventServer . cpp * / , <nl> + 6E97BDC10DA2B620003A2A89 / * EventServer . h * / , <nl> + E36C29E90DA72486001F0C9D / * Fanart . cpp * / , <nl> + 6E97BDC30DA2B620003A2A89 / * Fanart . h * / , <nl> E38E1E390D25F9FD00618676 / * FastDelegate . h * / , <nl> + F5E5697210803FC3006E788A / * fastmemcpy . cpp * / , <nl> + 43BF09DD1080D39300E25290 / * fastmemcpy . h * / , <nl> E38E1E3C0D25F9FD00618676 / * fstrcmp . cpp * / , <nl> E38E1E3D0D25F9FD00618676 / * fstrcmp . h * / , <nl> E38E1E3E0D25F9FD00618676 / * GUIInfoManager . cpp * / , <nl> <nl> 7CAA205B107AFC280096DE39 / * Job . h * / , <nl> E38E1E550D25F9FD00618676 / * LCD . cpp * / , <nl> E38E1E560D25F9FD00618676 / * LCD . h * / , <nl> + 83A72B950FBC8E3B00171871 / * LockFree . cpp * / , <nl> + 83A72B960FBC8E3B00171871 / * LockFree . h * / , <nl> E38E1E5B0D25F9FD00618676 / * log . cpp * / , <nl> E38E1E5C0D25F9FD00618676 / * log . h * / , <nl> F5F8E1E60E427F6700A8E96F / * md5 . cpp * / , <nl> F5F8E1E70E427F6700A8E96F / * md5 . h * / , <nl> E38E1E650D25F9FD00618676 / * MusicAlbumInfo . cpp * / , <nl> E38E1E660D25F9FD00618676 / * MusicAlbumInfo . h * / , <nl> + E36C29E80DA72486001F0C9D / * MusicArtistInfo . cpp * / , <nl> + 7CAA25371085971C0096DE39 / * MusicArtistInfo . h * / , <nl> E38E1E670D25F9FD00618676 / * MusicInfoScraper . cpp * / , <nl> E38E1E680D25F9FD00618676 / * MusicInfoScraper . h * / , <nl> E38E1E690D25F9FD00618676 / * Mutex . cpp * / , <nl> E38E1E6A0D25F9FD00618676 / * Mutex . h * / , <nl> E38E1E6B0D25F9FD00618676 / * Network . cpp * / , <nl> E38E1E6C0D25F9FD00618676 / * Network . h * / , <nl> + 7CAA25331085963B0096DE39 / * PasswordManager . cpp * / , <nl> + 7CAA25341085963B0096DE39 / * PasswordManager . h * / , <nl> E38E1E6D0D25F9FD00618676 / * PCMAmplifier . cpp * / , <nl> E38E1E6E0D25F9FD00618676 / * PCMAmplifier . h * / , <nl> E38E1E6F0D25F9FD00618676 / * PerformanceSample . cpp * / , <nl> <nl> E38E1E720D25F9FD00618676 / * PerformanceStats . h * / , <nl> E38E1E730D25F9FD00618676 / * RegExp . cpp * / , <nl> E38E1E740D25F9FD00618676 / * RegExp . h * / , <nl> + 88632A310E0C44DE00BB3DAB / * RssFeed . cpp * / , <nl> + 88632A320E0C44DE00BB3DAB / * RssFeed . h * / , <nl> E38E1E750D25F9FD00618676 / * RssReader . cpp * / , <nl> E38E1E760D25F9FD00618676 / * RssReader . h * / , <nl> E38E1E770D25F9FD00618676 / * ScraperParser . cpp * / , <nl> E38E1E780D25F9FD00618676 / * ScraperParser . h * / , <nl> + E36C29E70DA72486001F0C9D / * ScraperUrl . cpp * / , <nl> + 7CAA25381085971C0096DE39 / * ScraperUrl . h * / , <nl> E38E1E790D25F9FD00618676 / * SharedSection . cpp * / , <nl> E38E1E7A0D25F9FD00618676 / * SharedSection . h * / , <nl> E38E1E7B0D25F9FD00618676 / * SingleLock . cpp * / , <nl> E38E1E7C0D25F9FD00618676 / * SingleLock . h * / , <nl> E38E1E7E0D25F9FD00618676 / * Sntp . h * / , <nl> + E3E91FFC0D8C61DF002BF43D / * Socket . cpp * / , <nl> + 6E97BDC40DA2B620003A2A89 / * Socket . h * / , <nl> E38E1E7F0D25F9FD00618676 / * Splash . cpp * / , <nl> E38E1E800D25F9FD00618676 / * Splash . h * / , <nl> E38E1E810D25F9FD00618676 / * Stopwatch . cpp * / , <nl> <nl> F5E55B6F10741340006E788A / * TeletextDefines . h * / , <nl> E38E1E850D25F9FD00618676 / * Thread . cpp * / , <nl> E38E1E860D25F9FD00618676 / * Thread . h * / , <nl> + 7CCF7FC7106A0DF500992676 / * TimeUtils . cpp * / , <nl> + 7CCF7FC8106A0DF500992676 / * TimeUtils . h * / , <nl> E38E1E890D25F9FD00618676 / * TuxBoxUtil . cpp * / , <nl> E38E1E8A0D25F9FD00618676 / * TuxBoxUtil . h * / , <nl> E38E1E8B0D25F9FD00618676 / * UdpClient . cpp * / , <nl> <nl> 43BF09A31080D1E900E25290 / * RenderingControlSCPD . cpp in Sources * / , <nl> 43BF09AB1080D2ED00E25290 / * RdrConnectionManagerSCPD . cpp in Sources * / , <nl> F5E56BA61082A675006E788A / * PosixMountProvider . cpp in Sources * / , <nl> + 7CAA25351085963B0096DE39 / * PasswordManager . cpp in Sources * / , <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> <nl> 43BF09A11080D1E900E25290 / * RenderingControlSCPD . cpp in Sources * / , <nl> 43BF09AA1080D2ED00E25290 / * RdrConnectionManagerSCPD . cpp in Sources * / , <nl> F5E56BA71082A675006E788A / * PosixMountProvider . cpp in Sources * / , <nl> + 7CAA25361085963B0096DE39 / * PasswordManager . cpp in Sources * / , <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl>
fixed : sync OSX project file with r23697 and some minor cleanup
xbmc/xbmc
e34247d3ddf29a8554c9da4b400bd0c593745c32
2009-10-14T05:32:49Z
mmm a / Marlin / src / lcd / ultralcd . cpp <nl> ppp b / Marlin / src / lcd / ultralcd . cpp <nl> millis_t next_button_update_ms ; <nl> SETCURSOR ( x , y ) ; <nl> if ( ! string ) return ; <nl> <nl> + auto _newline = [ & x , & y ] ( ) { <nl> + x = 0 ; y + + ; / / move x to string len ( plus space ) <nl> + SETCURSOR ( 0 , y ) ; / / simulate carriage return <nl> + } ; <nl> + <nl> uint8_t * p = ( uint8_t * ) string ; <nl> wchar_t ch ; <nl> if ( wordwrap ) { <nl> - uint8_t * wrd = p , c = 0 ; <nl> + uint8_t * wrd = nullptr , c = 0 ; <nl> + / / find the end of the part <nl> for ( ; ; ) { <nl> + if ( ! wrd ) wrd = p ; / / Get word start / before / advancing <nl> p = get_utf8_value_cb ( p , cb_read_byte , & ch ) ; <nl> - const bool eol = ! ch ; <nl> + const bool eol = ! ch ; / / zero ends the string <nl> + / / End or a break between phrases ? <nl> if ( eol | | ch = = ' ' | | ch = = ' - ' | | ch = = ' + ' | | ch = = ' . ' ) { <nl> - if ( ! c & & ch = = ' ' ) continue ; / / collapse extra spaces <nl> - if ( x + c > LCD_WIDTH & & x > = ( LCD_WIDTH ) / 4 ) { / / should it wrap ? <nl> - x = 0 ; y + + ; / / move x to string len ( plus space ) <nl> - SETCURSOR ( 0 , y ) ; / / simulate carriage return <nl> - } <nl> + if ( ! c & & ch = = ' ' ) { if ( wrd ) wrd + + ; continue ; } / / collapse extra spaces <nl> + / / Past the right and the word is not too long ? <nl> + if ( x + c > LCD_WIDTH & & x > = ( LCD_WIDTH ) / 4 ) _newline ( ) ; / / should it wrap ? <nl> c + = ! eol ; / / + 1 so the space will be printed <nl> x + = c ; / / advance x to new position <nl> while ( c ) { / / character countdown <nl> - - c ; / / count down to zero <nl> wrd = get_utf8_value_cb ( wrd , cb_read_byte , & ch ) ; / / get characters again <nl> - lcd_put_wchar ( ch ) ; / / word ( plus space ) to the LCD <nl> + lcd_put_wchar ( ch ) ; / / character to the LCD <nl> } <nl> - if ( eol ) break ; / / all done <nl> + if ( eol ) break ; / / all done ! <nl> wrd = nullptr ; / / set up for next word <nl> } <nl> - else { <nl> - if ( ! wrd ) wrd = p ; / / starting a new word ? <nl> - c + + ; / / count word characters <nl> - } <nl> + else c + + ; / / count word characters <nl> } <nl> } <nl> else { <nl> millis_t next_button_update_ms ; <nl> if ( ! ch ) break ; <nl> lcd_put_wchar ( ch ) ; <nl> x + + ; <nl> - if ( x > = LCD_WIDTH ) { <nl> - x = 0 ; y + + ; <nl> - SETCURSOR ( 0 , y ) ; <nl> - } <nl> + if ( x > = LCD_WIDTH ) _newline ( ) ; <nl> } <nl> } <nl> } <nl>
Use lambda , fix wrap pointer
MarlinFirmware/Marlin
24c23b60fa96180a6237db45648d4732a095192f
2019-06-15T20:36:42Z
mmm a / src / heap / mark - compact . cc <nl> ppp b / src / heap / mark - compact . cc <nl> class MarkCompactMarkingVisitor final <nl> / / Marks the object black without pushing it on the marking stack . Returns <nl> / / true if object needed marking and false otherwise . <nl> V8_INLINE bool MarkObjectWithoutPush ( HeapObject * host , HeapObject * object ) { <nl> - if ( ObjectMarking : : WhiteToBlack ( object , MarkingState : : Internal ( object ) ) ) { <nl> + if ( ObjectMarking : : WhiteToBlack ( object , <nl> + collector_ - > marking_state ( object ) ) ) { <nl> if ( V8_UNLIKELY ( FLAG_track_retaining_path ) ) { <nl> heap_ - > AddRetainer ( host , object ) ; <nl> } <nl> class MarkCompactMarkingVisitor final <nl> / / Visit an unmarked object . <nl> V8_INLINE void VisitUnmarkedObject ( HeapObject * obj ) { <nl> DCHECK ( heap_ - > Contains ( obj ) ) ; <nl> - if ( ObjectMarking : : WhiteToBlack ( obj , MarkingState : : Internal ( obj ) ) ) { <nl> + if ( ObjectMarking : : WhiteToBlack ( obj , collector_ - > marking_state ( obj ) ) ) { <nl> Map * map = obj - > map ( ) ; <nl> - ObjectMarking : : WhiteToBlack ( obj , MarkingState : : Internal ( obj ) ) ; <nl> / / Mark the map pointer and the body . <nl> collector_ - > MarkObject ( obj , map ) ; <nl> Visit ( map , obj ) ; <nl>
[ heap ] Fix smaller issues in MarkCompactMarkingVisitor
v8/v8
ca33118d32ea0f2f5803485b14e56fae76d6b250
2017-07-28T13:30:52Z
mmm a / test / core / gpr / mpscq_test . cc <nl> ppp b / test / core / gpr / mpscq_test . cc <nl> static void test_serial ( void ) { <nl> GPR_ASSERT ( n - > i = = i ) ; <nl> gpr_free ( n ) ; <nl> } <nl> + gpr_mpscq_destroy ( & q ) ; <nl> } <nl> <nl> typedef struct { <nl>
call destroy function in test_serial ( )
grpc/grpc
a2f7ce699be7678ff72870c6a164317762b1b30d
2019-05-25T07:07:24Z
mmm a / ShapedJson / json - shaper . c <nl> ppp b / ShapedJson / json - shaper . c <nl> <nl> / / / <nl> / / / DISCLAIMER <nl> / / / <nl> - / / / Copyright 2010 - 2011 triagens GmbH , Cologne , Germany <nl> + / / / Copyright 2004 - 2012 triagens GmbH , Cologne , Germany <nl> / / / <nl> / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> / / / you may not use this file except in compliance with the License . <nl> <nl> / / / <nl> / / / @ author Dr . Frank Celler <nl> / / / @ author Martin Schoenert <nl> - / / / @ author Copyright 2006 - 2011 , triAGENS GmbH , Cologne , Germany <nl> + / / / @ author Copyright 2006 - 2012 , triAGENS GmbH , Cologne , Germany <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # include " json - shaper . h " <nl> <nl> - # include < BasicsC / associative . h > <nl> - # include < BasicsC / hashes . h > <nl> - # include < BasicsC / logging . h > <nl> - # include < BasicsC / strings . h > <nl> - # include < BasicsC / vector . h > <nl> + # include " BasicsC / associative . h " <nl> + # include " BasicsC / hashes . h " <nl> + # include " BasicsC / logging . h " <nl> + # include " BasicsC / strings . h " <nl> + # include " BasicsC / vector . h " <nl> <nl> / / # define DEBUG_JSON_SHAPER 1 <nl> <nl> static uint64_t HashElementAttributeName ( TRI_associative_pointer_t * array , void <nl> e = ( char const * ) element ; <nl> ee = ( attribute_2_id_t const * ) element ; <nl> <nl> - return TRI_FnvHashPointer ( e + sizeof ( attribute_2_id_t ) , ee - > _size - 1 ) ; <nl> + return TRI_FnvHashPointer ( e + sizeof ( attribute_2_id_t ) , ( size_t ) ( ee - > _size - 1 ) ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> static uint64_t HashElementShape ( TRI_associative_pointer_t * array , void const * <nl> e = element ; <nl> ee = element ; <nl> <nl> - return TRI_FnvHashPointer ( e + sizeof ( TRI_shape_sid_t ) , ee - > _size - sizeof ( TRI_shape_sid_t ) ) ; <nl> + return TRI_FnvHashPointer ( e + sizeof ( TRI_shape_sid_t ) , ( size_t ) ( ee - > _size - sizeof ( TRI_shape_sid_t ) ) ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> static bool EqualElementShape ( TRI_associative_pointer_t * array , void const * lef <nl> rr = right ; <nl> <nl> return ( ll - > _size = = rr - > _size ) <nl> - & & memcmp ( l + sizeof ( TRI_shape_sid_t ) , r + sizeof ( TRI_shape_sid_t ) , ll - > _size - sizeof ( TRI_shape_sid_t ) ) = = 0 ; <nl> + & & memcmp ( l + sizeof ( TRI_shape_sid_t ) , r + sizeof ( TRI_shape_sid_t ) , ( size_t ) ( ll - > _size - sizeof ( TRI_shape_sid_t ) ) ) = = 0 ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / ShapedJson / json - shaper . h <nl> ppp b / ShapedJson / json - shaper . h <nl> <nl> / / / <nl> / / / DISCLAIMER <nl> / / / <nl> - / / / Copyright 2010 - 2011 triagens GmbH , Cologne , Germany <nl> + / / / Copyright 2004 - 2012 triagens GmbH , Cologne , Germany <nl> / / / <nl> / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> / / / you may not use this file except in compliance with the License . <nl> <nl> / / / <nl> / / / @ author Dr . Frank Celler <nl> / / / @ author Martin Schoenert <nl> - / / / @ author Copyright 2006 - 2011 , triAGENS GmbH , Cologne , Germany <nl> + / / / @ author Copyright 2006 - 2012 , triAGENS GmbH , Cologne , Germany <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # ifndef TRIAGENS_PHILADELPHIA_SHAPED_JSON_JSON_SHAPER_H <nl> - # define TRIAGENS_PHILADELPHIA_SHAPED_JSON_JSON_SHAPER_H 1 <nl> + # ifndef TRIAGENS_SHAPED_JSON_JSON_SHAPER_H <nl> + # define TRIAGENS_SHAPED_JSON_JSON_SHAPER_H 1 <nl> <nl> - # include < BasicsC / common . h > <nl> - <nl> - # include < BasicsC / json . h > <nl> + # include " BasicsC / common . h " <nl> <nl> + # include " BasicsC / json . h " <nl> # include " ShapedJson / shaped - json . h " <nl> <nl> # ifdef __cplusplus <nl> mmm a / ShapedJson / shape - accessor . c <nl> ppp b / ShapedJson / shape - accessor . c <nl> <nl> / / / <nl> / / / DISCLAIMER <nl> / / / <nl> - / / / Copyright 2010 - 2011 triagens GmbH , Cologne , Germany <nl> + / / / Copyright 2004 - 2012 triagens GmbH , Cologne , Germany <nl> / / / <nl> / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> / / / you may not use this file except in compliance with the License . <nl> <nl> / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> / / / <nl> / / / @ author Dr . Frank Celler <nl> - / / / @ author Copyright 2011 , triagens GmbH , Cologne , Germany <nl> + / / / @ author Copyright 2011 - 2012 , triAGENS GmbH , Cologne , Germany <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # include " shape - accessor . h " <nl> <nl> - # include < BasicsC / logging . h > <nl> - # include < BasicsC / vector . h > <nl> - <nl> + # include " BasicsC / logging . h " <nl> + # include " BasicsC / vector . h " <nl> # include " ShapedJson / shaped - json . h " <nl> <nl> / / # define DEBUG_SHAPE_ACCESSOR 1 <nl> static bool BytecodeShapeAccessor ( TRI_shaper_t * shaper , TRI_shape_access_t * acc <nl> } <nl> <nl> TRI_PushBackVectorPointer ( & ops , ( void * ) TRI_SHAPE_AC_OFFSET_FIX ) ; <nl> - TRI_PushBackVectorPointer ( & ops , ( void * ) ( offsetsF [ 0 ] ) ) ; <nl> - TRI_PushBackVectorPointer ( & ops , ( void * ) ( offsetsF [ 1 ] ) ) ; <nl> + TRI_PushBackVectorPointer ( & ops , ( void * ) ( intptr_t ) ( offsetsF [ 0 ] ) ) ; / / offset is always smaller than 4 GByte <nl> + TRI_PushBackVectorPointer ( & ops , ( void * ) ( intptr_t ) ( offsetsF [ 1 ] ) ) ; / / offset is always smaller than 4 GByte <nl> <nl> TRI_PushBackVectorPointer ( & ops , ( void * ) TRI_SHAPE_AC_SHAPE_PTR ) ; <nl> cv . c = shape ; <nl> static bool ExecuteBytecodeShapeAccessor ( TRI_shape_access_t * accessor , <nl> break ; <nl> <nl> case TRI_SHAPE_AC_OFFSET_FIX : <nl> - b = ( TRI_shape_size_t ) * ops + + ; <nl> - e = ( TRI_shape_size_t ) * ops + + ; <nl> + b = ( TRI_shape_size_t ) ( intptr_t ) * ops + + ; / / offset is always smaller than 4 GByte <nl> + e = ( TRI_shape_size_t ) ( intptr_t ) * ops + + ; / / offset is always smaller than 4 GByte <nl> <nl> * end = ( ( char * ) * begin ) + e ; <nl> * begin = ( ( char * ) * begin ) + b ; <nl> static bool ExecuteBytecodeShapeAccessor ( TRI_shape_access_t * accessor , <nl> break ; <nl> <nl> case TRI_SHAPE_AC_OFFSET_VAR : <nl> - pos = ( TRI_shape_size_t ) * ops + + ; <nl> + pos = ( TRI_shape_size_t ) ( intptr_t ) * ops + + ; / / offset is always smaller than 4 GByte <nl> <nl> offsetsV = ( TRI_shape_size_t * ) * begin ; <nl> <nl> void TRI_PrintShapeAccessor ( TRI_shape_access_t * accessor ) { <nl> break ; <nl> <nl> case TRI_SHAPE_AC_OFFSET_FIX : <nl> - b = ( TRI_shape_size_t ) * ops + + ; <nl> - e = ( TRI_shape_size_t ) * ops + + ; <nl> + b = ( TRI_shape_size_t ) ( intptr_t ) * ops + + ; / / offset is always smaller than 4 GByte <nl> + e = ( TRI_shape_size_t ) ( intptr_t ) * ops + + ; / / offset is always smaller than 4 GByte <nl> <nl> printf ( " OP : fixed offset % lu - % lu \ n " , <nl> ( unsigned long ) b , <nl> void TRI_PrintShapeAccessor ( TRI_shape_access_t * accessor ) { <nl> break ; <nl> <nl> case TRI_SHAPE_AC_OFFSET_VAR : <nl> - pos = ( TRI_shape_size_t ) * ops + + ; <nl> + pos = ( TRI_shape_size_t ) ( intptr_t ) * ops + + ; / / offset is always smaller than 4 GByte <nl> <nl> printf ( " OP : variable offset at position % lu \ n " , <nl> ( unsigned long ) pos ) ; <nl> mmm a / ShapedJson / shape - accessor . h <nl> ppp b / ShapedJson / shape - accessor . h <nl> <nl> / / / <nl> / / / DISCLAIMER <nl> / / / <nl> - / / / Copyright 2010 - 2011 triagens GmbH , Cologne , Germany <nl> + / / / Copyright 2004 - 2012 triagens GmbH , Cologne , Germany <nl> / / / <nl> / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> / / / you may not use this file except in compliance with the License . <nl> <nl> / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> / / / <nl> / / / @ author Dr . Frank Celler <nl> - / / / @ author Copyright 2011 , triagens GmbH , Cologne , Germany <nl> + / / / @ author Copyright 2011 - 2012 , triAGENS GmbH , Cologne , Germany <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # ifndef TRIAGENS_PHILADELPHIA_SHAPED_JSON_SHAPE_ACCESSOR_H <nl> - # define TRIAGENS_PHILADELPHIA_SHAPED_JSON_SHAPE_ACCESSOR_H 1 <nl> + # ifndef TRIAGENS_SHAPED_JSON_SHAPE_ACCESSOR_H <nl> + # define TRIAGENS_SHAPED_JSON_SHAPE_ACCESSOR_H 1 <nl> <nl> - # include < BasicsC / common . h > <nl> + # include " BasicsC / common . h " <nl> <nl> - # include < BasicsC / json . h > <nl> + # include " BasicsC / json . h " <nl> <nl> # ifdef __cplusplus <nl> extern " C " { <nl> mmm a / ShapedJson / shaped - json . c <nl> ppp b / ShapedJson / shaped - json . c <nl> <nl> / / / <nl> / / / DISCLAIMER <nl> / / / <nl> - / / / Copyright 2010 - 2011 triagens GmbH , Cologne , Germany <nl> + / / / Copyright 2004 - 2012 triagens GmbH , Cologne , Germany <nl> / / / <nl> / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> / / / you may not use this file except in compliance with the License . <nl> <nl> / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> / / / <nl> / / / @ author Dr . Frank Celler <nl> - / / / @ author Copyright 2011 , triagens GmbH , Cologne , Germany <nl> + / / / @ author Copyright 2011 - 2012 , triAGENS GmbH , Cologne , Germany <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> # include " shaped - json . h " <nl> <nl> - # include < BasicsC / associative . h > <nl> - # include < BasicsC / hashes . h > <nl> - # include < BasicsC / logging . h > <nl> - # include < BasicsC / string - buffer . h > <nl> - # include < BasicsC / vector . h > <nl> - <nl> + # include " BasicsC / associative . h " <nl> + # include " BasicsC / hashes . h " <nl> + # include " BasicsC / logging . h " <nl> + # include " BasicsC / string - buffer . h " <nl> + # include " BasicsC / vector . h " <nl> # include " ShapedJson / json - shaper . h " <nl> <nl> / / # define DEBUG_JSON_SHAPER 1 <nl> <nl> <nl> void TRI_PrintShape ( TRI_shaper_t * shaper , TRI_shape_t const * shape , int indent ) ; <nl> static bool FillShapeValueJson ( TRI_shaper_t * shaper , TRI_shape_value_t * dst , TRI_json_t const * json ) ; <nl> - static TRI_json_t * JsonShapeData ( TRI_shaper_t * shaper , TRI_shape_t const * shape , char const * data , size_t size ) ; <nl> - static bool StringifyJsonShapeData ( TRI_shaper_t * shaper , TRI_string_buffer_t * buffer , TRI_shape_t const * shape , char const * data , size_t size ) ; <nl> + static TRI_json_t * JsonShapeData ( TRI_shaper_t * shaper , TRI_shape_t const * shape , char const * data , uint64_t size ) ; <nl> + static bool StringifyJsonShapeData ( TRI_shaper_t * shaper , TRI_string_buffer_t * buffer , TRI_shape_t const * shape , char const * data , uint64_t size ) ; <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - private functions <nl> void TRI_PrintShape ( TRI_shaper_t * shaper , TRI_shape_t const * shape , int indent ) <nl> TRI_shape_size_t const * offsets ; <nl> char const * ptr ; <nl> size_t i ; <nl> - size_t n ; <nl> + uint64_t n ; <nl> <nl> if ( shape = = NULL ) { <nl> printf ( " % * sUNKNOWN \ n " , indent , " " ) ; <nl> static int SortShapeValuesFunc ( void const * l , void const * r ) { <nl> return wl - wr ; <nl> } <nl> <nl> - return left - > _aid - right - > _aid ; <nl> + return ( int ) ( left - > _aid - right - > _aid ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> static bool FillShapeValueString ( TRI_shaper_t * shaper , TRI_shape_value_t * dst , <nl> static bool FillShapeValueList ( TRI_shaper_t * shaper , TRI_shape_value_t * dst , TRI_json_t const * json ) { <nl> size_t i ; <nl> size_t n ; <nl> - size_t total ; <nl> + uint64_t total ; <nl> <nl> TRI_shape_value_t * values ; <nl> TRI_shape_value_t * p ; <nl> static bool FillShapeValueList ( TRI_shaper_t * shaper , TRI_shape_value_t * dst , TR <nl> ptr + = sizeof ( TRI_shape_length_list_t ) ; <nl> <nl> for ( p = values ; p < e ; + + p ) { <nl> - memcpy ( ptr , p - > _value , p - > _size ) ; <nl> + memcpy ( ptr , p - > _value , ( size_t ) p - > _size ) ; <nl> ptr + = p - > _size ; <nl> } <nl> } <nl> static bool FillShapeValueList ( TRI_shaper_t * shaper , TRI_shape_value_t * dst , TR <nl> * offsets + + = offset ; <nl> offset + = p - > _size ; <nl> <nl> - memcpy ( ptr , p - > _value , p - > _size ) ; <nl> + memcpy ( ptr , p - > _value , ( size_t ) p - > _size ) ; <nl> ptr + = p - > _size ; <nl> } <nl> <nl> static bool FillShapeValueList ( TRI_shaper_t * shaper , TRI_shape_value_t * dst , TR <nl> * offsets + + = offset ; <nl> offset + = p - > _size ; <nl> <nl> - memcpy ( ptr , p - > _value , p - > _size ) ; <nl> + memcpy ( ptr , p - > _value , ( size_t ) p - > _size ) ; <nl> ptr + = p - > _size ; <nl> } <nl> <nl> static bool FillShapeValueList ( TRI_shaper_t * shaper , TRI_shape_value_t * dst , TR <nl> static bool FillShapeValueArray ( TRI_shaper_t * shaper , TRI_shape_value_t * dst , TRI_json_t const * json ) { <nl> size_t n ; <nl> size_t i ; <nl> - size_t total ; <nl> + uint64_t total ; <nl> <nl> size_t f ; <nl> size_t v ; <nl> static bool FillShapeValueArray ( TRI_shaper_t * shaper , TRI_shape_value_t * dst , T <nl> * aids + + = p - > _aid ; <nl> * sids + + = p - > _sid ; <nl> <nl> - memcpy ( ptr , p - > _value , p - > _size ) ; <nl> + memcpy ( ptr , p - > _value , ( size_t ) p - > _size ) ; <nl> ptr + = p - > _size ; <nl> <nl> dst - > _fixedSized & = p - > _fixedSized ; <nl> static bool FillShapeValueJson ( TRI_shaper_t * shaper , TRI_shape_value_t * dst , TR <nl> static TRI_json_t * JsonShapeDataNull ( TRI_shaper_t * shaper , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> return TRI_CreateNullJson ( ) ; <nl> } <nl> <nl> static TRI_json_t * JsonShapeDataNull ( TRI_shaper_t * shaper , <nl> static TRI_json_t * JsonShapeDataBoolean ( TRI_shaper_t * shaper , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> bool v ; <nl> <nl> v = ( * ( TRI_shape_boolean_t const * ) data ) ! = 0 ; <nl> static TRI_json_t * JsonShapeDataBoolean ( TRI_shaper_t * shaper , <nl> static TRI_json_t * JsonShapeDataNumber ( TRI_shaper_t * shaper , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_shape_number_t v ; <nl> <nl> v = * ( TRI_shape_number_t const * ) data ; <nl> static TRI_json_t * JsonShapeDataNumber ( TRI_shaper_t * shaper , <nl> static TRI_json_t * JsonShapeDataShortString ( TRI_shaper_t * shaper , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_shape_length_short_string_t l ; <nl> <nl> l = * ( TRI_shape_length_short_string_t const * ) data ; <nl> static TRI_json_t * JsonShapeDataShortString ( TRI_shaper_t * shaper , <nl> static TRI_json_t * JsonShapeDataLongString ( TRI_shaper_t * shaper , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_shape_length_long_string_t l ; <nl> <nl> l = * ( TRI_shape_length_long_string_t const * ) data ; <nl> static TRI_json_t * JsonShapeDataLongString ( TRI_shaper_t * shaper , <nl> static TRI_json_t * JsonShapeDataArray ( TRI_shaper_t * shaper , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_array_shape_t const * s ; <nl> TRI_shape_size_t f ; <nl> TRI_shape_size_t v ; <nl> static TRI_json_t * JsonShapeDataArray ( TRI_shaper_t * shaper , <nl> static TRI_json_t * JsonShapeDataList ( TRI_shaper_t * shaper , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> char const * ptr ; <nl> TRI_json_t * list ; <nl> <nl> static TRI_json_t * JsonShapeDataList ( TRI_shaper_t * shaper , <nl> static TRI_json_t * JsonShapeDataHomogeneousList ( TRI_shaper_t * shaper , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_homogeneous_list_shape_t const * s ; <nl> TRI_json_t * list ; <nl> TRI_shape_length_list_t i ; <nl> static TRI_json_t * JsonShapeDataHomogeneousList ( TRI_shaper_t * shaper , <nl> static TRI_json_t * JsonShapeDataHomogeneousSizedList ( TRI_shaper_t * shaper , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_homogeneous_sized_list_shape_t const * s ; <nl> TRI_json_t * list ; <nl> TRI_shape_length_list_t i ; <nl> static TRI_json_t * JsonShapeDataHomogeneousSizedList ( TRI_shaper_t * shaper , <nl> static TRI_json_t * JsonShapeData ( TRI_shaper_t * shaper , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> if ( shape = = NULL ) { <nl> return NULL ; <nl> } <nl> static bool StringifyJsonShapeDataNull ( TRI_shaper_t * shaper , <nl> TRI_string_buffer_t * buffer , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_AppendString2StringBuffer ( buffer , " null " , 4 ) ; <nl> return true ; <nl> } <nl> static bool StringifyJsonShapeDataBoolean ( TRI_shaper_t * shaper , <nl> TRI_string_buffer_t * buffer , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> bool v ; <nl> <nl> v = ( * ( TRI_shape_boolean_t const * ) data ) ! = 0 ; <nl> static bool StringifyJsonShapeDataNumber ( TRI_shaper_t * shaper , <nl> TRI_string_buffer_t * buffer , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_shape_number_t v ; <nl> <nl> v = * ( TRI_shape_number_t const * ) data ; <nl> static bool StringifyJsonShapeDataShortString ( TRI_shaper_t * shaper , <nl> TRI_string_buffer_t * buffer , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_shape_length_short_string_t l ; <nl> <nl> l = * ( TRI_shape_length_short_string_t const * ) data ; <nl> static bool StringifyJsonShapeDataLongString ( TRI_shaper_t * shaper , <nl> TRI_string_buffer_t * buffer , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_shape_length_long_string_t l ; <nl> <nl> l = * ( TRI_shape_length_long_string_t const * ) data ; <nl> static bool StringifyJsonShapeDataArray ( TRI_shaper_t * shaper , <nl> TRI_string_buffer_t * buffer , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size , <nl> + uint64_t size , <nl> bool braces ) { <nl> TRI_array_shape_t const * s ; <nl> TRI_shape_aid_t const * aids ; <nl> static bool StringifyJsonShapeDataList ( TRI_shaper_t * shaper , <nl> TRI_string_buffer_t * buffer , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_shape_length_list_t i ; <nl> TRI_shape_length_list_t l ; <nl> TRI_shape_sid_t const * sids ; <nl> static bool StringifyJsonShapeDataHomogeneousList ( TRI_shaper_t * shaper , <nl> TRI_string_buffer_t * buffer , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_homogeneous_list_shape_t const * s ; <nl> TRI_shape_length_list_t i ; <nl> TRI_shape_length_list_t l ; <nl> static bool StringifyJsonShapeDataHomogeneousSizedList ( TRI_shaper_t * shaper , <nl> TRI_string_buffer_t * buffer , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> TRI_homogeneous_sized_list_shape_t const * s ; <nl> TRI_shape_length_list_t i ; <nl> TRI_shape_length_list_t l ; <nl> static bool StringifyJsonShapeData ( TRI_shaper_t * shaper , <nl> TRI_string_buffer_t * buffer , <nl> TRI_shape_t const * shape , <nl> char const * data , <nl> - size_t size ) { <nl> + uint64_t size ) { <nl> if ( shape = = NULL ) { <nl> return false ; <nl> } <nl> TRI_shaped_json_t * TRI_ShapedJsonJson ( TRI_shaper_t * shaper , TRI_json_t const * j <nl> shaped = TRI_Allocate ( sizeof ( TRI_shaped_json_t ) ) ; <nl> <nl> shaped - > _sid = dst . _sid ; <nl> - shaped - > _data . length = dst . _size ; <nl> + shaped - > _data . length = ( uint32_t ) dst . _size ; <nl> shaped - > _data . data = dst . _value ; <nl> <nl> return shaped ; <nl> bool TRI_AtListShapedJson ( TRI_list_shape_t const * shape , <nl> <nl> result - > _sid = sids [ position ] ; <nl> result - > _data . data = ( ( char * ) json - > _data . data ) + offsets [ position ] ; <nl> - result - > _data . length = offsets [ position + 1 ] - offsets [ position ] ; <nl> + result - > _data . length = ( uint32_t ) ( offsets [ position + 1 ] - offsets [ position ] ) ; <nl> <nl> return true ; <nl> } <nl> bool TRI_AtHomogeneousListShapedJson ( TRI_homogeneous_list_shape_t const * shape , <nl> <nl> result - > _sid = shape - > _sidEntry ; <nl> result - > _data . data = ( ( char * ) json - > _data . data ) + offsets [ position ] ; <nl> - result - > _data . length = offsets [ position + 1 ] - offsets [ position ] ; <nl> + result - > _data . length = ( uint32_t ) ( offsets [ position + 1 ] - offsets [ position ] ) ; <nl> <nl> return true ; <nl> } <nl> bool TRI_AtHomogeneousSizedListShapedJson ( TRI_homogeneous_sized_list_shape_t co <nl> <nl> result - > _sid = shape - > _sidEntry ; <nl> result - > _data . data = ptr + ( shape - > _sizeEntry * position ) ; <nl> - result - > _data . length = shape - > _sizeEntry ; <nl> + result - > _data . length = ( uint32_t ) shape - > _sizeEntry ; <nl> <nl> return true ; <nl> } <nl> mmm a / ShapedJson / shaped - json . h <nl> ppp b / ShapedJson / shaped - json . h <nl> <nl> / / / <nl> / / / DISCLAIMER <nl> / / / <nl> - / / / Copyright 2010 - 2011 triagens GmbH , Cologne , Germany <nl> + / / / Copyright 2004 - 2012 triagens GmbH , Cologne , Germany <nl> / / / <nl> / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> / / / you may not use this file except in compliance with the License . <nl> <nl> / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> / / / <nl> / / / @ author Dr . Frank Celler <nl> - / / / @ author Copyright 2011 , triAGENS GmbH , Cologne , Germany <nl> + / / / @ author Copyright 2011 - 2012 , triAGENS GmbH , Cologne , Germany <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # ifndef TRIAGENS_PHILADELPHIA_SHAPED_JSON_SHAPED_JSON_H <nl> - # define TRIAGENS_PHILADELPHIA_SHAPED_JSON_SHAPED_JSON_H 1 <nl> + # ifndef TRIAGENS_SHAPED_JSON_SHAPED_JSON_H <nl> + # define TRIAGENS_SHAPED_JSON_SHAPED_JSON_H 1 <nl> <nl> - # include < BasicsC / common . h > <nl> + # include " BasicsC / common . h " <nl> <nl> - # include < BasicsC / json . h > <nl> + # include " BasicsC / json . h " <nl> <nl> # ifdef __cplusplus <nl> extern " C " { <nl>
cleanup
arangodb/arangodb
138f495431ed53b807d2a076df41d04d095877f2
2012-01-03T11:24:46Z
mmm a / hphp / hack / src / hhbc / hhbc_ast . ml <nl> ppp b / hphp / hack / src / hhbc / hhbc_ast . ml <nl> <nl> <nl> ( * * <nl> * TODO ( hgo ) : see within HHVM codebase what those types actually are * ) <nl> - type collection_type = string <nl> type rel_offset = int <nl> type property_name = string <nl> type member_op_mode = int <nl> type class_id = string <nl> type function_id = string <nl> type num_params = int <nl> <nl> + type collection_type = int <nl> + <nl> type instruct_basic = <nl> | Nop <nl> | EntryNop <nl> mmm a / hphp / hack / src / hhbc / hhbc_from_nast . ml <nl> ppp b / hphp / hack / src / hhbc / hhbc_from_nast . ml <nl> let emit_cast ( _ , hint_ ) = <nl> instr ( IOp CastDouble ) <nl> | _ - > emit_nyi " cast type " <nl> <nl> + let collection_type = function <nl> + | " Vector " - > 17 <nl> + | " Map " - > 18 <nl> + | " Set " - > 19 <nl> + | " Pair " - > 20 <nl> + | " ImmVector " - > 21 <nl> + | " ImmMap " - > 22 <nl> + | " ImmSet " - > 23 <nl> + | x - > failwith ( " unknown collection type ' " ^ x ^ " ' " ) <nl> + <nl> let rec from_expr expr = <nl> ( * Note that this takes an Ast . expr , not a Nast . expr . * ) <nl> match snd expr with <nl> let rec from_expr expr = <nl> | A . Collection ( ( _ , " dict " ) , es ) <nl> | A . Collection ( ( _ , " vec " ) , es ) <nl> | A . Collection ( ( _ , " keyset " ) , es ) - > emit_collection expr es <nl> - | _ - > <nl> - emit_nyi " expression " <nl> + | A . Collection ( ( pos , " Set " ) , fields ) - > begin <nl> + let collection_type = collection_type " Set " in <nl> + match fields with <nl> + | [ ] - > instr @ @ ILitConst ( NewCol collection_type ) <nl> + | _ - > gather <nl> + [ from_expr ( pos , A . Array fields ) <nl> + ; instr @ @ ILitConst ( ColFromArray collection_type ) <nl> + ] <nl> + end <nl> + <nl> + ( * TODO * ) <nl> + | A . Collection ( ( _ , type_str ) , _ ) - > <nl> + emit_nyi @ @ " collection : " ^ type_str <nl> + | A . New _ - > emit_nyi " new " <nl> + | A . Yield_break - > emit_nyi " yield_break " <nl> + | A . Shape _ - > emit_nyi " shape " <nl> + | A . Id _ - > emit_nyi " id " <nl> + | A . Id_type_arguments ( _ , _ ) - > emit_nyi " id_type_arguments " <nl> + | A . Lvarvar ( _ , _ ) - > emit_nyi " lvarvar " <nl> + | A . Clone _ - > emit_nyi " clone " <nl> + | A . Obj_get ( _ , _ , _ ) - > emit_nyi " obj_get " <nl> + | A . Array_get ( _ , _ ) - > emit_nyi " array_get " <nl> + | A . Class_get ( _ , _ ) - > emit_nyi " class_get " <nl> + | A . Class_const ( _ , _ ) - > emit_nyi " class_const " <nl> + | A . String2 _ - > emit_nyi " string2 " <nl> + | A . Yield _ - > emit_nyi " yield " <nl> + | A . Await _ - > emit_nyi " await " <nl> + | A . List _ - > emit_nyi " list " <nl> + | A . Efun ( _ , _ ) - > emit_nyi " efun " <nl> + | A . Lfun _ - > emit_nyi " lfun " <nl> + | A . Xml ( _ , _ , _ ) - > emit_nyi " xml " <nl> + | A . Unsafeexpr _ - > emit_nyi " unsafexpr " <nl> + | A . Import ( _ , _ ) - > emit_nyi " import " <nl> <nl> and emit_static_collection expr es = <nl> let a_label = Label . get_next_data_label ( ) in <nl> mmm a / hphp / hack / src / hhbc / hhbc_hhas . ml <nl> ppp b / hphp / hack / src / hhbc / hhbc_hhas . ml <nl> let string_of_lit_const instruction = <nl> | True - > " True " <nl> | False - > " False " <nl> | Double d - > " Double " ^ string_of_float d <nl> - | Array ( i , _ ) - > " Array @ A_ " ^ string_of_int i <nl> - | Dict ( i , _ ) - > " Dict @ A_ " ^ string_of_int i <nl> - | Vec ( i , _ ) - > " Vec @ A_ " ^ string_of_int i <nl> - | Keyset ( i , _ ) - > " Keyset @ A_ " ^ string_of_int i <nl> - | NewMixedArray i - > " NewMixedArray " ^ string_of_int i <nl> - | NewPackedArray i - > " NewPackedArray " ^ string_of_int i <nl> - | NewDictArray i - > " NewDictArray " ^ string_of_int i <nl> - | NewVecArray i - > " NewVecArray " ^ string_of_int i <nl> - | NewKeysetArray i - > " NewKeysetArray " ^ string_of_int i <nl> - | AddElemC - > " AddElemC " <nl> - | AddNewElemC - > " AddNewElemC " <nl> - | _ - > failwith " unexpected literal kind in string_of_lit_const " <nl> + | AddElemC - > " AddElemC " <nl> + | AddNewElemC - > " AddNewElemC " <nl> + | Array ( i , _ ) - > " Array @ A_ " ^ string_of_int i <nl> + | ColFromArray i - > " ColFromArray " ^ string_of_int i <nl> + | Dict ( i , _ ) - > " Dict @ A_ " ^ string_of_int i <nl> + | Keyset ( i , _ ) - > " Keyset @ A_ " ^ string_of_int i <nl> + | NewCol i - > " NewCol " ^ string_of_int i <nl> + | NewDictArray i - > " NewDictArray " ^ string_of_int i <nl> + | NewKeysetArray i - > " NewKeysetArray " ^ string_of_int i <nl> + | NewVecArray i - > " NewVecArray " ^ string_of_int i <nl> + | NewMixedArray i - > " NewMixedArray " ^ string_of_int i <nl> + | NewPackedArray i - > " NewPackedArray " ^ string_of_int i <nl> + | Vec ( i , _ ) - > " Vec @ A_ " ^ string_of_int i <nl> + <nl> + ( * TODO * ) <nl> + | _ - > " \ r # NYI : unexpected literal kind in string_of_lit_const " <nl> <nl> let string_of_operator instruction = <nl> match instruction with <nl>
pair construction , simplest test file
facebook/hhvm
4ea1d4d2b385b12607482addd91a23602fde5d86
2017-03-01T13:36:48Z
mmm a / src / video_core / renderer_vulkan / vk_stream_buffer . cpp <nl> ppp b / src / video_core / renderer_vulkan / vk_stream_buffer . cpp <nl> void VKStreamBuffer : : CreateBuffers ( VkBufferUsageFlags usage ) { <nl> <nl> / / Substract from the preferred heap size some bytes to avoid getting out of memory . <nl> const VkDeviceSize heap_size = memory_properties . memoryHeaps [ preferred_heap ] . size ; <nl> - const VkDeviceSize allocable_size = heap_size - 4 * 1024 * 1024 ; <nl> + const VkDeviceSize allocable_size = heap_size - 9 * 1024 * 1024 ; <nl> <nl> VkBufferCreateInfo buffer_ci ; <nl> buffer_ci . sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO ; <nl>
Merge pull request from lat9nq / fix - linux - nvidia - vulkan
yuzu-emu/yuzu
e73c53fad1a48915622f4c2db2250847551e31bf
2020-07-10T03:18:44Z
mmm a / src / jsifier . js <nl> ppp b / src / jsifier . js <nl> function JSify ( data , functionsOnly , givenFunctions ) { <nl> var ret = ident + ' ( ' + args . join ( ' , ' ) + ' ) ' ; <nl> if ( ASM_JS ) { / / TODO : do only when needed ( library functions and Math . * ? ) XXX & & shortident in Functions . libraryFunctions ) { <nl> ret = asmCoercion ( ret , returnType ) ; <nl> + if ( shortident = = ' abort ' & & funcData . returnType ! = ' void ' ) { <nl> + ret + = ' ; return 0 ' ; / / special case : abort ( ) can happen without return , breaking the return type of asm functions . ensure a return <nl> + } <nl> } <nl> return ret ; <nl> } <nl>
ensure a return when an abort happens in a function that returns something
emscripten-core/emscripten
4379d19dc217376bb11e9c4172c84ac194409c3c
2013-01-08T21:51:02Z
mmm a / hphp / runtime / base / apc - file - storage . cpp <nl> ppp b / hphp / runtime / base / apc - file - storage . cpp <nl> <nl> # include < sys / mman . h > <nl> <nl> # include " hphp / util / alloc . h " <nl> + # include " hphp / util / compatibility . h " <nl> # include " hphp / util / logger . h " <nl> # include " hphp / util / timer . h " <nl> <nl> + # include " hphp / runtime / base / apc - stats . h " <nl> + # include " hphp / runtime / base / builtin - functions . h " <nl> # include " hphp / runtime / base / runtime - option . h " <nl> # include " hphp / runtime / base / type - conversions . h " <nl> - # include " hphp / runtime / base / builtin - functions . h " <nl> - # include " hphp / runtime / server / server - stats . h " <nl> - # include " hphp / runtime / base / apc - stats . h " <nl> # include " hphp / runtime / ext / apc / ext_apc . h " <nl> + # include " hphp / runtime / server / server - stats . h " <nl> <nl> # if ! defined ( HAVE_POSIX_FALLOCATE ) & & \ <nl> ( _XOPEN_SOURCE > = 600 | | _POSIX_C_SOURCE > = 200112L | | defined ( __CYGWIN__ ) ) <nl> void APCFileStorage : : adviseOut ( ) { <nl> Logger : : Error ( " Failed to madvise chunk % d " , i ) ; <nl> } <nl> } <nl> + for ( auto i = 0u ; i < m_fds . size ( ) ; i + + ) { <nl> + if ( fadvise_dontneed ( m_fds [ i ] , m_chunkSize ) < 0 ) { <nl> + Logger : : Error ( " Failed to fadvise chunk file % d , fd = % d " , i , m_fds [ i ] ) ; <nl> + } <nl> + } <nl> } <nl> <nl> bool APCFileStorage : : hashCheck ( ) { <nl> bool APCFileStorage : : hashCheck ( ) { <nl> <nl> void APCFileStorage : : cleanup ( ) { <nl> std : : lock_guard < std : : mutex > lock ( m_lock ) ; <nl> - for ( unsigned int i = 0 ; i < m_fileNames . size ( ) ; i + + ) { <nl> - unlink ( m_fileNames [ i ] . c_str ( ) ) ; <nl> + for ( auto & fileName : m_fileNames ) { <nl> + unlink ( fileName . c_str ( ) ) ; <nl> + } <nl> + m_fileNames . clear ( ) ; <nl> + for ( auto fd : m_fds ) { <nl> + fadvise_dontneed ( fd , m_chunkSize ) ; <nl> + close ( fd ) ; <nl> } <nl> + m_fds . clear ( ) ; <nl> m_chunks . clear ( ) ; <nl> } <nl> <nl> bool APCFileStorage : : addFile ( ) { <nl> } <nl> <nl> m_chunks . push_back ( addr ) ; <nl> + m_fds . push_back ( fd ) ; <nl> / / memory_order_release guarantees that the new chunk is already present in <nl> / / m_chunks when we reset m_current . It is OK if other threads still try to <nl> / / use the previous chunk before this point . <nl> m_current . store ( static_cast < int64_t > ( m_chunks . size ( ) - 1 ) < < 32 , <nl> std : : memory_order_release ) ; <nl> - close ( fd ) ; <nl> return true ; <nl> } <nl> <nl> mmm a / hphp / runtime / base / apc - file - storage . h <nl> ppp b / hphp / runtime / base / apc - file - storage . h <nl> struct APCFileStorage { <nl> StorageState m_state { StorageState : : Invalid } ; <nl> std : : vector < char * > m_chunks ; <nl> std : : vector < std : : string > m_fileNames ; <nl> + std : : vector < int > m_fds ; <nl> std : : string m_prefix ; <nl> <nl> / / This lock is needed when manipulating chunks . <nl> mmm a / hphp / runtime / server / http - server . cpp <nl> ppp b / hphp / runtime / server / http - server . cpp <nl> <nl> # include " hphp / runtime / base / runtime - option . h " <nl> # include " hphp / runtime / base / init - fini - node . h " <nl> # include " hphp / runtime / debugger / debugger . h " <nl> + # include " hphp / runtime / ext / apc / ext_apc . h " <nl> # include " hphp / runtime / server / admin - request - handler . h " <nl> # include " hphp / runtime / server / http - request - handler . h " <nl> # include " hphp / runtime / server / replay - transport . h " <nl> <nl> # include " hphp / runtime / server / warmup - request - handler . h " <nl> # include " hphp / runtime / server / xbox - server . h " <nl> <nl> + # include " hphp / util / alloc . h " <nl> # include " hphp / util / boot_timer . h " <nl> # include " hphp / util / logger . h " <nl> # include " hphp / util / process . h " <nl> void HttpServer : : runOrExitProcess ( ) { <nl> } <nl> onServerShutdown ( ) ; <nl> <nl> + / / In theory , the kernel should do just as well even if we don ' t <nl> + / / explicitly advise files out . But we do it anyway . If there is a <nl> + / / new server process starting on the same host , it will see more <nl> + / / free memory and have more confidence to proceed . <nl> + advise_out ( RuntimeOption : : RepoLocalPath ) ; <nl> + advise_out ( RuntimeOption : : FileCache ) ; <nl> + apc_advise_out ( ) ; <nl> + <nl> waitForServers ( ) ; <nl> m_watchDog . waitForEnd ( ) ; <nl> playShutdownRequest ( RuntimeOption : : ServerCleanupRequest ) ; <nl> mmm a / hphp / runtime / server / proxygen / proxygen - server . cpp <nl> ppp b / hphp / runtime / server / proxygen / proxygen - server . cpp <nl> <nl> # include " hphp / runtime / base / program - functions . h " <nl> # include " hphp / runtime / base / url . h " <nl> # include " hphp / runtime / debugger / debugger . h " <nl> + # include " hphp / util / alloc . h " <nl> # include " hphp / util / compatibility . h " <nl> + # include " hphp / util / process . h " <nl> # include < proxygen / lib / http / codec / HTTP2Constants . h > <nl> <nl> namespace HPHP { <nl> void ProxygenServer : : stopVM ( ) { <nl> / / we can ' t call m_dispatcher . stop ( ) from the event loop , because it blocks <nl> / / all I / O . Spawn a thread to call it and callback when it ' s done . <nl> std : : thread vmStopper ( [ this ] { <nl> + purge_all ( ) ; <nl> Logger : : Info ( " % p : Stopping dispatcher port = % d " , this , m_port ) ; <nl> m_dispatcher . stop ( ) ; <nl> Logger : : Info ( " % p : Dispatcher stopped port = % d . conns = % d " , this , m_port , <nl> void ProxygenServer : : forceStop ( ) { <nl> void ProxygenServer : : reportShutdownStatus ( ) { <nl> if ( m_port ! = RuntimeOption : : ServerPort ) return ; <nl> if ( getStatus ( ) = = RunStatus : : STOPPED ) return ; <nl> - Logger : : Info ( " Shutdown state = % d , a / q / e / p % d / % d / % d / % d " , <nl> - ( int ) m_shutdownState , <nl> - getActiveWorker ( ) , <nl> - getQueuedJobs ( ) , <nl> - getLibEventConnectionCount ( ) , <nl> - ( int ) m_pendingTransports . size ( ) ) ; <nl> + Logger : : FInfo ( " Shutdown state = { } , a / q / e / p { } / { } / { } / { } , RSS = { } Mb " , <nl> + static_cast < int > ( m_shutdownState ) , <nl> + getActiveWorker ( ) , <nl> + getQueuedJobs ( ) , <nl> + getLibEventConnectionCount ( ) , <nl> + m_pendingTransports . size ( ) , <nl> + Process : : GetProcessRSS ( Process : : GetProcessId ( ) ) ) ; <nl> m_worker . getEventBase ( ) - > runAfterDelay ( [ this ] { reportShutdownStatus ( ) ; } , 500 ) ; <nl> } <nl> <nl> mmm a / hphp / util / alloc . h <nl> ppp b / hphp / util / alloc . h <nl> void flush_thread_stack ( ) ; <nl> * Free all unused memory back to system . On error , returns false and , if <nl> * not null , sets an error message in * errStr . <nl> * / <nl> - bool purge_all ( std : : string * errStr ) ; <nl> + bool purge_all ( std : : string * errStr = nullptr ) ; <nl> <nl> / * * <nl> * Like scoped_ptr , but calls free ( ) on destruct <nl> mmm a / hphp / util / compatibility . cpp <nl> ppp b / hphp / util / compatibility . cpp <nl> int fadvise_dontneed ( int fd , off_t len ) { <nl> # endif <nl> } <nl> <nl> + int advise_out ( const std : : string & fileName ) { <nl> + if ( fileName . empty ( ) ) return - 1 ; <nl> + int fd = open ( fileName . c_str ( ) , O_RDONLY ) ; <nl> + if ( fd = = - 1 ) return - 1 ; <nl> + int result = fadvise_dontneed ( fd , 0 ) ; <nl> + close ( fd ) ; <nl> + return result ; <nl> + } <nl> + <nl> # if defined ( __CYGWIN__ ) | | defined ( _MSC_VER ) <nl> # include < windows . h > <nl> <nl> mmm a / hphp / util / compatibility . h <nl> ppp b / hphp / util / compatibility . h <nl> <nl> # define incl_HPHP_COMPATIBILITY_H_ <nl> <nl> # include < cstdint > <nl> + # include < string > <nl> # include < time . h > <nl> # include < unistd . h > <nl> <nl> int64_t gettime_diff_us ( const timespec & start , const timespec & end ) ; <nl> * Drop the cached pages associated with the file from the file system <nl> * cache , if supported on our build target . <nl> * <nl> - * Returns : - 1 on error , setting errno according to posix_fadvise <nl> - * values . <nl> + * Returns : - 1 on error . <nl> * / <nl> int fadvise_dontneed ( int fd , off_t len ) ; <nl> + int advise_out ( const std : : string & fileName ) ; <nl> <nl> # if defined ( __CYGWIN__ ) | | defined ( _MSC_VER ) <nl> <nl>
evict some page cache while server drains
facebook/hhvm
67c96a187410f293fea7580bfe2209887d60d298
2016-03-25T16:00:32Z
mmm a / modules / tools / image_decompress / BUILD <nl> ppp b / modules / tools / image_decompress / BUILD <nl> load ( " / / tools : cpplint . bzl " , " cpplint " ) <nl> <nl> package ( default_visibility = [ " / / visibility : public " ] ) <nl> <nl> - cc_binary ( <nl> - name = " libimage_decompress . so " , <nl> + cc_library ( <nl> + name = " image_decompress_lib " , <nl> srcs = [ <nl> " image_decompress . cc " , <nl> + ] , <nl> + hdrs = [ <nl> " image_decompress . h " , <nl> ] , <nl> copts = [ ' - DMODULE_NAME = \ \ " image_decompress \ \ " ' ] , <nl> - linkshared = True , <nl> - linkstatic = False , <nl> deps = [ <nl> " / / cyber " , <nl> " / / modules / drivers / proto : sensor_proto " , <nl> " / / modules / tools / image_decompress / proto : decompress_proto " , <nl> + " @ opencv2 / / : core " , <nl> + " @ opencv2 / / : highgui " , <nl> ] , <nl> ) <nl> <nl> + cc_test ( <nl> + name = " image_decompress_test " , <nl> + size = " small " , <nl> + srcs = [ " image_decompress_test . cc " ] , <nl> + deps = [ <nl> + " : image_decompress_lib " , <nl> + " @ gtest / / : main " , <nl> + ] , <nl> + ) <nl> + <nl> + cc_binary ( <nl> + name = " libimage_decompress . so " , <nl> + linkshared = True , <nl> + linkstatic = False , <nl> + deps = [ " : image_decompress_lib " ] , <nl> + ) <nl> + <nl> cpplint ( ) <nl> new file mode 100644 <nl> index 00000000000 . . a2576e07bc3 <nl> mmm / dev / null <nl> ppp b / modules / tools / image_decompress / image_decompress_test . cc <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2019 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + # include " modules / tools / image_decompress / image_decompress . h " <nl> + <nl> + # include " cyber / init . h " <nl> + # include " gtest / gtest . h " <nl> + <nl> + namespace apollo { <nl> + namespace image_decompress { <nl> + <nl> + TEST ( ImageDecompressComponentTest , Init ) { <nl> + cyber : : Init ( " image_decompress_component_test " ) ; <nl> + ImageDecompressComponent component ; <nl> + } <nl> + <nl> + } / / namespace image_decompress <nl> + } / / namespace apollo <nl>
Tools : Add image_decompress test and fix dependency .
ApolloAuto/apollo
efe3f9b29b9508957a0531a1a8e23ed61ea4a50a
2019-01-02T20:36:25Z
mmm a / vnext / ReactUWP / Modules / NetworkingModule . cpp <nl> ppp b / vnext / ReactUWP / Modules / NetworkingModule . cpp <nl> std : : future < void > SendRequestAsync ( <nl> networking - > AddRequest ( requestId , completion ) ; <nl> <nl> winrt : : Windows : : Web : : Http : : HttpResponseMessage response = co_await completion ; <nl> - <nl> - networking - > OnResponseReceived ( requestId , response ) ; <nl> + if ( response ! = nullptr ) <nl> + networking - > OnResponseReceived ( requestId , response ) ; <nl> <nl> / / NotYetImplemented : useIncrementalUpdates <nl> <nl> - if ( response . Content ( ) ! = nullptr ) <nl> + if ( response ! = nullptr & & response . Content ( ) ! = nullptr ) <nl> { <nl> winrt : : Windows : : Storage : : Streams : : IInputStream inputStream = co_await response . Content ( ) . ReadAsInputStreamAsync ( ) ; <nl> auto reader = winrt : : Windows : : Storage : : Streams : : DataReader ( inputStream ) ; <nl> std : : future < void > SendRequestAsync ( <nl> } <nl> else <nl> { <nl> - networking - > OnRequestError ( requestId , " No response content " , false / * isTimeout * / ) ; <nl> + networking - > OnRequestError ( requestId , response = = nullptr ? " request failed " : " No response content " , false / * isTimeout * / ) ; <nl> } <nl> <nl> networking - > RemoveRequest ( requestId ) ; <nl>
add some error handling in NetworkingModule ( )
microsoft/react-native-windows
4256b9691fd26fe041ea617b823fb1fcf2fa14c4
2019-07-02T13:56:00Z
mmm a / xbmc / cores / VideoPlayer / VideoPlayer . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoPlayer . cpp <nl> void CVideoPlayer : : HandleMessages ( ) <nl> m_messenger . Put ( new CDVDMsgPlayerSeek ( iTime , m_playSpeed < 0 , true , false , false , true ) ) ; <nl> } <nl> <nl> - / / if playspeed is different then DVD_PLAYSPEED_NORMAL or DVD_PLAYSPEED_PAUSE <nl> - / / audioplayer , stops outputing audio to audiorendere , but still tries to <nl> - / / sleep an correct amount for each packet <nl> - / / videoplayer just plays faster after the clock speed has been increased <nl> - / / 1 . disable audio <nl> - / / 2 . skip frames and adjust their pts or the clock <nl> m_playSpeed = speed ; <nl> m_newPlaySpeed = speed ; <nl> m_caching = CACHESTATE_DONE ; <nl>
VideoPlayer : drop some outdated comments
xbmc/xbmc
ac95edc80ff0529feeb548fcecdb429760ea0478
2016-09-28T18:18:18Z
mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> v8_source_set ( " v8_base " ) { <nl> " src / safepoint - table . h " , <nl> " src / setup - isolate . h " , <nl> " src / signature . h " , <nl> + " src / simulator - base . cc " , <nl> + " src / simulator - base . h " , <nl> " src / simulator . h " , <nl> " src / snapshot / builtin - deserializer - allocator . cc " , <nl> " src / snapshot / builtin - deserializer - allocator . h " , <nl> mmm a / src / arm / simulator - arm . cc <nl> ppp b / src / arm / simulator - arm . cc <nl> void Simulator : : CheckICache ( base : : CustomMatcherHashMap * i_cache , <nl> } <nl> <nl> <nl> - void Simulator : : Initialize ( Isolate * isolate ) { <nl> - if ( isolate - > simulator_initialized ( ) ) return ; <nl> - isolate - > set_simulator_initialized ( true ) ; <nl> - : : v8 : : internal : : ExternalReference : : set_redirector ( isolate , <nl> - & RedirectExternalReference ) ; <nl> - } <nl> - <nl> - <nl> Simulator : : Simulator ( Isolate * isolate ) : isolate_ ( isolate ) { <nl> i_cache_ = isolate_ - > simulator_i_cache ( ) ; <nl> if ( i_cache_ = = nullptr ) { <nl> class Redirection { <nl> swi_instruction_ ( al | ( 0xF * B24 ) | kCallRtRedirected ) , <nl> type_ ( type ) , <nl> next_ ( nullptr ) { <nl> - next_ = isolate - > simulator_redirection ( ) ; <nl> - Simulator : : current ( isolate ) - > <nl> - FlushICache ( isolate - > simulator_i_cache ( ) , <nl> - reinterpret_cast < void * > ( & swi_instruction_ ) , <nl> - Instruction : : kInstrSize ) ; <nl> - isolate - > set_simulator_redirection ( this ) ; <nl> + next_ = Simulator : : redirection ( ) ; <nl> + Simulator : : FlushICache ( isolate - > simulator_i_cache ( ) , <nl> + reinterpret_cast < void * > ( & swi_instruction_ ) , <nl> + Instruction : : kInstrSize ) ; <nl> + Simulator : : set_redirection ( this ) ; <nl> } <nl> <nl> void * address_of_swi_instruction ( ) { <nl> class Redirection { <nl> <nl> static Redirection * Get ( Isolate * isolate , void * external_function , <nl> ExternalReference : : Type type ) { <nl> - Redirection * current = isolate - > simulator_redirection ( ) ; <nl> + Redirection * current = Simulator : : redirection ( ) ; <nl> for ( ; current ! = nullptr ; current = current - > next_ ) { <nl> if ( current - > external_function_ = = external_function & & <nl> current - > type_ = = type ) { <nl> class Redirection { <nl> <nl> <nl> / / static <nl> - void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> - Redirection * first ) { <nl> - Redirection : : DeleteChain ( first ) ; <nl> + void SimulatorBase : : GlobalTearDown ( ) { <nl> + delete redirection_mutex_ ; <nl> + redirection_mutex_ = nullptr ; <nl> + <nl> + Redirection : : DeleteChain ( redirection_ ) ; <nl> + redirection_ = nullptr ; <nl> + } <nl> + <nl> + / / static <nl> + void SimulatorBase : : TearDown ( base : : CustomMatcherHashMap * i_cache ) { <nl> if ( i_cache ! = nullptr ) { <nl> for ( base : : HashMap : : Entry * entry = i_cache - > Start ( ) ; entry ! = nullptr ; <nl> entry = i_cache - > Next ( entry ) ) { <nl> void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> } <nl> } <nl> <nl> - <nl> - void * Simulator : : RedirectExternalReference ( Isolate * isolate , <nl> - void * external_function , <nl> - ExternalReference : : Type type ) { <nl> - base : : LockGuard < base : : Mutex > lock_guard ( <nl> - isolate - > simulator_redirection_mutex ( ) ) ; <nl> + void * SimulatorBase : : RedirectExternalReference ( Isolate * isolate , <nl> + void * external_function , <nl> + ExternalReference : : Type type ) { <nl> + base : : LockGuard < base : : Mutex > lock_guard ( Simulator : : redirection_mutex ( ) ) ; <nl> Redirection * redirection = Redirection : : Get ( isolate , external_function , type ) ; <nl> return redirection - > address_of_swi_instruction ( ) ; <nl> } <nl> mmm a / src / arm / simulator - arm . h <nl> ppp b / src / arm / simulator - arm . h <nl> <nl> # include " src / arm / constants - arm . h " <nl> # include " src / assembler . h " <nl> # include " src / base / hashmap . h " <nl> + # include " src / simulator - base . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> class CachePage { <nl> char validity_map_ [ kValidityMapSize ] ; / / One byte per line . <nl> } ; <nl> <nl> - <nl> - class Simulator { <nl> + class Simulator : public SimulatorBase { <nl> public : <nl> friend class ArmDebugger ; <nl> enum Register { <nl> class Simulator { <nl> / / Executes ARM instructions until the PC reaches end_sim_pc . <nl> void Execute ( ) ; <nl> <nl> - / / Call on program start . <nl> - static void Initialize ( Isolate * isolate ) ; <nl> - <nl> - static void TearDown ( base : : CustomMatcherHashMap * i_cache , Redirection * first ) ; <nl> - <nl> / / V8 generally calls into generated JS code with 5 parameters and into <nl> / / generated RegExp code with 7 parameters . This is a convenience function , <nl> / / which sets up the simulator state and grabs the result on return . <nl> class Simulator { <nl> static CachePage * GetCachePage ( base : : CustomMatcherHashMap * i_cache , <nl> void * page ) ; <nl> <nl> - / / Runtime call support . Uses the isolate in a thread - safe way . <nl> - static void * RedirectExternalReference ( <nl> - Isolate * isolate , void * external_function , <nl> - v8 : : internal : : ExternalReference : : Type type ) ; <nl> - <nl> / / Handle arguments and return value for runtime FP functions . <nl> void GetFpArgs ( double * x , double * y , int32_t * z ) ; <nl> void SetFpResult ( const double & result ) ; <nl> mmm a / src / arm64 / simulator - arm64 . cc <nl> ppp b / src / arm64 / simulator - arm64 . cc <nl> SimSystemRegister SimSystemRegister : : DefaultValueFor ( SystemRegister id ) { <nl> } <nl> <nl> <nl> - void Simulator : : Initialize ( Isolate * isolate ) { <nl> - if ( isolate - > simulator_initialized ( ) ) return ; <nl> - isolate - > set_simulator_initialized ( true ) ; <nl> - ExternalReference : : set_redirector ( isolate , & RedirectExternalReference ) ; <nl> - } <nl> - <nl> - <nl> / / Get the active Simulator for the current thread . <nl> Simulator * Simulator : : current ( Isolate * isolate ) { <nl> Isolate : : PerIsolateThreadData * isolate_data = <nl> class Redirection { <nl> : external_function_ ( external_function ) , type_ ( type ) , next_ ( nullptr ) { <nl> redirect_call_ . SetInstructionBits ( <nl> HLT | Assembler : : ImmException ( kImmExceptionIsRedirectedCall ) ) ; <nl> - next_ = isolate - > simulator_redirection ( ) ; <nl> + next_ = Simulator : : redirection ( ) ; <nl> / / TODO ( all ) : Simulator flush I cache <nl> - isolate - > set_simulator_redirection ( this ) ; <nl> + Simulator : : set_redirection ( this ) ; <nl> } <nl> <nl> void * address_of_redirect_call ( ) { <nl> class Redirection { <nl> <nl> static Redirection * Get ( Isolate * isolate , void * external_function , <nl> ExternalReference : : Type type ) { <nl> - Redirection * current = isolate - > simulator_redirection ( ) ; <nl> + Redirection * current = Simulator : : redirection ( ) ; <nl> for ( ; current ! = nullptr ; current = current - > next_ ) { <nl> if ( current - > external_function_ = = external_function & & <nl> current - > type_ = = type ) { <nl> class Redirection { <nl> <nl> <nl> / / static <nl> - void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> - Redirection * first ) { <nl> - Redirection : : DeleteChain ( first ) ; <nl> + void SimulatorBase : : GlobalTearDown ( ) { <nl> + delete redirection_mutex_ ; <nl> + redirection_mutex_ = nullptr ; <nl> + <nl> + Redirection : : DeleteChain ( redirection_ ) ; <nl> + redirection_ = nullptr ; <nl> + } <nl> + <nl> + / / static <nl> + void SimulatorBase : : TearDown ( base : : CustomMatcherHashMap * i_cache ) { <nl> + / / TODO ( all ) : Simulator flush I cache <nl> } <nl> <nl> <nl> void Simulator : : DoRuntimeCall ( Instruction * instr ) { <nl> set_pc ( return_address ) ; <nl> } <nl> <nl> - <nl> - void * Simulator : : RedirectExternalReference ( Isolate * isolate , <nl> - void * external_function , <nl> - ExternalReference : : Type type ) { <nl> - base : : LockGuard < base : : Mutex > lock_guard ( <nl> - isolate - > simulator_redirection_mutex ( ) ) ; <nl> + void * SimulatorBase : : RedirectExternalReference ( Isolate * isolate , <nl> + void * external_function , <nl> + ExternalReference : : Type type ) { <nl> + base : : LockGuard < base : : Mutex > lock_guard ( Simulator : : redirection_mutex ( ) ) ; <nl> Redirection * redirection = Redirection : : Get ( isolate , external_function , type ) ; <nl> return redirection - > address_of_redirect_call ( ) ; <nl> } <nl> mmm a / src / arm64 / simulator - arm64 . h <nl> ppp b / src / arm64 / simulator - arm64 . h <nl> <nl> # include " src / assembler . h " <nl> # include " src / base / compiler - specific . h " <nl> # include " src / globals . h " <nl> + # include " src / simulator - base . h " <nl> # include " src / utils . h " <nl> <nl> namespace v8 { <nl> class LogicVRegister { <nl> bool round_ [ kQRegSize ] ; <nl> } ; <nl> <nl> - class Simulator : public DecoderVisitor { <nl> + / / Using multiple inheritance here is permitted because { DecoderVisitor } is a <nl> + / / pure interface class with only pure virtual methods . <nl> + class Simulator : public DecoderVisitor , public SimulatorBase { <nl> public : <nl> static void FlushICache ( base : : CustomMatcherHashMap * i_cache , void * start , <nl> size_t size ) { <nl> class Simulator : public DecoderVisitor { <nl> <nl> / / System functions . <nl> <nl> - static void Initialize ( Isolate * isolate ) ; <nl> - <nl> - static void TearDown ( base : : CustomMatcherHashMap * i_cache , Redirection * first ) ; <nl> - <nl> static Simulator * current ( v8 : : internal : : Isolate * isolate ) ; <nl> <nl> class CallArgument ; <nl> class Simulator : public DecoderVisitor { <nl> <nl> void ResetState ( ) ; <nl> <nl> - / / Runtime call support . Uses the isolate in a thread - safe way . <nl> - static void * RedirectExternalReference ( Isolate * isolate , <nl> - void * external_function , <nl> - ExternalReference : : Type type ) ; <nl> void DoRuntimeCall ( Instruction * instr ) ; <nl> <nl> / / Run the simulator . <nl> mmm a / src / isolate . cc <nl> ppp b / src / isolate . cc <nl> Isolate : : ~ Isolate ( ) { <nl> allocator_ = nullptr ; <nl> <nl> # if USE_SIMULATOR <nl> - Simulator : : TearDown ( simulator_i_cache_ , simulator_redirection_ ) ; <nl> + Simulator : : TearDown ( simulator_i_cache_ ) ; <nl> simulator_i_cache_ = nullptr ; <nl> - simulator_redirection_ = nullptr ; <nl> # endif <nl> } <nl> <nl> mmm a / src / isolate . h <nl> ppp b / src / isolate . h <nl> class ThreadLocalTop BASE_EMBEDDED { <nl> <nl> # if USE_SIMULATOR <nl> <nl> - # define ISOLATE_INIT_SIMULATOR_LIST ( V ) \ <nl> - V ( bool , simulator_initialized , false ) \ <nl> - V ( base : : CustomMatcherHashMap * , simulator_i_cache , nullptr ) \ <nl> - V ( Redirection * , simulator_redirection , nullptr ) <nl> + # define ISOLATE_INIT_SIMULATOR_LIST ( V ) \ <nl> + V ( bool , simulator_initialized , false ) \ <nl> + V ( base : : CustomMatcherHashMap * , simulator_i_cache , nullptr ) <nl> # else <nl> <nl> # define ISOLATE_INIT_SIMULATOR_LIST ( V ) <nl> class Isolate { <nl> <nl> # ifdef USE_SIMULATOR <nl> base : : Mutex * simulator_i_cache_mutex ( ) { return & simulator_i_cache_mutex_ ; } <nl> - base : : Mutex * simulator_redirection_mutex ( ) { <nl> - return & simulator_redirection_mutex_ ; <nl> - } <nl> # endif <nl> <nl> void set_allow_atomics_wait ( bool set ) { allow_atomics_wait_ = set ; } <nl> class Isolate { <nl> <nl> # ifdef USE_SIMULATOR <nl> base : : Mutex simulator_i_cache_mutex_ ; <nl> - base : : Mutex simulator_redirection_mutex_ ; <nl> # endif <nl> <nl> bool allow_atomics_wait_ ; <nl> mmm a / src / mips / simulator - mips . cc <nl> ppp b / src / mips / simulator - mips . cc <nl> void Simulator : : CheckICache ( base : : CustomMatcherHashMap * i_cache , <nl> } <nl> <nl> <nl> - void Simulator : : Initialize ( Isolate * isolate ) { <nl> - if ( isolate - > simulator_initialized ( ) ) return ; <nl> - isolate - > set_simulator_initialized ( true ) ; <nl> - : : v8 : : internal : : ExternalReference : : set_redirector ( isolate , <nl> - & RedirectExternalReference ) ; <nl> - } <nl> - <nl> - <nl> Simulator : : Simulator ( Isolate * isolate ) : isolate_ ( isolate ) { <nl> i_cache_ = isolate_ - > simulator_i_cache ( ) ; <nl> if ( i_cache_ = = nullptr ) { <nl> class Redirection { <nl> swi_instruction_ ( rtCallRedirInstr ) , <nl> type_ ( type ) , <nl> next_ ( nullptr ) { <nl> - next_ = isolate - > simulator_redirection ( ) ; <nl> - Simulator : : current ( isolate ) - > <nl> - FlushICache ( isolate - > simulator_i_cache ( ) , <nl> - reinterpret_cast < void * > ( & swi_instruction_ ) , <nl> - Instruction : : kInstrSize ) ; <nl> - isolate - > set_simulator_redirection ( this ) ; <nl> + next_ = Simulator : : redirection ( ) ; <nl> + Simulator : : FlushICache ( isolate - > simulator_i_cache ( ) , <nl> + reinterpret_cast < void * > ( & swi_instruction_ ) , <nl> + Instruction : : kInstrSize ) ; <nl> + Simulator : : set_redirection ( this ) ; <nl> } <nl> <nl> void * address_of_swi_instruction ( ) { <nl> class Redirection { <nl> <nl> static Redirection * Get ( Isolate * isolate , void * external_function , <nl> ExternalReference : : Type type ) { <nl> - Redirection * current = isolate - > simulator_redirection ( ) ; <nl> + Redirection * current = Simulator : : redirection ( ) ; <nl> for ( ; current ! = nullptr ; current = current - > next_ ) { <nl> if ( current - > external_function_ = = external_function & & <nl> current - > type_ = = type ) { <nl> class Redirection { <nl> <nl> <nl> / / static <nl> - void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> - Redirection * first ) { <nl> - Redirection : : DeleteChain ( first ) ; <nl> + void SimulatorBase : : GlobalTearDown ( ) { <nl> + delete redirection_mutex_ ; <nl> + redirection_mutex_ = nullptr ; <nl> + <nl> + Redirection : : DeleteChain ( redirection_ ) ; <nl> + redirection_ = nullptr ; <nl> + } <nl> + <nl> + / / static <nl> + void SimulatorBase : : TearDown ( base : : CustomMatcherHashMap * i_cache ) { <nl> if ( i_cache ! = nullptr ) { <nl> for ( base : : CustomMatcherHashMap : : Entry * entry = i_cache - > Start ( ) ; <nl> entry ! = nullptr ; entry = i_cache - > Next ( entry ) ) { <nl> void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> } <nl> } <nl> <nl> - <nl> - void * Simulator : : RedirectExternalReference ( Isolate * isolate , <nl> - void * external_function , <nl> - ExternalReference : : Type type ) { <nl> - base : : LockGuard < base : : Mutex > lock_guard ( <nl> - isolate - > simulator_redirection_mutex ( ) ) ; <nl> + void * SimulatorBase : : RedirectExternalReference ( Isolate * isolate , <nl> + void * external_function , <nl> + ExternalReference : : Type type ) { <nl> + base : : LockGuard < base : : Mutex > lock_guard ( Simulator : : redirection_mutex ( ) ) ; <nl> Redirection * redirection = Redirection : : Get ( isolate , external_function , type ) ; <nl> return redirection - > address_of_swi_instruction ( ) ; <nl> } <nl> mmm a / src / mips / simulator - mips . h <nl> ppp b / src / mips / simulator - mips . h <nl> <nl> <nl> # include " src / assembler . h " <nl> # include " src / base / hashmap . h " <nl> + # include " src / simulator - base . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> class SimInstruction : public InstructionGetters < SimInstructionBase > { <nl> } <nl> } ; <nl> <nl> - class Simulator { <nl> + class Simulator : public SimulatorBase { <nl> public : <nl> friend class MipsDebugger ; <nl> <nl> class Simulator { <nl> / / Executes MIPS instructions until the PC reaches end_sim_pc . <nl> void Execute ( ) ; <nl> <nl> - / / Call on program start . <nl> - static void Initialize ( Isolate * isolate ) ; <nl> - <nl> - static void TearDown ( base : : CustomMatcherHashMap * i_cache , Redirection * first ) ; <nl> - <nl> / / V8 generally calls into generated JS code with 5 parameters and into <nl> / / generated RegExp code with 7 parameters . This is a convenience function , <nl> / / which sets up the simulator state and grabs the result on return . <nl> class Simulator { <nl> / / Exceptions . <nl> void SignalException ( Exception e ) ; <nl> <nl> - / / Runtime call support . Uses the isolate in a thread - safe way . <nl> - static void * RedirectExternalReference ( Isolate * isolate , <nl> - void * external_function , <nl> - ExternalReference : : Type type ) ; <nl> - <nl> / / Handle arguments and return value for runtime FP functions . <nl> void GetFpArgs ( double * x , double * y , int32_t * z ) ; <nl> void SetFpResult ( const double & result ) ; <nl> mmm a / src / mips64 / simulator - mips64 . cc <nl> ppp b / src / mips64 / simulator - mips64 . cc <nl> void Simulator : : CheckICache ( base : : CustomMatcherHashMap * i_cache , <nl> } <nl> <nl> <nl> - void Simulator : : Initialize ( Isolate * isolate ) { <nl> - if ( isolate - > simulator_initialized ( ) ) return ; <nl> - isolate - > set_simulator_initialized ( true ) ; <nl> - : : v8 : : internal : : ExternalReference : : set_redirector ( isolate , <nl> - & RedirectExternalReference ) ; <nl> - } <nl> - <nl> - <nl> Simulator : : Simulator ( Isolate * isolate ) : isolate_ ( isolate ) { <nl> i_cache_ = isolate_ - > simulator_i_cache ( ) ; <nl> if ( i_cache_ = = nullptr ) { <nl> class Redirection { <nl> swi_instruction_ ( rtCallRedirInstr ) , <nl> type_ ( type ) , <nl> next_ ( nullptr ) { <nl> - next_ = isolate - > simulator_redirection ( ) ; <nl> - Simulator : : current ( isolate ) - > <nl> - FlushICache ( isolate - > simulator_i_cache ( ) , <nl> - reinterpret_cast < void * > ( & swi_instruction_ ) , <nl> - Instruction : : kInstrSize ) ; <nl> - isolate - > set_simulator_redirection ( this ) ; <nl> + next_ = Simulator : : redirection ( ) ; <nl> + Simulator : : FlushICache ( isolate - > simulator_i_cache ( ) , <nl> + reinterpret_cast < void * > ( & swi_instruction_ ) , <nl> + Instruction : : kInstrSize ) ; <nl> + Simulator : : set_redirection ( this ) ; <nl> } <nl> <nl> void * address_of_swi_instruction ( ) { <nl> class Redirection { <nl> <nl> static Redirection * Get ( Isolate * isolate , void * external_function , <nl> ExternalReference : : Type type ) { <nl> - Redirection * current = isolate - > simulator_redirection ( ) ; <nl> + Redirection * current = Simulator : : redirection ( ) ; <nl> for ( ; current ! = nullptr ; current = current - > next_ ) { <nl> if ( current - > external_function_ = = external_function & & <nl> current - > type_ = = type ) { <nl> class Redirection { <nl> <nl> <nl> / / static <nl> - void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> - Redirection * first ) { <nl> - Redirection : : DeleteChain ( first ) ; <nl> + void SimulatorBase : : GlobalTearDown ( ) { <nl> + delete redirection_mutex_ ; <nl> + redirection_mutex_ = nullptr ; <nl> + <nl> + Redirection : : DeleteChain ( redirection_ ) ; <nl> + redirection_ = nullptr ; <nl> + } <nl> + <nl> + / / static <nl> + void SimulatorBase : : TearDown ( base : : CustomMatcherHashMap * i_cache ) { <nl> if ( i_cache ! = nullptr ) { <nl> for ( base : : HashMap : : Entry * entry = i_cache - > Start ( ) ; entry ! = nullptr ; <nl> entry = i_cache - > Next ( entry ) ) { <nl> void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> } <nl> } <nl> <nl> - <nl> - void * Simulator : : RedirectExternalReference ( Isolate * isolate , <nl> - void * external_function , <nl> - ExternalReference : : Type type ) { <nl> - base : : LockGuard < base : : Mutex > lock_guard ( <nl> - isolate - > simulator_redirection_mutex ( ) ) ; <nl> + void * SimulatorBase : : RedirectExternalReference ( Isolate * isolate , <nl> + void * external_function , <nl> + ExternalReference : : Type type ) { <nl> + base : : LockGuard < base : : Mutex > lock_guard ( Simulator : : redirection_mutex ( ) ) ; <nl> Redirection * redirection = Redirection : : Get ( isolate , external_function , type ) ; <nl> return redirection - > address_of_swi_instruction ( ) ; <nl> } <nl> mmm a / src / mips64 / simulator - mips64 . h <nl> ppp b / src / mips64 / simulator - mips64 . h <nl> <nl> <nl> # include " src / assembler . h " <nl> # include " src / base / hashmap . h " <nl> + # include " src / simulator - base . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> class SimInstruction : public InstructionGetters < SimInstructionBase > { <nl> } <nl> } ; <nl> <nl> - class Simulator { <nl> + class Simulator : public SimulatorBase { <nl> public : <nl> friend class MipsDebugger ; <nl> <nl> class Simulator { <nl> / / Executes MIPS instructions until the PC reaches end_sim_pc . <nl> void Execute ( ) ; <nl> <nl> - / / Call on program start . <nl> - static void Initialize ( Isolate * isolate ) ; <nl> - <nl> - static void TearDown ( base : : CustomMatcherHashMap * i_cache , Redirection * first ) ; <nl> - <nl> / / V8 generally calls into generated JS code with 5 parameters and into <nl> / / generated RegExp code with 7 parameters . This is a convenience function , <nl> / / which sets up the simulator state and grabs the result on return . <nl> class Simulator { <nl> / / Exceptions . <nl> void SignalException ( Exception e ) ; <nl> <nl> - / / Runtime call support . Uses the isolate in a thread - safe way . <nl> - static void * RedirectExternalReference ( Isolate * isolate , <nl> - void * external_function , <nl> - ExternalReference : : Type type ) ; <nl> - <nl> / / Handle arguments and return value for runtime FP functions . <nl> void GetFpArgs ( double * x , double * y , int32_t * z ) ; <nl> void SetFpResult ( const double & result ) ; <nl> mmm a / src / ppc / simulator - ppc . cc <nl> ppp b / src / ppc / simulator - ppc . cc <nl> void Simulator : : CheckICache ( base : : CustomMatcherHashMap * i_cache , <nl> } <nl> <nl> <nl> - void Simulator : : Initialize ( Isolate * isolate ) { <nl> - if ( isolate - > simulator_initialized ( ) ) return ; <nl> - isolate - > set_simulator_initialized ( true ) ; <nl> - : : v8 : : internal : : ExternalReference : : set_redirector ( isolate , <nl> - & RedirectExternalReference ) ; <nl> - } <nl> - <nl> - <nl> Simulator : : Simulator ( Isolate * isolate ) : isolate_ ( isolate ) { <nl> i_cache_ = isolate_ - > simulator_i_cache ( ) ; <nl> if ( i_cache_ = = nullptr ) { <nl> class Redirection { <nl> swi_instruction_ ( rtCallRedirInstr | kCallRtRedirected ) , <nl> type_ ( type ) , <nl> next_ ( nullptr ) { <nl> - next_ = isolate - > simulator_redirection ( ) ; <nl> - Simulator : : current ( isolate ) - > FlushICache ( <nl> - isolate - > simulator_i_cache ( ) , <nl> - reinterpret_cast < void * > ( & swi_instruction_ ) , Instruction : : kInstrSize ) ; <nl> - isolate - > set_simulator_redirection ( this ) ; <nl> + next_ = Simulator : : redirection ( ) ; <nl> + Simulator : : FlushICache ( isolate - > simulator_i_cache ( ) , <nl> + reinterpret_cast < void * > ( & swi_instruction_ ) , <nl> + Instruction : : kInstrSize ) ; <nl> + Simulator : : set_redirection ( this ) ; <nl> if ( ABI_USES_FUNCTION_DESCRIPTORS ) { <nl> function_descriptor_ [ 0 ] = reinterpret_cast < intptr_t > ( & swi_instruction_ ) ; <nl> function_descriptor_ [ 1 ] = 0 ; <nl> class Redirection { <nl> <nl> static Redirection * Get ( Isolate * isolate , void * external_function , <nl> ExternalReference : : Type type ) { <nl> - Redirection * current = isolate - > simulator_redirection ( ) ; <nl> + Redirection * current = Simulator : : redirection ( ) ; <nl> for ( ; current ! = nullptr ; current = current - > next_ ) { <nl> if ( current - > external_function_ = = external_function & & <nl> current - > type_ = = type ) { <nl> class Redirection { <nl> <nl> <nl> / / static <nl> - void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> - Redirection * first ) { <nl> - Redirection : : DeleteChain ( first ) ; <nl> + void SimulatorBase : : GlobalTearDown ( ) { <nl> + delete redirection_mutex_ ; <nl> + redirection_mutex_ = nullptr ; <nl> + <nl> + Redirection : : DeleteChain ( redirection_ ) ; <nl> + redirection_ = nullptr ; <nl> + } <nl> + <nl> + / / static <nl> + void SimulatorBase : : TearDown ( base : : CustomMatcherHashMap * i_cache ) { <nl> if ( i_cache ! = nullptr ) { <nl> for ( base : : HashMap : : Entry * entry = i_cache - > Start ( ) ; entry ! = nullptr ; <nl> entry = i_cache - > Next ( entry ) ) { <nl> void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> } <nl> } <nl> <nl> - <nl> - void * Simulator : : RedirectExternalReference ( Isolate * isolate , <nl> - void * external_function , <nl> - ExternalReference : : Type type ) { <nl> - base : : LockGuard < base : : Mutex > lock_guard ( <nl> - isolate - > simulator_redirection_mutex ( ) ) ; <nl> + void * SimulatorBase : : RedirectExternalReference ( Isolate * isolate , <nl> + void * external_function , <nl> + ExternalReference : : Type type ) { <nl> + base : : LockGuard < base : : Mutex > lock_guard ( Simulator : : redirection_mutex ( ) ) ; <nl> Redirection * redirection = Redirection : : Get ( isolate , external_function , type ) ; <nl> return redirection - > address ( ) ; <nl> } <nl> mmm a / src / ppc / simulator - ppc . h <nl> ppp b / src / ppc / simulator - ppc . h <nl> <nl> # include " src / assembler . h " <nl> # include " src / base / hashmap . h " <nl> # include " src / ppc / constants - ppc . h " <nl> + # include " src / simulator - base . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> class CachePage { <nl> char validity_map_ [ kValidityMapSize ] ; / / One byte per line . <nl> } ; <nl> <nl> - <nl> - class Simulator { <nl> + class Simulator : public SimulatorBase { <nl> public : <nl> friend class PPCDebugger ; <nl> enum Register { <nl> class Simulator { <nl> / / Executes PPC instructions until the PC reaches end_sim_pc . <nl> void Execute ( ) ; <nl> <nl> - / / Call on program start . <nl> - static void Initialize ( Isolate * isolate ) ; <nl> - <nl> - static void TearDown ( base : : CustomMatcherHashMap * i_cache , Redirection * first ) ; <nl> - <nl> / / V8 generally calls into generated JS code with 5 parameters and into <nl> / / generated RegExp code with 7 parameters . This is a convenience function , <nl> / / which sets up the simulator state and grabs the result on return . <nl> class Simulator { <nl> static CachePage * GetCachePage ( base : : CustomMatcherHashMap * i_cache , <nl> void * page ) ; <nl> <nl> - / / Runtime call support . Uses the isolate in a thread - safe way . <nl> - static void * RedirectExternalReference ( <nl> - Isolate * isolate , void * external_function , <nl> - v8 : : internal : : ExternalReference : : Type type ) ; <nl> - <nl> / / Handle arguments and return value for runtime FP functions . <nl> void GetFpArgs ( double * x , double * y , intptr_t * z ) ; <nl> void SetFpResult ( const double & result ) ; <nl> mmm a / src / s390 / simulator - s390 . cc <nl> ppp b / src / s390 / simulator - s390 . cc <nl> void Simulator : : CheckICache ( base : : CustomMatcherHashMap * i_cache , <nl> } <nl> } <nl> <nl> - void Simulator : : Initialize ( Isolate * isolate ) { <nl> - if ( isolate - > simulator_initialized ( ) ) return ; <nl> - isolate - > set_simulator_initialized ( true ) ; <nl> - : : v8 : : internal : : ExternalReference : : set_redirector ( isolate , <nl> - & RedirectExternalReference ) ; <nl> - static base : : OnceType once = V8_ONCE_INIT ; <nl> - base : : CallOnce ( & once , & Simulator : : EvalTableInit ) ; <nl> - } <nl> - <nl> Simulator : : EvaluateFuncType Simulator : : EvalTable [ ] = { nullptr } ; <nl> <nl> void Simulator : : EvalTableInit ( ) { <nl> Simulator : : Simulator ( Isolate * isolate ) : isolate_ ( isolate ) { <nl> isolate_ - > set_simulator_i_cache ( i_cache_ ) ; <nl> } <nl> Initialize ( isolate ) ; <nl> + static base : : OnceType once = V8_ONCE_INIT ; <nl> + base : : CallOnce ( & once , & Simulator : : EvalTableInit ) ; <nl> / / Set up simulator support first . Some of this information is needed to <nl> / / setup the architecture state . <nl> # if V8_TARGET_ARCH_S390X <nl> class Redirection { <nl> # endif <nl> type_ ( type ) , <nl> next_ ( nullptr ) { <nl> - next_ = isolate - > simulator_redirection ( ) ; <nl> - Simulator : : current ( isolate ) - > FlushICache ( <nl> - isolate - > simulator_i_cache ( ) , <nl> - reinterpret_cast < void * > ( & swi_instruction_ ) , sizeof ( FourByteInstr ) ) ; <nl> - isolate - > set_simulator_redirection ( this ) ; <nl> + next_ = Simulator : : redirection ( ) ; <nl> + Simulator : : FlushICache ( isolate - > simulator_i_cache ( ) , <nl> + reinterpret_cast < void * > ( & swi_instruction_ ) , <nl> + sizeof ( FourByteInstr ) ) ; <nl> + Simulator : : set_redirection ( this ) ; <nl> if ( ABI_USES_FUNCTION_DESCRIPTORS ) { <nl> function_descriptor_ [ 0 ] = reinterpret_cast < intptr_t > ( & swi_instruction_ ) ; <nl> function_descriptor_ [ 1 ] = 0 ; <nl> class Redirection { <nl> <nl> static Redirection * Get ( Isolate * isolate , void * external_function , <nl> ExternalReference : : Type type ) { <nl> - Redirection * current = isolate - > simulator_redirection ( ) ; <nl> + Redirection * current = Simulator : : redirection ( ) ; <nl> for ( ; current ! = nullptr ; current = current - > next_ ) { <nl> if ( current - > external_function_ = = external_function & & <nl> current - > type_ = = type ) { <nl> class Redirection { <nl> } ; <nl> <nl> / / static <nl> - void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> - Redirection * first ) { <nl> - Redirection : : DeleteChain ( first ) ; <nl> + void SimulatorBase : : GlobalTearDown ( ) { <nl> + delete redirection_mutex_ ; <nl> + redirection_mutex_ = nullptr ; <nl> + <nl> + Redirection : : DeleteChain ( redirection_ ) ; <nl> + redirection_ = nullptr ; <nl> + } <nl> + <nl> + / / static <nl> + void SimulatorBase : : TearDown ( base : : CustomMatcherHashMap * i_cache ) { <nl> if ( i_cache ! = nullptr ) { <nl> for ( base : : HashMap : : Entry * entry = i_cache - > Start ( ) ; entry ! = nullptr ; <nl> entry = i_cache - > Next ( entry ) ) { <nl> void Simulator : : TearDown ( base : : CustomMatcherHashMap * i_cache , <nl> } <nl> } <nl> <nl> - void * Simulator : : RedirectExternalReference ( Isolate * isolate , <nl> - void * external_function , <nl> - ExternalReference : : Type type ) { <nl> - base : : LockGuard < base : : Mutex > lock_guard ( <nl> - isolate - > simulator_redirection_mutex ( ) ) ; <nl> + void * SimulatorBase : : RedirectExternalReference ( Isolate * isolate , <nl> + void * external_function , <nl> + ExternalReference : : Type type ) { <nl> + base : : LockGuard < base : : Mutex > lock_guard ( Simulator : : redirection_mutex ( ) ) ; <nl> Redirection * redirection = Redirection : : Get ( isolate , external_function , type ) ; <nl> return redirection - > address ( ) ; <nl> } <nl> mmm a / src / s390 / simulator - s390 . h <nl> ppp b / src / s390 / simulator - s390 . h <nl> <nl> # include " src / assembler . h " <nl> # include " src / base / hashmap . h " <nl> # include " src / s390 / constants - s390 . h " <nl> + # include " src / simulator - base . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> class CachePage { <nl> char validity_map_ [ kValidityMapSize ] ; / / One byte per line . <nl> } ; <nl> <nl> - class Simulator { <nl> + class Simulator : public SimulatorBase { <nl> public : <nl> friend class S390Debugger ; <nl> enum Register { <nl> class Simulator { <nl> / / Executes S390 instructions until the PC reaches end_sim_pc . <nl> void Execute ( ) ; <nl> <nl> - / / Call on program start . <nl> - static void Initialize ( Isolate * isolate ) ; <nl> - <nl> - static void TearDown ( base : : CustomMatcherHashMap * i_cache , Redirection * first ) ; <nl> - <nl> / / V8 generally calls into generated JS code with 5 parameters and into <nl> / / generated RegExp code with 7 parameters . This is a convenience function , <nl> / / which sets up the simulator state and grabs the result on return . <nl> class Simulator { <nl> static CachePage * GetCachePage ( base : : CustomMatcherHashMap * i_cache , <nl> void * page ) ; <nl> <nl> - / / Runtime call support . Uses the isolate in a thread - safe way . <nl> - static void * RedirectExternalReference ( <nl> - Isolate * isolate , void * external_function , <nl> - v8 : : internal : : ExternalReference : : Type type ) ; <nl> - <nl> / / Handle arguments and return value for runtime FP functions . <nl> void GetFpArgs ( double * x , double * y , intptr_t * z ) ; <nl> void SetFpResult ( const double & result ) ; <nl> new file mode 100644 <nl> index 00000000000 . . 5b311f18d9b <nl> mmm / dev / null <nl> ppp b / src / simulator - base . cc <nl> <nl> + / / Copyright 2017 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + # include " src / simulator - base . h " <nl> + <nl> + # include " src / assembler . h " <nl> + # include " src / isolate . h " <nl> + <nl> + # if defined ( USE_SIMULATOR ) <nl> + <nl> + namespace v8 { <nl> + namespace internal { <nl> + <nl> + / / static <nl> + base : : Mutex * SimulatorBase : : redirection_mutex_ = nullptr ; <nl> + <nl> + / / static <nl> + Redirection * SimulatorBase : : redirection_ = nullptr ; <nl> + <nl> + / / static <nl> + void SimulatorBase : : InitializeOncePerProcess ( ) { <nl> + DCHECK_NULL ( redirection_mutex_ ) ; <nl> + redirection_mutex_ = new base : : Mutex ( ) ; <nl> + } <nl> + <nl> + / / static <nl> + void SimulatorBase : : Initialize ( Isolate * isolate ) { <nl> + if ( isolate - > simulator_initialized ( ) ) return ; <nl> + isolate - > set_simulator_initialized ( true ) ; <nl> + ExternalReference : : set_redirector ( isolate , & RedirectExternalReference ) ; <nl> + } <nl> + <nl> + } / / namespace internal <nl> + } / / namespace v8 <nl> + <nl> + # endif / / defined ( USE_SIMULATOR ) <nl> new file mode 100644 <nl> index 00000000000 . . ee30dbb41b5 <nl> mmm / dev / null <nl> ppp b / src / simulator - base . h <nl> <nl> + / / Copyright 2017 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + # ifndef V8_SIMULATOR_BASE_H_ <nl> + # define V8_SIMULATOR_BASE_H_ <nl> + <nl> + # include " src / assembler . h " <nl> + # include " src / globals . h " <nl> + <nl> + namespace v8 { <nl> + namespace internal { <nl> + <nl> + class Redirection ; <nl> + <nl> + class SimulatorBase { <nl> + public : <nl> + / / Call on process start and exit . <nl> + static void InitializeOncePerProcess ( ) ; <nl> + / / TODO ( mstarzinger ) : Move implementation to " simulator - base . cc " file . <nl> + static void GlobalTearDown ( ) ; <nl> + <nl> + / / Call on isolate initialization and teardown . <nl> + static void Initialize ( Isolate * isolate ) ; <nl> + / / TODO ( mstarzinger ) : Move implementation to " simulator - base . cc " file . <nl> + static void TearDown ( base : : CustomMatcherHashMap * i_cache ) ; <nl> + <nl> + static base : : Mutex * redirection_mutex ( ) { return redirection_mutex_ ; } <nl> + static Redirection * redirection ( ) { return redirection_ ; } <nl> + static void set_redirection ( Redirection * r ) { redirection_ = r ; } <nl> + <nl> + private : <nl> + / / Runtime call support . Uses the isolate in a thread - safe way . <nl> + static void * RedirectExternalReference ( <nl> + Isolate * isolate , void * external_function , <nl> + v8 : : internal : : ExternalReference : : Type type ) ; <nl> + <nl> + static base : : Mutex * redirection_mutex_ ; <nl> + static Redirection * redirection_ ; <nl> + } ; <nl> + <nl> + } / / namespace internal <nl> + } / / namespace v8 <nl> + <nl> + # endif / / V8_SIMULATOR_BASE_H_ <nl> mmm a / src / simulator . h <nl> ppp b / src / simulator . h <nl> <nl> # define V8_SIMULATOR_H_ <nl> <nl> # include " src / globals . h " <nl> + # include " src / simulator - base . h " <nl> <nl> # if V8_TARGET_ARCH_IA32 <nl> # include " src / ia32 / simulator - ia32 . h " <nl> mmm a / src / v8 . cc <nl> ppp b / src / v8 . cc <nl> <nl> # include " src / objects - inl . h " <nl> # include " src / profiler / heap - profiler . h " <nl> # include " src / runtime - profiler . h " <nl> + # include " src / simulator . h " <nl> # include " src / snapshot / natives . h " <nl> # include " src / snapshot / snapshot . h " <nl> # include " src / tracing / tracing - category - observer . h " <nl> bool V8 : : Initialize ( ) { <nl> <nl> <nl> void V8 : : TearDown ( ) { <nl> + # if defined ( USE_SIMULATOR ) <nl> + Simulator : : GlobalTearDown ( ) ; <nl> + # endif <nl> Bootstrapper : : TearDownExtensions ( ) ; <nl> ElementsAccessor : : TearDown ( ) ; <nl> RegisteredExtension : : UnregisterAll ( ) ; <nl> void V8 : : InitializeOncePerProcessImpl ( ) { <nl> <nl> Isolate : : InitializeOncePerProcess ( ) ; <nl> <nl> + # if defined ( USE_SIMULATOR ) <nl> + Simulator : : InitializeOncePerProcess ( ) ; <nl> + # endif <nl> sampler : : Sampler : : SetUp ( ) ; <nl> CpuFeatures : : Probe ( false ) ; <nl> ElementsAccessor : : InitializeOncePerProcess ( ) ; <nl> mmm a / src / v8 . gyp <nl> ppp b / src / v8 . gyp <nl> <nl> ' safepoint - table . h ' , <nl> ' setup - isolate . h ' , <nl> ' signature . h ' , <nl> + ' simulator - base . cc ' , <nl> + ' simulator - base . h ' , <nl> ' simulator . h ' , <nl> ' snapshot / builtin - deserializer - allocator . cc ' , <nl> ' snapshot / builtin - deserializer - allocator . h ' , <nl>
[ simulator ] Refactor redirections to be process - wide .
v8/v8
f4dde200440a75a1eb5793e12fc3dc445f0f84e4
2017-12-13T13:28:10Z
mmm a / tensorflow / compiler / mlir / hlo / lib / Dialect / mhlo / transforms / sink_constants_to_control_flow . cc <nl> ppp b / tensorflow / compiler / mlir / hlo / lib / Dialect / mhlo / transforms / sink_constants_to_control_flow . cc <nl> limitations under the License . <nl> # include " llvm / ADT / DenseMap . h " <nl> # include " llvm / Support / Casting . h " <nl> # include " mlir - hlo / Dialect / mhlo / IR / hlo_ops . h " <nl> + # include " mlir / Dialect / StandardOps / IR / Ops . h " <nl> # include " mlir / IR / Operation . h " <nl> # include " mlir / Pass / Pass . h " <nl> # include " mlir / Pass / PassManager . h " <nl> # include " mlir / Support / LLVM . h " <nl> # include " mlir / Transforms / RegionUtils . h " <nl> - # include " mlir / Dialect / StandardOps / IR / Ops . h " / / from @ llvm - project <nl> <nl> namespace mlir { <nl> namespace mhlo { <nl>
Internal change
tensorflow/tensorflow
19d6fdc42d51ddbc978f9e2bcbf921a1460acc86
2020-08-04T06:03:09Z
mmm a / src / mips / macro - assembler - mips . cc <nl> ppp b / src / mips / macro - assembler - mips . cc <nl> void MacroAssembler : : BranchFCommon ( SecondaryField sizeField , Label * target , <nl> if ( ! IsMipsArchVariant ( kMips32r6 ) ) { <nl> if ( long_branch ) { <nl> Label skip ; <nl> - c ( UN , D , cmp1 , cmp2 ) ; <nl> + c ( UN , sizeField , cmp1 , cmp2 ) ; <nl> bc1f ( & skip ) ; <nl> nop ( ) ; <nl> BranchLong ( nan , bd ) ; <nl> bind ( & skip ) ; <nl> } else { <nl> - c ( UN , D , cmp1 , cmp2 ) ; <nl> + c ( UN , sizeField , cmp1 , cmp2 ) ; <nl> bc1t ( nan ) ; <nl> if ( bd = = PROTECT ) { <nl> nop ( ) ; <nl> void MacroAssembler : : BranchFCommon ( SecondaryField sizeField , Label * target , <nl> DCHECK ( ! cmp1 . is ( kDoubleCompareReg ) & & ! cmp2 . is ( kDoubleCompareReg ) ) ; <nl> if ( long_branch ) { <nl> Label skip ; <nl> - cmp ( UN , L , kDoubleCompareReg , cmp1 , cmp2 ) ; <nl> + cmp ( UN , sizeField , kDoubleCompareReg , cmp1 , cmp2 ) ; <nl> bc1eqz ( & skip , kDoubleCompareReg ) ; <nl> nop ( ) ; <nl> BranchLong ( nan , bd ) ; <nl> bind ( & skip ) ; <nl> } else { <nl> - cmp ( UN , L , kDoubleCompareReg , cmp1 , cmp2 ) ; <nl> + cmp ( UN , sizeField , kDoubleCompareReg , cmp1 , cmp2 ) ; <nl> bc1nez ( nan , kDoubleCompareReg ) ; <nl> if ( bd = = PROTECT ) { <nl> nop ( ) ; <nl> mmm a / src / mips64 / macro - assembler - mips64 . cc <nl> ppp b / src / mips64 / macro - assembler - mips64 . cc <nl> void MacroAssembler : : BranchFCommon ( SecondaryField sizeField , Label * target , <nl> if ( kArchVariant ! = kMips64r6 ) { <nl> if ( long_branch ) { <nl> Label skip ; <nl> - c ( UN , D , cmp1 , cmp2 ) ; <nl> + c ( UN , sizeField , cmp1 , cmp2 ) ; <nl> bc1f ( & skip ) ; <nl> nop ( ) ; <nl> J ( nan , bd ) ; <nl> bind ( & skip ) ; <nl> } else { <nl> - c ( UN , D , cmp1 , cmp2 ) ; <nl> + c ( UN , sizeField , cmp1 , cmp2 ) ; <nl> bc1t ( nan ) ; <nl> if ( bd = = PROTECT ) { <nl> nop ( ) ; <nl> void MacroAssembler : : BranchFCommon ( SecondaryField sizeField , Label * target , <nl> DCHECK ( ! cmp1 . is ( kDoubleCompareReg ) & & ! cmp2 . is ( kDoubleCompareReg ) ) ; <nl> if ( long_branch ) { <nl> Label skip ; <nl> - cmp ( UN , L , kDoubleCompareReg , cmp1 , cmp2 ) ; <nl> + cmp ( UN , sizeField , kDoubleCompareReg , cmp1 , cmp2 ) ; <nl> bc1eqz ( & skip , kDoubleCompareReg ) ; <nl> nop ( ) ; <nl> J ( nan , bd ) ; <nl> bind ( & skip ) ; <nl> } else { <nl> - cmp ( UN , L , kDoubleCompareReg , cmp1 , cmp2 ) ; <nl> + cmp ( UN , sizeField , kDoubleCompareReg , cmp1 , cmp2 ) ; <nl> bc1nez ( nan , kDoubleCompareReg ) ; <nl> if ( bd = = PROTECT ) { <nl> nop ( ) ; <nl>
MIPS : Fix sizeField in MacroAssembler : : BranchFCommon ( ) .
v8/v8
fef93bb23ba1175b41f5026363f61820effc69b9
2015-12-10T17:45:40Z
mmm a / methods . py <nl> ppp b / methods . py <nl> def win32_spawn ( sh , escape , cmd , args , spawnenv ) : <nl> return exit_code <nl> " " " <nl> <nl> - <nl> def android_add_maven_repository ( self , url ) : <nl> - self . android_maven_repos . append ( url ) <nl> - <nl> + if ( url not in self . android_maven_repos ) : <nl> + self . android_maven_repos . append ( url ) <nl> <nl> def android_add_dependency ( self , depline ) : <nl> - self . android_dependencies . append ( depline ) <nl> - <nl> + if ( depline not in self . android_dependencies ) : <nl> + self . android_dependencies . append ( depline ) <nl> <nl> def android_add_java_dir ( self , subpath ) : <nl> base_path = self . Dir ( " . " ) . abspath + " / modules / " + self . current_module + " / " + subpath <nl> - self . android_java_dirs . append ( base_path ) <nl> - <nl> + if ( base_path not in self . android_java_dirs ) : <nl> + self . android_java_dirs . append ( base_path ) <nl> <nl> def android_add_res_dir ( self , subpath ) : <nl> base_path = self . Dir ( " . " ) . abspath + " / modules / " + self . current_module + " / " + subpath <nl> - self . android_res_dirs . append ( base_path ) <nl> - <nl> + if ( base_path not in self . android_res_dirs ) : <nl> + self . android_res_dirs . append ( base_path ) <nl> <nl> def android_add_aidl_dir ( self , subpath ) : <nl> base_path = self . Dir ( " . " ) . abspath + " / modules / " + self . current_module + " / " + subpath <nl> - self . android_aidl_dirs . append ( base_path ) <nl> - <nl> + if ( base_path not in self . android_aidl_dirs ) : <nl> + self . android_aidl_dirs . append ( base_path ) <nl> <nl> def android_add_jni_dir ( self , subpath ) : <nl> base_path = self . Dir ( " . " ) . abspath + " / modules / " + self . current_module + " / " + subpath <nl> - self . android_jni_dirs . append ( base_path ) <nl> + if ( base_path not in self . android_jni_dirs ) : <nl> + self . android_jni_dirs . append ( base_path ) <nl> <nl> def android_add_gradle_plugin ( self , plugin ) : <nl> - self . android_gradle_plugins . append ( plugin ) <nl> + if ( plugin not in self . android_gradle_plugins ) : <nl> + self . android_gradle_plugins . append ( plugin ) <nl> <nl> def android_add_gradle_classpath ( self , classpath ) : <nl> - self . android_gradle_classpath . append ( classpath ) <nl> + if ( classpath not in self . android_gradle_classpath ) : <nl> + self . android_gradle_classpath . append ( classpath ) <nl> <nl> def android_add_default_config ( self , config ) : <nl> - self . android_default_config . append ( config ) <nl> - <nl> + if ( config not in self . android_default_config ) : <nl> + self . android_default_config . append ( config ) <nl> <nl> def android_add_to_manifest ( self , file ) : <nl> base_path = self . Dir ( " . " ) . abspath + " / modules / " + self . current_module + " / " + file <nl> f = open ( base_path , " rb " ) <nl> self . android_manifest_chunk + = f . read ( ) <nl> <nl> - <nl> def android_add_to_permissions ( self , file ) : <nl> base_path = self . Dir ( " . " ) . abspath + " / modules / " + self . current_module + " / " + file <nl> f = open ( base_path , " rb " ) <nl> self . android_permission_chunk + = f . read ( ) <nl> <nl> - <nl> def android_add_to_attributes ( self , file ) : <nl> base_path = self . Dir ( " . " ) . abspath + " / modules / " + self . current_module + " / " + file <nl> f = open ( base_path , " rb " ) <nl> self . android_appattributes_chunk + = f . read ( ) <nl> <nl> - <nl> def disable_module ( self ) : <nl> self . disabled_modules . append ( self . current_module ) <nl> <nl> - <nl> def use_windows_spawn_fix ( self , platform = None ) : <nl> <nl> if ( os . name ! = " nt " ) : <nl> mmm a / platform / android / SCsub <nl> ppp b / platform / android / SCsub <nl> if len ( env . android_maven_repos ) > 0 : <nl> gradle_maven_repos_text + = " " <nl> for x in env . android_maven_repos : <nl> gradle_maven_repos_text + = " \ tmaven { \ n " <nl> - gradle_maven_repos_text + = " \ t \ t " + x + " \ n " <nl> + gradle_maven_repos_text + = " \ t " + x + " \ n " <nl> gradle_maven_repos_text + = " \ t } \ n " <nl> <nl> gradle_maven_dependencies_text = " " <nl> <nl> for x in env . android_dependencies : <nl> - gradle_maven_dependencies_text + = x + " \ n " <nl> + gradle_maven_dependencies_text + = x + " \ n \ t " <nl> <nl> gradle_java_dirs_text = " " <nl> <nl> targetSdk = 23 <nl> for x in env . android_default_config : <nl> if x . startswith ( " minSdkVersion " ) and int ( x . split ( " " ) [ - 1 ] ) < minSdk : <nl> x = " minSdkVersion " + str ( minSdk ) <nl> - if x . startswith ( " targetSdkVersion " ) and int ( x . split ( ) [ - 1 ] ) > targetSdk : <nl> + if x . startswith ( " targetSdkVersion " ) and int ( x . split ( " " ) [ - 1 ] ) > targetSdk : <nl> x = " targetSdkVersion " + str ( targetSdk ) <nl> <nl> gradle_default_config_text + = x + " \ n \ t \ t " <nl>
Android : avoiding duplicates in build . gradle
godotengine/godot
f8309f86c2d9042789574ab5ec2ea37d38457574
2017-04-10T03:04:40Z
mmm a / include / rapidjson / reader . h <nl> ppp b / include / rapidjson / reader . h <nl> class GenericReader { <nl> \ param allocator Optional allocator for allocating stack memory . ( Only use for non - destructive parsing ) <nl> \ param stackCapacity stack capacity in bytes for storing a single decoded string . ( Only use for non - destructive parsing ) <nl> * / <nl> - GenericReader ( size_t limit = 0 , Allocator * allocator = 0 , size_t stackCapacity = kDefaultStackCapacity ) : stack_ ( allocator , stackCapacity ) , kStackSizeLimit ( limit ) , parseResult_ ( ) { } <nl> + GenericReader ( size_t limit = 0 , Allocator * allocator = 0 , size_t stackCapacity = kDefaultStackCapacity ) : stack_ ( allocator , stackCapacity ) , kStackSizeLimit_ ( limit ) , parseResult_ ( ) { } <nl> <nl> / / ! Parse JSON text . <nl> / * ! \ tparam parseFlags Combination of \ ref ParseFlag . <nl> class GenericReader { <nl> } <nl> <nl> bool CheckStackSpaceQuota ( size_t size ) const { <nl> - return kStackSizeLimit = = 0 | | ( stack_ . GetSize ( ) + size < = kStackSizeLimit ) ; <nl> + return kStackSizeLimit_ = = 0 | | ( stack_ . GetSize ( ) + size < = kStackSizeLimit_ ) ; <nl> } <nl> <nl> static const size_t kDefaultStackCapacity = 256 ; / / ! < Default stack capacity in bytes for storing a single decoded string . <nl> - const size_t kStackSizeLimit ; / / ! < Stack size limit ( in bytes ) . A value of 0 means no limit . <nl> internal : : Stack < Allocator > stack_ ; / / ! < A stack for storing decoded string temporarily during non - destructive parsing . <nl> + const size_t kStackSizeLimit_ ; / / ! < Stack size limit ( in bytes ) . A value of 0 means no limit . <nl> ParseResult parseResult_ ; <nl> } ; / / class GenericReader <nl> <nl>
Fix compilation error for gcc / clang .
Tencent/rapidjson
4a152646d9a5affe6018630afa5385ab460f8ccc
2014-07-17T16:12:04Z
mmm a / language / Portuguese / strings . xml <nl> ppp b / language / Portuguese / strings . xml <nl> <nl> < string id = " 140 " > CPU : < / string > <nl> < string id = " 141 " > GPU : < / string > <nl> < string id = " 142 " > Hora : < / string > <nl> - < string id = " 143 " > Hora e Data : < / string > <nl> + < string id = " 143 " > Actual : < / string > <nl> < string id = " 144 " > Versão : < / string > <nl> < string id = " 145 " > Rede : < / string > <nl> < string id = " 146 " > Tipo : < / string > <nl> <nl> < string id = " 20373 " > Temporada < / string > <nl> < string id = " 20374 " > A carregar informação de vídeo < / string > <nl> < string id = " 20375 " > Conteúdo não atribuído < / string > <nl> - <nl> + < string id = " 20376 " > Título original < / string > <nl> < string id = " 20377 " > Actualizar informação da série de TV < / string > <nl> < string id = " 20378 " > Actualizar informação de todos os episódios ? < / string > <nl> < string id = " 20379 " > A pasta contém apenas uma série de TV < / string > <nl>
updated : ticket - portugese translation . thanks to hudo
xbmc/xbmc
a781fa173daadb7a8e453016b8e7a5e1dc012111
2010-08-19T14:27:13Z