diff
stringlengths
41
2.03M
msg
stringlengths
1
1.5k
repo
stringlengths
5
40
sha
stringlengths
40
40
time
stringlengths
20
20
mmm a / tensorflow / core / common_runtime / lower_functional_ops_test . cc <nl> ppp b / tensorflow / core / common_runtime / lower_functional_ops_test . cc <nl> namespace { <nl> <nl> typedef FunctionDefHelper FDH ; <nl> <nl> + constexpr const char * const kLowerUsingSwitchMergeAttr = <nl> + LowerFunctionalOpsPass : : kLowerUsingSwitchMergeAttr ; <nl> + <nl> static void AssertHasSubstr ( StringPiece s , StringPiece expected ) { <nl> ASSERT_TRUE ( str_util : : StrContains ( s , expected ) ) <nl> < < " ' " < < s < < " ' does not contain ' " < < expected < < " ' " ; <nl> FunctionDef WhileWithIfBody ( ) { <nl> { " Tcond " , DT_BOOL } , <nl> { " Tin " , input_types } , <nl> { " Tout " , output_types } , <nl> - { LowerFunctionalOpsPass : : kLowerUsingSwitchMergeAttr , true } } } , <nl> + { kLowerUsingSwitchMergeAttr , true } } } , <nl> { { " one " } , " Const " , { } , { { " value " , kOne } , { " dtype " , DT_INT32 } } } , <nl> { { " updated_counter " } , " Add " , { " counter " , " one " } , { { " T " , DT_INT32 } } } , <nl> } ) ; <nl> TEST ( LowerIfWhileTest , CondInWhile ) { <nl> cond_func . mutable_func ( ) - > set_name ( " WhileWithIfCond " ) ; <nl> AttrValue body_func ; <nl> body_func . mutable_func ( ) - > set_name ( " WhileWithIfBody " ) ; <nl> - TF_ASSERT_OK ( <nl> - NodeBuilder ( " while " , " While " , & root . graph ( ) - > flib_def ( ) ) <nl> - . Input ( inputs ) <nl> - . Attr ( " T " , { DT_INT32 , DT_BOOL , DT_INT32 } ) <nl> - . Attr ( " cond " , cond_func ) <nl> - . Attr ( " body " , body_func ) <nl> - . Attr ( LowerFunctionalOpsPass : : kLowerUsingSwitchMergeAttr , true ) <nl> - . Finalize ( root . graph ( ) , & while_node ) ) ; <nl> + TF_ASSERT_OK ( NodeBuilder ( " while " , " While " , & root . graph ( ) - > flib_def ( ) ) <nl> + . Input ( inputs ) <nl> + . Attr ( " T " , { DT_INT32 , DT_BOOL , DT_INT32 } ) <nl> + . Attr ( " cond " , cond_func ) <nl> + . Attr ( " body " , body_func ) <nl> + . Attr ( kLowerUsingSwitchMergeAttr , true ) <nl> + . Finalize ( root . graph ( ) , & while_node ) ) ; <nl> TF_ASSERT_OK ( root . DoShapeInference ( while_node ) ) ; <nl> TF_ASSERT_OK ( root . ToGraph ( graph . get ( ) ) ) ; <nl> TF_ASSERT_OK ( Rewrite ( & graph ) ) ; <nl> FunctionDef IfWithWhileThen ( ) { <nl> { " body " , body_func } , <nl> { " T " , input_and_output_types } , <nl> { " output_shapes " , output_shapes } , <nl> - { LowerFunctionalOpsPass : : kLowerUsingSwitchMergeAttr , true } } } , <nl> + { kLowerUsingSwitchMergeAttr , true } } } , <nl> } ) ; <nl> } <nl> <nl> TEST ( LowerIfWhileTest , WhileInCond ) { <nl> AttrValue else_func ; <nl> else_func . mutable_func ( ) - > set_name ( " XTimesTwo " ) ; <nl> Node * if_node ; <nl> - TF_ASSERT_OK ( <nl> - NodeBuilder ( " if " , " If " , & root . graph ( ) - > flib_def ( ) ) <nl> - . Input ( pred . node ( ) ) <nl> - . Input ( inputs ) <nl> - . Attr ( " then_branch " , then_func ) <nl> - . Attr ( " else_branch " , else_func ) <nl> - . Attr ( " Tout " , { DT_INT32 } ) <nl> - . Attr ( LowerFunctionalOpsPass : : kLowerUsingSwitchMergeAttr , true ) <nl> - . Finalize ( root . graph ( ) , & if_node ) ) ; <nl> + TF_ASSERT_OK ( NodeBuilder ( " if " , " If " , & root . graph ( ) - > flib_def ( ) ) <nl> + . Input ( pred . node ( ) ) <nl> + . Input ( inputs ) <nl> + . Attr ( " then_branch " , then_func ) <nl> + . Attr ( " else_branch " , else_func ) <nl> + . Attr ( " Tout " , { DT_INT32 } ) <nl> + . Attr ( kLowerUsingSwitchMergeAttr , true ) <nl> + . Finalize ( root . graph ( ) , & if_node ) ) ; <nl> TF_ASSERT_OK ( root . DoShapeInference ( if_node ) ) ; <nl> TF_ASSERT_OK ( root . ToGraph ( graph . get ( ) ) ) ; <nl> <nl> TEST ( LowerIfWhileTest , RaisesWhenLoweringUnhandledOpType ) { <nl> Node * const_node ; <nl> Tensor const_val ( DT_INT32 , TensorShape ( { } ) ) ; <nl> const_val . scalar < int32 > ( ) ( ) = 1 ; <nl> - TF_ASSERT_OK ( <nl> - NodeBuilder ( " const " , " Const " ) <nl> - . Attr ( " value " , const_val ) <nl> - . Attr ( " dtype " , const_val . dtype ( ) ) <nl> - . Attr ( LowerFunctionalOpsPass : : kLowerUsingSwitchMergeAttr , true ) <nl> - . Finalize ( root . graph ( ) , & const_node ) ) ; <nl> + TF_ASSERT_OK ( NodeBuilder ( " const " , " Const " ) <nl> + . Attr ( " value " , const_val ) <nl> + . Attr ( " dtype " , const_val . dtype ( ) ) <nl> + . Attr ( kLowerUsingSwitchMergeAttr , true ) <nl> + . Finalize ( root . graph ( ) , & const_node ) ) ; <nl> TF_ASSERT_OK ( root . DoShapeInference ( const_node ) ) ; <nl> TF_ASSERT_OK ( root . ToGraph ( graph . get ( ) ) ) ; <nl> <nl>
Fix linkage error in MacOS build
tensorflow/tensorflow
84571dc96ae1d8a6e41f8f29e227e82142215c8f
2019-03-19T22:23:54Z
mmm a / jstests / repl / snapshot1 . js <nl> ppp b / jstests / repl / snapshot1 . js <nl> m . getDB ( baseName ) [ baseName ] . save ( { i : 1001 } ) ; <nl> assert . soon ( function ( ) { return 1002 = = s2 . getDB ( baseName ) [ baseName ] . count ( ) ; } ) ; <nl> assert . soon ( function ( ) { return 1002 = = s1 . getDB ( baseName ) [ baseName ] . count ( ) ; } ) ; <nl> <nl> - assert ( ! rawMongoProgramOutput ( ) . match ( / resync : cloning database / ) ) ; <nl> \ No newline at end of file <nl> + assert ( ! rawMongoProgramOutput ( ) . match ( / resync / ) ) ; <nl> \ No newline at end of file <nl> mmm a / shell / utils . cpp <nl> ppp b / shell / utils . cpp <nl> namespace mongo { <nl> MongoProgramScope : : ~ MongoProgramScope ( ) { <nl> try { <nl> KillMongoProgramInstances ( ) ; <nl> + ClearRawMongoProgramOutput ( BSONObj ( ) ) ; <nl> } catch ( . . . ) { <nl> assert ( false ) ; <nl> } <nl>
SERVER - 623 play well with other tests
mongodb/mongo
243bb5d0527bf689eba231597cb09e3862a5c72e
2010-02-17T05:18:54Z
new file mode 100644 <nl> index 0000000000 . . 349c858e35 <nl> mmm / dev / null <nl> ppp b / code / sorting / bead_sort / bead_sort . cs <nl> <nl> + / * Part of Cosmos by OpenGenus Foundation * / <nl> + <nl> + using System ; <nl> + using System . Linq ; <nl> + <nl> + namespace CS <nl> + { <nl> + public class BeadSort <nl> + { <nl> + public BeadSort ( ) <nl> + { <nl> + } <nl> + <nl> + static int [ ] Sort ( int [ ] arr ) { <nl> + int max = arr . Max ( ) ; <nl> + <nl> + var grid = new bool [ arr . Length , max ] ; <nl> + <nl> + int [ ] levelCount = new int [ max ] ; <nl> + <nl> + for ( int i = 0 ; i < max ; i + + ) { <nl> + levelCount [ i ] = 0 ; <nl> + for ( int j = 0 ; j < arr . Length ; j + + ) { <nl> + grid [ j , i ] = false ; <nl> + } <nl> + } <nl> + <nl> + foreach ( var num in arr ) <nl> + { <nl> + var tmpNum = num ; <nl> + for ( int j = 0 ; tmpNum > 0 ; j + + , tmpNum - - ) <nl> + { <nl> + grid [ levelCount [ j ] + + , j ] = true ; <nl> + } <nl> + } <nl> + <nl> + var sorted = new int [ arr . Length ] ; <nl> + for ( int i = 0 ; i < arr . Length ; i + + ) <nl> + { <nl> + int putt = 0 ; <nl> + for ( int j = 0 ; j < max & & grid [ arr . Length - 1 - i , j ] = = true ; j + + ) <nl> + { <nl> + putt + + ; <nl> + } <nl> + sorted [ i ] = putt ; <nl> + } <nl> + <nl> + return sorted ; <nl> + <nl> + } <nl> + <nl> + static void Main ( string [ ] args ) <nl> + { <nl> + const int numbers = 25 ; <nl> + int [ ] arr = new int [ numbers ] ; <nl> + <nl> + var rand = new Random ( ) ; <nl> + for ( int i = 0 ; i < numbers ; i + + ) <nl> + { <nl> + arr [ i ] = rand . Next ( 99 ) ; <nl> + } <nl> + <nl> + <nl> + Console . WriteLine ( " Before Sorting " ) ; <nl> + foreach ( var num in arr ) <nl> + { <nl> + Console . Write ( num + " " ) ; <nl> + } <nl> + <nl> + var sorted = Sort ( arr ) ; <nl> + Console . WriteLine ( " \ nSorted : " ) ; <nl> + foreach ( var num in sorted ) <nl> + { <nl> + Console . Write ( num + " " ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl>
Merge pull request from jarrodconnolly / bead - sort - cs
OpenGenus/cosmos
0f3fbc7b7bf8af50fcf0d532f537337702f7f3c6
2017-10-21T09:59:21Z
mmm a / test / scripts / components / input - event . test . js <nl> ppp b / test / scripts / components / input - event . test . js <nl> describe ( ' weex ' + goal + ' test ' , function ( ) { <nl> . waitForElementById ( " input - obj " , interval , 2000 ) <nl> . sendKeys ( ' testInput ' ) <nl> . sleep ( 500 ) <nl> - . sendKeys ( ' \ n ' ) <nl> . waitForElementByName ( ' input : testInput ' , interval , 2000 ) <nl> <nl> <nl>
* [ test ] input
apache/incubator-weex
d80b11ca2f8b0edfc0c4aa863ff584d132fed9f3
2017-08-10T02:37:30Z
mmm a / src / wallet / salvage . cpp <nl> ppp b / src / wallet / salvage . cpp <nl> static const char * HEADER_END = " HEADER = END " ; <nl> static const char * DATA_END = " DATA = END " ; <nl> typedef std : : pair < std : : vector < unsigned char > , std : : vector < unsigned char > > KeyValPair ; <nl> <nl> - bool RecoverDatabaseFile ( const fs : : path & file_path ) <nl> + bool RecoverDatabaseFile ( const fs : : path & file_path , bilingual_str & error , std : : vector < bilingual_str > & warnings ) <nl> { <nl> std : : string filename ; <nl> std : : shared_ptr < BerkeleyEnvironment > env = GetWalletEnv ( file_path , filename ) ; <nl> <nl> - bilingual_str open_err ; <nl> - if ( ! env - > Open ( open_err ) ) { <nl> - tfm : : format ( std : : cerr , " % s \ n " , open_err . original ) ; <nl> + if ( ! env - > Open ( error ) ) { <nl> return false ; <nl> } <nl> <nl> bool RecoverDatabaseFile ( const fs : : path & file_path ) <nl> <nl> int result = env - > dbenv - > dbrename ( nullptr , filename . c_str ( ) , nullptr , <nl> newFilename . c_str ( ) , DB_AUTO_COMMIT ) ; <nl> - if ( result = = 0 ) <nl> - LogPrintf ( " Renamed % s to % s \ n " , filename , newFilename ) ; <nl> - else <nl> + if ( result ! = 0 ) <nl> { <nl> - LogPrintf ( " Failed to rename % s to % s \ n " , filename , newFilename ) ; <nl> + error = strprintf ( Untranslated ( " Failed to rename % s to % s " ) , filename , newFilename ) ; <nl> return false ; <nl> } <nl> <nl> bool RecoverDatabaseFile ( const fs : : path & file_path ) <nl> Db db ( env - > dbenv . get ( ) , 0 ) ; <nl> result = db . verify ( newFilename . c_str ( ) , nullptr , & strDump , DB_SALVAGE | DB_AGGRESSIVE ) ; <nl> if ( result = = DB_VERIFY_BAD ) { <nl> - LogPrintf ( " Salvage : Database salvage found errors , all data may not be recoverable . \ n " ) ; <nl> + warnings . push_back ( Untranslated ( " Salvage : Database salvage found errors , all data may not be recoverable . " ) ) ; <nl> } <nl> if ( result ! = 0 & & result ! = DB_VERIFY_BAD ) { <nl> - LogPrintf ( " Salvage : Database salvage failed with result % d . \ n " , result ) ; <nl> + error = strprintf ( Untranslated ( " Salvage : Database salvage failed with result % d . " ) , result ) ; <nl> return false ; <nl> } <nl> <nl> bool RecoverDatabaseFile ( const fs : : path & file_path ) <nl> break ; <nl> getline ( strDump , valueHex ) ; <nl> if ( valueHex = = DATA_END ) { <nl> - LogPrintf ( " Salvage : WARNING : Number of keys in data does not match number of values . \ n " ) ; <nl> + warnings . push_back ( Untranslated ( " Salvage : WARNING : Number of keys in data does not match number of values . " ) ) ; <nl> break ; <nl> } <nl> salvagedData . push_back ( make_pair ( ParseHex ( keyHex ) , ParseHex ( valueHex ) ) ) ; <nl> bool RecoverDatabaseFile ( const fs : : path & file_path ) <nl> <nl> bool fSuccess ; <nl> if ( keyHex ! = DATA_END ) { <nl> - LogPrintf ( " Salvage : WARNING : Unexpected end of file while reading salvage output . \ n " ) ; <nl> + warnings . push_back ( Untranslated ( " Salvage : WARNING : Unexpected end of file while reading salvage output . " ) ) ; <nl> fSuccess = false ; <nl> } else { <nl> fSuccess = ( result = = 0 ) ; <nl> bool RecoverDatabaseFile ( const fs : : path & file_path ) <nl> <nl> if ( salvagedData . empty ( ) ) <nl> { <nl> - LogPrintf ( " Salvage ( aggressive ) found no records in % s . \ n " , newFilename ) ; <nl> + error = strprintf ( Untranslated ( " Salvage ( aggressive ) found no records in % s . " ) , newFilename ) ; <nl> return false ; <nl> } <nl> - LogPrintf ( " Salvage ( aggressive ) found % u records \ n " , salvagedData . size ( ) ) ; <nl> <nl> std : : unique_ptr < Db > pdbCopy = MakeUnique < Db > ( env - > dbenv . get ( ) , 0 ) ; <nl> int ret = pdbCopy - > open ( nullptr , / / Txn pointer <nl> bool RecoverDatabaseFile ( const fs : : path & file_path ) <nl> DB_CREATE , / / Flags <nl> 0 ) ; <nl> if ( ret > 0 ) { <nl> - LogPrintf ( " Cannot create database file % s \ n " , filename ) ; <nl> + error = strprintf ( Untranslated ( " Cannot create database file % s " ) , filename ) ; <nl> pdbCopy - > close ( 0 ) ; <nl> return false ; <nl> } <nl> bool RecoverDatabaseFile ( const fs : : path & file_path ) <nl> } <nl> if ( ! fReadOK ) <nl> { <nl> - LogPrintf ( " WARNING : WalletBatch : : Recover skipping % s : % s \ n " , strType , strErr ) ; <nl> + warnings . push_back ( strprintf ( Untranslated ( " WARNING : WalletBatch : : Recover skipping % s : % s " ) , strType , strErr ) ) ; <nl> continue ; <nl> } <nl> Dbt datKey ( & row . first [ 0 ] , row . first . size ( ) ) ; <nl> mmm a / src / wallet / salvage . h <nl> ppp b / src / wallet / salvage . h <nl> <nl> # include < fs . h > <nl> # include < streams . h > <nl> <nl> - bool RecoverDatabaseFile ( const fs : : path & file_path ) ; <nl> + struct bilingual_str ; <nl> + <nl> + bool RecoverDatabaseFile ( const fs : : path & file_path , bilingual_str & error , std : : vector < bilingual_str > & warnings ) ; <nl> <nl> # endif / / BITCOIN_WALLET_SALVAGE_H <nl> mmm a / src / wallet / walletdb . h <nl> ppp b / src / wallet / walletdb . h <nl> class WalletBatch <nl> DBErrors ZapSelectTx ( std : : vector < uint256 > & vHashIn , std : : vector < uint256 > & vHashOut ) ; <nl> / * Function to determine if a certain KV / key - type is a key ( cryptographical key ) type * / <nl> static bool IsKeyType ( const std : : string & strType ) ; <nl> - / * verifies the database environment * / <nl> - static bool VerifyEnvironment ( const fs : : path & wallet_path , bilingual_str & errorStr ) ; <nl> - / * verifies the database file * / <nl> - static bool VerifyDatabaseFile ( const fs : : path & wallet_path , bilingual_str & errorStr ) ; <nl> <nl> / / ! write the hdchain model ( external chain child index counter ) <nl> bool WriteHDChain ( const CHDChain & chain ) ; <nl> mmm a / src / wallet / wallettool . cpp <nl> ppp b / src / wallet / wallettool . cpp <nl> static void WalletShowInfo ( CWallet * wallet_instance ) <nl> tfm : : format ( std : : cout , " Address Book : % zu \ n " , wallet_instance - > m_address_book . size ( ) ) ; <nl> } <nl> <nl> - static bool SalvageWallet ( const fs : : path & path ) <nl> - { <nl> - / / Create a Database handle to allow for the db to be initialized before recovery <nl> - std : : unique_ptr < WalletDatabase > database = CreateWalletDatabase ( path ) ; <nl> - <nl> - / / Initialize the environment before recovery <nl> - bilingual_str error_string ; <nl> - try { <nl> - database - > Verify ( error_string ) ; <nl> - } catch ( const fs : : filesystem_error & e ) { <nl> - error_string = Untranslated ( strprintf ( " Error loading wallet . % s " , fsbridge : : get_filesystem_error_message ( e ) ) ) ; <nl> - } <nl> - if ( ! error_string . original . empty ( ) ) { <nl> - tfm : : format ( std : : cerr , " Failed to open wallet for salvage : % s \ n " , error_string . original ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / Perform the recovery <nl> - return RecoverDatabaseFile ( path ) ; <nl> - } <nl> - <nl> bool ExecuteWalletToolFunc ( const std : : string & command , const std : : string & name ) <nl> { <nl> fs : : path path = fs : : absolute ( name , GetWalletDir ( ) ) ; <nl> bool ExecuteWalletToolFunc ( const std : : string & command , const std : : string & name ) <nl> WalletShowInfo ( wallet_instance . get ( ) ) ; <nl> wallet_instance - > Close ( ) ; <nl> } else if ( command = = " salvage " ) { <nl> - return SalvageWallet ( path ) ; <nl> + bilingual_str error ; <nl> + std : : vector < bilingual_str > warnings ; <nl> + bool ret = RecoverDatabaseFile ( path , error , warnings ) ; <nl> + if ( ! ret ) { <nl> + for ( const auto warning : warnings ) { <nl> + tfm : : format ( std : : cerr , " % s \ n " , warning . original ) ; <nl> + } <nl> + if ( ! error . empty ( ) ) { <nl> + tfm : : format ( std : : cerr , " % s \ n " , error . original ) ; <nl> + } <nl> + } <nl> + return ret ; <nl> } <nl> } else { <nl> tfm : : format ( std : : cerr , " Invalid command : % s \ n " , command ) ; <nl>
Merge : wallet : Cleanup wallettool salvage and walletdb extraneous declarations
bitcoin/bitcoin
30dd562fd2c58536fa026fff9853b8d825216b01
2020-08-14T13:12:44Z
mmm a / src / bootstrapper . cc <nl> ppp b / src / bootstrapper . cc <nl> void Genesis : : InitializeGlobal_harmony_intl_relative_time_format ( ) { <nl> JSObject : : AddProperty ( isolate ( ) , prototype , factory ( ) - > to_string_tag_symbol ( ) , <nl> factory ( ) - > Object_string ( ) , <nl> static_cast < PropertyAttributes > ( DONT_ENUM | READ_ONLY ) ) ; <nl> + <nl> + SimpleInstallFunction ( isolate ( ) , prototype , " resolvedOptions " , <nl> + Builtins : : kRelativeTimeFormatPrototypeResolvedOptions , <nl> + 0 , false ) ; <nl> } <nl> <nl> # endif / / V8_INTL_SUPPORT <nl> mmm a / src / builtins / builtins - definitions . h <nl> ppp b / src / builtins / builtins - definitions . h <nl> namespace internal { <nl> ASM ( MathPowInternal ) <nl> <nl> # ifdef V8_INTL_SUPPORT <nl> - # define BUILTIN_LIST ( CPP , API , TFJ , TFC , TFS , TFH , ASM ) \ <nl> - BUILTIN_LIST_BASE ( CPP , API , TFJ , TFC , TFS , TFH , ASM ) \ <nl> - BUILTIN_LIST_FROM_DSL ( CPP , API , TFJ , TFC , TFS , TFH , ASM ) \ <nl> - \ <nl> - TFS ( StringToLowerCaseIntl , kString ) \ <nl> - / * ES # sec - string . prototype . tolowercase * / \ <nl> - TFJ ( StringPrototypeToLowerCaseIntl , 0 , kReceiver ) \ <nl> - / * ES # sec - string . prototype . touppercase * / \ <nl> - CPP ( StringPrototypeToUpperCaseIntl ) \ <nl> - / * ES # sec - string . prototype . normalize * / \ <nl> - CPP ( StringPrototypeNormalizeIntl ) \ <nl> - / * ecma402 # sec - intl . numberformat . prototype . formattoparts * / \ <nl> - CPP ( NumberFormatPrototypeFormatToParts ) \ <nl> - / * ecma402 # sec - intl . datetimeformat . prototype . formattoparts * / \ <nl> - CPP ( DateTimeFormatPrototypeFormatToParts ) \ <nl> - / * ecma402 # new proposal * / \ <nl> - / * ecma402 # sec - intl - locale - constructor * / \ <nl> - CPP ( LocaleConstructor ) \ <nl> - CPP ( LocalePrototypeLanguage ) \ <nl> - CPP ( LocalePrototypeScript ) \ <nl> - CPP ( LocalePrototypeRegion ) \ <nl> - CPP ( LocalePrototypeBaseName ) \ <nl> - CPP ( LocalePrototypeCalendar ) \ <nl> - CPP ( LocalePrototypeCaseFirst ) \ <nl> - CPP ( LocalePrototypeCollation ) \ <nl> - CPP ( LocalePrototypeHourCycle ) \ <nl> - CPP ( LocalePrototypeNumeric ) \ <nl> - CPP ( LocalePrototypeNumberingSystem ) \ <nl> - CPP ( LocalePrototypeToString ) \ <nl> - / * ecma402 # sec - number - format - functions * / \ <nl> - CPP ( NumberFormatInternalFormatNumber ) \ <nl> - / * ecma402 # sec - intl . numberformat . prototype . format * / \ <nl> - CPP ( NumberFormatPrototypeFormatNumber ) \ <nl> - / * ecma402 # sec - intl - relativetimeformat - constructor * / \ <nl> - CPP ( RelativeTimeFormatConstructor ) <nl> + # define BUILTIN_LIST ( CPP , API , TFJ , TFC , TFS , TFH , ASM ) \ <nl> + BUILTIN_LIST_BASE ( CPP , API , TFJ , TFC , TFS , TFH , ASM ) \ <nl> + BUILTIN_LIST_FROM_DSL ( CPP , API , TFJ , TFC , TFS , TFH , ASM ) \ <nl> + \ <nl> + TFS ( StringToLowerCaseIntl , kString ) \ <nl> + / * ES # sec - string . prototype . tolowercase * / \ <nl> + TFJ ( StringPrototypeToLowerCaseIntl , 0 , kReceiver ) \ <nl> + / * ES # sec - string . prototype . touppercase * / \ <nl> + CPP ( StringPrototypeToUpperCaseIntl ) \ <nl> + / * ES # sec - string . prototype . normalize * / \ <nl> + CPP ( StringPrototypeNormalizeIntl ) \ <nl> + / * ecma402 # sec - intl . numberformat . prototype . formattoparts * / \ <nl> + CPP ( NumberFormatPrototypeFormatToParts ) \ <nl> + / * ecma402 # sec - intl . datetimeformat . prototype . formattoparts * / \ <nl> + CPP ( DateTimeFormatPrototypeFormatToParts ) \ <nl> + / * ecma402 # new proposal * / \ <nl> + / * ecma402 # sec - intl - locale - constructor * / \ <nl> + CPP ( LocaleConstructor ) \ <nl> + CPP ( LocalePrototypeLanguage ) \ <nl> + CPP ( LocalePrototypeScript ) \ <nl> + CPP ( LocalePrototypeRegion ) \ <nl> + CPP ( LocalePrototypeBaseName ) \ <nl> + CPP ( LocalePrototypeCalendar ) \ <nl> + CPP ( LocalePrototypeCaseFirst ) \ <nl> + CPP ( LocalePrototypeCollation ) \ <nl> + CPP ( LocalePrototypeHourCycle ) \ <nl> + CPP ( LocalePrototypeNumeric ) \ <nl> + CPP ( LocalePrototypeNumberingSystem ) \ <nl> + CPP ( LocalePrototypeToString ) \ <nl> + / * ecma402 # sec - number - format - functions * / \ <nl> + CPP ( NumberFormatInternalFormatNumber ) \ <nl> + / * ecma402 # sec - intl . numberformat . prototype . format * / \ <nl> + CPP ( NumberFormatPrototypeFormatNumber ) \ <nl> + / * ecma402 # sec - intl - relativetimeformat - constructor * / \ <nl> + CPP ( RelativeTimeFormatConstructor ) \ <nl> + / * ecma402 # sec - intl . relativetimeformat . prototype . resolvedoptions * / \ <nl> + CPP ( RelativeTimeFormatPrototypeResolvedOptions ) <nl> # else <nl> # define BUILTIN_LIST ( CPP , API , TFJ , TFC , TFS , TFH , ASM ) \ <nl> BUILTIN_LIST_BASE ( CPP , API , TFJ , TFC , TFS , TFH , ASM ) \ <nl> mmm a / src / builtins / builtins - intl . cc <nl> ppp b / src / builtins / builtins - intl . cc <nl> BUILTIN ( RelativeTimeFormatConstructor ) { <nl> options ) ) ; <nl> } <nl> <nl> + BUILTIN ( RelativeTimeFormatPrototypeResolvedOptions ) { <nl> + HandleScope scope ( isolate ) ; <nl> + CHECK_RECEIVER ( JSRelativeTimeFormat , format_holder , <nl> + " Intl . RelativeTimeFormat . prototype . resolvedOptions " ) ; <nl> + return * JSRelativeTimeFormat : : ResolvedOptions ( isolate , format_holder ) ; <nl> + } <nl> + <nl> / / Locale getters . <nl> BUILTIN ( LocalePrototypeLanguage ) { <nl> HandleScope scope ( isolate ) ; <nl> mmm a / test / intl / intl . status <nl> ppp b / test / intl / intl . status <nl> <nl> ' * ' : [ SKIP ] , <nl> } ] , # variant = = no_wasm_traps <nl> <nl> + [ ' system = = windows ' , { <nl> + # noi18n cannot turn on ICU backend for Date <nl> + ' relative - time - format / default - locale - fr - CA ' : [ SKIP ] , <nl> + ' relative - time - format / default - locale - pt - BR ' : [ SKIP ] , <nl> + } ] , # system = = windows ' <nl> + <nl> ] <nl> new file mode 100644 <nl> index 00000000000 . . 32f64ee02d7 <nl> mmm / dev / null <nl> ppp b / test / intl / relative - time - format / default - locale - fr - CA . js <nl> <nl> + / / Copyright 2018 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> + / / Flags : - - harmony - intl - relative - time - format - - harmony - locale <nl> + / / Environment Variables : LC_ALL = fr_CA <nl> + assertEquals ( <nl> + ' fr - CA ' , <nl> + ( new Intl . RelativeTimeFormat ( ) ) . resolvedOptions ( ) . locale ) ; <nl> + <nl> + assertEquals ( <nl> + ' fr - CA ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ] , { style : ' short ' , numeric : ' auto ' } ) ) <nl> + . resolvedOptions ( ) . locale ) ; <nl> new file mode 100644 <nl> index 00000000000 . . 89f7aa14f06 <nl> mmm / dev / null <nl> ppp b / test / intl / relative - time - format / default - locale - pt - BR . js <nl> <nl> + / / Copyright 2018 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> + / / Flags : - - harmony - intl - relative - time - format - - harmony - locale <nl> + / / Environment Variables : LC_ALL = pt_BR <nl> + assertEquals ( <nl> + ' pt - BR ' , <nl> + ( new Intl . RelativeTimeFormat ( ) ) . resolvedOptions ( ) . locale ) ; <nl> + <nl> + assertEquals ( <nl> + ' pt - BR ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ] , { style : ' short ' , numeric : ' auto ' } ) ) <nl> + . resolvedOptions ( ) . locale ) ; <nl> new file mode 100644 <nl> index 00000000000 . . d51a58a9605 <nl> mmm / dev / null <nl> ppp b / test / intl / relative - time - format / resolved - options . js <nl> <nl> + / / Copyright 2018 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> + / / Flags : - - harmony - intl - relative - time - format <nl> + <nl> + let rtf = new Intl . RelativeTimeFormat ( ) ; <nl> + / / Test 1 . 4 . 5 Intl . RelativeTimeFormat . prototype . resolvedOptions ( ) <nl> + / / The default style is ' long ' <nl> + assertEquals ( ' long ' , rtf . resolvedOptions ( ) . style ) ; <nl> + <nl> + / / The default numeric is ' always ' <nl> + assertEquals ( ' always ' , rtf . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + / / contains style , numeric and locale key <nl> + assertEquals ( 3 , Object . getOwnPropertyNames ( rtf . resolvedOptions ( ) ) . length ) ; <nl> + <nl> + / / contains style , numeric and locale key <nl> + assertEquals ( 3 , Object . getOwnPropertyNames ( new Intl . RelativeTimeFormat ( ' en ' ) . resolvedOptions ( ) ) . length ) ; <nl> + <nl> + assertEquals ( <nl> + ' short ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' short ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' always ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' short ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' narrow ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' narrow ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' always ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' narrow ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' long ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' long ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' always ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' long ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' auto ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { numeric : ' auto ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' long ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { numeric : ' auto ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' always ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { numeric : ' always ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' long ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { numeric : ' always ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' long ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' long ' , numeric : ' auto ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' auto ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' long ' , numeric : ' auto ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' long ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' long ' , numeric : ' always ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' always ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' long ' , numeric : ' always ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' short ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' short ' , numeric : ' auto ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' auto ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' short ' , numeric : ' auto ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' short ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' short ' , numeric : ' always ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' always ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' short ' , numeric : ' always ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' narrow ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' narrow ' , numeric : ' auto ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' auto ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' narrow ' , numeric : ' auto ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' narrow ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' narrow ' , numeric : ' always ' } ) ) <nl> + . resolvedOptions ( ) . style ) ; <nl> + <nl> + assertEquals ( <nl> + ' always ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' sr ' ] , { style : ' narrow ' , numeric : ' always ' } ) ) <nl> + . resolvedOptions ( ) . numeric ) ; <nl> + <nl> + assertEquals ( <nl> + ' ar ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' ar ' ] ) ) . resolvedOptions ( ) . locale ) ; <nl> + <nl> + assertEquals ( <nl> + ' ar ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' ar ' , ' en ' ] ) ) . resolvedOptions ( ) . locale ) ; <nl> + <nl> + assertEquals ( <nl> + ' fr ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' fr ' , ' en ' ] ) ) . resolvedOptions ( ) . locale ) ; <nl> + <nl> + assertEquals ( <nl> + ' ar ' , <nl> + ( new Intl . RelativeTimeFormat ( [ ' xyz ' , ' ar ' ] ) ) . resolvedOptions ( ) . locale ) ; <nl> + <nl> + { <nl> + var receiver = 1 ; <nl> + assertThrows ( ( ) = > <nl> + Intl . RelativeTimeFormat . prototype . resolvedOptions . call ( receiver ) , TypeError ) ; <nl> + <nl> + receiver = { } ; <nl> + assertThrows ( ( ) = > <nl> + Intl . RelativeTimeFormat . prototype . resolvedOptions . call ( receiver ) , TypeError ) ; <nl> + } <nl> + <nl> + / / The following is not working yet because it depend on the getAvailableLocales <nl> + / / work in another path set . <nl> + / / TODO ( ftang ) : uncomment the following once that patchset is checked in . <nl> + / / assertEquals ( <nl> + / / ' ar ' , <nl> + / / ( new Intl . RelativeTimeFormat ( [ ' i - default ' , ' ar ' ] ) ) . resolvedOptions ( ) . locale ) ; <nl> mmm a / test / intl / testcfg . py <nl> ppp b / test / intl / testcfg . py <nl> <nl> # OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> <nl> import os <nl> + import re <nl> <nl> from testrunner . local import testsuite <nl> from testrunner . objects import testcase <nl> <nl> + ENV_PATTERN = re . compile ( r " / / \ s + Environment Variables : ( . * ) " ) <nl> + <nl> class TestSuite ( testsuite . TestSuite ) : <nl> def ListTests ( self ) : <nl> tests = [ ] <nl> def __init__ ( self , * args , * * kwargs ) : <nl> super ( TestCase , self ) . __init__ ( * args , * * kwargs ) <nl> <nl> self . _source_flags = self . _parse_source_flags ( ) <nl> + source = self . get_source ( ) <nl> + self . _env = self . _parse_source_env ( source ) <nl> + <nl> + def _parse_source_env ( self , source ) : <nl> + env_match = ENV_PATTERN . search ( source ) <nl> + env = { } <nl> + if env_match : <nl> + for env_pair in env_match . group ( 1 ) . strip ( ) . split ( ) : <nl> + var , value = env_pair . split ( ' = ' ) <nl> + env [ var ] = value <nl> + return env <nl> + <nl> + def _get_cmd_env ( self ) : <nl> + return self . _env <nl> <nl> def _get_files_params ( self ) : <nl> files = map ( lambda f : os . path . join ( self . suite . root , f ) , [ <nl> mmm a / test / test262 / test262 . status <nl> ppp b / test / test262 / test262 . status <nl> <nl> ' intl402 / RelativeTimeFormat / prototype / formatToParts / length ' : [ FAIL ] , <nl> ' intl402 / RelativeTimeFormat / prototype / formatToParts / name ' : [ FAIL ] , <nl> ' intl402 / RelativeTimeFormat / prototype / formatToParts / prop - desc ' : [ FAIL ] , <nl> - ' intl402 / RelativeTimeFormat / prototype / resolvedOptions / length ' : [ FAIL ] , <nl> - ' intl402 / RelativeTimeFormat / prototype / resolvedOptions / name ' : [ FAIL ] , <nl> - ' intl402 / RelativeTimeFormat / prototype / resolvedOptions / prop - desc ' : [ FAIL ] , <nl> <nl> # https : / / bugs . chromium . org / p / v8 / issues / detail ? id = 7813 <nl> ' built - ins / Array / prototype / lastIndexOf / calls - only - has - on - prototype - after - length - zeroed ' : [ FAIL ] , <nl>
[ Intl ] Implement Intl . RelativeTimeFormat . prototype . resolvedOptions
v8/v8
a52c42dad8a76975631d0cf720892588519d6afb
2018-07-10T14:24:26Z
similarity index 93 % <nl> rename from . github / workflows / continuous - integration . yml <nl> rename to . github / workflows / presubmit . yml <nl> mmm a / . github / workflows / continuous - integration . yml <nl> ppp b / . github / workflows / presubmit . yml <nl> <nl> - name : Continuous Integration <nl> + name : Presubmit <nl> <nl> on : [ pull_request ] <nl> <nl>
Rename CI workflow to Presubmit
google/filament
ceafc7835b869cdf2ac9779f106fcaa7ecdc7a2e
2019-08-31T18:53:20Z
mmm a / CHANGELOG <nl> ppp b / CHANGELOG <nl> <nl> v2 . 2 . 0 ( XXXX - XX - XX ) <nl> mmmmmmmmmmmmmmmmmm - <nl> <nl> + * cleanup of version - check , added module org / arangodb / database - version , <nl> + added - - check - version option <nl> + <nl> * fixed issue # 881 : [ 2 . 1 . 0 ] Bombarded ( every 10 sec or so ) with <nl> " WARNING format string is corrupt " when in non - system DB Dashboard <nl> <nl> mmm a / Documentation / UserManual / CommandLine . md <nl> ppp b / Documentation / UserManual / CommandLine . md <nl> General Options { # CommandLineGeneralOptions } <nl> <nl> @ CLEARPAGE <nl> @ anchor CommandLineUpgrade <nl> - @ copydetails triagens : : arango : : ApplicationV8 : : _performUpgrade <nl> + @ CMDOPT { \ - - upgrade } <nl> + <nl> + Specifying this option will make the server perform a database upgrade at <nl> + start . A database upgrade will first compare the version number stored in <nl> + the file VERSION in the database directory with the current server version . <nl> + <nl> + If the two version numbers match , the server will start normally . <nl> + <nl> + If the version number found in the database directory is higher than the <nl> + version number the server is running , the server expects this is an <nl> + unintentional downgrade and will warn about this . It will however start <nl> + normally . Using the server in these conditions is however not recommended <nl> + nor supported . <nl> + <nl> + If the version number found in the database directory is lower than the <nl> + version number the server is running , the server will check whether there <nl> + are any upgrade tasks to perform . It will then execute all required upgrade <nl> + tasks and print their statuses . If one of the upgrade tasks fails , the <nl> + server will exit and refuse to start . <nl> + Re - starting the server with the upgrade option will then again trigger the <nl> + upgrade check and execution until the problem is fixed . If all tasks are <nl> + finished , the server will start normally . <nl> + <nl> + Whether or not this option is specified , the server will always perform a <nl> + version check on startup . Running the server with a non - matching version <nl> + number in the VERSION file will make the server refuse to start . <nl> <nl> @ CLEARPAGE <nl> @ anchor CommandLineConfiguration <nl> mmm a / arangod / RestServer / ArangoServer . cpp <nl> ppp b / arangod / RestServer / ArangoServer . cpp <nl> void ArangoServer : : buildApplicationServer ( ) { <nl> additional [ ApplicationServer : : OPTIONS_CMDLINE ] <nl> ( " console " , " do not start as server , start a JavaScript emergency console instead " ) <nl> ( " upgrade " , " perform a database upgrade " ) <nl> + ( " check - version " , " checks the versions of the database and exit " ) <nl> ; <nl> <nl> / / other options <nl> int ArangoServer : : startupServer ( ) { <nl> _applicationV8 - > setVocbase ( vocbase ) ; <nl> _applicationV8 - > setConcurrency ( concurrency ) ; <nl> <nl> + bool performUpgrade = false ; <nl> + <nl> if ( _applicationServer - > programOptions ( ) . has ( " upgrade " ) ) { <nl> - _applicationV8 - > performUpgrade ( ) ; <nl> + performUpgrade = true ; <nl> } <nl> <nl> / / skip an upgrade even if VERSION is missing <nl> + bool skipUpgrade = false ; <nl> + <nl> if ( _applicationServer - > programOptions ( ) . has ( " no - upgrade " ) ) { <nl> - _applicationV8 - > skipUpgrade ( ) ; <nl> + skipUpgrade = true ; <nl> } <nl> <nl> # ifdef TRI_ENABLE_MRUBY <nl> int ArangoServer : : startupServer ( ) { <nl> _applicationMR - > setConcurrency ( _dispatcherThreads ) ; <nl> # endif <nl> <nl> - _applicationServer - > prepare ( ) ; <nl> - <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> - / / create the dispatcher <nl> + / / prepare everything <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> <nl> + / / prepare scheduler and dispatcher <nl> + _applicationServer - > prepare ( ) ; <nl> + <nl> + / / now we can create the queues <nl> _applicationDispatcher - > buildStandardQueue ( _dispatcherThreads , ( int ) _dispatcherQueueSize ) ; <nl> <nl> + / / and finish prepare <nl> _applicationServer - > prepare2 ( ) ; <nl> <nl> + / / run version check <nl> + if ( _applicationServer - > programOptions ( ) . has ( " check - version " ) ) { <nl> + _applicationV8 - > runUpgradeCheck ( ) ; <nl> + } <nl> + <nl> + _applicationV8 - > runVersionCheck ( skipUpgrade , performUpgrade ) ; <nl> + <nl> + / / setup the V8 actions <nl> + _applicationV8 - > prepareActions ( ) ; <nl> + <nl> + / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> + / / create endpoints and handlers <nl> + / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> + <nl> / / we pass the options by reference , so keep them until shutdown <nl> RestActionHandler : : action_options_t httpOptions ; <nl> httpOptions . _vocbase = vocbase ; <nl> mmm a / arangod / V8Server / ApplicationV8 . cpp <nl> ppp b / arangod / V8Server / ApplicationV8 . cpp <nl> ApplicationV8 : : ApplicationV8 ( TRI_server_t * server , <nl> _useActions ( true ) , <nl> _developmentMode ( false ) , <nl> _frontendDevelopmentMode ( false ) , <nl> - _performUpgrade ( false ) , <nl> - _skipUpgrade ( false ) , <nl> _gcInterval ( 1000 ) , <nl> _gcFrequency ( 10 . 0 ) , <nl> _v8Options ( " " ) , <nl> void ApplicationV8 : : setVocbase ( TRI_vocbase_t * vocbase ) { <nl> _vocbase = vocbase ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief perform a database upgrade <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - void ApplicationV8 : : performUpgrade ( ) { <nl> - _performUpgrade = true ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief skip a database upgrade <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - void ApplicationV8 : : skipUpgrade ( ) { <nl> - _skipUpgrade = true ; <nl> - } <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief enters a context <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void ApplicationV8 : : enableDevelopmentMode ( ) { <nl> _developmentMode = true ; <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief runs the version check <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + void ApplicationV8 : : runVersionCheck ( bool skip , bool perform ) { <nl> + LOG_TRACE ( " starting version check " ) ; <nl> + <nl> + / / enter context and isolate <nl> + V8Context * context = _contexts [ 0 ] ; <nl> + <nl> + context - > _locker = new v8 : : Locker ( context - > _isolate ) ; <nl> + context - > _isolate - > Enter ( ) ; <nl> + context - > _context - > Enter ( ) ; <nl> + <nl> + / / run upgrade script <nl> + if ( ! skip ) { <nl> + LOG_DEBUG ( " running database version check " ) ; <nl> + <nl> + / / can do this without a lock as this is the startup <nl> + for ( size_t j = 0 ; j < _server - > _databases . _nrAlloc ; + + j ) { <nl> + TRI_vocbase_t * vocbase = ( TRI_vocbase_t * ) _server - > _databases . _table [ j ] ; <nl> + <nl> + if ( vocbase ! = 0 ) { <nl> + / / special check script to be run just once in first thread ( not in all ) <nl> + / / but for all databases <nl> + v8 : : HandleScope scope ; <nl> + <nl> + v8 : : Handle < v8 : : Object > args = v8 : : Object : : New ( ) ; <nl> + args - > Set ( v8 : : String : : New ( " upgrade " ) , v8 : : Boolean : : New ( perform ) ) ; <nl> + <nl> + context - > _context - > Global ( ) - > Set ( v8 : : String : : New ( " UPGRADE_ARGS " ) , args ) ; <nl> + <nl> + bool ok = TRI_V8RunVersionCheck ( vocbase , & _startupLoader , context - > _context ) ; <nl> + <nl> + if ( ! ok ) { <nl> + if ( context - > _context - > Global ( ) - > Has ( v8 : : String : : New ( " UPGRADE_STARTED " ) ) ) { <nl> + if ( perform ) { <nl> + LOG_FATAL_AND_EXIT ( <nl> + " Database upgrade failed for ' % s ' . Please inspect the logs from the upgrade procedure " , <nl> + vocbase - > _name ) ; <nl> + } <nl> + else { <nl> + LOG_FATAL_AND_EXIT ( <nl> + " Database version check failed for ' % s ' . Please start the server with the - - upgrade option " , <nl> + vocbase - > _name ) ; <nl> + } <nl> + } <nl> + else { <nl> + LOG_FATAL_AND_EXIT ( " JavaScript error during server start " ) ; <nl> + } <nl> + } <nl> + <nl> + LOG_DEBUG ( " database version check passed for ' % s ' " , vocbase - > _name ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( perform ) { <nl> + <nl> + / / issue # 391 : when invoked with - - upgrade , the server will not always shut down <nl> + LOG_INFO ( " database upgrade passed " ) ; <nl> + context - > _context - > Exit ( ) ; <nl> + context - > _isolate - > Exit ( ) ; <nl> + delete context - > _locker ; <nl> + <nl> + / / regular shutdown . . . wait for all threads to finish <nl> + <nl> + / / again , can do this without the lock <nl> + for ( size_t j = 0 ; j < _server - > _databases . _nrAlloc ; + + j ) { <nl> + TRI_vocbase_t * vocbase = ( TRI_vocbase_t * ) _server - > _databases . _table [ j ] ; <nl> + <nl> + if ( vocbase ! = 0 ) { <nl> + vocbase - > _state = 2 ; <nl> + <nl> + int res = TRI_ERROR_NO_ERROR ; <nl> + <nl> + res | = TRI_JoinThread ( & vocbase - > _synchroniser ) ; <nl> + res | = TRI_JoinThread ( & vocbase - > _compactor ) ; <nl> + vocbase - > _state = 3 ; <nl> + res | = TRI_JoinThread ( & vocbase - > _cleanup ) ; <nl> + <nl> + if ( res ! = TRI_ERROR_NO_ERROR ) { <nl> + LOG_ERROR ( " unable to join database threads for database ' % s ' " , vocbase - > _name ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + LOG_INFO ( " finished " ) ; <nl> + TRI_EXIT_FUNCTION ( EXIT_SUCCESS , NULL ) ; <nl> + } <nl> + <nl> + / / and return from the context <nl> + context - > _context - > Exit ( ) ; <nl> + context - > _isolate - > Exit ( ) ; <nl> + delete context - > _locker ; <nl> + <nl> + LOG_TRACE ( " finished version check " ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief runs the upgrade check <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + void ApplicationV8 : : runUpgradeCheck ( ) { <nl> + LOG_TRACE ( " starting upgrade check " ) ; <nl> + <nl> + / / enter context and isolate <nl> + V8Context * context = _contexts [ 0 ] ; <nl> + <nl> + context - > _locker = new v8 : : Locker ( context - > _isolate ) ; <nl> + context - > _isolate - > Enter ( ) ; <nl> + context - > _context - > Enter ( ) ; <nl> + <nl> + / / run upgrade script <nl> + LOG_DEBUG ( " running database upgrade check " ) ; <nl> + <nl> + / / can do this without a lock as this is the startup <nl> + int result = 1 ; <nl> + <nl> + for ( size_t j = 0 ; j < _server - > _databases . _nrAlloc ; + + j ) { <nl> + TRI_vocbase_t * vocbase = ( TRI_vocbase_t * ) _server - > _databases . _table [ j ] ; <nl> + <nl> + if ( vocbase ! = 0 ) { <nl> + / / special check script to be run just once in first thread ( not in all ) <nl> + / / but for all databases <nl> + v8 : : HandleScope scope ; <nl> + <nl> + int status = TRI_V8RunUpgradeCheck ( vocbase , & _startupLoader , context - > _context ) ; <nl> + <nl> + if ( status < 0 ) { <nl> + LOG_FATAL_AND_EXIT ( <nl> + " Database upgrade check failed for ' % s ' . Please inspect the logs from any errors " , <nl> + vocbase - > _name ) ; <nl> + } <nl> + else if ( status = = 3 ) { <nl> + result = 3 ; <nl> + } <nl> + else if ( status = = 2 & & result = = 1 ) { <nl> + result = 2 ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / issue # 391 : when invoked with - - upgrade , the server will not always shut down <nl> + context - > _context - > Exit ( ) ; <nl> + context - > _isolate - > Exit ( ) ; <nl> + delete context - > _locker ; <nl> + <nl> + / / regular shutdown . . . wait for all threads to finish <nl> + <nl> + / / again , can do this without the lock <nl> + for ( size_t j = 0 ; j < _server - > _databases . _nrAlloc ; + + j ) { <nl> + TRI_vocbase_t * vocbase = ( TRI_vocbase_t * ) _server - > _databases . _table [ j ] ; <nl> + <nl> + if ( vocbase ! = 0 ) { <nl> + vocbase - > _state = 2 ; <nl> + <nl> + int res = TRI_ERROR_NO_ERROR ; <nl> + <nl> + res | = TRI_JoinThread ( & vocbase - > _synchroniser ) ; <nl> + res | = TRI_JoinThread ( & vocbase - > _compactor ) ; <nl> + vocbase - > _state = 3 ; <nl> + res | = TRI_JoinThread ( & vocbase - > _cleanup ) ; <nl> + <nl> + if ( res ! = TRI_ERROR_NO_ERROR ) { <nl> + LOG_ERROR ( " unable to join database threads for database ' % s ' " , vocbase - > _name ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( result = = 1 ) { <nl> + TRI_EXIT_FUNCTION ( EXIT_SUCCESS , NULL ) ; <nl> + } <nl> + else { <nl> + TRI_EXIT_FUNCTION ( result , NULL ) ; <nl> + } <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief prepares the actions <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + void ApplicationV8 : : prepareActions ( ) { <nl> + for ( size_t i = 0 ; i < _nrInstances ; + + i ) { <nl> + prepareV8Actions ( i ) ; <nl> + } <nl> + } <nl> + <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - ApplicationFeature methods <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> void ApplicationV8 : : setupOptions ( map < string , basics : : ProgramOptionsDescription > <nl> / / / { @ inheritDoc } <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - bool ApplicationV8 : : prepare2 ( ) { <nl> + bool ApplicationV8 : : prepare ( ) { <nl> <nl> / / check the startup path <nl> if ( _startupPath . empty ( ) ) { <nl> bool ApplicationV8 : : prepare2 ( ) { <nl> _gcFrequency = 1 ; <nl> } <nl> <nl> + return true ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / { @ inheritDoc } <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + bool ApplicationV8 : : prepare2 ( ) { <nl> + <nl> / / setup instances <nl> _contexts = new V8Context * [ _nrInstances ] ; <nl> <nl> bool ApplicationV8 : : prepareV8Instance ( const size_t i ) { <nl> TRI_InitV8Cluster ( context - > _context ) ; <nl> # endif <nl> <nl> - <nl> if ( _useActions ) { <nl> TRI_InitV8Actions ( context - > _context , _vocbase , _scheduler , _dispatcher , this ) ; <nl> } <nl> bool ApplicationV8 : : prepareV8Instance ( const size_t i ) { <nl> } <nl> } <nl> <nl> - / / set global flag before loading system files <nl> - if ( i = = 0 & & ! _skipUpgrade ) { <nl> - v8 : : HandleScope scope ; <nl> - TRI_AddGlobalVariableVocbase ( context - > _context , " UPGRADE " , v8 : : Boolean : : New ( _performUpgrade ) ) ; <nl> - } <nl> - <nl> / / load all init files <nl> for ( size_t j = 0 ; j < files . size ( ) ; + + j ) { <nl> bool ok = _startupLoader . loadScript ( context - > _context , files [ j ] ) ; <nl> bool ApplicationV8 : : prepareV8Instance ( const size_t i ) { <nl> } <nl> } <nl> <nl> + / / and return from the context <nl> + context - > _context - > Exit ( ) ; <nl> + context - > _isolate - > Exit ( ) ; <nl> + delete context - > _locker ; <nl> <nl> - / / run upgrade script <nl> - if ( i = = 0 & & ! _skipUpgrade ) { <nl> - LOG_DEBUG ( " running database version check " ) ; <nl> - <nl> - / / can do this without a lock as this is the startup <nl> - for ( size_t j = 0 ; j < _server - > _databases . _nrAlloc ; + + j ) { <nl> - TRI_vocbase_t * vocbase = ( TRI_vocbase_t * ) _server - > _databases . _table [ j ] ; <nl> - <nl> - if ( vocbase ! = 0 ) { <nl> - / / special check script to be run just once in first thread ( not in all ) <nl> - / / but for all databases <nl> - v8 : : HandleScope scope ; <nl> - <nl> - context - > _context - > Global ( ) - > Set ( v8 : : String : : New ( " UPGRADE_ARGS " ) , v8 : : Object : : New ( ) ) ; <nl> - <nl> - bool ok = TRI_V8RunVersionCheck ( vocbase , & _startupLoader , context - > _context ) ; <nl> - <nl> - if ( ! ok ) { <nl> - if ( context - > _context - > Global ( ) - > Has ( v8 : : String : : New ( " UPGRADE_STARTED " ) ) ) { <nl> - if ( _performUpgrade ) { <nl> - LOG_FATAL_AND_EXIT ( " Database upgrade failed for ' % s ' . Please inspect the logs from the upgrade procedure " , vocbase - > _name ) ; <nl> - } <nl> - else { <nl> - LOG_FATAL_AND_EXIT ( " Database version check failed for ' % s ' . Please start the server with the - - upgrade option " , vocbase - > _name ) ; <nl> - } <nl> - } <nl> - else { <nl> - LOG_FATAL_AND_EXIT ( " JavaScript error during server start " ) ; <nl> - } <nl> - } <nl> - <nl> - LOG_DEBUG ( " database version check passed for ' % s ' " , vocbase - > _name ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - if ( _performUpgrade ) { <nl> - / / issue # 391 : when invoked with - - upgrade , the server will not always shut down <nl> - LOG_INFO ( " database upgrade passed " ) ; <nl> - context - > _context - > Exit ( ) ; <nl> - context - > _isolate - > Exit ( ) ; <nl> - delete context - > _locker ; <nl> + / / initialise garbage collection for context <nl> + context - > _numExecutions = 0 ; <nl> + context - > _hasDeadObjects = true ; <nl> + context - > _lastGcStamp = TRI_microtime ( ) ; <nl> <nl> - / / regular shutdown . . . wait for all threads to finish <nl> + LOG_TRACE ( " initialised V8 context # % d " , ( int ) i ) ; <nl> <nl> - / / again , can do this without the lock <nl> - for ( size_t j = 0 ; j < _server - > _databases . _nrAlloc ; + + j ) { <nl> - TRI_vocbase_t * vocbase = ( TRI_vocbase_t * ) _server - > _databases . _table [ j ] ; <nl> + _freeContexts . push_back ( context ) ; <nl> <nl> - if ( vocbase ! = 0 ) { <nl> - vocbase - > _state = 2 ; <nl> + return true ; <nl> + } <nl> <nl> - int res = TRI_ERROR_NO_ERROR ; <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief prepares the V8 actions <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - res | = TRI_JoinThread ( & vocbase - > _synchroniser ) ; <nl> - res | = TRI_JoinThread ( & vocbase - > _compactor ) ; <nl> - vocbase - > _state = 3 ; <nl> - res | = TRI_JoinThread ( & vocbase - > _cleanup ) ; <nl> + void ApplicationV8 : : prepareV8Actions ( const size_t i ) { <nl> + LOG_TRACE ( " initialising V8 actions # % d " , ( int ) i ) ; <nl> <nl> - if ( res ! = TRI_ERROR_NO_ERROR ) { <nl> - LOG_ERROR ( " unable to join database threads for database ' % s ' " , vocbase - > _name ) ; <nl> - } <nl> - } <nl> - } <nl> + / / enter context and isolate <nl> + V8Context * context = _contexts [ i ] ; <nl> <nl> - LOG_INFO ( " finished " ) ; <nl> - TRI_EXIT_FUNCTION ( EXIT_SUCCESS , NULL ) ; <nl> - } <nl> + context - > _locker = new v8 : : Locker ( context - > _isolate ) ; <nl> + context - > _isolate - > Enter ( ) ; <nl> + context - > _context - > Enter ( ) ; <nl> <nl> / / scan for foxx applications <nl> if ( i = = 0 ) { <nl> + <nl> / / once again , we don ' t need the lock as this is the startup <nl> for ( size_t j = 0 ; j < _server - > _databases . _nrAlloc ; + + j ) { <nl> TRI_vocbase_t * vocbase = ( TRI_vocbase_t * ) _server - > _databases . _table [ j ] ; <nl> bool ApplicationV8 : : prepareV8Instance ( const size_t i ) { <nl> delete context - > _locker ; <nl> <nl> / / initialise garbage collection for context <nl> - context - > _numExecutions = 0 ; <nl> - context - > _hasDeadObjects = true ; <nl> - context - > _lastGcStamp = TRI_microtime ( ) ; <nl> - <nl> - LOG_TRACE ( " initialised V8 context # % d " , ( int ) i ) ; <nl> - <nl> - _freeContexts . push_back ( context ) ; <nl> - <nl> - return true ; <nl> + LOG_TRACE ( " initialised V8 actions # % d " , ( int ) i ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void ApplicationV8 : : shutdownV8Instance ( size_t i ) { <nl> LOG_TRACE ( " closed V8 context # % d " , ( int ) i ) ; <nl> } <nl> <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - END - OF - FILE <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> / / Local Variables : <nl> / / mode : outline - minor <nl> / / outline - regexp : " / / / @ brief \ \ | / / / { @ inheritDoc } \ \ | / / / @ addtogroup \ \ | / / / @ page \ \ | / / - - SECTION - - \ \ | / / / @ \ \ } " <nl> mmm a / arangod / V8Server / ApplicationV8 . h <nl> ppp b / arangod / V8Server / ApplicationV8 . h <nl> namespace triagens { <nl> <nl> void setVocbase ( struct TRI_vocbase_s * ) ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief enable the database version check <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - void performUpgrade ( ) ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief disable the database version check <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - void skipUpgrade ( ) ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief enters an context <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> namespace triagens { <nl> _definedBooleans [ name ] = value ; <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief runs the version check <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + void runVersionCheck ( bool skip , bool perform ) ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief runs the upgrade check <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + void runUpgradeCheck ( ) ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief prepares the actions <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + void prepareActions ( ) ; <nl> + <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - ApplicationFeature methods <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> namespace triagens { <nl> <nl> void setupOptions ( map < string , basics : : ProgramOptionsDescription > & ) ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / { @ inheritDoc } <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + bool prepare ( ) ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / { @ inheritDoc } <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> namespace triagens { <nl> <nl> bool prepareV8Instance ( size_t ) ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief prepares the V8 actions <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + void prepareV8Actions ( size_t ) ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief shut downs a V8 instances <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> namespace triagens { <nl> <nl> bool _frontendDevelopmentMode ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief perform a database upgrade <nl> - / / / <nl> - / / / @ CMDOPT { \ - - upgrade } <nl> - / / / <nl> - / / / Specifying this option will make the server perform a database upgrade at <nl> - / / / start . A database upgrade will first compare the version number stored in <nl> - / / / the file VERSION in the database directory with the current server version . <nl> - / / / <nl> - / / / If the two version numbers match , the server will start normally . <nl> - / / / <nl> - / / / If the version number found in the database directory is higher than the <nl> - / / / version number the server is running , the server expects this is an <nl> - / / / unintentional downgrade and will warn about this . It will however start <nl> - / / / normally . Using the server in these conditions is however not recommended <nl> - / / / nor supported . <nl> - / / / <nl> - / / / If the version number found in the database directory is lower than the <nl> - / / / version number the server is running , the server will check whether there <nl> - / / / are any upgrade tasks to perform . It will then execute all required upgrade <nl> - / / / tasks and print their statuses . If one of the upgrade tasks fails , the <nl> - / / / server will exit and refuse to start . <nl> - / / / Re - starting the server with the upgrade option will then again trigger the <nl> - / / / upgrade check and execution until the problem is fixed . If all tasks are <nl> - / / / finished , the server will start normally . <nl> - / / / <nl> - / / / Whether or not this option is specified , the server will always perform a <nl> - / / / version check on startup . Running the server with a non - matching version <nl> - / / / number in the VERSION file will make the server refuse to start . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - bool _performUpgrade ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief perform a database upgrade <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - bool _skipUpgrade ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief JavaScript garbage collection interval ( each x requests ) <nl> / / / <nl> mmm a / arangod / V8Server / v8 - vocbase . cpp <nl> ppp b / arangod / V8Server / v8 - vocbase . cpp <nl> bool TRI_V8RunVersionCheck ( void * vocbase , <nl> return ok ; <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief run upgrade check <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + int TRI_V8RunUpgradeCheck ( void * vocbase , <nl> + JSLoader * startupLoader , <nl> + v8 : : Handle < v8 : : Context > context ) { <nl> + assert ( startupLoader ! = 0 ) ; <nl> + <nl> + v8 : : HandleScope scope ; <nl> + TRI_v8_global_t * v8g = ( TRI_v8_global_t * ) v8 : : Isolate : : GetCurrent ( ) - > GetData ( ) ; <nl> + void * orig = v8g - > _vocbase ; <nl> + v8g - > _vocbase = vocbase ; <nl> + <nl> + v8 : : Handle < v8 : : Value > result = startupLoader - > executeGlobalScript ( context , " server / upgrade - check . js " ) ; <nl> + int code = ( int ) TRI_ObjectToInt64 ( result ) ; <nl> + <nl> + v8g - > _vocbase = orig ; <nl> + <nl> + return code ; <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief initialize foxx <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / arangod / V8Server / v8 - vocbase . h <nl> ppp b / arangod / V8Server / v8 - vocbase . h <nl> bool TRI_V8RunVersionCheck ( void * , <nl> triagens : : arango : : JSLoader * , <nl> v8 : : Handle < v8 : : Context > ) ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief run upgrade check <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + int TRI_V8RunUpgradeCheck ( void * vocbase , <nl> + triagens : : arango : : JSLoader * startupLoader , <nl> + v8 : : Handle < v8 : : Context > context ) ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief initialize foxx <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / js / apps / system / aardvark / frontend / js / bootstrap / module - internal . js <nl> ppp b / js / apps / system / aardvark / frontend / js / bootstrap / module - internal . js <nl> <nl> COLOR_OUTPUT_RESET , COLOR_BRIGHT , COLOR_BLACK , COLOR_BOLD_BLACK , COLOR_BLINK , COLOR_BLUE , <nl> COLOR_BOLD_BLUE , COLOR_BOLD_GREEN , COLOR_RED , COLOR_BOLD_RED , COLOR_GREEN , COLOR_WHITE , <nl> COLOR_BOLD_WHITE , COLOR_YELLOW , COLOR_BOLD_YELLOW , COLOR_CYAN , COLOR_BOLD_CYAN , COLOR_MAGENTA , <nl> - COLOR_BOLD_MAGENTA , PRETTY_PRINT , VALGRIND , VERSION , UPGRADE , <nl> + COLOR_BOLD_MAGENTA , PRETTY_PRINT , VALGRIND , VERSION , <nl> BYTES_SENT_DISTRIBUTION , BYTES_RECEIVED_DISTRIBUTION , CONNECTION_TIME_DISTRIBUTION , <nl> REQUEST_TIME_DISTRIBUTION , DEVELOPMENT_MODE , FE_DEVELOPMENT_MODE , THREAD_NUMBER , LOGFILE_PATH , <nl> SYS_PLATFORM , SYS_EXECUTE_EXTERNAL , SYS_STATUS_EXTERNAL , SYS_KILL_EXTERNAL , <nl> <nl> delete VERSION ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief upgrade <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - exports . upgrade = " unknown " ; <nl> - <nl> - if ( typeof UPGRADE ! = = " undefined " ) { <nl> - exports . upgrade = UPGRADE ; <nl> - delete UPGRADE ; <nl> - } <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief platform <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / js / common / bootstrap / module - internal . js <nl> ppp b / js / common / bootstrap / module - internal . js <nl> <nl> COLOR_OUTPUT_RESET , COLOR_BRIGHT , COLOR_BLACK , COLOR_BOLD_BLACK , COLOR_BLINK , COLOR_BLUE , <nl> COLOR_BOLD_BLUE , COLOR_BOLD_GREEN , COLOR_RED , COLOR_BOLD_RED , COLOR_GREEN , COLOR_WHITE , <nl> COLOR_BOLD_WHITE , COLOR_YELLOW , COLOR_BOLD_YELLOW , COLOR_CYAN , COLOR_BOLD_CYAN , COLOR_MAGENTA , <nl> - COLOR_BOLD_MAGENTA , PRETTY_PRINT , VALGRIND , VERSION , UPGRADE , <nl> + COLOR_BOLD_MAGENTA , PRETTY_PRINT , VALGRIND , VERSION , <nl> BYTES_SENT_DISTRIBUTION , BYTES_RECEIVED_DISTRIBUTION , CONNECTION_TIME_DISTRIBUTION , <nl> REQUEST_TIME_DISTRIBUTION , DEVELOPMENT_MODE , FE_DEVELOPMENT_MODE , THREAD_NUMBER , LOGFILE_PATH , <nl> SYS_PLATFORM , SYS_EXECUTE_EXTERNAL , SYS_STATUS_EXTERNAL , SYS_KILL_EXTERNAL , <nl> <nl> delete VERSION ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief upgrade <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - exports . upgrade = " unknown " ; <nl> - <nl> - if ( typeof UPGRADE ! = = " undefined " ) { <nl> - exports . upgrade = UPGRADE ; <nl> - delete UPGRADE ; <nl> - } <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief platform <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> new file mode 100644 <nl> index 00000000000 . . d6b47b8030d <nl> mmm / dev / null <nl> ppp b / js / server / modules / org / arangodb / database - version . js <nl> <nl> + / * jslint indent : 2 , nomen : true , maxlen : 100 , sloppy : true , vars : true , white : true , plusplus : true , stupid : true , continue : true , regexp : true nonpropdel : true * / <nl> + / * global require , exports , module * / <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief database version check <nl> + / / / <nl> + / / / @ file <nl> + / / / <nl> + / / / Checks if the database needs to be upgraded . <nl> + / / / <nl> + / / / DISCLAIMER <nl> + / / / <nl> + / / / Copyright 2014 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> + / / / 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> + / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> + / / / <nl> + / / / @ author Dr . Frank Celler <nl> + / / / @ author Copyright 2014 , triAGENS GmbH , Cologne , Germany <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + var internal = require ( " internal " ) ; <nl> + var cluster = require ( " org / arangodb / cluster " ) ; <nl> + var fs = require ( " fs " ) ; <nl> + var db = internal . db ; <nl> + var console = require ( " console " ) ; <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - private functions <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief logger <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + var logger = { <nl> + info : function ( msg ) { <nl> + console . log ( " In database ' % s ' : % s " , db . _name ( ) , msg ) ; <nl> + } , <nl> + <nl> + error : function ( msg ) { <nl> + console . error ( " In database ' % s ' : % s " , db . _name ( ) , msg ) ; <nl> + } , <nl> + <nl> + log : function ( msg ) { <nl> + this . info ( msg ) ; <nl> + } <nl> + } ; <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - public constants <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief VERSION_MATCH <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . VERSION_MATCH = 1 ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief DOWNGRADE <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . DOWNGRADE_NEEDED = 2 ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief UPGRADE <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . UPGRADE_NEEDED = 3 ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief IS_CLUSTER <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . IS_CLUSTER = - 1 ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief CANNOT_PARSE_VERSION_FILE <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . CANNOT_PARSE_VERSION_FILE = - 2 ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief CANNOT_READ_VERSION_FILE <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . CANNOT_READ_VERSION_FILE = - 3 ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief NO_VERSION_FILE <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . NO_VERSION_FILE = - 4 ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief NO_SERVER_VERSION <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . NO_SERVER_VERSION = - 5 ; <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - public functions <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief checks the version <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . databaseVersion = function ( ) { <nl> + if ( cluster . isCoordinator ( ) ) { <nl> + return { result : exports . IS_CLUSTER } ; <nl> + } <nl> + <nl> + / / path to the VERSION file <nl> + var versionFile = internal . db . _path ( ) + " / VERSION " ; <nl> + var lastVersion = null ; <nl> + <nl> + / / VERSION file exists , read its contents <nl> + if ( fs . exists ( versionFile ) ) { <nl> + var versionInfo = fs . read ( versionFile ) ; <nl> + <nl> + if ( versionInfo ! = = ' ' ) { <nl> + var versionValues = JSON . parse ( versionInfo ) ; <nl> + <nl> + if ( versionValues & & versionValues . version & & ! isNaN ( versionValues . version ) ) { <nl> + lastVersion = parseFloat ( versionValues . version ) ; <nl> + } <nl> + else { <nl> + logger . error ( " Cannot parse VERSION file ' " + versionFile + " ' : ' " + versionInfo + " ' " ) ; <nl> + return { result : exports . CANNOT_PARSE_VERSION_FILE } ; <nl> + } <nl> + } <nl> + else { <nl> + logger . error ( " Cannot read VERSION file : ' " + versionFile + " ' " ) ; <nl> + return { result : exports . CANNOT_READ_VERSION_FILE } ; <nl> + } <nl> + } <nl> + else { <nl> + return { result : exports . NO_VERSION_FILE } ; <nl> + } <nl> + <nl> + / / extract server version <nl> + var currentServerVersion = internal . db . _version ( ) . match ( / ^ ( \ d + \ . \ d + ) . * $ / ) ; <nl> + <nl> + / / server version is invalid for some reason <nl> + if ( ! currentServerVersion ) { <nl> + logger . error ( " Unexpected ArangoDB server version : " + internal . db . _version ( ) ) ; <nl> + return { result : exports . NO_SERVER_VERSION } ; <nl> + } <nl> + <nl> + var currentVersion = parseFloat ( currentServerVersion [ 1 ] ) ; <nl> + <nl> + / / version match ! <nl> + if ( lastVersion = = = currentVersion ) { <nl> + return { <nl> + result : exports . VERSION_MATCH , <nl> + serverVersion : currentVersion , <nl> + databaseVersion : lastVersion <nl> + } ; <nl> + } <nl> + <nl> + / / downgrade ? ? <nl> + if ( lastVersion > currentVersion ) { <nl> + return { <nl> + result : exports . DOWNGRADE_NEEDED , <nl> + serverVersion : currentVersion , <nl> + databaseVersion : lastVersion <nl> + } ; <nl> + } <nl> + <nl> + / / upgrade <nl> + if ( lastVersion < currentVersion ) { <nl> + return { <nl> + result : exports . UPGRADE_NEEDED , <nl> + serverVersion : currentVersion , <nl> + databaseVersion : lastVersion <nl> + } ; <nl> + } <nl> + } ; <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - END - OF - FILE <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + / / Local Variables : <nl> + / / mode : outline - minor <nl> + / / outline - regexp : " ^ \ \ ( / / / @ brief \ \ | / / / @ addtogroup \ \ | / / - - SECTION - - \ \ | / / / @ page \ \ | / / / @ } \ \ ) " <nl> + / / End : <nl> mmm a / js / server / modules / org / arangodb / tasks . js <nl> ppp b / js / server / modules / org / arangodb / tasks . js <nl> exports . register = internal . registerTask ; <nl> exports . unregister = internal . unregisterTask ; <nl> exports . get = internal . getTask ; <nl> <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - END - OF - FILE <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> / / Local Variables : <nl> / / mode : outline - minor <nl> / / outline - regexp : " / / / @ brief \ \ | / / / @ addtogroup \ \ | / / - - SECTION - - \ \ | / / / @ } \ \ | / \ \ * jslint " <nl> mmm a / js / server / tests / shell - tasks . js <nl> ppp b / js / server / tests / shell - tasks . js <nl> jsunity . run ( TaskSuite ) ; <nl> <nl> return jsunity . done ( ) ; <nl> <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - END - OF - FILE <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> / / Local Variables : <nl> / / mode : outline - minor <nl> / / outline - regexp : " ^ \ \ ( / / / @ brief \ \ | / / / @ addtogroup \ \ | / / - - SECTION - - \ \ | / / / @ page \ \ | / / / @ } \ \ ) " <nl> new file mode 100644 <nl> index 00000000000 . . 565bdc164fa <nl> mmm / dev / null <nl> ppp b / js / server / upgrade - check . js <nl> <nl> + / * jslint indent : 2 , nomen : true , maxlen : 100 , sloppy : true , vars : true , white : true , plusplus : true , stupid : true , continue : true , regexp : true nonpropdel : true * / <nl> + / * global require , exports , module , UPGRADE_ARGS * / <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief upgrade check <nl> + / / / <nl> + / / / @ file <nl> + / / / <nl> + / / / Version check at the start of the server , will optionally perform necessary <nl> + / / / upgrades . <nl> + / / / <nl> + / / / DISCLAIMER <nl> + / / / <nl> + / / / Copyright 2014 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> + / / / 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> + / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> + / / / <nl> + / / / @ author Dr . Frank Celler <nl> + / / / @ author Copyright 2014 , triAGENS GmbH , Cologne , Germany <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - upgrade check <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + ( function ( ) { <nl> + return require ( " org / arangodb / database - version " ) . databaseVersion ( ) . result ; <nl> + } ( ) ) ; <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - END - OF - FILE <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + / / Local Variables : <nl> + / / mode : outline - minor <nl> + / / outline - regexp : " ^ \ \ ( / / / @ brief \ \ | / / / @ addtogroup \ \ | / / - - SECTION - - \ \ | / / / @ page \ \ | / / / @ } \ \ ) " <nl> + / / End : <nl> mmm a / js / server / version - check . js <nl> ppp b / js / server / version - check . js <nl> <nl> <nl> / / version match ! <nl> if ( lastVersion = = = currentVersion ) { <nl> - if ( internal . upgrade ) { <nl> + if ( args . upgrade ) { <nl> runUpgrade ( currentVersion , true ) ; <nl> } <nl> else { <nl> <nl> <nl> / / upgrade <nl> if ( lastVersion < currentVersion ) { <nl> - if ( internal . upgrade ) { <nl> + if ( args . upgrade ) { <nl> return runUpgrade ( currentVersion , true ) ; <nl> } <nl> <nl>
cleanup of version - check , added option check - version
arangodb/arangodb
8db46677551cb5a07f6250a6ada20e15487e094b
2014-06-01T11:37:21Z
mmm a / BUILDING . md <nl> ppp b / BUILDING . md <nl> gRPC C + + - Building from source <nl> If you plan to build from source and run tests , install the following as well : <nl> ` ` ` sh <nl> $ [ sudo ] apt - get install libgflags - dev libgtest - dev <nl> - $ [ sudo ] apt - get install clang libc + + - dev <nl> + $ [ sudo ] apt - get install clang - 5 . 0 libc + + - dev <nl> ` ` ` <nl> <nl> # # MacOS <nl>
Update doc about using clang - 5 . 0
grpc/grpc
3fe631d1b6ffa7ab9f46d120ef27298e4ede3d9c
2019-03-05T21:57:41Z
mmm a / PowerEditor / src / WinControls / DockingWnd / DockingDlgInterface . h <nl> ppp b / PowerEditor / src / WinControls / DockingWnd / DockingDlgInterface . h <nl> class DockingDlgInterface : public StaticDialog <nl> : : GetWindowText ( _hSelf , temp , MAX_PATH ) ; <nl> _pluginName = temp ; <nl> / / user information <nl> + assert ( data - > hClient ! = nullptr ) ; <nl> data - > hClient = _hSelf ; <nl> + <nl> + assert ( data - > pszName ! = nullptr ) ; <nl> data - > pszName = ( TCHAR * ) _pluginName . c_str ( ) ; <nl> <nl> / / supported features by plugin <nl>
[ ADD ] Add assert .
notepad-plus-plus/notepad-plus-plus
6db831fcd0d85ced5d6141606a3713202859e4df
2015-08-26T07:03:21Z
mmm a / src / base / bits . cc <nl> ppp b / src / base / bits . cc <nl> <nl> # include < limits > <nl> <nl> # include " src / base / logging . h " <nl> + # include " src / base / safe_math . h " <nl> <nl> namespace v8 { <nl> namespace base { <nl> int32_t SignedMod32 ( int32_t lhs , int32_t rhs ) { <nl> return lhs % rhs ; <nl> } <nl> <nl> + <nl> + int64_t FromCheckedNumeric ( const internal : : CheckedNumeric < int64_t > value ) { <nl> + if ( value . IsValid ( ) ) <nl> + return value . ValueUnsafe ( ) ; <nl> + <nl> + / / We could return max / min but we don ' t really expose what the maximum delta <nl> + / / is . Instead , return max / ( - max ) , which is something that clients can reason <nl> + / / about . <nl> + / / TODO ( rvargas ) crbug . com / 332611 : don ' t use internal values . <nl> + int64_t limit = std : : numeric_limits < int64_t > : : max ( ) ; <nl> + if ( value . validity ( ) = = internal : : RANGE_UNDERFLOW ) <nl> + limit = - limit ; <nl> + return value . ValueOrDefault ( limit ) ; <nl> + } <nl> + <nl> + <nl> + int64_t SignedSaturatedAdd64 ( int64_t lhs , int64_t rhs ) { <nl> + internal : : CheckedNumeric < int64_t > rv ( lhs ) ; <nl> + rv + = rhs ; <nl> + return FromCheckedNumeric ( rv ) ; <nl> + } <nl> + <nl> + <nl> + int64_t SignedSaturatedSub64 ( int64_t lhs , int64_t rhs ) { <nl> + internal : : CheckedNumeric < int64_t > rv ( lhs ) ; <nl> + rv - = rhs ; <nl> + return FromCheckedNumeric ( rv ) ; <nl> + } <nl> + <nl> } / / namespace bits <nl> } / / namespace base <nl> } / / namespace v8 <nl> mmm a / src / base / bits . h <nl> ppp b / src / base / bits . h <nl> <nl> <nl> namespace v8 { <nl> namespace base { <nl> + <nl> + namespace internal { <nl> + template < typename T > <nl> + class CheckedNumeric ; <nl> + } <nl> + <nl> namespace bits { <nl> <nl> / / CountPopulation32 ( value ) returns the number of bits set in | value | . <nl> inline uint32_t UnsignedMod32 ( uint32_t lhs , uint32_t rhs ) { <nl> return rhs ? lhs % rhs : 0u ; <nl> } <nl> <nl> + <nl> + / / Clamp | value | on overflow and underflow conditions . <nl> + int64_t FromCheckedNumeric ( const internal : : CheckedNumeric < int64_t > value ) ; <nl> + <nl> + <nl> + / / SignedSaturatedAdd64 ( lhs , rhs ) adds | lhs | and | rhs | , <nl> + / / checks and returns the result . <nl> + int64_t SignedSaturatedAdd64 ( int64_t lhs , int64_t rhs ) ; <nl> + <nl> + <nl> + / / SignedSaturatedSub64 ( lhs , rhs ) substracts | lhs | by | rhs | , <nl> + / / checks and returns the result . <nl> + int64_t SignedSaturatedSub64 ( int64_t lhs , int64_t rhs ) ; <nl> + <nl> + <nl> } / / namespace bits <nl> } / / namespace base <nl> } / / namespace v8 <nl> mmm a / src / base / platform / time . h <nl> ppp b / src / base / platform / time . h <nl> <nl> # include < iosfwd > <nl> # include < limits > <nl> <nl> + # include " src / base / bits . h " <nl> # include " src / base / macros . h " <nl> + # include " src / base / safe_math . h " <nl> <nl> / / Forward declarations . <nl> extern " C " { <nl> namespace v8 { <nl> namespace base { <nl> <nl> class Time ; <nl> + class TimeDelta ; <nl> class TimeTicks ; <nl> <nl> + namespace time_internal { <nl> + template < class TimeClass > <nl> + class TimeBase ; <nl> + } <nl> + <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / TimeDelta <nl> / / <nl> class TimeDelta final { <nl> } <nl> <nl> private : <nl> + template < class TimeClass > friend class time_internal : : TimeBase ; <nl> / / Constructs a delta given the duration in microseconds . This is private <nl> / / to avoid confusion by callers with an integer constructor . Use <nl> / / FromSeconds , FromMilliseconds , etc . instead . <nl> class TimeDelta final { <nl> } ; <nl> <nl> <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - / / Time <nl> - / / <nl> - / / This class represents an absolute point in time , internally represented as <nl> - / / microseconds ( s / 1 , 000 , 000 ) since 00 : 00 : 00 UTC , January 1 , 1970 . <nl> + namespace time_internal { <nl> + <nl> + / / TimeBasemmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> - class Time final { <nl> + / / Provides value storage and comparison / math operations common to all time <nl> + / / classes . Each subclass provides for strong type - checking to ensure <nl> + / / semantically meaningful comparison / math of time values from the same clock <nl> + / / source or timeline . <nl> + template < class TimeClass > <nl> + class TimeBase { <nl> public : <nl> + static const int64_t kHoursPerDay = 24 ; <nl> static const int64_t kMillisecondsPerSecond = 1000 ; <nl> + static const int64_t kMillisecondsPerDay = <nl> + kMillisecondsPerSecond * 60 * 60 * kHoursPerDay ; <nl> static const int64_t kMicrosecondsPerMillisecond = 1000 ; <nl> - static const int64_t kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * <nl> - kMillisecondsPerSecond ; <nl> + static const int64_t kMicrosecondsPerSecond = <nl> + kMicrosecondsPerMillisecond * kMillisecondsPerSecond ; <nl> static const int64_t kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60 ; <nl> static const int64_t kMicrosecondsPerHour = kMicrosecondsPerMinute * 60 ; <nl> - static const int64_t kMicrosecondsPerDay = kMicrosecondsPerHour * 24 ; <nl> + static const int64_t kMicrosecondsPerDay = <nl> + kMicrosecondsPerHour * kHoursPerDay ; <nl> static const int64_t kMicrosecondsPerWeek = kMicrosecondsPerDay * 7 ; <nl> static const int64_t kNanosecondsPerMicrosecond = 1000 ; <nl> - static const int64_t kNanosecondsPerSecond = kNanosecondsPerMicrosecond * <nl> - kMicrosecondsPerSecond ; <nl> + static const int64_t kNanosecondsPerSecond = <nl> + kNanosecondsPerMicrosecond * kMicrosecondsPerSecond ; <nl> <nl> - / / Contains the NULL time . Use Time : : Now ( ) to get the current time . <nl> - Time ( ) : us_ ( 0 ) { } <nl> - <nl> - / / Returns true if the time object has not been initialized . <nl> - bool IsNull ( ) const { return us_ = = 0 ; } <nl> + / / Returns true if this object has not been initialized . <nl> + / / <nl> + / / Warning : Be careful when writing code that performs math on time values , <nl> + / / since it ' s possible to produce a valid " zero " result that should not be <nl> + / / interpreted as a " null " value . <nl> + bool IsNull ( ) const { <nl> + return us_ = = 0 ; <nl> + } <nl> <nl> - / / Returns true if the time object is the maximum time . <nl> + / / Returns true if this object represents the maximum time . <nl> bool IsMax ( ) const { return us_ = = std : : numeric_limits < int64_t > : : max ( ) ; } <nl> <nl> + / / For serializing only . Use FromInternalValue ( ) to reconstitute . Please don ' t <nl> + / / use this and do arithmetic on it , as it is more error prone than using the <nl> + / / provided operators . <nl> + int64_t ToInternalValue ( ) const { return us_ ; } <nl> + <nl> + TimeClass & operator = ( TimeClass other ) { <nl> + us_ = other . us_ ; <nl> + return * ( static_cast < TimeClass * > ( this ) ) ; <nl> + } <nl> + <nl> + / / Compute the difference between two times . <nl> + TimeDelta operator - ( TimeClass other ) const { <nl> + return TimeDelta : : FromMicroseconds ( us_ - other . us_ ) ; <nl> + } <nl> + <nl> + / / Return a new time modified by some delta . <nl> + TimeClass operator + ( TimeDelta delta ) const { <nl> + return TimeClass ( bits : : SignedSaturatedAdd64 ( delta . delta_ , us_ ) ) ; <nl> + } <nl> + TimeClass operator - ( TimeDelta delta ) const { <nl> + return TimeClass ( - bits : : SignedSaturatedSub64 ( delta . delta_ , us_ ) ) ; <nl> + } <nl> + <nl> + / / Modify by some time delta . <nl> + TimeClass & operator + = ( TimeDelta delta ) { <nl> + return static_cast < TimeClass & > ( * this = ( * this + delta ) ) ; <nl> + } <nl> + TimeClass & operator - = ( TimeDelta delta ) { <nl> + return static_cast < TimeClass & > ( * this = ( * this - delta ) ) ; <nl> + } <nl> + <nl> + / / Comparison operators <nl> + bool operator = = ( TimeClass other ) const { <nl> + return us_ = = other . us_ ; <nl> + } <nl> + bool operator ! = ( TimeClass other ) const { <nl> + return us_ ! = other . us_ ; <nl> + } <nl> + bool operator < ( TimeClass other ) const { <nl> + return us_ < other . us_ ; <nl> + } <nl> + bool operator < = ( TimeClass other ) const { <nl> + return us_ < = other . us_ ; <nl> + } <nl> + bool operator > ( TimeClass other ) const { <nl> + return us_ > other . us_ ; <nl> + } <nl> + bool operator > = ( TimeClass other ) const { <nl> + return us_ > = other . us_ ; <nl> + } <nl> + <nl> + / / Converts an integer value representing TimeClass to a class . This is used <nl> + / / when deserializing a | TimeClass | structure , using a value known to be <nl> + / / compatible . It is not provided as a constructor because the integer type <nl> + / / may be unclear from the perspective of a caller . <nl> + static TimeClass FromInternalValue ( int64_t us ) { return TimeClass ( us ) ; } <nl> + <nl> + protected : <nl> + explicit TimeBase ( int64_t us ) : us_ ( us ) { } <nl> + <nl> + / / Time value in a microsecond timebase . <nl> + int64_t us_ ; <nl> + } ; <nl> + <nl> + } / / namespace time_internal <nl> + <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / Time <nl> + / / <nl> + / / This class represents an absolute point in time , internally represented as <nl> + / / microseconds ( s / 1 , 000 , 000 ) since 00 : 00 : 00 UTC , January 1 , 1970 . <nl> + <nl> + class Time final : public time_internal : : TimeBase < Time > { <nl> + public : <nl> + / / Contains the NULL time . Use Time : : Now ( ) to get the current time . <nl> + Time ( ) : TimeBase ( 0 ) { } <nl> + <nl> / / Returns the current time . Watch out , the system might adjust its clock <nl> / / in which case time will actually go backwards . We don ' t guarantee that <nl> / / times are increasing , or that two calls to Now ( ) won ' t be the same . <nl> class Time final { <nl> / / with which we might compare it . <nl> static Time Max ( ) { return Time ( std : : numeric_limits < int64_t > : : max ( ) ) ; } <nl> <nl> - / / Converts to / from internal values . The meaning of the " internal value " is <nl> - / / completely up to the implementation , so it should be treated as opaque . <nl> - static Time FromInternalValue ( int64_t value ) { <nl> - return Time ( value ) ; <nl> - } <nl> - int64_t ToInternalValue ( ) const { <nl> - return us_ ; <nl> - } <nl> - <nl> / / Converts to / from POSIX time specs . <nl> static Time FromTimespec ( struct timespec ts ) ; <nl> struct timespec ToTimespec ( ) const ; <nl> class Time final { <nl> static Time FromJsTime ( double ms_since_epoch ) ; <nl> double ToJsTime ( ) const ; <nl> <nl> - Time & operator = ( const Time & other ) { <nl> - us_ = other . us_ ; <nl> - return * this ; <nl> - } <nl> - <nl> - / / Compute the difference between two times . <nl> - TimeDelta operator - ( const Time & other ) const { <nl> - return TimeDelta : : FromMicroseconds ( us_ - other . us_ ) ; <nl> - } <nl> - <nl> - / / Modify by some time delta . <nl> - Time & operator + = ( const TimeDelta & delta ) { <nl> - us_ + = delta . InMicroseconds ( ) ; <nl> - return * this ; <nl> - } <nl> - Time & operator - = ( const TimeDelta & delta ) { <nl> - us_ - = delta . InMicroseconds ( ) ; <nl> - return * this ; <nl> - } <nl> - <nl> - / / Return a new time modified by some delta . <nl> - Time operator + ( const TimeDelta & delta ) const { <nl> - return Time ( us_ + delta . InMicroseconds ( ) ) ; <nl> - } <nl> - Time operator - ( const TimeDelta & delta ) const { <nl> - return Time ( us_ - delta . InMicroseconds ( ) ) ; <nl> - } <nl> - <nl> - / / Comparison operators <nl> - bool operator = = ( const Time & other ) const { <nl> - return us_ = = other . us_ ; <nl> - } <nl> - bool operator ! = ( const Time & other ) const { <nl> - return us_ ! = other . us_ ; <nl> - } <nl> - bool operator < ( const Time & other ) const { <nl> - return us_ < other . us_ ; <nl> - } <nl> - bool operator < = ( const Time & other ) const { <nl> - return us_ < = other . us_ ; <nl> - } <nl> - bool operator > ( const Time & other ) const { <nl> - return us_ > other . us_ ; <nl> - } <nl> - bool operator > = ( const Time & other ) const { <nl> - return us_ > = other . us_ ; <nl> - } <nl> - <nl> private : <nl> - explicit Time ( int64_t us ) : us_ ( us ) { } <nl> - <nl> - / / Time in microseconds in UTC . <nl> - int64_t us_ ; <nl> + friend class time_internal : : TimeBase < Time > ; <nl> + explicit Time ( int64_t us ) : TimeBase ( us ) { } <nl> } ; <nl> <nl> std : : ostream & operator < < ( std : : ostream & , const Time & ) ; <nl> inline Time operator + ( const TimeDelta & delta , const Time & time ) { <nl> / / Time : : Now ( ) may actually decrease or jump ) . But note that TimeTicks may <nl> / / " stand still " , for example if the computer suspended . <nl> <nl> - class TimeTicks final { <nl> + class TimeTicks final : public time_internal : : TimeBase < TimeTicks > { <nl> public : <nl> - TimeTicks ( ) : ticks_ ( 0 ) { } <nl> + TimeTicks ( ) : TimeBase ( 0 ) { } <nl> <nl> / / Platform - dependent tick count representing " right now . " <nl> / / The resolution of this clock is ~ 1 - 15ms . Resolution varies depending <nl> class TimeTicks final { <nl> / / Returns true if the high - resolution clock is working on this system . <nl> static bool IsHighResolutionClockWorking ( ) ; <nl> <nl> - / / Returns true if this object has not been initialized . <nl> - bool IsNull ( ) const { return ticks_ = = 0 ; } <nl> - <nl> - / / Converts to / from internal values . The meaning of the " internal value " is <nl> - / / completely up to the implementation , so it should be treated as opaque . <nl> - static TimeTicks FromInternalValue ( int64_t value ) { <nl> - return TimeTicks ( value ) ; <nl> - } <nl> - int64_t ToInternalValue ( ) const { <nl> - return ticks_ ; <nl> - } <nl> - <nl> - TimeTicks & operator = ( const TimeTicks other ) { <nl> - ticks_ = other . ticks_ ; <nl> - return * this ; <nl> - } <nl> - <nl> - / / Compute the difference between two times . <nl> - TimeDelta operator - ( const TimeTicks other ) const { <nl> - return TimeDelta : : FromMicroseconds ( ticks_ - other . ticks_ ) ; <nl> - } <nl> - <nl> - / / Modify by some time delta . <nl> - TimeTicks & operator + = ( const TimeDelta & delta ) { <nl> - ticks_ + = delta . InMicroseconds ( ) ; <nl> - return * this ; <nl> - } <nl> - TimeTicks & operator - = ( const TimeDelta & delta ) { <nl> - ticks_ - = delta . InMicroseconds ( ) ; <nl> - return * this ; <nl> - } <nl> - <nl> - / / Return a new TimeTicks modified by some delta . <nl> - TimeTicks operator + ( const TimeDelta & delta ) const { <nl> - return TimeTicks ( ticks_ + delta . InMicroseconds ( ) ) ; <nl> - } <nl> - TimeTicks operator - ( const TimeDelta & delta ) const { <nl> - return TimeTicks ( ticks_ - delta . InMicroseconds ( ) ) ; <nl> - } <nl> - <nl> - / / Comparison operators <nl> - bool operator = = ( const TimeTicks & other ) const { <nl> - return ticks_ = = other . ticks_ ; <nl> - } <nl> - bool operator ! = ( const TimeTicks & other ) const { <nl> - return ticks_ ! = other . ticks_ ; <nl> - } <nl> - bool operator < ( const TimeTicks & other ) const { <nl> - return ticks_ < other . ticks_ ; <nl> - } <nl> - bool operator < = ( const TimeTicks & other ) const { <nl> - return ticks_ < = other . ticks_ ; <nl> - } <nl> - bool operator > ( const TimeTicks & other ) const { <nl> - return ticks_ > other . ticks_ ; <nl> - } <nl> - bool operator > = ( const TimeTicks & other ) const { <nl> - return ticks_ > = other . ticks_ ; <nl> - } <nl> - <nl> private : <nl> + friend class time_internal : : TimeBase < TimeTicks > ; <nl> + <nl> / / Please use Now ( ) to create a new object . This is for internal use <nl> / / and testing . Ticks is in microseconds . <nl> - explicit TimeTicks ( int64_t ticks ) : ticks_ ( ticks ) { } <nl> - <nl> - / / Tick count in microseconds . <nl> - int64_t ticks_ ; <nl> + explicit TimeTicks ( int64_t ticks ) : TimeBase ( ticks ) { } <nl> } ; <nl> <nl> inline TimeTicks operator + ( const TimeDelta & delta , const TimeTicks & ticks ) { <nl>
Create TimeBase for time related classes .
v8/v8
5cbe0f5d25592525b1f8244a81c75a9df29969a8
2016-05-06T18:36:37Z
mmm a / src / csharp / Grpc . IntegrationTesting / WorkerServiceImpl . cs <nl> ppp b / src / csharp / Grpc . IntegrationTesting / WorkerServiceImpl . cs <nl> public class WorkerServiceImpl : WorkerService . IWorkerService <nl> <nl> public WorkerServiceImpl ( Action stopRequestHandler ) <nl> { <nl> - this . stopRequestHandler = Grpc . Core . Utils . Preconditions . CheckNotNull ( stopRequestHandler ) ; <nl> + this . stopRequestHandler = GrpcPreconditions . CheckNotNull ( stopRequestHandler ) ; <nl> } <nl> <nl> public async Task RunServer ( IAsyncStreamReader < ServerArgs > requestStream , IServerStreamWriter < ServerStatus > responseStream , ServerCallContext context ) <nl>
Merge pull request from jtattermusch / grpcpreconditions_fix
grpc/grpc
73979f4f8075ed249c642b8730735a480cd8e34c
2016-02-23T21:10:52Z
mmm a / platform / iphone / SCsub <nl> ppp b / platform / iphone / SCsub <nl> iphone_lib = [ <nl> ' view_controller . mm ' , <nl> ' game_center . mm ' , <nl> ' in_app_store . mm ' , <nl> + ' icloud . mm ' , <nl> ' Appirater . m ' , <nl> ] <nl> <nl> mmm a / platform / iphone / detect . py <nl> ppp b / platform / iphone / detect . py <nl> def get_opts ( ) : <nl> ( ' IPHONESDK ' , ' path to the iphone SDK ' , ' / Applications / Xcode . app / Contents / Developer / Platforms / iPhoneOS . platform / Developer / SDKs / $ { IOS_SDK_VERSION } . sdk / ' ) , <nl> ( ' game_center ' , ' Support for game center ' , ' yes ' ) , <nl> ( ' store_kit ' , ' Support for in - app store ' , ' yes ' ) , <nl> + ( ' icloud ' , ' Support for icloud backups ' , ' yes ' ) , <nl> ( ' ios_gles22_override ' , ' Force GLES2 . 0 on iOS ' , ' yes ' ) , <nl> ( ' ios_appirater ' , ' Enable Appirater ' , ' no ' ) , <nl> ( ' ios_exceptions ' , ' Use exceptions when compiling on playbook ' , ' yes ' ) , <nl> def configure ( env ) : <nl> if env [ ' store_kit ' ] = = ' yes ' : <nl> env . Append ( CPPFLAGS = [ ' - DSTOREKIT_ENABLED ' ] ) <nl> env . Append ( LINKFLAGS = [ ' - framework ' , ' StoreKit ' ] ) <nl> + <nl> + if env [ ' icloud ' ] = = ' yes ' : <nl> + env . Append ( CPPFLAGS = [ ' - DICLOUD_ENABLED ' ] ) <nl> <nl> env . Append ( CPPPATH = [ ' $ IPHONESDK / usr / include ' , ' $ IPHONESDK / System / Library / Frameworks / OpenGLES . framework / Headers ' , ' $ IPHONESDK / System / Library / Frameworks / AudioUnit . framework / Headers ' ] ) <nl> <nl> new file mode 100644 <nl> index 00000000000 . . ca21f62ba11 <nl> mmm / dev / null <nl> ppp b / platform / iphone / icloud . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * icloud . h * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * This file is part of : * / <nl> + / * GODOT ENGINE * / <nl> + / * http : / / www . godotengine . org * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * Copyright ( c ) 2007 - 2015 Juan Linietsky , Ariel Manzur . * / <nl> + / * * / <nl> + / * Permission is hereby granted , free of charge , to any person obtaining * / <nl> + / * a copy of this software and associated documentation files ( the * / <nl> + / * " Software " ) , to deal in the Software without restriction , including * / <nl> + / * without limitation the rights to use , copy , modify , merge , publish , * / <nl> + / * distribute , sublicense , and / or sell copies of the Software , and to * / <nl> + / * permit persons to whom the Software is furnished to do so , subject to * / <nl> + / * the following conditions : * / <nl> + / * * / <nl> + / * The above copyright notice and this permission notice shall be * / <nl> + / * included in all copies or substantial portions of the Software . * / <nl> + / * * / <nl> + / * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , * / <nl> + / * EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * / <nl> + / * MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . * / <nl> + / * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * / <nl> + / * CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF CONTRACT , * / <nl> + / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> + / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + # ifdef ICLOUD_ENABLED <nl> + <nl> + # ifndef ICLOUD_H <nl> + # define ICLOUD_H <nl> + <nl> + # include " core / object . h " <nl> + <nl> + <nl> + class ICloud : public Object { <nl> + <nl> + OBJ_TYPE ( ICloud , Object ) ; <nl> + <nl> + static ICloud * instance ; <nl> + static void _bind_methods ( ) ; <nl> + <nl> + List < Variant > pending_events ; <nl> + <nl> + public : <nl> + <nl> + Error remove_key ( Variant p_param ) ; <nl> + Variant set_key_values ( Variant p_param ) ; <nl> + Variant get_key_value ( Variant p_param ) ; <nl> + Error synchronize_key_values ( ) ; <nl> + Variant get_all_key_values ( ) ; <nl> + <nl> + int get_pending_event_count ( ) ; <nl> + Variant pop_pending_event ( ) ; <nl> + <nl> + static ICloud * get_singleton ( ) ; <nl> + <nl> + ICloud ( ) ; <nl> + ~ ICloud ( ) ; <nl> + } ; <nl> + <nl> + <nl> + # endif <nl> + <nl> + # endif <nl> new file mode 100644 <nl> index 00000000000 . . 2dc2f7d9c16 <nl> mmm / dev / null <nl> ppp b / platform / iphone / icloud . mm <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * icloud . mm * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * This file is part of : * / <nl> + / * GODOT ENGINE * / <nl> + / * http : / / www . godotengine . org * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * Copyright ( c ) 2007 - 2015 Juan Linietsky , Ariel Manzur . * / <nl> + / * * / <nl> + / * Permission is hereby granted , free of charge , to any person obtaining * / <nl> + / * a copy of this software and associated documentation files ( the * / <nl> + / * " Software " ) , to deal in the Software without restriction , including * / <nl> + / * without limitation the rights to use , copy , modify , merge , publish , * / <nl> + / * distribute , sublicense , and / or sell copies of the Software , and to * / <nl> + / * permit persons to whom the Software is furnished to do so , subject to * / <nl> + / * the following conditions : * / <nl> + / * * / <nl> + / * The above copyright notice and this permission notice shall be * / <nl> + / * included in all copies or substantial portions of the Software . * / <nl> + / * * / <nl> + / * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , * / <nl> + / * EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * / <nl> + / * MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . * / <nl> + / * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * / <nl> + / * CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF CONTRACT , * / <nl> + / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> + / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + # ifdef ICLOUD_ENABLED <nl> + <nl> + # include " icloud . h " <nl> + <nl> + extern " C " { <nl> + # import < Foundation / Foundation . h > <nl> + # import " app_delegate . h " <nl> + } ; <nl> + <nl> + ICloud * ICloud : : instance = NULL ; <nl> + <nl> + void ICloud : : _bind_methods ( ) { <nl> + ObjectTypeDB : : bind_method ( _MD ( " remove_key " ) , & ICloud : : remove_key ) ; <nl> + ObjectTypeDB : : bind_method ( _MD ( " set_key_values " ) , & ICloud : : set_key_values ) ; <nl> + ObjectTypeDB : : bind_method ( _MD ( " get_key_value " ) , & ICloud : : get_key_value ) ; <nl> + ObjectTypeDB : : bind_method ( _MD ( " synchronize_key_values " ) , & ICloud : : synchronize_key_values ) ; <nl> + ObjectTypeDB : : bind_method ( _MD ( " get_all_key_values " ) , & ICloud : : get_all_key_values ) ; <nl> + <nl> + ObjectTypeDB : : bind_method ( _MD ( " get_pending_event_count " ) , & ICloud : : get_pending_event_count ) ; <nl> + ObjectTypeDB : : bind_method ( _MD ( " pop_pending_event " ) , & ICloud : : pop_pending_event ) ; <nl> + } ; <nl> + <nl> + int ICloud : : get_pending_event_count ( ) { <nl> + <nl> + return pending_events . size ( ) ; <nl> + } ; <nl> + <nl> + Variant ICloud : : pop_pending_event ( ) { <nl> + <nl> + Variant front = pending_events . front ( ) - > get ( ) ; <nl> + pending_events . pop_front ( ) ; <nl> + <nl> + return front ; <nl> + } ; <nl> + <nl> + ICloud * ICloud : : get_singleton ( ) { <nl> + return instance ; <nl> + } ; <nl> + <nl> + / / convert from apple ' s abstract type to godot ' s abstract type . . . . <nl> + Variant nsobject_to_variant ( NSObject * object ) { <nl> + if ( [ object isKindOfClass : [ NSString class ] ] ) { <nl> + const char * str = [ ( NSString * ) object UTF8String ] ; <nl> + return String : : utf8 ( str ! = NULL ? str : " " ) ; <nl> + } <nl> + else if ( [ object isKindOfClass : [ NSData class ] ] ) { <nl> + ByteArray ret ; <nl> + NSData * data = ( NSData * ) object ; <nl> + if ( [ data length ] > 0 ) { <nl> + ret . resize ( [ data length ] ) ; <nl> + { <nl> + ByteArray : : Write w = ret . write ( ) ; <nl> + copymem ( w . ptr ( ) , [ data bytes ] , [ data length ] ) ; <nl> + } <nl> + } <nl> + return ret ; <nl> + } <nl> + else if ( [ object isKindOfClass : [ NSArray class ] ] ) { <nl> + Array result ; <nl> + NSArray * array = ( NSArray * ) object ; <nl> + for ( unsigned int i = 0 ; i < [ array count ] ; + + i ) { <nl> + NSObject * value = [ array objectAtIndex : i ] ; <nl> + result . push_back ( nsobject_to_variant ( value ) ) ; <nl> + } <nl> + return result ; <nl> + } <nl> + else if ( [ object isKindOfClass : [ NSDictionary class ] ] ) { <nl> + Dictionary result ; <nl> + NSDictionary * dic = ( NSDictionary * ) object ; <nl> + <nl> + <nl> + NSArray * keys = [ dic allKeys ] ; <nl> + int count = [ keys count ] ; <nl> + for ( int i = 0 ; i < count ; + + i ) { <nl> + NSObject * k = [ keys objectAtIndex : i ] ; <nl> + NSObject * v = [ dic objectForKey : k ] ; <nl> + <nl> + result [ nsobject_to_variant ( k ) ] = nsobject_to_variant ( v ) ; <nl> + } <nl> + return result ; <nl> + } <nl> + else if ( [ object isKindOfClass : [ NSNumber class ] ] ) { <nl> + / / Every type except numbers can reliably identify its type . The following is comparing to the * internal * representation , which isn ' t guaranteed to match the type that was used to create it , and is not advised , particularly when dealing with potential platform differences ( ie , 32 / 64 bit ) <nl> + / / To avoid errors , we ' ll cast as broadly as possible , and only return int or float . <nl> + / / bool , char , int , uint , longlong - > int <nl> + / / float , double - > float <nl> + NSNumber * num = ( NSNumber * ) object ; <nl> + if ( strcmp ( [ num objCType ] , @ encode ( BOOL ) ) = = 0 ) { <nl> + return Variant ( ( int ) [ num boolValue ] ) ; <nl> + } <nl> + else if ( strcmp ( [ num objCType ] , @ encode ( char ) ) = = 0 ) { <nl> + return Variant ( ( int ) [ num charValue ] ) ; <nl> + } <nl> + else if ( strcmp ( [ num objCType ] , @ encode ( int ) ) = = 0 ) { <nl> + return Variant ( [ num intValue ] ) ; <nl> + } <nl> + else if ( strcmp ( [ num objCType ] , @ encode ( unsigned int ) ) = = 0 ) { <nl> + return Variant ( ( int ) [ num unsignedIntValue ] ) ; <nl> + } <nl> + else if ( strcmp ( [ num objCType ] , @ encode ( long long ) ) = = 0 ) { <nl> + return Variant ( ( int ) [ num longValue ] ) ; <nl> + } <nl> + else if ( strcmp ( [ num objCType ] , @ encode ( float ) ) = = 0 ) { <nl> + return Variant ( [ num floatValue ] ) ; <nl> + } <nl> + else if ( strcmp ( [ num objCType ] , @ encode ( double ) ) = = 0 ) { <nl> + return Variant ( ( float ) [ num doubleValue ] ) ; <nl> + } <nl> + } <nl> + else if ( [ object isKindOfClass : [ NSDate class ] ] ) { <nl> + / / this is a type that icloud supports . . . but how did you submit it in the first place ? <nl> + / / I guess this is a type that * might * show up , if you were , say , trying to make your game <nl> + / / compatible with existing cloud data written by another engine ' s version of your game <nl> + WARN_PRINT ( " NSDate unsupported , returning null Variant " ) <nl> + return Variant ( ) ; <nl> + } <nl> + else if ( [ object isKindOfClass : [ NSNull class ] ] or object = = nil ) { <nl> + return Variant ( ) ; <nl> + } <nl> + else { <nl> + WARN_PRINT ( " Trying to convert unknown NSObject type to Variant " ) ; <nl> + return Variant ( ) ; <nl> + } <nl> + } <nl> + <nl> + NSObject * variant_to_nsobject ( Variant v ) { <nl> + if ( v . get_type ( ) = = Variant : : STRING ) { <nl> + return [ [ [ NSString alloc ] initWithUTF8String : ( ( String ) v ) . utf8 ( ) . get_data ( ) ] autorelease ] ; <nl> + } <nl> + else if ( v . get_type ( ) = = Variant : : REAL ) { <nl> + return [ NSNumber numberWithDouble : ( double ) v ] ; <nl> + } <nl> + else if ( v . get_type ( ) = = Variant : : INT ) { <nl> + return [ NSNumber numberWithLongLong : ( long ) ( int ) v ] ; <nl> + } <nl> + else if ( v . get_type ( ) = = Variant : : BOOL ) { <nl> + return [ NSNumber numberWithBool : BOOL ( ( bool ) v ) ] ; <nl> + } <nl> + else if ( v . get_type ( ) = = Variant : : DICTIONARY ) { <nl> + NSMutableDictionary * result = [ [ [ NSMutableDictionary alloc ] init ] autorelease ] ; <nl> + Dictionary dic = v ; <nl> + Array keys = dic . keys ( ) ; <nl> + for ( unsigned int i = 0 ; i < keys . size ( ) ; + + i ) { <nl> + NSString * key = [ [ [ NSString alloc ] initWithUTF8String : ( ( String ) ( keys [ i ] ) ) . utf8 ( ) . get_data ( ) ] autorelease ] ; <nl> + NSObject * value = variant_to_nsobject ( dic [ keys [ i ] ] ) ; <nl> + <nl> + if ( key = = NULL | | value = = NULL ) { <nl> + return NULL ; <nl> + } <nl> + <nl> + [ result setObject : value forKey : key ] ; <nl> + } <nl> + return result ; <nl> + } <nl> + else if ( v . get_type ( ) = = Variant : : ARRAY ) { <nl> + NSMutableArray * result = [ [ [ NSMutableArray alloc ] init ] autorelease ] ; <nl> + Array arr = v ; <nl> + for ( unsigned int i = 0 ; i < arr . size ( ) ; + + i ) { <nl> + NSObject * value = variant_to_nsobject ( arr [ i ] ) ; <nl> + if ( value = = NULL ) { <nl> + / / trying to add something unsupported to the array . cancel the whole array <nl> + return NULL ; <nl> + } <nl> + [ result addObject : value ] ; <nl> + } <nl> + return result ; <nl> + } <nl> + else if ( v . get_type ( ) = = Variant : : RAW_ARRAY ) { <nl> + ByteArray arr = v ; <nl> + ByteArray : : Read r = arr . read ( ) ; <nl> + NSData * result = [ NSData dataWithBytes : r . ptr ( ) length : arr . size ( ) ] ; <nl> + return result ; <nl> + } <nl> + WARN_PRINT ( String ( " Could not add unsupported type to iCloud : ' " + Variant : : get_type_name ( v . get_type ( ) ) + " ' " ) . utf8 ( ) . get_data ( ) ) ; <nl> + return NULL ; <nl> + } <nl> + <nl> + <nl> + Error ICloud : : remove_key ( Variant p_param ) { <nl> + String param = p_param ; <nl> + NSString * key = [ [ [ NSString alloc ] initWithUTF8String : param . utf8 ( ) . get_data ( ) ] autorelease ] ; <nl> + <nl> + NSUbiquitousKeyValueStore * store = [ NSUbiquitousKeyValueStore defaultStore ] ; <nl> + <nl> + if ( ! [ [ store dictionaryRepresentation ] objectForKey : key ] ) { <nl> + return ERR_INVALID_PARAMETER ; <nl> + } <nl> + <nl> + [ store removeObjectForKey : key ] ; <nl> + return OK ; <nl> + } <nl> + <nl> + / / return an array of the keys that could not be set <nl> + Variant ICloud : : set_key_values ( Variant p_params ) { <nl> + Dictionary params = p_params ; <nl> + Array keys = params . keys ( ) ; <nl> + <nl> + Array error_keys ; <nl> + <nl> + for ( unsigned int i = 0 ; i < keys . size ( ) ; + + i ) { <nl> + String variant_key = keys [ i ] ; <nl> + Variant variant_value = params [ variant_key ] ; <nl> + <nl> + NSString * key = [ [ [ NSString alloc ] initWithUTF8String : variant_key . utf8 ( ) . get_data ( ) ] autorelease ] ; <nl> + if ( key = = NULL ) { <nl> + error_keys . push_back ( variant_key ) ; <nl> + continue ; <nl> + } <nl> + <nl> + NSObject * value = variant_to_nsobject ( variant_value ) ; <nl> + <nl> + if ( value = = NULL ) { <nl> + error_keys . push_back ( variant_key ) ; <nl> + continue ; <nl> + } <nl> + <nl> + NSUbiquitousKeyValueStore * store = [ NSUbiquitousKeyValueStore defaultStore ] ; <nl> + [ store setObject : value forKey : key ] ; <nl> + } <nl> + <nl> + return error_keys ; <nl> + } <nl> + <nl> + Variant ICloud : : get_key_value ( Variant p_param ) { <nl> + String param = p_param ; <nl> + <nl> + NSString * key = [ [ [ NSString alloc ] initWithUTF8String : param . utf8 ( ) . get_data ( ) ] autorelease ] ; <nl> + NSUbiquitousKeyValueStore * store = [ NSUbiquitousKeyValueStore defaultStore ] ; <nl> + <nl> + if ( ! [ [ store dictionaryRepresentation ] objectForKey : key ] ) { <nl> + return Variant ( ) ; <nl> + } <nl> + <nl> + Variant result = nsobject_to_variant ( [ [ store dictionaryRepresentation ] objectForKey : key ] ) ; <nl> + <nl> + return result ; <nl> + } <nl> + <nl> + Variant ICloud : : get_all_key_values ( ) { <nl> + Dictionary result ; <nl> + <nl> + NSUbiquitousKeyValueStore * store = [ NSUbiquitousKeyValueStore defaultStore ] ; <nl> + NSDictionary * store_dictionary = [ store dictionaryRepresentation ] ; <nl> + <nl> + NSArray * keys = [ store_dictionary allKeys ] ; <nl> + int count = [ keys count ] ; <nl> + for ( int i = 0 ; i < count ; + + i ) { <nl> + NSString * k = [ keys objectAtIndex : i ] ; <nl> + NSObject * v = [ store_dictionary objectForKey : k ] ; <nl> + <nl> + const char * str = [ k UTF8String ] ; <nl> + if ( str ! = NULL ) { <nl> + result [ String : : utf8 ( str ) ] = nsobject_to_variant ( v ) ; <nl> + } <nl> + } <nl> + <nl> + return result ; <nl> + } <nl> + <nl> + Error ICloud : : synchronize_key_values ( ) { <nl> + NSUbiquitousKeyValueStore * store = [ NSUbiquitousKeyValueStore defaultStore ] ; <nl> + BOOL result = [ store synchronize ] ; <nl> + if ( result = = YES ) { <nl> + return OK ; <nl> + } <nl> + else { <nl> + return FAILED ; <nl> + } <nl> + } <nl> + / * <nl> + Error ICloud : : initial_sync ( ) { <nl> + / / you sometimes have to write something to the store to get it to download new data . go apple ! <nl> + NSUbiquitousKeyValueStore * store = [ NSUbiquitousKeyValueStore defaultStore ] ; <nl> + if ( [ store boolForKey : @ " isb " ] ) <nl> + { <nl> + [ store setBool : NO forKey : @ " isb " ] ; <nl> + } <nl> + else <nl> + { <nl> + [ store setBool : YES forKey : @ " isb " ] ; <nl> + } <nl> + return synchronize ( ) ; <nl> + } <nl> + * / <nl> + ICloud : : ICloud ( ) { <nl> + ERR_FAIL_COND ( instance ! = NULL ) ; <nl> + instance = this ; <nl> + / / connected = false ; <nl> + <nl> + [ <nl> + / / [ NSNotificationCenter defaultCenter ] addObserverForName : @ " notify " <nl> + [ NSNotificationCenter defaultCenter ] addObserverForName : NSUbiquitousKeyValueStoreDidChangeExternallyNotification <nl> + object : [ NSUbiquitousKeyValueStore defaultStore ] <nl> + queue : nil <nl> + usingBlock : ^ ( NSNotification * notification ) { <nl> + NSDictionary * userInfo = [ notification userInfo ] ; <nl> + NSInteger change = [ [ userInfo objectForKey : NSUbiquitousKeyValueStoreChangeReasonKey ] integerValue ] ; <nl> + <nl> + Dictionary ret ; <nl> + ret [ " type " ] = " key_value_changed " ; <nl> + <nl> + / / StringArray result_keys ; <nl> + / / Array result_values ; <nl> + Dictionary keyValues ; <nl> + String reason = " " ; <nl> + <nl> + if ( change = = NSUbiquitousKeyValueStoreServerChange ) { <nl> + reason = " server " ; <nl> + } <nl> + else if ( change = = NSUbiquitousKeyValueStoreInitialSyncChange ) { <nl> + reason = " initial_sync " ; <nl> + } <nl> + else if ( change = = NSUbiquitousKeyValueStoreQuotaViolationChange ) { <nl> + reason = " quota_violation " ; <nl> + } <nl> + else if ( change = = NSUbiquitousKeyValueStoreAccountChange ) { <nl> + reason = " account " ; <nl> + } <nl> + <nl> + ret [ " reason " ] = reason ; <nl> + <nl> + <nl> + NSUbiquitousKeyValueStore * store = [ NSUbiquitousKeyValueStore defaultStore ] ; <nl> + <nl> + NSArray * keys = [ userInfo objectForKey : NSUbiquitousKeyValueStoreChangedKeysKey ] ; <nl> + for ( NSString * key in keys ) { <nl> + const char * str = [ key UTF8String ] ; <nl> + if ( str = = NULL ) { <nl> + continue ; <nl> + } <nl> + <nl> + NSObject * object = [ store objectForKey : key ] ; <nl> + <nl> + / / figure out what kind of object it is <nl> + Variant value = nsobject_to_variant ( object ) ; <nl> + <nl> + keyValues [ String : : utf8 ( str ) ] = value ; <nl> + } <nl> + <nl> + ret [ " changed_values " ] = keyValues ; <nl> + pending_events . push_back ( ret ) ; <nl> + } <nl> + ] ; <nl> + } <nl> + <nl> + <nl> + ICloud : : ~ ICloud ( ) { <nl> + <nl> + } ; <nl> + <nl> + # endif <nl> mmm a / platform / iphone / os_iphone . cpp <nl> ppp b / platform / iphone / os_iphone . cpp <nl> void OSIPhone : : initialize ( const VideoMode & p_desired , int p_video_driver , int p_au <nl> store_kit = memnew ( InAppStore ) ; <nl> Globals : : get_singleton ( ) - > add_singleton ( Globals : : Singleton ( " InAppStore " , store_kit ) ) ; <nl> # endif <nl> + <nl> + # ifdef ICLOUD_ENABLED <nl> + icloud = memnew ( ICloud ) ; <nl> + Globals : : get_singleton ( ) - > add_singleton ( Globals : : Singleton ( " ICloud " , icloud ) ) ; <nl> + / / icloud - > connect ( ) ; <nl> + # endif <nl> } ; <nl> <nl> MainLoop * OSIPhone : : get_main_loop ( ) const { <nl> mmm a / platform / iphone / os_iphone . h <nl> ppp b / platform / iphone / os_iphone . h <nl> <nl> # include " servers / spatial_sound_2d / spatial_sound_2d_server_sw . h " <nl> # include " game_center . h " <nl> # include " in_app_store . h " <nl> + # include " icloud . h " <nl> <nl> class AudioDriverIphone ; <nl> class RasterizerGLES2 ; <nl> class OSIPhone : public OS_Unix { <nl> # ifdef STOREKIT_ENABLED <nl> InAppStore * store_kit ; <nl> # endif <nl> + # ifdef ICLOUD_ENABLED <nl> + ICloud * icloud ; <nl> + # endif <nl> <nl> MainLoop * main_loop ; <nl> <nl> mmm a / platform / iphone / view_controller . mm <nl> ppp b / platform / iphone / view_controller . mm <nl> - ( BOOL ) prefersStatusBarHidden <nl> return YES ; <nl> } <nl> <nl> + # ifdef GAME_CENTER_ENABLED <nl> - ( void ) gameCenterViewControllerDidFinish : ( GKGameCenterViewController * ) gameCenterViewController { <nl> / / [ gameCenterViewController dismissViewControllerAnimated : YES completion : ^ { GameCenter : : get_singleton ( ) - > game_center_closed ( ) ; } ] ; / / version for signaling when overlay is completely gone <nl> GameCenter : : get_singleton ( ) - > game_center_closed ( ) ; <nl> [ gameCenterViewController dismissViewControllerAnimated : YES completion : nil ] ; <nl> } <nl> + # endif <nl> <nl> @ end <nl>
Initial iCloud implementation , supporting key value pairs
godotengine/godot
1fe5cc8e1d9fdcc3a383e936754f0323035c1f2d
2015-09-27T23:54:20Z
mmm a / emcc <nl> ppp b / emcc <nl> try : <nl> <nl> js_optimizer_queue + = [ ' simplifyExpressions ' ] <nl> <nl> - if debug_level = = 0 or profiling : js_optimizer_queue + = [ ' simplifyIfs ' ] <nl> + # simplify ifs if it is ok to make the code somewhat unreadable , and unless outlining ( simplified ifs <nl> + # with commaified code breaks late aggressive variable elimination ) <nl> + if ( debug_level = = 0 or profiling ) and shared . Settings . OUTLINING_LIMIT = = 0 : js_optimizer_queue + = [ ' simplifyIfs ' ] <nl> <nl> if opt_level > = 3 and shared . Settings . PRECISE_F32 : js_optimizer_queue + = [ ' optimizeFrounds ' ] <nl> <nl> mmm a / tools / js - optimizer . js <nl> ppp b / tools / js - optimizer . js <nl> var ALTER_FLOW = set ( ' break ' , ' continue ' , ' return ' ) ; <nl> var BREAK_CAPTURERS = set ( ' do ' , ' while ' , ' for ' , ' switch ' ) ; <nl> var CONTINUE_CAPTURERS = LOOP ; <nl> <nl> + var COMMABLE = set ( ' assign ' , ' binary ' , ' unary - prefix ' , ' unary - postfix ' , ' name ' , ' num ' , ' call ' , ' seq ' , ' conditional ' , ' sub ' ) ; <nl> + <nl> var FUNCTIONS_THAT_ALWAYS_THROW = set ( ' abort ' , ' ___resumeException ' , ' ___cxa_throw ' , ' ___cxa_rethrow ' ) ; <nl> <nl> var NULL_NODE = [ ' name ' , ' null ' ] ; <nl> function simplifyIfs ( ast ) { <nl> var body = node [ 2 ] ; <nl> / / recurse to handle chains <nl> while ( body [ 0 ] = = = ' block ' ) { <nl> - if ( body [ 1 ] . length ! = = 1 ) break ; <nl> - var singleton = body [ 1 ] [ 0 ] ; <nl> + var stats = body [ 1 ] ; <nl> + if ( stats . length > 1 ) { <nl> + var last = stats [ stats . length - 1 ] ; <nl> + if ( last [ 0 ] = = = ' if ' & & ! last [ 3 ] ) { <nl> + / / try to commaify - turn everything between the ifs into a comma operator inside the second if <nl> + var ok = true ; <nl> + for ( var i = 0 ; i < stats . length - 1 ; i + + ) { <nl> + var curr = stats [ i ] ; <nl> + if ( curr [ 0 ] = = = ' stat ' ) curr = curr [ 1 ] ; <nl> + if ( ! ( curr [ 0 ] in COMMABLE ) ) ok = false ; <nl> + } <nl> + if ( ok ) { <nl> + for ( var i = stats . length - 2 ; i > = 0 ; i - - ) { <nl> + var curr = stats [ i ] ; <nl> + if ( curr [ 0 ] = = = ' stat ' ) curr = curr [ 1 ] ; <nl> + last [ 1 ] = [ ' seq ' , curr , last [ 1 ] ] ; <nl> + } <nl> + stats = body [ 1 ] = [ last ] ; <nl> + } <nl> + } <nl> + } <nl> + if ( stats . length ! = = 1 ) break ; <nl> + var singleton = stats [ 0 ] ; <nl> if ( singleton [ 0 ] = = = ' if ' & & ! singleton [ 3 ] ) { <nl> node [ 1 ] = [ ' conditional ' , node [ 1 ] , singleton [ 1 ] , [ ' num ' , 0 ] ] ; <nl> body = node [ 2 ] = singleton [ 2 ] ; <nl> mmm a / tools / test - js - optimizer - si - output . js <nl> ppp b / tools / test - js - optimizer - si - output . js <nl> function a ( ) { <nl> h ( ) ; <nl> } <nl> if ( x ) { <nl> - f ( ) ; <nl> + return ; <nl> if ( y ) { <nl> g ( ) ; <nl> } <nl> function a ( ) { <nl> g ( ) ; <nl> } <nl> if ( x ) { <nl> - f ( ) ; <nl> + return ; <nl> if ( y ? z : 0 ) { <nl> g ( ) ; <nl> } <nl> } <nl> if ( x ? y : 0 ) { <nl> - f ( ) ; <nl> + return ; <nl> if ( z ) { <nl> g ( ) ; <nl> } <nl> function a ( ) { <nl> } <nl> f ( ) ; <nl> } <nl> + if ( x ? ( f ( ) , x = x + 2 | 0 , y ) : 0 ) { <nl> + g ( ) ; <nl> + } <nl> + if ( x ) { <nl> + f ( ) ; <nl> + x = x + 2 | 0 ; <nl> + return ; <nl> + if ( y ) { <nl> + g ( ) ; <nl> + } <nl> + } <nl> } <nl> <nl> mmm a / tools / test - js - optimizer - si . js <nl> ppp b / tools / test - js - optimizer - si . js <nl> function a ( ) { <nl> h ( ) ; <nl> } <nl> if ( x ) { <nl> - f ( ) ; <nl> + return ; <nl> if ( y ) { <nl> g ( ) ; <nl> } <nl> function a ( ) { <nl> } <nl> } <nl> if ( x ) { <nl> - f ( ) ; <nl> + return ; <nl> if ( y ) { <nl> if ( z ) { <nl> g ( ) ; <nl> function a ( ) { <nl> } <nl> if ( x ) { <nl> if ( y ) { <nl> - f ( ) ; <nl> + return ; <nl> if ( z ) { <nl> g ( ) ; <nl> } <nl> function a ( ) { <nl> } <nl> f ( ) ; <nl> } <nl> + if ( x ) { <nl> + f ( ) ; <nl> + x = x + 2 | 0 ; <nl> + if ( y ) { <nl> + g ( ) ; <nl> + } <nl> + } <nl> + if ( x ) { <nl> + f ( ) ; <nl> + x = x + 2 | 0 ; <nl> + return ; <nl> + if ( y ) { <nl> + g ( ) ; <nl> + } <nl> + } <nl> } <nl> <nl>
uncommaify between ifs that can potentially be simplified
emscripten-core/emscripten
6c31546ced32fd968ae50da7803964c9195ebd62
2014-03-18T00:56:17Z
mmm a / src / mongo / db / namespace_details . cpp <nl> ppp b / src / mongo / db / namespace_details . cpp <nl> namespace mongo { <nl> int chain = 0 ; <nl> while ( 1 ) { <nl> { <nl> - int a = cur . a ( ) ; <nl> - if ( a < - 1 | | a > = 100000 ) { <nl> - problem ( ) < < " ~ ~ Assertion - cur out of range in _alloc ( ) " < < cur . toString ( ) < < <nl> - " a : " < < a < < " b : " < < b < < " chain : " < < chain < < ' \ n ' ; <nl> - logContext ( ) ; <nl> - if ( cur = = * prev ) <nl> - prev - > Null ( ) ; <nl> - cur . Null ( ) ; <nl> + int fileNumber = cur . a ( ) ; <nl> + int fileOffset = cur . getOfs ( ) ; <nl> + if ( fileNumber < - 1 | | fileNumber > = 100000 | | fileOffset < 0 ) { <nl> + StringBuilder sb ; <nl> + sb < < " Deleted record list corrupted in bucket " < < b <nl> + < < " , link number " < < chain <nl> + < < " , invalid link is " < < cur . toString ( ) <nl> + < < " , throwing Fatal Assertion " ; <nl> + problem ( ) < < sb . str ( ) < < endl ; <nl> + fassertFailed ( 16469 ) ; <nl> } <nl> } <nl> if ( cur . isNull ( ) ) { <nl>
SERVER - 7077 fassert after logging message on corrupted deletedList
mongodb/mongo
857699a1870d45d8b89534a934612c04df4701f9
2012-11-09T19:03:01Z
mmm a / folly / FileUtil . cpp <nl> ppp b / folly / FileUtil . cpp <nl> int writeFileAtomicNoThrow ( <nl> StringPiece filename , <nl> iovec * iov , <nl> int count , <nl> - mode_t permissions ) { <nl> + mode_t permissions , <nl> + SyncType syncType ) { <nl> / / We write the data to a temporary file name first , then atomically rename <nl> / / it into place . This ensures that the file contents will always be valid , <nl> / / even if we crash or are killed partway through writing out data . <nl> int writeFileAtomicNoThrow ( <nl> return errno ; <nl> } <nl> <nl> + / / To guarantee atomicity across power failues on POSIX file systems , <nl> + / / the temporary file must be explicitly sync ' ed before the rename . <nl> + if ( syncType = = SyncType : : WITH_SYNC ) { <nl> + rc = fsyncNoInt ( tmpFD ) ; <nl> + if ( rc = = - 1 ) { <nl> + return errno ; <nl> + } <nl> + } <nl> + <nl> / / Close the file before renaming to make sure all data has <nl> / / been successfully written . <nl> rc = close ( tmpFD ) ; <nl> void writeFileAtomic ( <nl> StringPiece filename , <nl> iovec * iov , <nl> int count , <nl> - mode_t permissions ) { <nl> - auto rc = writeFileAtomicNoThrow ( filename , iov , count , permissions ) ; <nl> + mode_t permissions , <nl> + SyncType syncType ) { <nl> + auto rc = writeFileAtomicNoThrow ( filename , iov , count , permissions , syncType ) ; <nl> if ( rc ! = 0 ) { <nl> auto msg = std : : string ( __func__ ) + " ( ) failed to update " + filename . str ( ) ; <nl> throw std : : system_error ( rc , std : : generic_category ( ) , msg ) ; <nl> } <nl> } <nl> <nl> - void writeFileAtomic ( StringPiece filename , ByteRange data , mode_t permissions ) { <nl> + void writeFileAtomic ( <nl> + StringPiece filename , <nl> + ByteRange data , <nl> + mode_t permissions , <nl> + SyncType syncType ) { <nl> iovec iov ; <nl> iov . iov_base = const_cast < unsigned char * > ( data . data ( ) ) ; <nl> iov . iov_len = data . size ( ) ; <nl> - writeFileAtomic ( filename , & iov , 1 , permissions ) ; <nl> + writeFileAtomic ( filename , & iov , 1 , permissions , syncType ) ; <nl> } <nl> <nl> void writeFileAtomic ( <nl> StringPiece filename , <nl> StringPiece data , <nl> - mode_t permissions ) { <nl> - writeFileAtomic ( filename , ByteRange ( data ) , permissions ) ; <nl> + mode_t permissions , <nl> + SyncType syncType ) { <nl> + writeFileAtomic ( filename , ByteRange ( data ) , permissions , syncType ) ; <nl> } <nl> <nl> } / / namespace folly <nl> mmm a / folly / FileUtil . h <nl> ppp b / folly / FileUtil . h <nl> ssize_t pwritevNoInt ( int fd , const iovec * iov , int count , off_t offset ) ; <nl> * is unspecified . <nl> * / <nl> FOLLY_NODISCARD ssize_t readFull ( int fd , void * buf , size_t count ) ; <nl> - FOLLY_NODISCARD ssize_t preadFull ( int fd , void * buf , size_t count , off_t offset ) ; <nl> + FOLLY_NODISCARD ssize_t <nl> + preadFull ( int fd , void * buf , size_t count , off_t offset ) ; <nl> FOLLY_NODISCARD ssize_t readvFull ( int fd , iovec * iov , int count ) ; <nl> FOLLY_NODISCARD ssize_t preadvFull ( int fd , iovec * iov , int count , off_t offset ) ; <nl> <nl> bool writeFile ( <nl> return closeNoInt ( fd ) = = 0 & & ok ; <nl> } <nl> <nl> + / * For atomic writes , do we sync to guarantee ordering or not ? * / <nl> + enum class SyncType { <nl> + WITH_SYNC , <nl> + WITHOUT_SYNC , <nl> + } ; <nl> + <nl> / * * <nl> * Write file contents " atomically " . <nl> * <nl> bool writeFile ( <nl> * <nl> * Note that on platforms that do not provide atomic filesystem rename <nl> * functionality ( e . g . , Windows ) this behavior may not be truly atomic . <nl> + * <nl> + * The default implementation does not sync the data to storage before <nl> + * the rename . Therefore , the write is * not * atomic in the event of a <nl> + * power failure or OS crash . To guarantee atomicity in these cases , <nl> + * specify syncType = WITH_SYNC , which will incur a performance cost <nl> + * of waiting for the data to be persisted to storage . Note that the <nl> + * return of the function does not guarantee the directory <nl> + * modifications have been written to disk ; a further sync of the <nl> + * directory after the function returns is required to ensure the <nl> + * modification is durable . <nl> * / <nl> void writeFileAtomic ( <nl> StringPiece filename , <nl> iovec * iov , <nl> int count , <nl> - mode_t permissions = 0644 ) ; <nl> + mode_t permissions = 0644 , <nl> + SyncType syncType = SyncType : : WITHOUT_SYNC ) ; <nl> void writeFileAtomic ( <nl> StringPiece filename , <nl> ByteRange data , <nl> - mode_t permissions = 0644 ) ; <nl> + mode_t permissions = 0644 , <nl> + SyncType syncType = SyncType : : WITHOUT_SYNC ) ; <nl> void writeFileAtomic ( <nl> StringPiece filename , <nl> StringPiece data , <nl> - mode_t permissions = 0644 ) ; <nl> + mode_t permissions = 0644 , <nl> + SyncType syncType = SyncType : : WITHOUT_SYNC ) ; <nl> <nl> / * * <nl> * A version of writeFileAtomic ( ) that returns an errno value instead of <nl> int writeFileAtomicNoThrow ( <nl> StringPiece filename , <nl> iovec * iov , <nl> int count , <nl> - mode_t permissions = 0644 ) ; <nl> + mode_t permissions = 0644 , <nl> + SyncType syncType = SyncType : : WITHOUT_SYNC ) ; <nl> <nl> } / / namespace folly <nl> mmm a / folly / test / FileUtilTest . cpp <nl> ppp b / folly / test / FileUtilTest . cpp <nl> TEST_F ( WriteFileAtomic , writeNew ) { <nl> EXPECT_EQ ( 0644 , getPerms ( path ) ) ; <nl> } <nl> <nl> + TEST_F ( WriteFileAtomic , withSync ) { <nl> + / / Call writeFileAtomic ( ) to create a new file <nl> + auto path = tmpPath ( " foo " ) ; <nl> + auto contents = StringPiece { " contents \ n " } ; <nl> + auto permissions = mode_t { 0644 } ; <nl> + writeFileAtomic ( path , contents , permissions , SyncType : : WITH_SYNC ) ; <nl> + <nl> + / / The directory should contain exactly 1 file now , with the correct contents <nl> + EXPECT_EQ ( set < string > { " foo " } , listTmpDir ( ) ) ; <nl> + EXPECT_EQ ( contents , readData ( path ) ) ; <nl> + EXPECT_EQ ( 0644 , getPerms ( path ) ) ; <nl> + } <nl> + <nl> TEST_F ( WriteFileAtomic , overwrite ) { <nl> / / Call writeFileAtomic ( ) to create a new file <nl> auto path = tmpPath ( " foo " ) ; <nl>
writeFileAtomic optionally syncs to provide durable atomicity
facebook/folly
a14c8b756bfbffe631602ede6bc64721bb1d5d2c
2020-02-07T22:04:50Z
mmm a / contrib / README . md <nl> ppp b / contrib / README . md <nl> Contains files used to package bitcoind / bitcoin - qt <nl> for Debian - based Linux systems . If you compile bitcoind / bitcoin - qt yourself , there are some useful files here . <nl> <nl> # # # [ Gitian - descriptors ] ( / contrib / gitian - descriptors ) # # # <nl> - Notes on getting Gitian builds up and running using KVM . <nl> + Files used during the gitian build process . For more information about gitian , see the [ the Bitcoin Core documentation repository ] ( https : / / github . com / bitcoin - core / docs ) . <nl> <nl> # # # [ Gitian - keys ] ( / contrib / gitian - keys ) <nl> PGP keys used for signing Bitcoin Core [ Gitian release ] ( / doc / release - process . md ) results . <nl> deleted file mode 100644 <nl> index d9dbfd3cb3d1 . . 000000000000 <nl> mmm a / contrib / gitian - descriptors / README . md <nl> ppp / dev / null <nl> <nl> - # # # Gavin ' s notes on getting Gitian builds up and running using KVM <nl> - <nl> - These instructions distilled from <nl> - [ https : / / help . ubuntu . com / community / KVM / Installation ] ( https : / / help . ubuntu . com / community / KVM / Installation ) . <nl> - <nl> - You need the right hardware : you need a 64 - bit - capable CPU with hardware virtualization support ( Intel VT - x or AMD - V ) . Not all modern CPUs support hardware virtualization . <nl> - <nl> - You probably need to enable hardware virtualization in your machine ' s BIOS . <nl> - <nl> - You need to be running a recent version of 64 - bit - Ubuntu , and you need to install several prerequisites : <nl> - <nl> - sudo apt - get install ruby apache2 git apt - cacher - ng python - vm - builder qemu - kvm <nl> - <nl> - Sanity checks : <nl> - <nl> - sudo service apt - cacher - ng status # Should return apt - cacher - ng is running <nl> - ls - l / dev / kvm # Should show a / dev / kvm device <nl> - <nl> - <nl> - Once you ' ve got the right hardware and software : <nl> - <nl> - git clone git : / / github . com / bitcoin / bitcoin . git <nl> - git clone git : / / github . com / devrandom / gitian - builder . git <nl> - mkdir gitian - builder / inputs <nl> - cd gitian - builder / inputs <nl> - <nl> - # Create base images <nl> - cd gitian - builder <nl> - bin / make - base - vm - - suite trusty - - arch amd64 <nl> - cd . . <nl> - <nl> - # Get inputs ( see doc / release - process . md for exact inputs needed and where to get them ) <nl> - . . . <nl> - <nl> - # For further build instructions see doc / release - process . md <nl> - . . . <nl> - <nl> mmmmmmmmmmmmmmmmmmmmm - <nl> - <nl> - ` gitian - builder ` now also supports building using LXC . See <nl> - [ help . ubuntu . com ] ( https : / / help . ubuntu . com / 14 . 04 / serverguide / lxc . html ) <nl> - for how to get LXC up and running under Ubuntu . <nl> - <nl> - If your main machine is a 64 - bit Mac or PC with a few gigabytes of memory <nl> - and at least 10 gigabytes of free disk space , you can ` gitian - build ` using <nl> - LXC running inside a virtual machine . <nl> - <nl> - Here ' s a description of Gavin ' s setup on OSX 10 . 6 : <nl> - <nl> - 1 . Download and install VirtualBox from [ https : / / www . virtualbox . org / ] ( https : / / www . virtualbox . org / ) <nl> - <nl> - 2 . Download the 64 - bit Ubuntu Desktop 12 . 04 LTS . iso CD image from <nl> - [ http : / / www . ubuntu . com / ] ( http : / / www . ubuntu . com / ) <nl> - <nl> - 3 . Run VirtualBox and create a new virtual machine , using the Ubuntu . iso ( see the [ VirtualBox documentation ] ( https : / / www . virtualbox . org / wiki / Documentation ) for details ) . Create it with at least 2 gigabytes of memory and a disk that is at least 20 gigabytes big . <nl> - <nl> - 4 . Inside the running Ubuntu desktop , install : <nl> - <nl> - sudo apt - get install debootstrap lxc ruby apache2 git apt - cacher - ng python - vm - builder <nl> - <nl> - 5 . Still inside Ubuntu , tell gitian - builder to use LXC , then follow the " Once you ' ve got the right hardware and software " instructions above : <nl> - <nl> - export USE_LXC = 1 <nl> - git clone git : / / github . com / bitcoin / bitcoin . git <nl> - . . . etc <nl>
Merge : [ docs ] Remove partial gitian build instructions from descriptors dir .
bitcoin/bitcoin
bbc901d3a683c92438a6b28dca50b956decc4433
2017-09-29T08:24:58Z
mmm a / wscript <nl> ppp b / wscript <nl> def get_output_folders ( self , platform , configuration , target_spec = None , game_p <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> @ conf <nl> def is_bootstrap_available ( bld ) : <nl> - bootstrap_path = bld . path . abspath ( ) + ' / Tools / branch_bootstrap / dist / bootstrap . exe ' <nl> + bootstrap_path = bld . path . abspath ( ) + ' / Tools / branch_bootstrap / bootstrap . exe ' <nl> return os . path . isfile ( bootstrap_path ) <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl>
! XF ( Bootstrap ) Bootstrap now updates SDKs by default , and can be launched by double - clicking the executable . ( Approved by davidka )
CRYTEK/CRYENGINE
6c6998afec8ff0446e1faceff5360023244a5960
2017-01-06T15:29:57Z
mmm a / src / analyzer . js <nl> ppp b / src / analyzer . js <nl> function analyzer ( data ) { <nl> / / Normal variables <nl> func . lines . forEach ( function ( item ) { <nl> if ( item . intertype = = = ' assign ' ) { <nl> - if ( ! item . value . tokens . slice ( - 1 ) [ 0 ] . item ) throw ' Did you run llvm - dis with - show - annotations ? ' ; <nl> - var commaIndex = getTokenIndexByText ( item . value . tokens , ' ; ' ) ; <nl> var variable = func . variables [ item . ident ] = { <nl> ident : item . ident , <nl> type : item . value . type , <nl> origin : item . value . intertype , <nl> lineNum : item . lineNum , <nl> - uses : parseInt ( item . value . tokens [ commaIndex + 1 ] . item . tokens [ 0 ] . text . split ( ' = ' ) [ 1 ] ) <nl> + uses : item . uses <nl> } ; <nl> assert ( isNumber ( variable . uses ) , ' Failed to find the # of uses of var : ' + item . ident ) ; <nl> if ( variable . origin = = = ' alloca ' ) { <nl> mmm a / src / framework . js <nl> ppp b / src / framework . js <nl> Substrate . prototype = { <nl> if ( ! hadProcessing ) { <nl> if ( DEBUG ) print ( " Solving complete : no remaining items " ) ; <nl> finalComment ( ) ; <nl> - this . results . forEach ( function ( output ) { <nl> - delete output . __uid__ ; / / Might recycle these <nl> + this . results . forEach ( function ( result ) { <nl> + delete result . __uid__ ; / / Might recycle these <nl> + if ( that . onResult ) that . onResult ( result ) ; <nl> } ) ; <nl> ret = this . results ; <nl> break ; <nl> mmm a / src / intertyper . js <nl> ppp b / src / intertyper . js <nl> function intertyper ( data , parseFunctions , baseLineNum ) { <nl> substrate . addActor ( ' Assign ' , { <nl> processItem : function ( item ) { <nl> var opIndex = findTokenText ( item , ' = ' ) ; <nl> + if ( ! item . tokens . slice ( - 1 ) [ 0 ] . item ) throw ' Did you run llvm - dis with - show - annotations ? ' ; <nl> + var commentIndex = getTokenIndexByText ( item . tokens , ' ; ' ) ; <nl> var pair = splitItem ( { <nl> intertype : ' assign ' , <nl> ident : toNiceIdent ( combineTokens ( item . tokens . slice ( 0 , opIndex ) ) . text ) , <nl> - lineNum : item . lineNum <nl> + lineNum : item . lineNum , <nl> + uses : parseInt ( item . tokens [ commentIndex + 1 ] . item . tokens [ 0 ] . text . split ( ' = ' ) [ 1 ] ) <nl> } , ' value ' ) ; <nl> this . forwardItem ( pair . parent , ' Reintegrator ' ) ; <nl> - this . forwardItem ( mergeInto ( pair . child , { / / Additional token , to be triaged and later re - integrated <nl> - indent : - 1 , <nl> - tokens : item . tokens . slice ( opIndex + 1 ) <nl> - } ) , ' Triager ' ) ; <nl> + pair . child . indent = - 1 ; <nl> + pair . child . tokens = item . tokens . slice ( opIndex + 1 ) ; <nl> + this . forwardItem ( pair . child , ' Triager ' ) ; <nl> } <nl> } ) ; <nl> <nl> function intertyper ( data , parseFunctions , baseLineNum ) { <nl> llvmLines : data <nl> } , ' LineSplitter ' ) ; <nl> <nl> + substrate . onResult = function ( result ) { <nl> + if ( result . tokens ) result . tokens = null ; / / We do not need tokens , past the intertyper . Clean them up as soon as possible here . <nl> + } ; <nl> + <nl> return substrate . solve ( ) ; <nl> } <nl> <nl>
discard almost all . tokens when intertyper ends , to save memory ( all except for inside Globals )
emscripten-core/emscripten
497065b580828e050087896ac05d0e1f1fdd8627
2011-11-29T23:00:23Z
mmm a / docs - translations / ko - KR / api / menu . md <nl> ppp b / docs - translations / ko - KR / api / menu . md <nl> OS X의 네이티브 액션에 대해 자세히 알아보려면 <nl> 또한 ` template ` 에는 다른 속성도 추가할 수 있으며 메뉴가 만들어질 때 해당 메뉴 아이템의 <nl> 프로퍼티로 변환됩니다 . <nl> <nl> - # # # ` Menu . popup ( [ browserWindow , x , y , positioningItem ] ) ` <nl> + # # Instance Methods <nl> + <nl> + ` menu ` 객체는 다음과 같은 인스턴스 메서드를 가지고 있습니다 : <nl> + <nl> + # # # ` menu . popup ( [ browserWindow , x , y , positioningItem ] ) ` <nl> <nl> * ` browserWindow ` BrowserWindow ( optional ) - 기본값은 ` null ` 입니다 . <nl> * ` x ` Number ( optional ) - 기본값은 - 1입니다 . <nl> OS X의 네이티브 액션에 대해 자세히 알아보려면 <nl> ` positioningItem ` 속성은 메뉴 팝업 시 마우스 커서에 바로 위치시킬 메뉴 아이템의 <nl> 인덱스입니다 . ( OS X에서만 지원합니다 ) <nl> <nl> - # # # ` Menu . append ( menuItem ) ` <nl> + # # # ` menu . append ( menuItem ) ` <nl> <nl> * ` menuItem ` MenuItem <nl> <nl> 메뉴의 리스트 끝에 ` menuItem ` 을 삽입합니다 . <nl> <nl> - # # # ` Menu . insert ( pos , menuItem ) ` <nl> + # # # ` menu . insert ( pos , menuItem ) ` <nl> <nl> * ` pos ` Integer <nl> * ` menuItem ` MenuItem <nl> <nl> ` pos ` 위치에 ` menuItem ` 을 삽입합니다 . <nl> <nl> - # # # ` Menu . items ( ) ` <nl> + # # Instance Properties <nl> + <nl> + ` menu ` 객체는 또한 다음과 같은 속성을 가지고 있습니다 : <nl> + <nl> + # # # ` menu . items ` <nl> <nl> 메뉴가 가지고 있는 메뉴 아이템들의 배열입니다 . <nl> <nl> mmm a / docs - translations / ko - KR / development / build - instructions - osx . md <nl> ppp b / docs - translations / ko - KR / development / build - instructions - osx . md <nl> $ git clone https : / / github . com / atom / electron . git <nl> # # 부트 스트랩 <nl> <nl> 부트스트랩 스크립트는 필수적인 빌드 종속성 라이브러리들을 모두 다운로드하고 프로젝트 <nl> - 파일을 생성합니다 . 참고로 Electron은 ` ninja ` 를 빌드 툴체인으로 사용하므로 Xcode <nl> - 프로젝트는 생성되지 않습니다 . <nl> + 파일을 생성합니다 . 참고로 Electron은 [ ninja ] ( https : / / ninja - build . org / ) 를 빌드 <nl> + 툴체인으로 사용하므로 Xcode 프로젝트는 생성되지 않습니다 . <nl> <nl> ` ` ` bash <nl> $ cd electron <nl> mmm a / docs - translations / ko - KR / development / build - system - overview . md <nl> ppp b / docs - translations / ko - KR / development / build - system - overview . md <nl> <nl> # 빌드 시스템 개요 <nl> <nl> - Electron은 프로젝트 생성을 위해 ` gyp ` 를 사용하며 ` ninja ` 를 이용하여 빌드합니다 . <nl> - 프로젝트 설정은 ` . gyp ` 와 ` . gypi ` 파일에서 볼 수 있습니다 . <nl> + Electron은 프로젝트 생성을 위해 [ gyp ] ( https : / / gyp . gsrc . io / ) 를 사용하며 <nl> + [ ninja ] ( https : / / ninja - build . org / ) 를 이용하여 빌드합니다 . 프로젝트 설정은 ` . gyp ` 와 <nl> + ` . gypi ` 파일에서 볼 수 있습니다 . <nl> <nl> # # gyp 파일 <nl> <nl>
: memo : Update Korean docs as upstream
electron/electron
8fac75f4ee2eee76de179a5ae902aa7a9525dbaa
2016-03-22T04:48:14Z
mmm a / packaging / osx / uninstall - rethinkdb . sh <nl> ppp b / packaging / osx / uninstall - rethinkdb . sh <nl> <nl> # ! / bin / sh <nl> - <nl> - rm / usr / local / bin / rethinkdb <nl> - rm - r / usr / local / share / rethinkdb <nl> + rm - v / usr / local / bin / rethinkdb <nl> + rm - v / usr / local / bin / rethinkdb - dump <nl> + rm - v / usr / local / bin / rethinkdb - dump . py <nl> + rm - v / usr / local / bin / rethinkdb - restore <nl> + rm - v / usr / local / bin / rethinkdb - restore . py <nl> + rm - v / usr / local / bin / rethinkdb - export <nl> + rm - v / usr / local / bin / rethinkdb - export . py <nl> + rm - v / usr / local / bin / rethinkdb - import <nl> + rm - v / usr / local / bin / rethinkdb - import . py <nl> + rm - rv / usr / local / share / rethinkdb <nl>
Add the backup scripts to the osx uninstall script
rethinkdb/rethinkdb
3836f544565fb569684634059062f44cf118d2e1
2013-07-09T01:59:27Z
mmm a / editor / editor_node . cpp <nl> ppp b / editor / editor_node . cpp <nl> void EditorNode : : _notification ( int p_what ) { <nl> play_button_panel - > add_style_override ( " panel " , gui_base - > get_stylebox ( " PlayButtonPanel " , " EditorStyles " ) ) ; <nl> scene_root_parent - > add_style_override ( " panel " , gui_base - > get_stylebox ( " Content " , " EditorStyles " ) ) ; <nl> bottom_panel - > add_style_override ( " panel " , gui_base - > get_stylebox ( " Content " , " EditorStyles " ) ) ; <nl> + scene_tabs - > add_style_override ( " tab_fg " , gui_base - > get_stylebox ( " SceneTabFG " , " EditorStyles " ) ) ; <nl> + scene_tabs - > add_style_override ( " tab_bg " , gui_base - > get_stylebox ( " SceneTabBG " , " EditorStyles " ) ) ; <nl> if ( bool ( EDITOR_DEF ( " interface / scene_tabs / resize_if_many_tabs " , true ) ) ) { <nl> scene_tabs - > set_min_width ( int ( EDITOR_DEF ( " interface / scene_tabs / minimum_width " , 50 ) ) * EDSCALE ) ; <nl> } else { <nl>
Merge pull request from volzhs / fix - scene - tab - theme
godotengine/godot
16622fccd23b58ae5a54dfafaacde10999210613
2017-06-16T19:48:09Z
mmm a / docs / Parameters . rst <nl> ppp b / docs / Parameters . rst <nl> If one parameter appears in both command line and config file , LightGBM will use <nl> Core Parameters <nl> mmmmmmmmmmmmmmm <nl> <nl> - - ` ` config ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` config_file ` ` <nl> + - ` ` config ` ` , default = ` ` " " ` ` , type = string , aliases : ` ` config_file ` ` <nl> <nl> - path of config file <nl> <nl> - - * * Note * * : Only can be used in CLI version <nl> + - * * Note * * : can be used only in CLI version <nl> <nl> - - ` ` task ` ` , default = \ ` ` train ` ` , type = enum , options = \ ` ` train ` ` , ` ` predict ` ` , ` ` convert_model ` ` , ` ` refit ` ` , alias = \ ` ` task_type ` ` <nl> + - ` ` task ` ` , default = ` ` train ` ` , type = enum , options : ` ` train ` ` , ` ` predict ` ` , ` ` convert_model ` ` , ` ` refit ` ` , aliases : ` ` task_type ` ` <nl> <nl> - - ` ` train ` ` , alias = \ ` ` training ` ` , for training <nl> + - ` ` train ` ` , for training , aliases : ` ` training ` ` <nl> <nl> - - ` ` predict ` ` , alias = \ ` ` prediction ` ` , ` ` test ` ` , for prediction <nl> + - ` ` predict ` ` , for prediction , aliases : ` ` prediction ` ` , ` ` test ` ` <nl> <nl> - - ` ` convert_model ` ` , for converting model file into if - else format , see more information in ` Convert model parameters < # convert - model - parameters > ` __ <nl> + - ` ` convert_model ` ` , for converting model file into if - else format , see more information in ` IO Parameters < # io - parameters > ` __ <nl> <nl> - - ` ` refit ` ` , alias = \ ` ` refit_tree ` ` , refit existing models with new data <nl> + - ` ` refit ` ` , for refitting existing models with new data , aliases : ` ` refit_tree ` ` <nl> <nl> - - * * Note * * : Only can be used in CLI version <nl> + - * * Note * * : can be used only in CLI version <nl> <nl> - - ` ` application ` ` , default = \ ` ` regression ` ` , type = enum , <nl> - options = \ ` ` regression ` ` , ` ` regression_l1 ` ` , ` ` huber ` ` , ` ` fair ` ` , ` ` poisson ` ` , ` ` quantile ` ` , ` ` mape ` ` , ` ` gammma ` ` , ` ` tweedie ` ` , <nl> - ` ` binary ` ` , ` ` multiclass ` ` , ` ` multiclassova ` ` , ` ` xentropy ` ` , ` ` xentlambda ` ` , ` ` lambdarank ` ` , <nl> - alias = \ ` ` app ` ` , ` ` objective ` ` , ` ` objective_type ` ` <nl> + - ` ` objective ` ` , default = ` ` regression ` ` , type = enum , options : ` ` regression ` ` , ` ` regression_l1 ` ` , ` ` huber ` ` , ` ` fair ` ` , ` ` poisson ` ` , ` ` quantile ` ` , ` ` mape ` ` , ` ` gammma ` ` , ` ` tweedie ` ` , ` ` binary ` ` , ` ` multiclass ` ` , ` ` multiclassova ` ` , ` ` xentropy ` ` , ` ` xentlambda ` ` , ` ` lambdarank ` ` , aliases : ` ` objective_type ` ` , ` ` app ` ` , ` ` application ` ` <nl> <nl> - regression application <nl> <nl> - - ` ` regression_l2 ` ` , L2 loss , alias = \ ` ` regression ` ` , ` ` mean_squared_error ` ` , ` ` mse ` ` , ` ` l2_root ` ` , ` ` root_mean_squared_error ` ` , ` ` rmse ` ` <nl> + - ` ` regression_l2 ` ` , L2 loss , aliases : ` ` regression ` ` , ` ` mean_squared_error ` ` , ` ` mse ` ` , ` ` l2_root ` ` , ` ` root_mean_squared_error ` ` , ` ` rmse ` ` <nl> <nl> - - ` ` regression_l1 ` ` , L1 loss , alias = \ ` ` mean_absolute_error ` ` , ` ` mae ` ` <nl> + - ` ` regression_l1 ` ` , L1 loss , aliases : ` ` mean_absolute_error ` ` , ` ` mae ` ` <nl> <nl> - - ` ` huber ` ` , ` Huber loss ` _ <nl> + - ` ` huber ` ` , ` Huber loss < https : / / en . wikipedia . org / wiki / Huber_loss > ` __ <nl> <nl> - - ` ` fair ` ` , ` Fair loss ` _ <nl> + - ` ` fair ` ` , ` Fair loss < https : / / www . kaggle . com / c / allstate - claims - severity / discussion / 24520 > ` __ <nl> <nl> - - ` ` poisson ` ` , ` Poisson regression ` _ <nl> + - ` ` poisson ` ` , ` Poisson regression < https : / / en . wikipedia . org / wiki / Poisson_regression > ` __ <nl> <nl> - - ` ` quantile ` ` , ` Quantile regression ` _ <nl> + - ` ` quantile ` ` , ` Quantile regression < https : / / en . wikipedia . org / wiki / Quantile_regression > ` __ <nl> <nl> - - ` ` mape ` ` , ` MAPE loss ` _ , alias = \ ` ` mean_absolute_percentage_error ` ` <nl> + - ` ` mape ` ` , ` MAPE loss < https : / / en . wikipedia . org / wiki / Mean_absolute_percentage_error > ` __ , aliases : ` ` mean_absolute_percentage_error ` ` <nl> <nl> - - ` ` gamma ` ` , Gamma regression with log - link . It might be useful , e . g . , for modeling insurance claims severity , or for any target that might be ` gamma - distributed ` _ <nl> + - ` ` gamma ` ` , Gamma regression with log - link . It might be useful , e . g . , for modeling insurance claims severity , or for any target that might be ` gamma - distributed < https : / / en . wikipedia . org / wiki / Gamma_distribution # Applications > ` __ <nl> <nl> - - ` ` tweedie ` ` , Tweedie regression with log - link . It might be useful , e . g . , for modeling total loss in insurance , or for any target that might be ` tweedie - distributed ` _ <nl> + - ` ` tweedie ` ` , Tweedie regression with log - link . It might be useful , e . g . , for modeling total loss in insurance , or for any target that might be ` tweedie - distributed < https : / / en . wikipedia . org / wiki / Tweedie_distribution # Applications > ` __ <nl> <nl> - - ` ` binary ` ` , binary ` log loss ` _ classification ( or logistic regression ) . Requires labels in { 0 , 1 } ; see ` ` xentropy ` ` for general probability labels in [ 0 , 1 ] <nl> + - ` ` binary ` ` , binary ` log loss < https : / / en . wikipedia . org / wiki / Cross_entropy > ` __ classification ( or logistic regression ) . Requires labels in { 0 , 1 } ; see ` ` xentropy ` ` for general probability labels in [ 0 , 1 ] <nl> <nl> - multi - class classification application <nl> <nl> - - ` ` multiclass ` ` , ` softmax ` _ objective function , alias = \ ` ` softmax ` ` <nl> + - ` ` multiclass ` ` , ` softmax < https : / / en . wikipedia . org / wiki / Softmax_function > ` __ objective function , aliases : ` ` softmax ` ` <nl> <nl> - - ` ` multiclassova ` ` , ` One - vs - All ` _ binary objective function , alias = \ ` ` multiclass_ova ` ` , ` ` ova ` ` , ` ` ovr ` ` <nl> + - ` ` multiclassova ` ` , ` One - vs - All < https : / / en . wikipedia . org / wiki / Multiclass_classification # One - vs . - rest > ` __ binary objective function , aliases : ` ` multiclass_ova ` ` , ` ` ova ` ` , ` ` ovr ` ` <nl> <nl> - ` ` num_class ` ` should be set as well <nl> <nl> - cross - entropy application <nl> <nl> - - ` ` xentropy ` ` , objective function for cross - entropy ( with optional linear weights ) , alias = \ ` ` cross_entropy ` ` <nl> + - ` ` xentropy ` ` , objective function for cross - entropy ( with optional linear weights ) , aliases : ` ` cross_entropy ` ` <nl> <nl> - - ` ` xentlambda ` ` , alternative parameterization of cross - entropy , alias = \ ` ` cross_entropy_lambda ` ` <nl> + - ` ` xentlambda ` ` , alternative parameterization of cross - entropy , aliases : ` ` cross_entropy_lambda ` ` <nl> <nl> - - the label is anything in interval [ 0 , 1 ] <nl> + - label is anything in interval [ 0 , 1 ] <nl> <nl> - - ` ` lambdarank ` ` , ` lambdarank ` _ application <nl> + - ` ` lambdarank ` ` , ` lambdarank < https : / / papers . nips . cc / paper / 2971 - learning - to - rank - with - nonsmooth - cost - functions . pdf > ` __ application <nl> <nl> - - the label should be ` ` int ` ` type in lambdarank tasks , and larger number represent the higher relevance ( e . g . 0 : bad , 1 : fair , 2 : good , 3 : perfect ) <nl> + - label should be ` ` int ` ` type in lambdarank tasks , and larger number represents the higher relevance ( e . g . 0 : bad , 1 : fair , 2 : good , 3 : perfect ) <nl> <nl> - - ` label_gain < # objective - parameters > ` __ can be used to set the gain ( weight ) of ` ` int ` ` label <nl> + - ` label_gain < # objective - parameters > ` __ can be used to set the gain ( weight ) of ` ` int ` ` label <nl> <nl> - all values in ` ` label ` ` must be smaller than number of elements in ` ` label_gain ` ` <nl> <nl> - - ` ` boosting ` ` , default = \ ` ` gbdt ` ` , type = enum , <nl> - options = \ ` ` gbdt ` ` , ` ` rf ` ` , ` ` dart ` ` , ` ` goss ` ` , <nl> - alias = \ ` ` boost ` ` , ` ` boosting_type ` ` <nl> + - ` ` boosting ` ` , default = ` ` gbdt ` ` , type = enum , options : ` ` gbdt ` ` , ` ` gbrt ` ` , ` ` rf ` ` , ` ` random_forest ` ` , ` ` dart ` ` , ` ` goss ` ` , aliases : ` ` boosting_type ` ` , ` ` boost ` ` <nl> <nl> - - ` ` gbdt ` ` , traditional Gradient Boosting Decision Tree <nl> + - ` ` gbdt ` ` , traditional Gradient Boosting Decision Tree , aliases : ` ` gbrt ` ` <nl> <nl> - - ` ` rf ` ` , Random Forest <nl> + - ` ` rf ` ` , Random Forest , aliases : ` ` random_forest ` ` <nl> <nl> - - ` ` dart ` ` , ` Dropouts meet Multiple Additive Regression Trees ` _ <nl> + - ` ` dart ` ` , ` Dropouts meet Multiple Additive Regression Trees < https : / / arxiv . org / abs / 1505 . 01866 > ` __ <nl> <nl> - ` ` goss ` ` , Gradient - based One - Side Sampling <nl> <nl> - - ` ` data ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` train ` ` , ` ` train_data ` ` , ` ` data_filename ` ` <nl> + - ` ` data ` ` , default = ` ` " " ` ` , type = string , aliases : ` ` train ` ` , ` ` train_data ` ` , ` ` data_filename ` ` <nl> <nl> - - training data , LightGBM will train from this data <nl> + - path of training data , LightGBM will train from this data <nl> <nl> - - ` ` valid ` ` , default = \ ` ` " " ` ` , type = multi - string , alias = \ ` ` test ` ` , ` ` valid_data ` ` , ` ` test_data ` ` , ` ` valid_filenames ` ` <nl> + - ` ` valid ` ` , default = ` ` " " ` ` , type = string , aliases : ` ` test ` ` , ` ` valid_data ` ` , ` ` valid_data_file ` ` , ` ` test_data ` ` , ` ` valid_filenames ` ` <nl> <nl> - - validation / test data , LightGBM will output metrics for these data <nl> + - path ( s ) of validation / test data , LightGBM will output metrics for these data <nl> <nl> - - support multi validation data , separate by ` ` , ` ` <nl> + - support multiple validation data , separated by ` ` , ` ` <nl> <nl> - - ` ` num_iterations ` ` , default = \ ` ` 100 ` ` , type = int , <nl> - alias = \ ` ` num_iteration ` ` , ` ` num_tree ` ` , ` ` num_trees ` ` , ` ` num_round ` ` , ` ` num_rounds ` ` , ` ` num_boost_round ` ` , ` ` n_estimators ` ` <nl> + - ` ` num_iterations ` ` , default = ` ` 100 ` ` , type = int , aliases : ` ` num_iteration ` ` , ` ` num_tree ` ` , ` ` num_trees ` ` , ` ` num_round ` ` , ` ` num_rounds ` ` , ` ` num_boost_round ` ` , ` ` n_estimators ` ` , constraints : ` ` num_iterations > = 0 ` ` <nl> <nl> - number of boosting iterations <nl> <nl> - - * * Note * * : for Python / R package , * * this parameter is ignored * * , <nl> - use ` ` num_boost_round ` ` ( Python ) or ` ` nrounds ` ` ( R ) input arguments of ` ` train ` ` and ` ` cv ` ` methods instead <nl> + - * * Note * * : for Python / R - package , * * this parameter is ignored * * , use ` ` num_boost_round ` ` ( Python ) or ` ` nrounds ` ` ( R ) input arguments of ` ` train ` ` and ` ` cv ` ` methods instead <nl> <nl> - - * * Note * * : internally , LightGBM constructs ` ` num_class * num_iterations ` ` trees for ` ` multiclass ` ` problems <nl> + - * * Note * * : internally , LightGBM constructs ` ` num_class * num_iterations ` ` trees for multi - class classification problems <nl> <nl> - - ` ` learning_rate ` ` , default = \ ` ` 0 . 1 ` ` , type = double , alias = \ ` ` shrinkage_rate ` ` <nl> + - ` ` learning_rate ` ` , default = ` ` 0 . 1 ` ` , type = double , aliases : ` ` shrinkage_rate ` ` , constraints : ` ` learning_rate > 0 . 0 ` ` <nl> <nl> - shrinkage rate <nl> <nl> - in ` ` dart ` ` , it also affects on normalization weights of dropped trees <nl> <nl> - - ` ` num_leaves ` ` , default = \ ` ` 31 ` ` , type = int , alias = \ ` ` num_leaf ` ` <nl> + - ` ` num_leaves ` ` , default = ` ` 31 ` ` , type = int , aliases : ` ` num_leaf ` ` , constraints : ` ` num_leaves > 1 ` ` <nl> <nl> - - number of leaves in one tree <nl> + - max number of leaves in one tree <nl> <nl> - - ` ` tree_learner ` ` , default = \ ` ` serial ` ` , type = enum , options = \ ` ` serial ` ` , ` ` feature ` ` , ` ` data ` ` , ` ` voting ` ` , alias = \ ` ` tree ` ` , ` ` tree_learner_type ` ` <nl> + - ` ` tree_learner ` ` , default = ` ` serial ` ` , type = enum , options : ` ` serial ` ` , ` ` feature ` ` , ` ` data ` ` , ` ` voting ` ` , aliases : ` ` tree ` ` , ` ` tree_learner_type ` ` <nl> <nl> - ` ` serial ` ` , single machine tree learner <nl> <nl> - - ` ` feature ` ` , alias = \ ` ` feature_parallel ` ` , feature parallel tree learner <nl> + - ` ` feature ` ` , feature parallel tree learner , aliases : ` ` feature_parallel ` ` <nl> <nl> - - ` ` data ` ` , alias = \ ` ` data_parallel ` ` , data parallel tree learner <nl> + - ` ` data ` ` , data parallel tree learner , aliases : ` ` data_parallel ` ` <nl> <nl> - - ` ` voting ` ` , alias = \ ` ` voting_parallel ` ` , voting parallel tree learner <nl> + - ` ` voting ` ` , voting parallel tree learner , aliases : ` ` voting_parallel ` ` <nl> <nl> - refer to ` Parallel Learning Guide < . / Parallel - Learning - Guide . rst > ` __ to get more details <nl> <nl> - - ` ` num_threads ` ` , default = \ ` ` OpenMP_default ` ` , type = int , alias = \ ` ` num_thread ` ` , ` ` nthread ` ` , ` ` nthreads ` ` <nl> + - ` ` num_threads ` ` , default = ` ` 0 ` ` , type = int , aliases : ` ` num_thread ` ` , ` ` nthread ` ` , ` ` nthreads ` ` <nl> <nl> - number of threads for LightGBM <nl> <nl> - - for the best speed , set this to the number of * * real CPU cores * * , <nl> - not the number of threads ( most CPU using ` hyper - threading ` _ to generate 2 threads per CPU core ) <nl> + - ` ` 0 ` ` means default number of threads in OpenMP <nl> <nl> - - do not set it too large if your dataset is small ( do not use 64 threads for a dataset with 10 , 000 rows for instance ) <nl> + - for the best speed , set this to the number of * * real CPU cores * * , not the number of threads ( most CPUs use ` hyper - threading < https : / / en . wikipedia . org / wiki / Hyper - threading > ` __ to generate 2 threads per CPU core ) <nl> <nl> - - be aware a task manager or any similar CPU monitoring tool might report cores not being fully utilized . * * This is normal * * <nl> + - do not set it too large if your dataset is small ( for instance , do not use 64 threads for a dataset with 10 , 000 rows ) <nl> <nl> - - for parallel learning , should not use full CPU cores since this will cause poor performance for the network <nl> + - be aware a task manager or any similar CPU monitoring tool might report that cores not being fully utilized . * * This is normal * * <nl> <nl> - - ` ` device ` ` , default = \ ` ` cpu ` ` , options = \ ` ` cpu ` ` , ` ` gpu ` ` <nl> + - for parallel learning , do not use all CPU cores because this will cause poor performance for the network communication <nl> <nl> - - choose device for the tree learning , you can use GPU to achieve the faster learning <nl> + - ` ` device_type ` ` , default = ` ` cpu ` ` , type = enum , options : ` ` cpu ` ` , ` ` gpu ` ` , aliases : ` ` device ` ` <nl> + <nl> + - device for the tree learning , you can use GPU to achieve the faster learning <nl> <nl> - * * Note * * : it is recommended to use the smaller ` ` max_bin ` ` ( e . g . 63 ) to get the better speed up <nl> <nl> - - * * Note * * : for the faster speed , GPU use 32 - bit float point to sum up by default , may affect the accuracy for some tasks . <nl> - You can set ` ` gpu_use_dp = true ` ` to enable 64 - bit float point , but it will slow down the training <nl> + - * * Note * * : for the faster speed , GPU uses 32 - bit float point to sum up by default , so this may affect the accuracy for some tasks . You can set ` ` gpu_use_dp = true ` ` to enable 64 - bit float point , but it will slow down the training <nl> + <nl> + - * * Note * * : refer to ` Installation Guide < . / Installation - Guide . rst # build - gpu - version > ` __ to build LightGBM with GPU support <nl> + <nl> + - ` ` seed ` ` , default = ` ` 0 ` ` , type = int , aliases : ` ` random_seed ` ` <nl> <nl> - - * * Note * * : refer to ` Installation Guide < . / Installation - Guide . rst # build - gpu - version > ` __ to build with GPU <nl> + - this seed is used to generate other seeds , e . g . ` ` data_random_seed ` ` , ` ` feature_fraction_seed ` ` <nl> + <nl> + - will be overridden , if you set other seeds <nl> <nl> Learning Control Parameters <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> <nl> - - ` ` max_depth ` ` , default = \ ` ` - 1 ` ` , type = int <nl> + - ` ` max_depth ` ` , default = ` ` - 1 ` ` , type = int <nl> <nl> - - limit the max depth for tree model . This is used to deal with over - fitting when ` ` # data ` ` is small . Tree still grows by leaf - wise <nl> + - limit the max depth for tree model . This is used to deal with over - fitting when ` ` # data ` ` is small . Tree still grows leaf - wise <nl> <nl> - ` ` < 0 ` ` means no limit <nl> <nl> - - ` ` min_data_in_leaf ` ` , default = \ ` ` 20 ` ` , type = int , alias = \ ` ` min_data_per_leaf ` ` , ` ` min_data ` ` , ` ` min_child_samples ` ` <nl> + - ` ` min_data_in_leaf ` ` , default = ` ` 20 ` ` , type = int , aliases : ` ` min_data_per_leaf ` ` , ` ` min_data ` ` , ` ` min_child_samples ` ` , constraints : ` ` min_data_in_leaf > = 0 ` ` <nl> <nl> - minimal number of data in one leaf . Can be used to deal with over - fitting <nl> <nl> - - ` ` min_sum_hessian_in_leaf ` ` , default = \ ` ` 1e - 3 ` ` , type = double , <nl> - alias = \ ` ` min_sum_hessian_per_leaf ` ` , ` ` min_sum_hessian ` ` , ` ` min_hessian ` ` , ` ` min_child_weight ` ` <nl> + - ` ` min_sum_hessian_in_leaf ` ` , default = ` ` 1e - 3 ` ` , type = double , aliases : ` ` min_sum_hessian_per_leaf ` ` , ` ` min_sum_hessian ` ` , ` ` min_hessian ` ` , ` ` min_child_weight ` ` , constraints : ` ` min_sum_hessian_in_leaf > = 0 . 0 ` ` <nl> <nl> - minimal sum hessian in one leaf . Like ` ` min_data_in_leaf ` ` , it can be used to deal with over - fitting <nl> <nl> - - ` ` feature_fraction ` ` , default = \ ` ` 1 . 0 ` ` , type = double , ` ` 0 . 0 < feature_fraction < = 1 . 0 ` ` , alias = \ ` ` sub_feature ` ` , ` ` colsample_bytree ` ` <nl> + - ` ` bagging_fraction ` ` , default = ` ` 1 . 0 ` ` , type = double , aliases : ` ` sub_row ` ` , ` ` subsample ` ` , ` ` bagging ` ` , constraints : ` ` 0 . 0 < bagging_fraction < = 1 . 0 ` ` <nl> <nl> - - LightGBM will randomly select part of features on each iteration if ` ` feature_fraction ` ` smaller than ` ` 1 . 0 ` ` . <nl> - For example , if set to ` ` 0 . 8 ` ` , will select 80 % features before training each tree <nl> + - like ` ` feature_fraction ` ` , but this will randomly select part of data without resampling <nl> <nl> - can be used to speed up training <nl> <nl> - can be used to deal with over - fitting <nl> <nl> - - ` ` feature_fraction_seed ` ` , default = \ ` ` 2 ` ` , type = int <nl> + - * * Note * * : to enable bagging , ` ` bagging_freq ` ` should be set to a non zero value as well <nl> <nl> - - random seed for ` ` feature_fraction ` ` <nl> + - ` ` bagging_freq ` ` , default = ` ` 0 ` ` , type = int , aliases : ` ` subsample_freq ` ` <nl> <nl> - - ` ` bagging_fraction ` ` , default = \ ` ` 1 . 0 ` ` , type = double , ` ` 0 . 0 < bagging_fraction < = 1 . 0 ` ` , alias = \ ` ` sub_row ` ` , ` ` subsample ` ` , ` ` bagging ` ` <nl> + - frequency for bagging <nl> <nl> - - like ` ` feature_fraction ` ` , but this will randomly select part of data without resampling <nl> + - ` ` 0 ` ` means disable bagging ; ` ` k ` ` means perform bagging at every ` ` k ` ` iteration <nl> + <nl> + - * * Note * * : to enable bagging , ` ` bagging_fraction ` ` should be set to value smaller than ` ` 1 . 0 ` ` as well <nl> + <nl> + - ` ` bagging_seed ` ` , default = ` ` 3 ` ` , type = int , aliases : ` ` bagging_fraction_seed ` ` <nl> + <nl> + - random seed for bagging <nl> + <nl> + - ` ` feature_fraction ` ` , default = ` ` 1 . 0 ` ` , type = double , aliases : ` ` sub_feature ` ` , ` ` colsample_bytree ` ` , constraints : ` ` 0 . 0 < feature_fraction < = 1 . 0 ` ` <nl> + <nl> + - LightGBM will randomly select part of features on each iteration if ` ` feature_fraction ` ` smaller than ` ` 1 . 0 ` ` . For example , if you set it to ` ` 0 . 8 ` ` , LightGBM will select 80 % of features before training each tree <nl> <nl> - can be used to speed up training <nl> <nl> - can be used to deal with over - fitting <nl> <nl> - - * * Note * * : To enable bagging , ` ` bagging_freq ` ` should be set to a non zero value as well <nl> + - ` ` feature_fraction_seed ` ` , default = ` ` 2 ` ` , type = int <nl> + <nl> + - random seed for ` ` feature_fraction ` ` <nl> <nl> - - ` ` bagging_freq ` ` , default = \ ` ` 0 ` ` , type = int , alias = \ ` ` subsample_freq ` ` <nl> + - ` ` early_stopping_round ` ` , default = ` ` 0 ` ` , type = int , aliases : ` ` early_stopping_rounds ` ` , ` ` early_stopping ` ` <nl> <nl> - - frequency for bagging , ` ` 0 ` ` means disable bagging . ` ` k ` ` means will perform bagging at every ` ` k ` ` iteration <nl> + - will stop training if one metric of one validation data doesn ' t improve in last ` ` early_stopping_round ` ` rounds <nl> <nl> - - * * Note * * : to enable bagging , ` ` bagging_fraction ` ` should be set as well <nl> + - ` ` < = 0 ` ` means disable <nl> <nl> - - ` ` bagging_seed ` ` , default = \ ` ` 3 ` ` , type = int , alias = \ ` ` bagging_fraction_seed ` ` <nl> + - ` ` max_delta_step ` ` , default = ` ` 0 . 0 ` ` , type = double , aliases : ` ` max_tree_output ` ` , ` ` max_leaf_output ` ` <nl> <nl> - - random seed for bagging <nl> + - used to limit the max output of tree leaves <nl> <nl> - - ` ` early_stopping_round ` ` , default = \ ` ` 0 ` ` , type = int , alias = \ ` ` early_stopping_rounds ` ` , ` ` early_stopping ` ` <nl> + - ` ` < = 0 ` ` means no constraint <nl> <nl> - - will stop training if one metric of one validation data doesn ' t improve in last ` ` early_stopping_round ` ` rounds <nl> + - the final max output of leaves is ` ` learning_rate * max_delta_step ` ` <nl> <nl> - - ` ` lambda_l1 ` ` , default = \ ` ` 0 ` ` , type = double , alias = \ ` ` reg_alpha ` ` <nl> + - ` ` lambda_l1 ` ` , default = ` ` 0 . 0 ` ` , type = double , aliases : ` ` reg_alpha ` ` , constraints : ` ` lambda_l1 > = 0 . 0 ` ` <nl> <nl> - L1 regularization <nl> <nl> - - ` ` lambda_l2 ` ` , default = \ ` ` 0 ` ` , type = double , alias = \ ` ` reg_lambda ` ` <nl> + - ` ` lambda_l2 ` ` , default = ` ` 0 . 0 ` ` , type = double , aliases : ` ` reg_lambda ` ` , constraints : ` ` lambda_l2 > = 0 . 0 ` ` <nl> <nl> - L2 regularization <nl> <nl> - - ` ` max_delta_step ` ` , default = \ ` ` 0 ` ` , type = double , alias = \ ` ` max_tree_output ` ` , ` ` max_leaf_output ` ` <nl> + - ` ` min_gain_to_split ` ` , default = ` ` 0 . 0 ` ` , type = double , aliases : ` ` min_split_gain ` ` , constraints : ` ` min_gain_to_split > = 0 . 0 ` ` <nl> <nl> - - Used to limit the max output of tree leaves <nl> + - the minimal gain to perform split <nl> <nl> - - when < = 0 , there is not constraint <nl> + - ` ` drop_rate ` ` , default = ` ` 0 . 1 ` ` , type = double , constraints : ` ` 0 . 0 < = drop_rate < = 1 . 0 ` ` <nl> <nl> - - the final max output of leaves is ` ` learning_rate * max_delta_step ` ` <nl> + - used only in ` ` dart ` ` <nl> <nl> - - ` ` min_split_gain ` ` , default = \ ` ` 0 ` ` , type = double , alias = \ ` ` min_gain_to_split ` ` <nl> + - dropout rate <nl> <nl> - - the minimal gain to perform split <nl> + - ` ` max_drop ` ` , default = ` ` 50 ` ` , type = int <nl> <nl> - - ` ` drop_rate ` ` , default = \ ` ` 0 . 1 ` ` , type = double , ` ` 0 . 0 < = drop_rate < = 1 . 0 ` ` <nl> + - used only in ` ` dart ` ` <nl> <nl> - - only used in ` ` dart ` ` <nl> + - max number of dropped trees on one iteration <nl> <nl> - - ` ` skip_drop ` ` , default = \ ` ` 0 . 5 ` ` , type = double , ` ` 0 . 0 < = skip_drop < = 1 . 0 ` ` <nl> + - ` ` < = 0 ` ` means no limit <nl> <nl> - - only used in ` ` dart ` ` , probability of skipping drop <nl> + - ` ` skip_drop ` ` , default = ` ` 0 . 5 ` ` , type = double , constraints : ` ` 0 . 0 < = skip_drop < = 1 . 0 ` ` <nl> <nl> - - ` ` max_drop ` ` , default = \ ` ` 50 ` ` , type = int <nl> + - used only in ` ` dart ` ` <nl> <nl> - - only used in ` ` dart ` ` , max number of dropped trees on one iteration <nl> - <nl> - - ` ` < = 0 ` ` means no limit <nl> + - probability of skipping drop <nl> <nl> - - ` ` uniform_drop ` ` , default = \ ` ` false ` ` , type = bool <nl> + - ` ` xgboost_dart_mode ` ` , default = ` ` false ` ` , type = bool <nl> <nl> - - only used in ` ` dart ` ` , set this to ` ` true ` ` if want to use uniform drop <nl> + - used only in ` ` dart ` ` <nl> <nl> - - ` ` xgboost_dart_mode ` ` , default = \ ` ` false ` ` , type = bool <nl> + - set this to ` ` true ` ` , if you want to use xgboost dart mode <nl> <nl> - - only used in ` ` dart ` ` , set this to ` ` true ` ` if want to use xgboost dart mode <nl> + - ` ` uniform_drop ` ` , default = ` ` false ` ` , type = bool <nl> <nl> - - ` ` drop_seed ` ` , default = \ ` ` 4 ` ` , type = int <nl> + - used only in ` ` dart ` ` <nl> <nl> - - only used in ` ` dart ` ` , random seed to choose dropping models <nl> + - set this to ` ` true ` ` , if you want to use uniform drop <nl> <nl> - - ` ` top_rate ` ` , default = \ ` ` 0 . 2 ` ` , type = double <nl> + - ` ` drop_seed ` ` , default = ` ` 4 ` ` , type = int <nl> <nl> - - only used in ` ` goss ` ` , the retain ratio of large gradient data <nl> + - used only in ` ` dart ` ` <nl> <nl> - - ` ` other_rate ` ` , default = \ ` ` 0 . 1 ` ` , type = int <nl> + - random seed to choose dropping models <nl> <nl> - - only used in ` ` goss ` ` , the retain ratio of small gradient data <nl> + - ` ` top_rate ` ` , default = ` ` 0 . 2 ` ` , type = double , constraints : ` ` 0 . 0 < = top_rate < = 1 . 0 ` ` <nl> <nl> - - ` ` min_data_per_group ` ` , default = \ ` ` 100 ` ` , type = int <nl> + - used only in ` ` goss ` ` <nl> <nl> - - min number of data per categorical group <nl> + - the retain ratio of large gradient data <nl> <nl> - - ` ` max_cat_threshold ` ` , default = \ ` ` 32 ` ` , type = int <nl> + - ` ` other_rate ` ` , default = ` ` 0 . 1 ` ` , type = double , constraints : ` ` 0 . 0 < = other_rate < = 1 . 0 ` ` <nl> <nl> - - use for the categorical features <nl> + - used only in ` ` goss ` ` <nl> <nl> - - limit the max threshold points in categorical features <nl> + - the retain ratio of small gradient data <nl> + <nl> + - ` ` min_data_per_group ` ` , default = ` ` 100 ` ` , type = int , constraints : ` ` min_data_per_group > 0 ` ` <nl> + <nl> + - minimal number of data per categorical group <nl> <nl> - - ` ` cat_smooth ` ` , default = \ ` ` 10 ` ` , type = double <nl> + - ` ` max_cat_threshold ` ` , default = ` ` 32 ` ` , type = int , constraints : ` ` max_cat_threshold > 0 ` ` <nl> <nl> - used for the categorical features <nl> <nl> - - this can reduce the effect of noises in categorical features , especially for categories with few data <nl> + - limit the max threshold points in categorical features <nl> <nl> - - ` ` cat_l2 ` ` , default = \ ` ` 10 ` ` , type = double <nl> + - ` ` cat_l2 ` ` , default = ` ` 10 . 0 ` ` , type = double , constraints : ` ` cat_l2 > = 0 . 0 ` ` <nl> + <nl> + - used for the categorical features <nl> <nl> - L2 regularization in categorcial split <nl> <nl> - - ` ` max_cat_to_onehot ` ` , default = \ ` ` 4 ` ` , type = int <nl> + - ` ` cat_smooth ` ` , default = ` ` 10 . 0 ` ` , type = double , constraints : ` ` cat_smooth > = 0 . 0 ` ` <nl> + <nl> + - used for the categorical features <nl> + <nl> + - this can reduce the effect of noises in categorical features , especially for categories with few data <nl> + <nl> + - ` ` max_cat_to_onehot ` ` , default = ` ` 4 ` ` , type = int , constraints : ` ` max_cat_to_onehot > 0 ` ` <nl> <nl> - when number of categories of one feature smaller than or equal to ` ` max_cat_to_onehot ` ` , one - vs - other split algorithm will be used <nl> <nl> - - ` ` top_k ` ` , default = \ ` ` 20 ` ` , type = int , alias = \ ` ` topk ` ` <nl> + - ` ` top_k ` ` , default = ` ` 20 ` ` , type = int , aliases : ` ` topk ` ` , constraints : ` ` top_k > 0 ` ` <nl> <nl> - used in ` Voting parallel < . / Parallel - Learning - Guide . rst # choose - appropriate - parallel - algorithm > ` __ <nl> <nl> - set this to larger value for more accurate result , but it will slow down the training speed <nl> <nl> - - ` ` monotone_constraint ` ` , default = \ ` ` None ` ` , type = multi - int , alias = \ ` ` mc ` ` , ` ` monotone_constraints ` ` <nl> + - ` ` monotone_constraints ` ` , default = ` ` None ` ` , type = multi - int , aliases : ` ` mc ` ` , ` ` monotone_constraint ` ` <nl> <nl> - used for constraints of monotonic features <nl> <nl> - ` ` 1 ` ` means increasing , ` ` - 1 ` ` means decreasing , ` ` 0 ` ` means non - constraint <nl> <nl> - - you need to specify all features in order . For example , ` ` mc = - 1 , 0 , 1 ` ` means the decreasing for 1st feature , non - constraint for 2nd feature and increasing for the 3rd feature <nl> + - you need to specify all features in order . For example , ` ` mc = - 1 , 0 , 1 ` ` means decreasing for 1st feature , non - constraint for 2nd feature and increasing for the 3rd feature <nl> + <nl> + - ` ` forcedsplits_filename ` ` , default = ` ` " " ` ` , type = string , aliases : ` ` fs ` ` , ` ` forced_splits_filename ` ` , ` ` forced_splits_file ` ` , ` ` forced_splits ` ` <nl> + <nl> + - path to a ` ` . json ` ` file that specifies splits to force at the top of every decision tree before best - first learning commences <nl> + <nl> + - ` ` . json ` ` file can be arbitrarily nested , and each split contains ` ` feature ` ` , ` ` threshold ` ` fields , as well as ` ` left ` ` and ` ` right ` ` fields representing subsplits <nl> + <nl> + - categorical splits are forced in a one - hot fashion , with ` ` left ` ` representing the split containing the feature value and ` ` right ` ` representing other values <nl> + <nl> + - see ` this file < https : / / github . com / Microsoft / LightGBM / tree / master / examples / binary_classification / forced_splits . json > ` __ as an example <nl> <nl> IO Parameters <nl> mmmmmmmmmmmm - <nl> <nl> - - ` ` max_bin ` ` , default = \ ` ` 255 ` ` , type = int <nl> + - ` ` verbosity ` ` , default = ` ` 1 ` ` , type = int , aliases : ` ` verbose ` ` <nl> + <nl> + - controls the level of LightGBM ' s verbosity <nl> + <nl> + - ` ` < 0 ` ` : Fatal , ` ` = 0 ` ` : Error ( Warn ) , ` ` > 0 ` ` : Info <nl> + <nl> + - ` ` max_bin ` ` , default = ` ` 255 ` ` , type = int , constraints : ` ` max_bin > 1 ` ` <nl> + <nl> + - max number of bins that feature values will be bucketed in <nl> + <nl> + - small number of bins may reduce training accuracy but may increase general power ( deal with over - fitting ) <nl> + <nl> + - LightGBM will auto compress memory according to ` ` max_bin ` ` . For example , LightGBM will use ` ` uint8_t ` ` for feature value if ` ` max_bin = 255 ` ` <nl> + <nl> + - ` ` min_data_in_bin ` ` , default = ` ` 3 ` ` , type = int , constraints : ` ` min_data_in_bin > 0 ` ` <nl> + <nl> + - minimal number of data inside one bin <nl> + <nl> + - use this to avoid one - data - one - bin ( potential over - fitting ) <nl> <nl> - - max number of bins that feature values will be bucketed in . <nl> - Small number of bins may reduce training accuracy but may increase general power ( deal with over - fitting ) <nl> + - ` ` bin_construct_sample_cnt ` ` , default = ` ` 200000 ` ` , type = int , aliases : ` ` subsample_for_bin ` ` , constraints : ` ` bin_construct_sample_cnt > 0 ` ` <nl> <nl> - - LightGBM will auto compress memory according ` ` max_bin ` ` . <nl> - For example , LightGBM will use ` ` uint8_t ` ` for feature value if ` ` max_bin = 255 ` ` <nl> + - number of data that sampled to construct histogram bins <nl> + <nl> + - setting this to larger value will give better training result , but will increase data loading time <nl> + <nl> + - set this to larger value if data is very sparse <nl> + <nl> + - ` ` histogram_pool_size ` ` , default = ` ` - 1 . 0 ` ` , type = double <nl> <nl> - - ` ` min_data_in_bin ` ` , default = \ ` ` 3 ` ` , type = int <nl> + - max cache size in MB for historical histogram <nl> <nl> - - min number of data inside one bin , use this to avoid one - data - one - bin ( may over - fitting ) <nl> + - ` ` < 0 ` ` means no limit <nl> + <nl> + - ` ` data_random_seed ` ` , default = ` ` 1 ` ` , type = int <nl> + <nl> + - random seed for data partition in parallel learning ( excluding the ` ` feature_parallel ` ` mode ) <nl> <nl> - - ` ` data_random_seed ` ` , default = \ ` ` 1 ` ` , type = int <nl> + - ` ` output_model ` ` , default = ` ` LightGBM_model . txt ` ` , type = string , aliases : ` ` model_output ` ` , ` ` model_out ` ` <nl> <nl> - - random seed for data partition in parallel learning ( not include feature parallel ) <nl> + - filename of output model in training <nl> <nl> - - ` ` output_model ` ` , default = \ ` ` LightGBM_model . txt ` ` , type = string , alias = \ ` ` model_output ` ` , ` ` model_out ` ` <nl> + - ` ` snapshot_freq ` ` , default = ` ` - 1 ` ` , type = int <nl> <nl> - - file name of output model in training <nl> + - frequency of saving model file snapshot <nl> <nl> - - ` ` input_model ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` model_input ` ` , ` ` model_in ` ` <nl> + - set this to positive value to enable this function . For example , the model file will be snapshotted at each iteration if ` ` snapshot_freq = 1 ` ` <nl> <nl> - - file name of input model <nl> + - ` ` input_model ` ` , default = ` ` " " ` ` , type = string , aliases : ` ` model_input ` ` , ` ` model_in ` ` <nl> <nl> - - for ` ` prediction ` ` task , this model will be used for prediction data <nl> + - filename of input model <nl> + <nl> + - for ` ` prediction ` ` task , this model will be applied to prediction data <nl> <nl> - for ` ` train ` ` task , training will be continued from this model <nl> <nl> - - ` ` output_result ` ` , default = \ ` ` LightGBM_predict_result . txt ` ` , <nl> - type = string , alias = \ ` ` predict_result ` ` , ` ` prediction_result ` ` <nl> + - * * Note * * : can be used only in CLI version <nl> + <nl> + - ` ` output_result ` ` , default = ` ` LightGBM_predict_result . txt ` ` , type = string , aliases : ` ` predict_result ` ` , ` ` prediction_result ` ` <nl> <nl> - - file name of prediction result in ` ` prediction ` ` task <nl> + - filename of prediction result in ` ` prediction ` ` task <nl> <nl> - - ` ` pre_partition ` ` , default = \ ` ` false ` ` , type = bool , alias = \ ` ` is_pre_partition ` ` <nl> + - ` ` initscore_filename ` ` , default = ` ` " " ` ` , type = string , aliases : ` ` init_score_filename ` ` , ` ` init_score_file ` ` , ` ` init_score ` ` , ` ` input_init_score ` ` <nl> <nl> - - used for parallel learning ( not include feature parallel ) <nl> + - path of file with training initial score <nl> + <nl> + - if ` ` " " ` ` , will use ` ` train_data_file ` ` + ` ` . init ` ` ( if exists ) <nl> + <nl> + - ` ` valid_data_initscores ` ` , default = ` ` " " ` ` , type = string , aliases : ` ` valid_data_init_scores ` ` , ` ` valid_init_score_file ` ` , ` ` valid_init_score ` ` <nl> + <nl> + - path ( s ) of file ( s ) with validation initial score ( s ) <nl> + <nl> + - if ` ` " " ` ` , will use ` ` valid_data_file ` ` + ` ` . init ` ` ( if exists ) <nl> + <nl> + - separate by ` ` , ` ` for multi - validation data <nl> + <nl> + - ` ` pre_partition ` ` , default = ` ` false ` ` , type = bool , aliases : ` ` is_pre_partition ` ` <nl> + <nl> + - used for parallel learning ( excluding the ` ` feature_parallel ` ` mode ) <nl> <nl> - ` ` true ` ` if training data are pre - partitioned , and different machines use different partitions <nl> <nl> - - ` ` is_sparse ` ` , default = \ ` ` true ` ` , type = bool , alias = \ ` ` is_enable_sparse ` ` , ` ` enable_sparse ` ` <nl> + - ` ` enable_bundle ` ` , default = ` ` true ` ` , type = bool , aliases : ` ` is_enable_bundle ` ` , ` ` bundle ` ` <nl> + <nl> + - set this to ` ` false ` ` to disable Exclusive Feature Bundling ( EFB ) , which is described in ` LightGBM : A Highly Efficient Gradient Boosting Decision Tree < https : / / papers . nips . cc / paper / 6907 - lightgbm - a - highly - efficient - gradient - boosting - decision - tree > ` __ <nl> + <nl> + - * * Note * * : disabling this may cause the slow training speed for sparse datasets <nl> + <nl> + - ` ` max_conflict_rate ` ` , default = ` ` 0 . 0 ` ` , type = double , constraints : ` ` 0 . 0 < = max_conflict_rate < 1 . 0 ` ` <nl> + <nl> + - max conflict rate for bundles in EFB <nl> + <nl> + - set this to ` ` 0 . 0 ` ` to disallow the conflict and provide more accurate results <nl> + <nl> + - set this to a larger value to achieve faster speed <nl> + <nl> + - ` ` is_enable_sparse ` ` , default = ` ` true ` ` , type = bool , aliases : ` ` is_sparse ` ` , ` ` enable_sparse ` ` , ` ` sparse ` ` <nl> + <nl> + - used to enable / disable sparse optimization <nl> + <nl> + - ` ` sparse_threshold ` ` , default = ` ` 0 . 8 ` ` , type = double , constraints : ` ` 0 . 0 < sparse_threshold < = 1 . 0 ` ` <nl> + <nl> + - the threshold of zero elements precentage for treating a feature as a sparse one <nl> + <nl> + - ` ` use_missing ` ` , default = ` ` true ` ` , type = bool <nl> + <nl> + - set this to ` ` false ` ` to disable the special handle of missing value <nl> <nl> - - used to enable / disable sparse optimization . Set to ` ` false ` ` to disable sparse optimization <nl> + - ` ` zero_as_missing ` ` , default = ` ` false ` ` , type = bool <nl> <nl> - - ` ` two_round ` ` , default = \ ` ` false ` ` , type = bool , alias = \ ` ` two_round_loading ` ` , ` ` use_two_round_loading ` ` <nl> + - set this to ` ` true ` ` to treat all zero as missing values ( including the unshown values in libsvm / sparse matrics ) <nl> <nl> - - by default , LightGBM will map data file to memory and load features from memory . <nl> - This will provide faster data loading speed . But it may run out of memory when the data file is very big <nl> + - set this to ` ` false ` ` to use ` ` na ` ` for representing missing values <nl> + <nl> + - ` ` two_round ` ` , default = ` ` false ` ` , type = bool , aliases : ` ` two_round_loading ` ` , ` ` use_two_round_loading ` ` <nl> <nl> - set this to ` ` true ` ` if data file is too big to fit in memory <nl> <nl> - - ` ` save_binary ` ` , default = \ ` ` false ` ` , type = bool , alias = \ ` ` is_save_binary ` ` , ` ` is_save_binary_file ` ` <nl> + - by default , LightGBM will map data file to memory and load features from memory . This will provide faster data loading speed , but may cause run out of memory error when the data file is very big <nl> + <nl> + - ` ` save_binary ` ` , default = ` ` false ` ` , type = bool , aliases : ` ` is_save_binary ` ` , ` ` is_save_binary_file ` ` <nl> + <nl> + - if ` ` true ` ` , LightGBM will save the dataset ( including validation data ) to a binary file . This speed ups the data loading for the next time <nl> <nl> - - if ` ` true ` ` LightGBM will save the dataset ( include validation data ) to a binary file . <nl> - Speed up the data loading for the next time <nl> + - ` ` enable_load_from_binary_file ` ` , default = ` ` true ` ` , type = bool , aliases : ` ` load_from_binary_file ` ` , ` ` binary_load ` ` , ` ` load_binary ` ` <nl> <nl> - - ` ` verbosity ` ` , default = \ ` ` 1 ` ` , type = int , alias = \ ` ` verbose ` ` <nl> + - set this to ` ` true ` ` to enable autoloading from previous saved binary datasets <nl> <nl> - - ` ` < 0 ` ` = Fatal , <nl> - ` ` = 0 ` ` = Error ( Warn ) , <nl> - ` ` > 0 ` ` = Info <nl> + - set this to ` ` false ` ` to ignore binary datasets <nl> <nl> - - ` ` header ` ` , default = \ ` ` false ` ` , type = bool , alias = \ ` ` has_header ` ` <nl> + - ` ` header ` ` , default = ` ` false ` ` , type = bool , aliases : ` ` has_header ` ` <nl> <nl> - set this to ` ` true ` ` if input data has header <nl> <nl> - - ` ` label ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` label_column ` ` <nl> + - ` ` label_column ` ` , default = ` ` " " ` ` , type = int or string , aliases : ` ` label ` ` <nl> <nl> - - specify the label column <nl> + - used to specify the label column <nl> <nl> - use number for index , e . g . ` ` label = 0 ` ` means column \ _0 is the label <nl> <nl> - add a prefix ` ` name : ` ` for column name , e . g . ` ` label = name : is_click ` ` <nl> <nl> - - ` ` weight ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` weight_column ` ` <nl> + - ` ` weight_column ` ` , default = ` ` " " ` ` , type = int or string , aliases : ` ` weight ` ` <nl> <nl> - - specify the weight column <nl> + - used to specify the weight column <nl> <nl> - use number for index , e . g . ` ` weight = 0 ` ` means column \ _0 is the weight <nl> <nl> - add a prefix ` ` name : ` ` for column name , e . g . ` ` weight = name : weight ` ` <nl> <nl> - - * * Note * * : index starts from ` ` 0 ` ` . <nl> - And it doesn ' t count the label column when passing type is Index , e . g . when label is column \ _0 , and weight is column \ _1 , the correct parameter is ` ` weight = 0 ` ` <nl> + - * * Note * * : index starts from ` ` 0 ` ` and it doesn ' t count the label column when passing type is ` ` int ` ` , e . g . when label is column \ _0 , and weight is column \ _1 , the correct parameter is ` ` weight = 0 ` ` <nl> <nl> - - ` ` query ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` query_column ` ` , ` ` group ` ` , ` ` group_column ` ` <nl> + - ` ` group_column ` ` , default = ` ` " " ` ` , type = int or string , aliases : ` ` group ` ` , ` ` group_id ` ` , ` ` query_column ` ` , ` ` query ` ` , ` ` query_id ` ` <nl> <nl> - - specify the query / group id column <nl> + - used to specify the query / group id column <nl> <nl> - use number for index , e . g . ` ` query = 0 ` ` means column \ _0 is the query id <nl> <nl> - add a prefix ` ` name : ` ` for column name , e . g . ` ` query = name : query_id ` ` <nl> <nl> - - * * Note * * : data should be grouped by query \ _id . <nl> - Index starts from ` ` 0 ` ` . <nl> - And it doesn ' t count the label column when passing type is Index , e . g . when label is column \ _0 and query \ _id is column \ _1 , the correct parameter is ` ` query = 0 ` ` <nl> + - * * Note * * : data should be grouped by query \ _id <nl> <nl> - - ` ` ignore_column ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` ignore_feature ` ` , ` ` blacklist ` ` <nl> + - * * Note * * : index starts from ` ` 0 ` ` and it doesn ' t count the label column when passing type is ` ` int ` ` , e . g . when label is column \ _0 and query \ _id is column \ _1 , the correct parameter is ` ` query = 0 ` ` <nl> <nl> - - specify some ignoring columns in training <nl> + - ` ` ignore_column ` ` , default = ` ` " " ` ` , type = multi - int or string , aliases : ` ` ignore_feature ` ` , ` ` blacklist ` ` <nl> + <nl> + - used to specify some ignoring columns in training <nl> <nl> - use number for index , e . g . ` ` ignore_column = 0 , 1 , 2 ` ` means column \ _0 , column \ _1 and column \ _2 will be ignored <nl> <nl> IO Parameters <nl> <nl> - * * Note * * : works only in case of loading data directly from file <nl> <nl> - - * * Note * * : index starts from ` ` 0 ` ` . And it doesn ' t count the label column <nl> + - * * Note * * : index starts from ` ` 0 ` ` and it doesn ' t count the label column when passing type is ` ` int ` ` <nl> <nl> - - ` ` categorical_feature ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` categorical_column ` ` , ` ` cat_feature ` ` , ` ` cat_column ` ` <nl> + - ` ` categorical_feature ` ` , default = ` ` " " ` ` , type = multi - int or string , aliases : ` ` cat_feature ` ` , ` ` categorical_column ` ` , ` ` cat_column ` ` <nl> <nl> - - specify categorical features <nl> + - used to specify categorical features <nl> <nl> - use number for index , e . g . ` ` categorical_feature = 0 , 1 , 2 ` ` means column \ _0 , column \ _1 and column \ _2 are categorical features <nl> <nl> - add a prefix ` ` name : ` ` for column name , e . g . ` ` categorical_feature = name : c1 , c2 , c3 ` ` means c1 , c2 and c3 are categorical features <nl> <nl> - - * * Note * * : only supports categorical with ` ` int ` ` type . Index starts from ` ` 0 ` ` . And it doesn ' t count the label column <nl> + - * * Note * * : only supports categorical with ` ` int ` ` type <nl> + <nl> + - * * Note * * : index starts from ` ` 0 ` ` and it doesn ' t count the label column when passing type is ` ` int ` ` <nl> <nl> - * * Note * * : all values should be less than ` ` Int32 . MaxValue ` ` ( 2147483647 ) <nl> <nl> - * * Note * * : the negative values will be treated as * * missing values * * <nl> <nl> - - ` ` predict_raw_score ` ` , default = \ ` ` false ` ` , type = bool , alias = \ ` ` raw_score ` ` , ` ` is_predict_raw_score ` ` , ` ` predict_rawscore ` ` <nl> + - ` ` predict_raw_score ` ` , default = ` ` false ` ` , type = bool , aliases : ` ` is_predict_raw_score ` ` , ` ` predict_rawscore ` ` , ` ` raw_score ` ` <nl> <nl> - - only used in ` ` prediction ` ` task <nl> + - used only in ` ` prediction ` ` task <nl> <nl> - - set to ` ` true ` ` to predict only the raw scores <nl> + - set this to ` ` true ` ` to predict only the raw scores <nl> <nl> - - set to ` ` false ` ` to predict transformed scores <nl> + - set this to ` ` false ` ` to predict transformed scores <nl> <nl> - - ` ` predict_leaf_index ` ` , default = \ ` ` false ` ` , type = bool , alias = \ ` ` leaf_index ` ` , ` ` is_predict_leaf_index ` ` <nl> + - ` ` predict_leaf_index ` ` , default = ` ` false ` ` , type = bool , aliases : ` ` is_predict_leaf_index ` ` , ` ` leaf_index ` ` <nl> <nl> - - only used in ` ` prediction ` ` task <nl> + - used only in ` ` prediction ` ` task <nl> <nl> - - set to ` ` true ` ` to predict with leaf index of all trees <nl> + - set this to ` ` true ` ` to predict with leaf index of all trees <nl> <nl> - - ` ` predict_contrib ` ` , default = \ ` ` false ` ` , type = bool , alias = \ ` ` contrib ` ` , ` ` is_predict_contrib ` ` <nl> + - ` ` predict_contrib ` ` , default = ` ` false ` ` , type = bool , aliases : ` ` is_predict_contrib ` ` , ` ` contrib ` ` <nl> <nl> - - only used in ` ` prediction ` ` task <nl> + - used only in ` ` prediction ` ` task <nl> <nl> - - set to ` ` true ` ` to estimate ` SHAP values ` _ , which represent how each feature contributs to each prediction . <nl> - Produces number of features + 1 values where the last value is the expected value of the model output over the training data <nl> + - set this to ` ` true ` ` to estimate ` SHAP values < https : / / arxiv . org / abs / 1706 . 06060 > ` __ , which represent how each feature contributs to each prediction <nl> <nl> - - ` ` bin_construct_sample_cnt ` ` , default = \ ` ` 200000 ` ` , type = int , alias = \ ` ` subsample_for_bin ` ` <nl> + - produces ` ` # features + 1 ` ` values where the last value is the expected value of the model output over the training data <nl> <nl> - - number of data that sampled to construct histogram bins <nl> + - ` ` num_iteration_predict ` ` , default = ` ` - 1 ` ` , type = int <nl> <nl> - - will give better training result when set this larger , but will increase data loading time <nl> + - used only in ` ` prediction ` ` task <nl> <nl> - - set this to larger value if data is very sparse <nl> + - used to specify how many trained iterations will be used in prediction <nl> <nl> - - ` ` num_iteration_predict ` ` , default = \ ` ` - 1 ` ` , type = int <nl> + - ` ` < = 0 ` ` means no limit <nl> <nl> - - only used in ` ` prediction ` ` task <nl> - - use to specify how many trained iterations will be used in prediction <nl> + - ` ` pred_early_stop ` ` , default = ` ` false ` ` , type = bool <nl> <nl> - - ` ` < = 0 ` ` means no limit <nl> + - used only in ` ` prediction ` ` task <nl> <nl> - - ` ` pred_early_stop ` ` , default = \ ` ` false ` ` , type = bool <nl> + - if ` ` true ` ` , will use early - stopping to speed up the prediction . May affect the accuracy <nl> <nl> - - if ` ` true ` ` will use early - stopping to speed up the prediction . May affect the accuracy <nl> + - ` ` pred_early_stop_freq ` ` , default = ` ` 10 ` ` , type = int <nl> <nl> - - ` ` pred_early_stop_freq ` ` , default = \ ` ` 10 ` ` , type = int <nl> + - used only in ` ` prediction ` ` task <nl> <nl> - the frequency of checking early - stopping prediction <nl> <nl> - - ` ` pred_early_stop_margin ` ` , default = \ ` ` 10 . 0 ` ` , type = double <nl> + - ` ` pred_early_stop_margin ` ` , default = ` ` 10 . 0 ` ` , type = double <nl> + <nl> + - used only in ` ` prediction ` ` task <nl> <nl> - the threshold of margin in early - stopping prediction <nl> <nl> - - ` ` use_missing ` ` , default = \ ` ` true ` ` , type = bool <nl> + - ` ` convert_model_language ` ` , default = ` ` " " ` ` , type = string <nl> <nl> - - set to ` ` false ` ` to disable the special handle of missing value <nl> + - used only in ` ` convert_model ` ` task <nl> <nl> - - ` ` zero_as_missing ` ` , default = \ ` ` false ` ` , type = bool <nl> + - only ` ` cpp ` ` is supported yet <nl> <nl> - - set to ` ` true ` ` to treat all zero as missing values ( including the unshown values in libsvm / sparse matrics ) <nl> + - if ` ` convert_model_language ` ` is set and ` ` task = train ` ` , the model will be also converted <nl> <nl> - - set to ` ` false ` ` to use ` ` na ` ` to represent missing values <nl> + - ` ` convert_model ` ` , default = ` ` gbdt_prediction . cpp ` ` , type = string , aliases : ` ` convert_model_file ` ` <nl> <nl> - - ` ` init_score_file ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` init_score_filename ` ` , ` ` initscore_filename ` ` , ` ` init_score ` ` <nl> + - used only in ` ` convert_model ` ` task <nl> <nl> - - path to training initial score file , ` ` " " ` ` will use ` ` train_data_file ` ` + ` ` . init ` ` ( if exists ) <nl> + - output filename of converted model <nl> <nl> - - ` ` valid_init_score_file ` ` , default = \ ` ` " " ` ` , type = multi - string , alias = \ ` ` valid_data_initscores ` ` , ` ` valid_data_init_scores ` ` , ` ` valid_init_score ` ` <nl> + Objective Parameters <nl> + mmmmmmmmmmmmmmmmmm - - <nl> <nl> - - path to validation initial score file , ` ` " " ` ` will use ` ` valid_data_file ` ` + ` ` . init ` ` ( if exists ) <nl> + - ` ` num_class ` ` , default = ` ` 1 ` ` , type = int , aliases : ` ` num_classes ` ` , constraints : ` ` num_class > 0 ` ` <nl> <nl> - - separate by ` ` , ` ` for multi - validation data <nl> + - used only in ` ` multi - class ` ` classification application <nl> <nl> - - ` ` forced_splits ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` forced_splits_file ` ` , ` ` forcedsplits_filename ` ` , ` ` forced_splits_filename ` ` <nl> + - ` ` is_unbalance ` ` , default = ` ` false ` ` , type = bool , aliases : ` ` unbalanced_sets ` ` <nl> <nl> - - path to a ` ` . json ` ` file that specifies splits to force at the top of every decision tree before best - first learning commences <nl> + - used only in ` ` binary ` ` application <nl> <nl> - - ` ` . json ` ` file can be arbitrarily nested , and each split contains ` ` feature ` ` , ` ` threshold ` ` fields , as well as ` ` left ` ` and ` ` right ` ` <nl> - fields representing subsplits . Categorical splits are forced in a one - hot fashion , with ` ` left ` ` representing the split containing <nl> - the feature value and ` ` right ` ` representing other values <nl> + - set this to ` ` true ` ` if training data are unbalance <nl> <nl> - - see ` this file < https : / / github . com / Microsoft / LightGBM / tree / master / examples / binary_classification / forced_splits . json > ` __ as an example <nl> + - * * Note * * : this parameter cannot be used at the same time with ` ` scale_pos_weight ` ` , choose only * * one * * of them <nl> <nl> - Objective Parameters <nl> mmmmmmmmmmmmmmmmmmmmm <nl> + - ` ` scale_pos_weight ` ` , default = ` ` 1 . 0 ` ` , type = double , constraints : ` ` scale_pos_weight > 0 . 0 ` ` <nl> <nl> - - ` ` sigmoid ` ` , default = \ ` ` 1 . 0 ` ` , type = double <nl> + - used only in ` ` binary ` ` application <nl> <nl> - - parameter for sigmoid function . Will be used in ` ` binary ` ` and ` ` multiclassova ` ` classification and in ` ` lambdarank ` ` <nl> + - weight of labels with positive class <nl> <nl> - - ` ` alpha ` ` , default = \ ` ` 0 . 9 ` ` , type = double <nl> + - * * Note * * : this parameter cannot be used at the same time with ` ` is_unbalance ` ` , choose only * * one * * of them <nl> <nl> - - parameter for ` Huber loss ` _ and ` Quantile regression ` _ . Will be used in ` ` regression ` ` task <nl> + - ` ` sigmoid ` ` , default = ` ` 1 . 0 ` ` , type = double , constraints : ` ` sigmoid > 0 . 0 ` ` <nl> <nl> - - ` ` fair_c ` ` , default = \ ` ` 1 . 0 ` ` , type = double <nl> + - used only in ` ` binary ` ` and ` ` multiclassova ` ` classification and in ` ` lambdarank ` ` applications <nl> <nl> - - parameter for ` Fair loss ` _ . Will be used in ` ` regression ` ` task <nl> + - parameter for the sigmoid function <nl> <nl> - - ` ` poisson_max_delta_step ` ` , default = \ ` ` 0 . 7 ` ` , type = double <nl> + - ` ` boost_from_average ` ` , default = ` ` true ` ` , type = bool <nl> <nl> - - parameter for ` Poisson regression ` _ to safeguard optimization <nl> + - used only in ` ` regression ` ` , ` ` binary ` ` and ` ` cross - entropy ` ` applications <nl> <nl> - - ` ` scale_pos_weight ` ` , default = \ ` ` 1 . 0 ` ` , type = double <nl> + - adjusts initial score to the mean of labels for faster convergence <nl> <nl> - - weight of positive class in ` ` binary ` ` classification task <nl> + - ` ` reg_sqrt ` ` , default = ` ` false ` ` , type = bool <nl> <nl> - - ` ` boost_from_average ` ` , default = \ ` ` true ` ` , type = bool <nl> + - used only in ` ` regression ` ` application <nl> <nl> - - used only in ` ` regression ` ` , ` ` binary ` ` , and ` ` xentropy ` ` tasks ( others may get added ) <nl> + - used to fit ` ` sqrt ( label ) ` ` instead of original values and prediction result will be also automatically converted to ` ` prediction ^ 2 ` ` <nl> <nl> - - adjust initial score to the mean of labels for faster convergence <nl> + - might be useful in case of large - range labels <nl> <nl> - - ` ` is_unbalance ` ` , default = \ ` ` false ` ` , type = bool , alias = \ ` ` unbalanced_sets ` ` <nl> + - ` ` alpha ` ` , default = ` ` 0 . 9 ` ` , type = double , constraints : ` ` 0 . 0 < alpha < 1 . 0 ` ` <nl> <nl> - - used in ` ` binary ` ` classification <nl> - <nl> - - set this to ` ` true ` ` if training data are unbalance <nl> + - used only in ` ` huber ` ` and ` ` quantile ` ` ` ` regression ` ` applications <nl> <nl> - - ` ` max_position ` ` , default = \ ` ` 20 ` ` , type = int <nl> + - parameter for ` Huber loss < https : / / en . wikipedia . org / wiki / Huber_loss > ` __ and ` Quantile regression < https : / / en . wikipedia . org / wiki / Quantile_regression > ` __ <nl> <nl> - - used in ` ` lambdarank ` ` <nl> + - ` ` fair_c ` ` , default = ` ` 1 . 0 ` ` , type = double , constraints : ` ` fair_c > 0 . 0 ` ` <nl> <nl> - - will optimize ` NDCG ` _ at this position <nl> + - used only in ` ` fair ` ` ` ` regression ` ` application <nl> <nl> - - ` ` label_gain ` ` , default = \ ` ` 0 , 1 , 3 , 7 , 15 , 31 , 63 , . . . , 2 ^ 30 - 1 ` ` , type = multi - double <nl> + - parameter for ` Fair loss < https : / / www . kaggle . com / c / allstate - claims - severity / discussion / 24520 > ` __ <nl> <nl> - - used in ` ` lambdarank ` ` <nl> + - ` ` poisson_max_delta_step ` ` , default = ` ` 0 . 7 ` ` , type = double , constraints : ` ` poisson_max_delta_step > 0 . 0 ` ` <nl> <nl> - - relevant gain for labels . For example , the gain of label ` ` 2 ` ` is ` ` 3 ` ` if using default label gains <nl> + - used only in ` ` poisson ` ` ` ` regression ` ` application <nl> <nl> - - separate by ` ` , ` ` <nl> + - parameter for ` Poisson regression < https : / / en . wikipedia . org / wiki / Poisson_regression > ` __ to safeguard optimization <nl> + <nl> + - ` ` tweedie_variance_power ` ` , default = ` ` 1 . 5 ` ` , type = double , constraints : ` ` 1 . 0 < = tweedie_variance_power < 2 . 0 ` ` <nl> + <nl> + - used only in ` ` tweedie ` ` ` ` regression ` ` application <nl> + <nl> + - used to control the variance of the tweedie distribution <nl> + <nl> + - set this closer to ` ` 2 ` ` to shift towards a * * Gamma * * distribution <nl> <nl> - - ` ` num_class ` ` , default = \ ` ` 1 ` ` , type = int , alias = \ ` ` num_classes ` ` <nl> + - set this closer to ` ` 1 ` ` to shift towards a * * Poisson * * distribution <nl> <nl> - - only used in multi - class classification <nl> + - ` ` max_position ` ` , default = ` ` 20 ` ` , type = int , constraints : ` ` max_position > 0 ` ` <nl> <nl> - - ` ` reg_sqrt ` ` , default = \ ` ` false ` ` , type = bool <nl> + - used only in ` ` lambdarank ` ` application <nl> <nl> - - only used in ` ` regression ` ` <nl> + - optimizes ` NDCG < https : / / en . wikipedia . org / wiki / Discounted_cumulative_gain # Normalized_DCG > ` __ at this position <nl> <nl> - - will fit ` ` sqrt ( label ) ` ` instead and prediction result will be also automatically converted to ` ` pow2 ( prediction ) ` ` <nl> + - ` ` label_gain ` ` , default = ` ` 0 , 1 , 3 , 7 , 15 , 31 , 63 , . . . , 2 ^ 30 - 1 ` ` , type = multi - double <nl> <nl> - - ` ` tweedie_variance_power ` ` , default = \ ` ` 1 . 5 ` ` , type = \ ` ` double ` ` , range = \ ` ` [ 1 , 2 ) ` ` <nl> + - used only in ` ` lambdarank ` ` application <nl> <nl> - - only used in ` ` tweedie ` ` regression <nl> + - relevant gain for labels . For example , the gain of label ` ` 2 ` ` is ` ` 3 ` ` in case of default label gains <nl> <nl> - - controls the variance of the tweedie distribution <nl> - <nl> - - set closer to 2 to shift towards a gamma distribution <nl> - <nl> - - set closer to 1 to shift towards a poisson distribution <nl> + - separate by ` ` , ` ` <nl> <nl> Metric Parameters <nl> mmmmmmmmmmmmmmm - - <nl> <nl> - - ` ` metric ` ` , default = \ ` ` ' ' ` ` , type = multi - enum , alias = \ ` ` metric_types ` ` <nl> - <nl> - - metric to be evaluated on the evaluation sets * * in addition * * to what is provided in the training arguments <nl> - <nl> - - ` ` ' ' ` ` ( empty string or not specific ) , metric corresponding to specified objective will be used <nl> - ( this is possible only for pre - defined objective functions , otherwise no evaluation metric will be added ) <nl> - <nl> - - ` ` ' None ' ` ` ( string , * * not * * a ` ` None ` ` value ) , no metric registered , alias = \ ` ` na ` ` <nl> - <nl> - - ` ` l1 ` ` , absolute loss , alias = \ ` ` mean_absolute_error ` ` , ` ` mae ` ` , ` ` regression_l1 ` ` <nl> - <nl> - - ` ` l2 ` ` , square loss , alias = \ ` ` mean_squared_error ` ` , ` ` mse ` ` , ` ` regression_l2 ` ` , ` ` regression ` ` <nl> - <nl> - - ` ` l2_root ` ` , root square loss , alias = \ ` ` root_mean_squared_error ` ` , ` ` rmse ` ` <nl> - <nl> - - ` ` quantile ` ` , ` Quantile regression ` _ <nl> - <nl> - - ` ` mape ` ` , ` MAPE loss ` _ , alias = \ ` ` mean_absolute_percentage_error ` ` <nl> - <nl> - - ` ` huber ` ` , ` Huber loss ` _ <nl> - <nl> - - ` ` fair ` ` , ` Fair loss ` _ <nl> - <nl> - - ` ` poisson ` ` , negative log - likelihood for ` Poisson regression ` _ <nl> - <nl> - - ` ` gamma ` ` , negative log - likelihood for Gamma regression <nl> - <nl> - - ` ` gamma_deviance ` ` , residual deviance for Gamma regression <nl> - <nl> - - ` ` tweedie ` ` , negative log - likelihood for Tweedie regression <nl> - <nl> - - ` ` ndcg ` ` , ` NDCG ` _ <nl> - <nl> - - ` ` map ` ` , ` MAP ` _ , alias = \ ` ` mean_average_precision ` ` <nl> - <nl> - - ` ` auc ` ` , ` AUC ` _ <nl> - <nl> - - ` ` binary_logloss ` ` , ` log loss ` _ , alias = \ ` ` binary ` ` <nl> - <nl> + - ` ` metric ` ` , default = ` ` " " ` ` , type = multi - enum , aliases : ` ` metrics ` ` , ` ` metric_types ` ` <nl> + <nl> + - metric ( s ) to be evaluated on the evaluation sets * * in addition * * to what is provided in the training arguments <nl> + <nl> + - ` ` " " ` ` ( empty string or not specific ) means that metric corresponding to specified ` ` objective ` ` will be used ( this is possible only for pre - defined objective functions , otherwise no evaluation metric will be added ) <nl> + <nl> + - ` ` " None " ` ` ( string , * * not * * a ` ` None ` ` value ) means that no metric will be registered , aliases : ` ` na ` ` <nl> + <nl> + - ` ` l1 ` ` , absolute loss , aliases : ` ` mean_absolute_error ` ` , ` ` mae ` ` , ` ` regression_l1 ` ` <nl> + <nl> + - ` ` l2 ` ` , square loss , aliases : ` ` mean_squared_error ` ` , ` ` mse ` ` , ` ` regression_l2 ` ` , ` ` regression ` ` <nl> + <nl> + - ` ` l2_root ` ` , root square loss , aliases : ` ` root_mean_squared_error ` ` , ` ` rmse ` ` <nl> + <nl> + - ` ` quantile ` ` , ` Quantile regression < https : / / en . wikipedia . org / wiki / Quantile_regression > ` __ <nl> + <nl> + - ` ` mape ` ` , ` MAPE loss < https : / / en . wikipedia . org / wiki / Mean_absolute_percentage_error > ` __ , aliases : ` ` mean_absolute_percentage_error ` ` <nl> + <nl> + - ` ` huber ` ` , ` Huber loss < https : / / en . wikipedia . org / wiki / Huber_loss > ` __ <nl> + <nl> + - ` ` fair ` ` , ` Fair loss < https : / / www . kaggle . com / c / allstate - claims - severity / discussion / 24520 > ` __ <nl> + <nl> + - ` ` poisson ` ` , negative log - likelihood for ` Poisson regression < https : / / en . wikipedia . org / wiki / Poisson_regression > ` __ <nl> + <nl> + - ` ` gamma ` ` , negative log - likelihood for * * Gamma * * regression <nl> + <nl> + - ` ` gamma_deviance ` ` , residual deviance for * * Gamma * * regression <nl> + <nl> + - ` ` tweedie ` ` , negative log - likelihood for * * Tweedie * * regression <nl> + <nl> + - ` ` ndcg ` ` , ` NDCG < https : / / en . wikipedia . org / wiki / Discounted_cumulative_gain # Normalized_DCG > ` __ <nl> + <nl> + - ` ` map ` ` , ` MAP < https : / / makarandtapaswi . wordpress . com / 2012 / 07 / 02 / intuition - behind - average - precision - and - map / > ` __ , aliases : ` ` mean_average_precision ` ` <nl> + <nl> + - ` ` auc ` ` , ` AUC < https : / / en . wikipedia . org / wiki / Receiver_operating_characteristic # Area_under_the_curve > ` __ <nl> + <nl> + - ` ` binary_logloss ` ` , ` log loss < https : / / en . wikipedia . org / wiki / Cross_entropy > ` __ , aliases : ` ` binary ` ` <nl> + <nl> - ` ` binary_error ` ` , for one sample : ` ` 0 ` ` for correct classification , ` ` 1 ` ` for error classification <nl> - <nl> - - ` ` multi_logloss ` ` , log loss for mulit - class classification , alias = \ ` ` multiclass ` ` , ` ` softmax ` ` , ` ` multiclassova ` ` , ` ` multiclass_ova ` ` , ` ` ova ` ` , ` ` ovr ` ` <nl> - <nl> - - ` ` multi_error ` ` , error rate for mulit - class classification <nl> - <nl> - - ` ` xentropy ` ` , cross - entropy ( with optional linear weights ) , alias = \ ` ` cross_entropy ` ` <nl> - <nl> - - ` ` xentlambda ` ` , " intensity - weighted " cross - entropy , alias = \ ` ` cross_entropy_lambda ` ` <nl> - <nl> - - ` ` kldiv ` ` , ` Kullback - Leibler divergence ` _ , alias = \ ` ` kullback_leibler ` ` <nl> + <nl> + - ` ` multi_logloss ` ` , log loss for multi - class classification , aliases : ` ` multiclass ` ` , ` ` softmax ` ` , ` ` multiclassova ` ` , ` ` multiclass_ova ` ` , ` ` ova ` ` , ` ` ovr ` ` <nl> + <nl> + - ` ` multi_error ` ` , error rate for multi - class classification <nl> + <nl> + - ` ` xentropy ` ` , cross - entropy ( with optional linear weights ) , aliases : ` ` cross_entropy ` ` <nl> + <nl> + - ` ` xentlambda ` ` , " intensity - weighted " cross - entropy , aliases : ` ` cross_entropy_lambda ` ` <nl> + <nl> + - ` ` kldiv ` ` , ` Kullback - Leibler divergence < https : / / en . wikipedia . org / wiki / Kullback % E2 % 80 % 93Leibler_divergence > ` __ , aliases : ` ` kullback_leibler ` ` <nl> <nl> - support multiple metrics , separated by ` ` , ` ` <nl> <nl> - - ` ` metric_freq ` ` , default = \ ` ` 1 ` ` , type = int , alias = \ ` ` output_freq ` ` <nl> + - ` ` metric_freq ` ` , default = ` ` 1 ` ` , type = int , aliases : ` ` output_freq ` ` , constraints : ` ` metric_freq > 0 ` ` <nl> <nl> - frequency for metric output <nl> <nl> - - ` ` train_metric ` ` , default = \ ` ` false ` ` , type = bool , alias = \ ` ` training_metric ` ` , ` ` is_training_metric ` ` , ` ` is_provide_training_metric ` ` <nl> + - ` ` is_provide_training_metric ` ` , default = ` ` false ` ` , type = bool , aliases : ` ` training_metric ` ` , ` ` is_training_metric ` ` , ` ` train_metric ` ` <nl> <nl> - - set this to ` ` true ` ` if you need to output metric result of training <nl> + - set this to ` ` true ` ` to output metric result over training dataset <nl> <nl> - - ` ` ndcg_at ` ` , default = \ ` ` 1 , 2 , 3 , 4 , 5 ` ` , type = multi - int , alias = \ ` ` ndcg_eval_at ` ` , ` ` eval_at ` ` <nl> + - ` ` eval_at ` ` , default = ` ` 1 , 2 , 3 , 4 , 5 ` ` , type = multi - int , aliases : ` ` ndcg_eval_at ` ` , ` ` ndcg_at ` ` <nl> <nl> - - ` NDCG ` _ evaluation positions , separated by ` ` , ` ` <nl> + - used only with ` ` ndcg ` ` and ` ` map ` ` metrics <nl> + <nl> + - ` NDCG < https : / / en . wikipedia . org / wiki / Discounted_cumulative_gain # Normalized_DCG > ` __ evaluation positions , separated by ` ` , ` ` <nl> <nl> Network Parameters <nl> mmmmmmmmmmmmmmmmmm <nl> <nl> - Following parameters are used for parallel learning , and only used for base ( socket ) version . <nl> - <nl> - - ` ` num_machines ` ` , default = \ ` ` 1 ` ` , type = int , alias = \ ` ` num_machine ` ` <nl> + - ` ` num_machines ` ` , default = ` ` 1 ` ` , type = int , aliases : ` ` num_machine ` ` , constraints : ` ` num_machines > 0 ` ` <nl> <nl> - - used for parallel learning , the number of machines for parallel learning application <nl> + - the number of machines for parallel learning application <nl> <nl> - - need to set this in both socket and mpi versions <nl> + - this parameter is needed to be set in both * * socket * * and * * mpi * * versions <nl> <nl> - - ` ` local_listen_port ` ` , default = \ ` ` 12400 ` ` , type = int , alias = \ ` ` local_port ` ` <nl> + - ` ` local_listen_port ` ` , default = ` ` 12400 ` ` , type = int , aliases : ` ` local_port ` ` , ` ` port ` ` , constraints : ` ` local_listen_port > 0 ` ` <nl> <nl> - TCP listen port for local machines <nl> <nl> - - you should allow this port in firewall settings before training <nl> + - * * Note * * : don ' t forget to allow this port in firewall settings before training <nl> <nl> - - ` ` time_out ` ` , default = \ ` ` 120 ` ` , type = int <nl> + - ` ` time_out ` ` , default = ` ` 120 ` ` , type = int , constraints : ` ` time_out > 0 ` ` <nl> <nl> - socket time - out in minutes <nl> <nl> - - ` ` machine_list_file ` ` , default = \ ` ` " " ` ` , type = string , alias = \ ` ` mlist ` ` <nl> + - ` ` machine_list_filename ` ` , default = ` ` " " ` ` , type = string , aliases : ` ` machine_list_file ` ` , ` ` machine_list ` ` , ` ` mlist ` ` <nl> + <nl> + - path of file that lists machines for this parallel learning application <nl> <nl> - - file that lists machines for this parallel learning application <nl> + - each line contains one IP and one port for one machine . The format is ` ` ip port ` ` ( space as a separator ) <nl> <nl> - - each line contains one IP and one port for one machine . The format is ` ` ip port ` ` , separate by space <nl> + - ` ` machines ` ` , default = ` ` " " ` ` , type = string , aliases : ` ` workers ` ` , ` ` nodes ` ` <nl> + <nl> + - list of machines in the following format : ` ` ip1 : port1 , ip2 : port2 ` ` <nl> <nl> GPU Parameters <nl> mmmmmmmmmmmm - - <nl> <nl> - - ` ` gpu_platform_id ` ` , default = \ ` ` - 1 ` ` , type = int <nl> + - ` ` gpu_platform_id ` ` , default = ` ` - 1 ` ` , type = int <nl> <nl> - OpenCL platform ID . Usually each GPU vendor exposes one OpenCL platform <nl> <nl> - - default value is ` ` - 1 ` ` , means the system - wide default platform <nl> + - ` ` - 1 ` ` means the system - wide default platform <nl> <nl> - - ` ` gpu_device_id ` ` , default = \ ` ` - 1 ` ` , type = int <nl> + - ` ` gpu_device_id ` ` , default = ` ` - 1 ` ` , type = int <nl> <nl> - OpenCL device ID in the specified platform . Each GPU in the selected platform has a unique device ID <nl> <nl> - - default value is ` ` - 1 ` ` , means the default device in the selected platform <nl> - <nl> - - ` ` gpu_use_dp ` ` , default = \ ` ` false ` ` , type = bool <nl> - <nl> - - set to ` ` true ` ` to use double precision math on GPU ( default using single precision ) <nl> - <nl> - Convert Model Parameters <nl> mmmmmmmmmmmmmmmmmmmmmmmm - <nl> - <nl> - This feature is only supported in command line version yet . <nl> - <nl> - - ` ` convert_model_language ` ` , default = \ ` ` " " ` ` , type = string <nl> - <nl> - - only ` ` cpp ` ` is supported yet <nl> + - ` ` - 1 ` ` means the default device in the selected platform <nl> <nl> - - if ` ` convert_model_language ` ` is set when ` ` task ` ` is set to ` ` train ` ` , the model will also be converted <nl> + - ` ` gpu_use_dp ` ` , default = ` ` false ` ` , type = bool <nl> <nl> - - ` ` convert_model ` ` , default = \ ` ` " gbdt_prediction . cpp " ` ` , type = string <nl> - <nl> - - output file name of converted model <nl> + - set this to ` ` true ` ` to use double precision math on GPU ( by default single precision is used ) <nl> <nl> . . end params list <nl> <nl> In this case LightGBM will load the query file automatically if it exists . <nl> Also , you can include query / group id column in your data file . Please refer to parameter ` ` group ` ` in above . <nl> <nl> . . _Laurae + + Interactive Documentation : https : / / sites . google . com / view / lauraepp / parameters <nl> - <nl> - . . _Huber loss : https : / / en . wikipedia . org / wiki / Huber_loss <nl> - <nl> - . . _Quantile regression : https : / / en . wikipedia . org / wiki / Quantile_regression <nl> - <nl> - . . _MAPE loss : https : / / en . wikipedia . org / wiki / Mean_absolute_percentage_error <nl> - <nl> - . . _Fair loss : https : / / www . kaggle . com / c / allstate - claims - severity / discussion / 24520 <nl> - <nl> - . . _Poisson regression : https : / / en . wikipedia . org / wiki / Poisson_regression <nl> - <nl> - . . _lambdarank : https : / / papers . nips . cc / paper / 2971 - learning - to - rank - with - nonsmooth - cost - functions . pdf <nl> - <nl> - . . _Dropouts meet Multiple Additive Regression Trees : https : / / arxiv . org / abs / 1505 . 01866 <nl> - <nl> - . . _hyper - threading : https : / / en . wikipedia . org / wiki / Hyper - threading <nl> - <nl> - . . _SHAP values : https : / / arxiv . org / abs / 1706 . 06060 <nl> - <nl> - . . _NDCG : https : / / en . wikipedia . org / wiki / Discounted_cumulative_gain # Normalized_DCG <nl> - <nl> - . . _MAP : https : / / makarandtapaswi . wordpress . com / 2012 / 07 / 02 / intuition - behind - average - precision - and - map / <nl> - <nl> - . . _AUC : https : / / en . wikipedia . org / wiki / Receiver_operating_characteristic # Area_under_the_curve <nl> - <nl> - . . _log loss : https : / / en . wikipedia . org / wiki / Cross_entropy <nl> - <nl> - . . _softmax : https : / / en . wikipedia . org / wiki / Softmax_function <nl> - <nl> - . . _One - vs - All : https : / / en . wikipedia . org / wiki / Multiclass_classification # One - vs . - rest <nl> - <nl> - . . _Kullback - Leibler divergence : https : / / en . wikipedia . org / wiki / Kullback % E2 % 80 % 93Leibler_divergence <nl> - <nl> - . . _gamma - distributed : https : / / en . wikipedia . org / wiki / Gamma_distribution # Applications <nl> - <nl> - . . _tweedie - distributed : https : / / en . wikipedia . org / wiki / Tweedie_distribution # Applications <nl> mmm a / docs / README . rst <nl> ppp b / docs / README . rst <nl> Documentation <nl> <nl> Documentation for LightGBM is generated using ` Sphinx < http : / / www . sphinx - doc . org / > ` __ . <nl> <nl> - List of parameters and their descriptions in ` Parameters . rst < https : / / github . com / Microsoft / LightGBM / blob / master / docs / Parameters . rst > ` __ <nl> + List of parameters and their descriptions in ` Parameters . rst < . / Parameters . rst > ` __ <nl> is generated automatically from comments in ` config file < https : / / github . com / Microsoft / LightGBM / blob / master / include / LightGBM / config . h > ` __ <nl> by ` this script < https : / / github . com / Microsoft / LightGBM / blob / master / helper / parameter_generator . py > ` __ . <nl> <nl> mmm a / helper / parameter_generator . py <nl> ppp b / helper / parameter_generator . py <nl> def GetParameterInfos ( config_hpp ) : <nl> elif cur_key is not None : <nl> line = line . strip ( ) <nl> if line . startswith ( " / / " ) : <nl> - tokens = line [ 2 : ] . split ( " = " ) <nl> - key = tokens [ 0 ] . strip ( ) <nl> - val = ' = ' . join ( tokens [ 1 : ] ) . strip ( ) <nl> + key , _ , val = line [ 2 : ] . partition ( " = " ) <nl> + key = key . strip ( ) <nl> + val = val . strip ( ) <nl> if key not in cur_info : <nl> - if key = = " descl2 " : <nl> + if key = = " descl2 " and " desc " not in cur_info : <nl> cur_info [ " desc " ] = [ ] <nl> - else : <nl> + elif key ! = " descl2 " : <nl> cur_info [ key ] = [ ] <nl> if key = = " desc " : <nl> - cur_info [ " desc " ] . append ( [ " l1 " , val ] ) <nl> + cur_info [ " desc " ] . append ( ( " l1 " , val ) ) <nl> elif key = = " descl2 " : <nl> - cur_info [ " desc " ] . append ( [ " l2 " , val ] ) <nl> + cur_info [ " desc " ] . append ( ( " l2 " , val ) ) <nl> else : <nl> cur_info [ key ] . append ( val ) <nl> elif line : <nl> def GetAlias ( infos ) : <nl> name = y [ " name " ] [ 0 ] <nl> alias = y [ " alias " ] [ 0 ] . split ( ' , ' ) <nl> for name2 in alias : <nl> - pairs . append ( [ name2 . strip ( ) , name ] ) <nl> + pairs . append ( ( name2 . strip ( ) , name ) ) <nl> return pairs <nl> <nl> <nl> - def SetOneVarFromString ( name , type , checks ) : <nl> + def SetOneVarFromString ( name , param_type , checks ) : <nl> ret = " " <nl> univar_mapper = { " int " : " GetInt " , " double " : " GetDouble " , " bool " : " GetBool " , " std : : string " : " GetString " } <nl> - if " vector " not in type : <nl> - ret + = " % s ( params , \ " % s \ " , & % s ) ; \ n " % ( univar_mapper [ type ] , name , name ) <nl> + if " vector " not in param_type : <nl> + ret + = " % s ( params , \ " % s \ " , & % s ) ; \ n " % ( univar_mapper [ param_type ] , name , name ) <nl> if len ( checks ) > 0 : <nl> for check in checks : <nl> ret + = " CHECK ( % s % s ) ; \ n " % ( name , check ) <nl> ret + = " \ n " <nl> else : <nl> ret + = " if ( GetString ( params , \ " % s \ " , & tmp_str ) ) { \ n " % ( name ) <nl> - type2 = type . split ( " < " ) [ 1 ] [ : - 1 ] <nl> + type2 = param_type . split ( " < " ) [ 1 ] [ : - 1 ] <nl> if type2 = = " std : : string " : <nl> ret + = " % s = Common : : Split ( tmp_str . c_str ( ) , ' , ' ) ; \ n " % ( name ) <nl> else : <nl> def parse_check ( check , reverse = False ) : <nl> if checks_len > 1 : <nl> number1 , sign1 = parse_check ( checks [ 0 ] ) <nl> number2 , sign2 = parse_check ( checks [ 1 ] , reverse = True ) <nl> - checks_str = ' , ` ` { 0 } { 1 } { 2 } { 3 } { 4 } ` ` ' . format ( number2 , sign2 , name , sign1 , number1 ) <nl> + checks_str = ' , constraints : ` ` { 0 } { 1 } { 2 } { 3 } { 4 } ` ` ' . format ( number2 , sign2 , name , sign1 , number1 ) <nl> elif checks_len = = 1 : <nl> number , sign = parse_check ( checks [ 0 ] ) <nl> - checks_str = ' , ` ` { 0 } { 1 } { 2 } ` ` ' . format ( name , sign , number ) <nl> + checks_str = ' , constraints : ` ` { 0 } { 1 } { 2 } ` ` ' . format ( name , sign , number ) <nl> else : <nl> checks_str = ' ' <nl> main_desc = ' - ` ` { 0 } ` ` , default = ` ` { 1 } ` ` , type = { 2 } { 3 } { 4 } { 5 } ' . format ( name , default , param_type , options_str , aliases_str , checks_str ) <nl> def GenParameterCode ( config_hpp , config_out_cpp ) : <nl> # alias table <nl> str_to_write + = " std : : unordered_map < std : : string , std : : string > Config : : alias_table ( { \ n " <nl> for pair in alias : <nl> - str_to_write + = " { \ " % s \ " , \ " % s \ " } , \ n " % ( pair [ 0 ] , pair [ 1 ] ) <nl> + str_to_write + = " { \ " % s \ " , \ " % s \ " } , \ n " % ( pair [ 0 ] , pair [ 1 ] ) <nl> str_to_write + = " } ) ; \ n \ n " <nl> # names <nl> str_to_write + = " std : : unordered_set < std : : string > Config : : parameter_set ( { \ n " <nl> for name in names : <nl> - str_to_write + = " \ " % s \ " , \ n " % ( name ) <nl> + str_to_write + = " \ " % s \ " , \ n " % ( name ) <nl> str_to_write + = " } ) ; \ n \ n " <nl> # from strings <nl> str_to_write + = " void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : string > & params ) { \ n " <nl> def GenParameterCode ( config_hpp , config_out_cpp ) : <nl> for y in x : <nl> if " [ doc - only ] " in y : <nl> continue <nl> - type = y [ " inner_type " ] [ 0 ] <nl> + param_type = y [ " inner_type " ] [ 0 ] <nl> name = y [ " name " ] [ 0 ] <nl> checks = [ ] <nl> if " check " in y : <nl> checks = y [ " check " ] <nl> - tmp = SetOneVarFromString ( name , type , checks ) <nl> + tmp = SetOneVarFromString ( name , param_type , checks ) <nl> str_to_write + = tmp <nl> # tails <nl> str_to_write + = " } \ n \ n " <nl> def GenParameterCode ( config_hpp , config_out_cpp ) : <nl> for y in x : <nl> if " [ doc - only ] " in y : <nl> continue <nl> - type = y [ " inner_type " ] [ 0 ] <nl> + param_type = y [ " inner_type " ] [ 0 ] <nl> name = y [ " name " ] [ 0 ] <nl> - if " vector " in type : <nl> - if " int8 " in type : <nl> + if " vector " in param_type : <nl> + if " int8 " in param_type : <nl> str_to_write + = " str_buf < < \ " [ % s : \ " < < Common : : Join ( Common : : ArrayCast < int8_t , int > ( % s ) , \ " , \ " ) < < \ " ] \ \ n \ " ; \ n " % ( name , name ) <nl> else : <nl> str_to_write + = " str_buf < < \ " [ % s : \ " < < Common : : Join ( % s , \ " , \ " ) < < \ " ] \ \ n \ " ; \ n " % ( name , name ) <nl> mmm a / src / io / config_auto . cpp <nl> ppp b / src / io / config_auto . cpp <nl> <nl> # include < LightGBM / config . h > <nl> namespace LightGBM { <nl> std : : unordered_map < std : : string , std : : string > Config : : alias_table ( { <nl> - { " config_file " , " config " } , <nl> - { " task_type " , " task " } , <nl> - { " application " , " objective " } , <nl> - { " app " , " objective " } , <nl> - { " objective_type " , " objective " } , <nl> - { " boosting_type " , " boosting " } , <nl> - { " boost " , " boosting " } , <nl> - { " train " , " data " } , <nl> - { " train_data " , " data " } , <nl> - { " data_filename " , " data " } , <nl> - { " test " , " valid " } , <nl> - { " valid_data " , " valid " } , <nl> - { " test_data " , " valid " } , <nl> - { " valid_filenames " , " valid " } , <nl> - { " num_iteration " , " num_iterations " } , <nl> - { " num_tree " , " num_iterations " } , <nl> - { " num_trees " , " num_iterations " } , <nl> - { " num_round " , " num_iterations " } , <nl> - { " num_rounds " , " num_iterations " } , <nl> - { " num_boost_round " , " num_iterations " } , <nl> - { " n_estimators " , " num_iterations " } , <nl> - { " shrinkage_rate " , " learning_rate " } , <nl> - { " num_leaf " , " num_leaves " } , <nl> - { " tree " , " tree_learner " } , <nl> - { " tree_learner_type " , " tree_learner " } , <nl> - { " num_thread " , " num_threads " } , <nl> - { " nthread " , " num_threads " } , <nl> - { " nthreads " , " num_threads " } , <nl> + { " config_file " , " config " } , <nl> + { " task_type " , " task " } , <nl> + { " objective_type " , " objective " } , <nl> + { " app " , " objective " } , <nl> + { " application " , " objective " } , <nl> + { " boosting_type " , " boosting " } , <nl> + { " boost " , " boosting " } , <nl> + { " train " , " data " } , <nl> + { " train_data " , " data " } , <nl> + { " data_filename " , " data " } , <nl> + { " test " , " valid " } , <nl> + { " valid_data " , " valid " } , <nl> + { " valid_data_file " , " valid " } , <nl> + { " test_data " , " valid " } , <nl> + { " valid_filenames " , " valid " } , <nl> + { " num_iteration " , " num_iterations " } , <nl> + { " num_tree " , " num_iterations " } , <nl> + { " num_trees " , " num_iterations " } , <nl> + { " num_round " , " num_iterations " } , <nl> + { " num_rounds " , " num_iterations " } , <nl> + { " num_boost_round " , " num_iterations " } , <nl> + { " n_estimators " , " num_iterations " } , <nl> + { " shrinkage_rate " , " learning_rate " } , <nl> + { " num_leaf " , " num_leaves " } , <nl> + { " tree " , " tree_learner " } , <nl> + { " tree_learner_type " , " tree_learner " } , <nl> + { " num_thread " , " num_threads " } , <nl> + { " nthread " , " num_threads " } , <nl> + { " nthreads " , " num_threads " } , <nl> { " device " , " device_type " } , <nl> - { " random_seed " , " seed " } , <nl> - { " min_data_per_leaf " , " min_data_in_leaf " } , <nl> - { " min_data " , " min_data_in_leaf " } , <nl> - { " min_child_samples " , " min_data_in_leaf " } , <nl> - { " min_sum_hessian_per_leaf " , " min_sum_hessian_in_leaf " } , <nl> - { " min_sum_hessian " , " min_sum_hessian_in_leaf " } , <nl> - { " min_hessian " , " min_sum_hessian_in_leaf " } , <nl> - { " min_child_weight " , " min_sum_hessian_in_leaf " } , <nl> - { " sub_row " , " bagging_fraction " } , <nl> - { " subsample " , " bagging_fraction " } , <nl> - { " bagging " , " bagging_fraction " } , <nl> - { " subsample_freq " , " bagging_freq " } , <nl> - { " bagging_fraction_seed " , " bagging_seed " } , <nl> - { " sub_feature " , " feature_fraction " } , <nl> - { " colsample_bytree " , " feature_fraction " } , <nl> - { " early_stopping_rounds " , " early_stopping_round " } , <nl> - { " early_stopping " , " early_stopping_round " } , <nl> - { " max_tree_output " , " max_delta_step " } , <nl> - { " max_leaf_output " , " max_delta_step " } , <nl> - { " reg_alpha " , " lambda_l1 " } , <nl> - { " reg_lambda " , " lambda_l2 " } , <nl> - { " min_split_gain " , " min_gain_to_split " } , <nl> - { " topk " , " top_k " } , <nl> - { " mc " , " monotone_constraints " } , <nl> - { " monotone_constraint " , " monotone_constraints " } , <nl> - { " forced_splits_filename " , " forcedsplits_filename " } , <nl> - { " forced_splits_file " , " forcedsplits_filename " } , <nl> - { " forced_splits " , " forcedsplits_filename " } , <nl> - { " model_output " , " output_model " } , <nl> - { " model_out " , " output_model " } , <nl> - { " model_input " , " input_model " } , <nl> - { " model_in " , " input_model " } , <nl> - { " predict_result " , " output_result " } , <nl> - { " prediction_result " , " output_result " } , <nl> - { " is_pre_partition " , " pre_partition " } , <nl> - { " is_sparse " , " is_enable_sparse " } , <nl> - { " enable_sparse " , " is_enable_sparse " } , <nl> - { " two_round_loading " , " two_round " } , <nl> - { " use_two_round_loading " , " two_round " } , <nl> - { " is_save_binary " , " save_binary " } , <nl> - { " is_save_binary_file " , " save_binary " } , <nl> - { " verbose " , " verbosity " } , <nl> - { " has_header " , " header " } , <nl> - { " label " , " label_column " } , <nl> - { " weight " , " weight_column " } , <nl> - { " query_column " , " group_column " } , <nl> - { " group " , " group_column " } , <nl> - { " query " , " group_column " } , <nl> - { " ignore_feature " , " ignore_column " } , <nl> - { " blacklist " , " ignore_column " } , <nl> - { " categorical_column " , " categorical_feature " } , <nl> - { " cat_feature " , " categorical_feature " } , <nl> - { " cat_column " , " categorical_feature " } , <nl> - { " raw_score " , " predict_raw_score " } , <nl> - { " is_predict_raw_score " , " predict_raw_score " } , <nl> - { " predict_rawscore " , " predict_raw_score " } , <nl> - { " leaf_index " , " predict_leaf_index " } , <nl> - { " is_predict_leaf_index " , " predict_leaf_index " } , <nl> - { " contrib " , " predict_contrib " } , <nl> - { " is_predict_contrib " , " predict_contrib " } , <nl> - { " subsample_for_bin " , " bin_construct_sample_cnt " } , <nl> - { " init_score_filename " , " initscore_filename " } , <nl> - { " init_score_file " , " initscore_filename " } , <nl> - { " init_score " , " initscore_filename " } , <nl> - { " valid_data_init_scores " , " valid_data_initscores " } , <nl> - { " valid_init_score_file " , " valid_data_initscores " } , <nl> - { " valid_init_score " , " valid_data_initscores " } , <nl> - { " num_classes " , " num_class " } , <nl> - { " unbalanced_sets " , " is_unbalance " } , <nl> - { " metric_types " , " metric " } , <nl> - { " output_freq " , " metric_freq " } , <nl> - { " training_metric " , " is_provide_training_metric " } , <nl> - { " is_training_metric " , " is_provide_training_metric " } , <nl> - { " train_metric " , " is_provide_training_metric " } , <nl> - { " ndcg_eval_at " , " eval_at " } , <nl> - { " ndcg_at " , " eval_at " } , <nl> - { " num_machine " , " num_machines " } , <nl> - { " local_port " , " local_listen_port " } , <nl> - { " mlist " , " machine_list_filename " } , <nl> - { " works " , " machines " } , <nl> - { " nodes " , " machines " } , <nl> + { " random_seed " , " seed " } , <nl> + { " min_data_per_leaf " , " min_data_in_leaf " } , <nl> + { " min_data " , " min_data_in_leaf " } , <nl> + { " min_child_samples " , " min_data_in_leaf " } , <nl> + { " min_sum_hessian_per_leaf " , " min_sum_hessian_in_leaf " } , <nl> + { " min_sum_hessian " , " min_sum_hessian_in_leaf " } , <nl> + { " min_hessian " , " min_sum_hessian_in_leaf " } , <nl> + { " min_child_weight " , " min_sum_hessian_in_leaf " } , <nl> + { " sub_row " , " bagging_fraction " } , <nl> + { " subsample " , " bagging_fraction " } , <nl> + { " bagging " , " bagging_fraction " } , <nl> + { " subsample_freq " , " bagging_freq " } , <nl> + { " bagging_fraction_seed " , " bagging_seed " } , <nl> + { " sub_feature " , " feature_fraction " } , <nl> + { " colsample_bytree " , " feature_fraction " } , <nl> + { " early_stopping_rounds " , " early_stopping_round " } , <nl> + { " early_stopping " , " early_stopping_round " } , <nl> + { " max_tree_output " , " max_delta_step " } , <nl> + { " max_leaf_output " , " max_delta_step " } , <nl> + { " reg_alpha " , " lambda_l1 " } , <nl> + { " reg_lambda " , " lambda_l2 " } , <nl> + { " min_split_gain " , " min_gain_to_split " } , <nl> + { " topk " , " top_k " } , <nl> + { " mc " , " monotone_constraints " } , <nl> + { " monotone_constraint " , " monotone_constraints " } , <nl> + { " fs " , " forcedsplits_filename " } , <nl> + { " forced_splits_filename " , " forcedsplits_filename " } , <nl> + { " forced_splits_file " , " forcedsplits_filename " } , <nl> + { " forced_splits " , " forcedsplits_filename " } , <nl> + { " verbose " , " verbosity " } , <nl> + { " subsample_for_bin " , " bin_construct_sample_cnt " } , <nl> + { " model_output " , " output_model " } , <nl> + { " model_out " , " output_model " } , <nl> + { " model_input " , " input_model " } , <nl> + { " model_in " , " input_model " } , <nl> + { " predict_result " , " output_result " } , <nl> + { " prediction_result " , " output_result " } , <nl> + { " init_score_filename " , " initscore_filename " } , <nl> + { " init_score_file " , " initscore_filename " } , <nl> + { " init_score " , " initscore_filename " } , <nl> + { " input_init_score " , " initscore_filename " } , <nl> + { " valid_data_init_scores " , " valid_data_initscores " } , <nl> + { " valid_init_score_file " , " valid_data_initscores " } , <nl> + { " valid_init_score " , " valid_data_initscores " } , <nl> + { " is_pre_partition " , " pre_partition " } , <nl> + { " is_enable_bundle " , " enable_bundle " } , <nl> + { " bundle " , " enable_bundle " } , <nl> + { " is_sparse " , " is_enable_sparse " } , <nl> + { " enable_sparse " , " is_enable_sparse " } , <nl> + { " sparse " , " is_enable_sparse " } , <nl> + { " two_round_loading " , " two_round " } , <nl> + { " use_two_round_loading " , " two_round " } , <nl> + { " is_save_binary " , " save_binary " } , <nl> + { " is_save_binary_file " , " save_binary " } , <nl> + { " load_from_binary_file " , " enable_load_from_binary_file " } , <nl> + { " binary_load " , " enable_load_from_binary_file " } , <nl> + { " load_binary " , " enable_load_from_binary_file " } , <nl> + { " has_header " , " header " } , <nl> + { " label " , " label_column " } , <nl> + { " weight " , " weight_column " } , <nl> + { " group " , " group_column " } , <nl> + { " group_id " , " group_column " } , <nl> + { " query_column " , " group_column " } , <nl> + { " query " , " group_column " } , <nl> + { " query_id " , " group_column " } , <nl> + { " ignore_feature " , " ignore_column " } , <nl> + { " blacklist " , " ignore_column " } , <nl> + { " cat_feature " , " categorical_feature " } , <nl> + { " categorical_column " , " categorical_feature " } , <nl> + { " cat_column " , " categorical_feature " } , <nl> + { " is_predict_raw_score " , " predict_raw_score " } , <nl> + { " predict_rawscore " , " predict_raw_score " } , <nl> + { " raw_score " , " predict_raw_score " } , <nl> + { " is_predict_leaf_index " , " predict_leaf_index " } , <nl> + { " leaf_index " , " predict_leaf_index " } , <nl> + { " is_predict_contrib " , " predict_contrib " } , <nl> + { " contrib " , " predict_contrib " } , <nl> + { " convert_model_file " , " convert_model " } , <nl> + { " num_classes " , " num_class " } , <nl> + { " unbalanced_sets " , " is_unbalance " } , <nl> + { " metrics " , " metric " } , <nl> + { " metric_types " , " metric " } , <nl> + { " output_freq " , " metric_freq " } , <nl> + { " training_metric " , " is_provide_training_metric " } , <nl> + { " is_training_metric " , " is_provide_training_metric " } , <nl> + { " train_metric " , " is_provide_training_metric " } , <nl> + { " ndcg_eval_at " , " eval_at " } , <nl> + { " ndcg_at " , " eval_at " } , <nl> + { " num_machine " , " num_machines " } , <nl> + { " local_port " , " local_listen_port " } , <nl> + { " port " , " local_listen_port " } , <nl> + { " machine_list_file " , " machine_list_filename " } , <nl> + { " machine_list " , " machine_list_filename " } , <nl> + { " mlist " , " machine_list_filename " } , <nl> + { " workers " , " machines " } , <nl> + { " nodes " , " machines " } , <nl> } ) ; <nl> <nl> std : : unordered_set < std : : string > Config : : parameter_set ( { <nl> - " config " , <nl> - " task " , <nl> - " objective " , <nl> - " boosting " , <nl> - " data " , <nl> - " valid " , <nl> - " num_iterations " , <nl> - " learning_rate " , <nl> - " num_leaves " , <nl> - " tree_learner " , <nl> - " num_threads " , <nl> - " device_type " , <nl> - " seed " , <nl> - " max_depth " , <nl> - " min_data_in_leaf " , <nl> - " min_sum_hessian_in_leaf " , <nl> - " bagging_fraction " , <nl> - " bagging_freq " , <nl> - " bagging_seed " , <nl> - " feature_fraction " , <nl> - " feature_fraction_seed " , <nl> - " early_stopping_round " , <nl> - " max_delta_step " , <nl> - " lambda_l1 " , <nl> - " lambda_l2 " , <nl> - " min_gain_to_split " , <nl> - " drop_rate " , <nl> - " max_drop " , <nl> - " skip_drop " , <nl> - " xgboost_dart_mode " , <nl> - " uniform_drop " , <nl> - " drop_seed " , <nl> - " top_rate " , <nl> - " other_rate " , <nl> - " min_data_per_group " , <nl> - " max_cat_threshold " , <nl> - " cat_l2 " , <nl> - " cat_smooth " , <nl> - " max_cat_to_onehot " , <nl> - " top_k " , <nl> - " monotone_constraints " , <nl> - " forcedsplits_filename " , <nl> - " max_bin " , <nl> - " min_data_in_bin " , <nl> - " data_random_seed " , <nl> - " output_model " , <nl> - " input_model " , <nl> - " output_result " , <nl> - " pre_partition " , <nl> - " is_enable_sparse " , <nl> - " sparse_threshold " , <nl> - " two_round " , <nl> - " save_binary " , <nl> - " verbosity " , <nl> - " header " , <nl> - " label_column " , <nl> - " weight_column " , <nl> - " group_column " , <nl> - " ignore_column " , <nl> - " categorical_feature " , <nl> - " predict_raw_score " , <nl> - " predict_leaf_index " , <nl> - " predict_contrib " , <nl> - " num_iteration_predict " , <nl> - " pred_early_stop " , <nl> - " pred_early_stop_freq " , <nl> - " pred_early_stop_margin " , <nl> - " bin_construct_sample_cnt " , <nl> - " use_missing " , <nl> - " zero_as_missing " , <nl> - " initscore_filename " , <nl> - " valid_data_initscores " , <nl> - " histogram_pool_size " , <nl> - " enable_load_from_binary_file " , <nl> - " enable_bundle " , <nl> - " max_conflict_rate " , <nl> - " snapshot_freq " , <nl> - " convert_model_language " , <nl> - " convert_model " , <nl> - " num_class " , <nl> - " sigmoid " , <nl> - " alpha " , <nl> - " fair_c " , <nl> - " poisson_max_delta_step " , <nl> - " boost_from_average " , <nl> - " is_unbalance " , <nl> - " scale_pos_weight " , <nl> - " reg_sqrt " , <nl> - " tweedie_variance_power " , <nl> - " label_gain " , <nl> - " max_position " , <nl> - " metric " , <nl> - " metric_freq " , <nl> - " is_provide_training_metric " , <nl> - " eval_at " , <nl> - " num_machines " , <nl> - " local_listen_port " , <nl> - " time_out " , <nl> - " machine_list_filename " , <nl> - " machines " , <nl> - " gpu_platform_id " , <nl> - " gpu_device_id " , <nl> - " gpu_use_dp " , <nl> + " config " , <nl> + " task " , <nl> + " objective " , <nl> + " boosting " , <nl> + " data " , <nl> + " valid " , <nl> + " num_iterations " , <nl> + " learning_rate " , <nl> + " num_leaves " , <nl> + " tree_learner " , <nl> + " num_threads " , <nl> + " device_type " , <nl> + " seed " , <nl> + " max_depth " , <nl> + " min_data_in_leaf " , <nl> + " min_sum_hessian_in_leaf " , <nl> + " bagging_fraction " , <nl> + " bagging_freq " , <nl> + " bagging_seed " , <nl> + " feature_fraction " , <nl> + " feature_fraction_seed " , <nl> + " early_stopping_round " , <nl> + " max_delta_step " , <nl> + " lambda_l1 " , <nl> + " lambda_l2 " , <nl> + " min_gain_to_split " , <nl> + " drop_rate " , <nl> + " max_drop " , <nl> + " skip_drop " , <nl> + " xgboost_dart_mode " , <nl> + " uniform_drop " , <nl> + " drop_seed " , <nl> + " top_rate " , <nl> + " other_rate " , <nl> + " min_data_per_group " , <nl> + " max_cat_threshold " , <nl> + " cat_l2 " , <nl> + " cat_smooth " , <nl> + " max_cat_to_onehot " , <nl> + " top_k " , <nl> + " monotone_constraints " , <nl> + " forcedsplits_filename " , <nl> + " verbosity " , <nl> + " max_bin " , <nl> + " min_data_in_bin " , <nl> + " bin_construct_sample_cnt " , <nl> + " histogram_pool_size " , <nl> + " data_random_seed " , <nl> + " output_model " , <nl> + " snapshot_freq " , <nl> + " input_model " , <nl> + " output_result " , <nl> + " initscore_filename " , <nl> + " valid_data_initscores " , <nl> + " pre_partition " , <nl> + " enable_bundle " , <nl> + " max_conflict_rate " , <nl> + " is_enable_sparse " , <nl> + " sparse_threshold " , <nl> + " use_missing " , <nl> + " zero_as_missing " , <nl> + " two_round " , <nl> + " save_binary " , <nl> + " enable_load_from_binary_file " , <nl> + " header " , <nl> + " label_column " , <nl> + " weight_column " , <nl> + " group_column " , <nl> + " ignore_column " , <nl> + " categorical_feature " , <nl> + " predict_raw_score " , <nl> + " predict_leaf_index " , <nl> + " predict_contrib " , <nl> + " num_iteration_predict " , <nl> + " pred_early_stop " , <nl> + " pred_early_stop_freq " , <nl> + " pred_early_stop_margin " , <nl> + " convert_model_language " , <nl> + " convert_model " , <nl> + " num_class " , <nl> + " is_unbalance " , <nl> + " scale_pos_weight " , <nl> + " sigmoid " , <nl> + " boost_from_average " , <nl> + " reg_sqrt " , <nl> + " alpha " , <nl> + " fair_c " , <nl> + " poisson_max_delta_step " , <nl> + " tweedie_variance_power " , <nl> + " max_position " , <nl> + " label_gain " , <nl> + " metric " , <nl> + " metric_freq " , <nl> + " is_provide_training_metric " , <nl> + " eval_at " , <nl> + " num_machines " , <nl> + " local_listen_port " , <nl> + " time_out " , <nl> + " machine_list_filename " , <nl> + " machines " , <nl> + " gpu_platform_id " , <nl> + " gpu_device_id " , <nl> + " gpu_use_dp " , <nl> } ) ; <nl> <nl> void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : string > & params ) { <nl> void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : str <nl> CHECK ( num_iterations > = 0 ) ; <nl> <nl> GetDouble ( params , " learning_rate " , & learning_rate ) ; <nl> - CHECK ( learning_rate > 0 ) ; <nl> + CHECK ( learning_rate > 0 . 0 ) ; <nl> <nl> GetInt ( params , " num_leaves " , & num_leaves ) ; <nl> CHECK ( num_leaves > 1 ) ; <nl> void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : str <nl> CHECK ( min_data_in_leaf > = 0 ) ; <nl> <nl> GetDouble ( params , " min_sum_hessian_in_leaf " , & min_sum_hessian_in_leaf ) ; <nl> + CHECK ( min_sum_hessian_in_leaf > = 0 . 0 ) ; <nl> <nl> GetDouble ( params , " bagging_fraction " , & bagging_fraction ) ; <nl> - CHECK ( bagging_fraction > 0 ) ; <nl> + CHECK ( bagging_fraction > 0 . 0 ) ; <nl> CHECK ( bagging_fraction < = 1 . 0 ) ; <nl> <nl> GetInt ( params , " bagging_freq " , & bagging_freq ) ; <nl> void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : str <nl> GetInt ( params , " bagging_seed " , & bagging_seed ) ; <nl> <nl> GetDouble ( params , " feature_fraction " , & feature_fraction ) ; <nl> - CHECK ( feature_fraction > 0 ) ; <nl> + CHECK ( feature_fraction > 0 . 0 ) ; <nl> CHECK ( feature_fraction < = 1 . 0 ) ; <nl> <nl> GetInt ( params , " feature_fraction_seed " , & feature_fraction_seed ) ; <nl> void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : str <nl> GetDouble ( params , " max_delta_step " , & max_delta_step ) ; <nl> <nl> GetDouble ( params , " lambda_l1 " , & lambda_l1 ) ; <nl> - CHECK ( lambda_l1 > = 0 ) ; <nl> + CHECK ( lambda_l1 > = 0 . 0 ) ; <nl> <nl> GetDouble ( params , " lambda_l2 " , & lambda_l2 ) ; <nl> - CHECK ( lambda_l2 > = 0 ) ; <nl> + CHECK ( lambda_l2 > = 0 . 0 ) ; <nl> <nl> GetDouble ( params , " min_gain_to_split " , & min_gain_to_split ) ; <nl> + CHECK ( min_gain_to_split > = 0 . 0 ) ; <nl> <nl> GetDouble ( params , " drop_rate " , & drop_rate ) ; <nl> - CHECK ( drop_rate > = 0 ) ; <nl> + CHECK ( drop_rate > = 0 . 0 ) ; <nl> CHECK ( drop_rate < = 1 . 0 ) ; <nl> <nl> GetInt ( params , " max_drop " , & max_drop ) ; <nl> <nl> GetDouble ( params , " skip_drop " , & skip_drop ) ; <nl> - CHECK ( skip_drop > = 0 ) ; <nl> + CHECK ( skip_drop > = 0 . 0 ) ; <nl> CHECK ( skip_drop < = 1 . 0 ) ; <nl> <nl> GetBool ( params , " xgboost_dart_mode " , & xgboost_dart_mode ) ; <nl> void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : str <nl> GetInt ( params , " drop_seed " , & drop_seed ) ; <nl> <nl> GetDouble ( params , " top_rate " , & top_rate ) ; <nl> - CHECK ( top_rate > = 0 ) ; <nl> + CHECK ( top_rate > = 0 . 0 ) ; <nl> CHECK ( top_rate < = 1 . 0 ) ; <nl> <nl> GetDouble ( params , " other_rate " , & other_rate ) ; <nl> - CHECK ( other_rate > = 0 ) ; <nl> + CHECK ( other_rate > = 0 . 0 ) ; <nl> CHECK ( other_rate < = 1 . 0 ) ; <nl> <nl> GetInt ( params , " min_data_per_group " , & min_data_per_group ) ; <nl> void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : str <nl> CHECK ( max_cat_threshold > 0 ) ; <nl> <nl> GetDouble ( params , " cat_l2 " , & cat_l2 ) ; <nl> - CHECK ( cat_l2 > = 0 ) ; <nl> + CHECK ( cat_l2 > = 0 . 0 ) ; <nl> <nl> GetDouble ( params , " cat_smooth " , & cat_smooth ) ; <nl> - CHECK ( cat_smooth > = 0 ) ; <nl> + CHECK ( cat_smooth > = 0 . 0 ) ; <nl> <nl> GetInt ( params , " max_cat_to_onehot " , & max_cat_to_onehot ) ; <nl> CHECK ( max_cat_to_onehot > 0 ) ; <nl> <nl> GetInt ( params , " top_k " , & top_k ) ; <nl> + CHECK ( top_k > 0 ) ; <nl> <nl> if ( GetString ( params , " monotone_constraints " , & tmp_str ) ) { <nl> monotone_constraints = Common : : StringToArray < int8_t > ( tmp_str , ' , ' ) ; <nl> void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : str <nl> <nl> GetString ( params , " forcedsplits_filename " , & forcedsplits_filename ) ; <nl> <nl> + GetInt ( params , " verbosity " , & verbosity ) ; <nl> + <nl> GetInt ( params , " max_bin " , & max_bin ) ; <nl> CHECK ( max_bin > 1 ) ; <nl> <nl> GetInt ( params , " min_data_in_bin " , & min_data_in_bin ) ; <nl> CHECK ( min_data_in_bin > 0 ) ; <nl> <nl> + GetInt ( params , " bin_construct_sample_cnt " , & bin_construct_sample_cnt ) ; <nl> + CHECK ( bin_construct_sample_cnt > 0 ) ; <nl> + <nl> + GetDouble ( params , " histogram_pool_size " , & histogram_pool_size ) ; <nl> + <nl> GetInt ( params , " data_random_seed " , & data_random_seed ) ; <nl> <nl> GetString ( params , " output_model " , & output_model ) ; <nl> <nl> + GetInt ( params , " snapshot_freq " , & snapshot_freq ) ; <nl> + <nl> GetString ( params , " input_model " , & input_model ) ; <nl> <nl> GetString ( params , " output_result " , & output_result ) ; <nl> <nl> + GetString ( params , " initscore_filename " , & initscore_filename ) ; <nl> + <nl> + if ( GetString ( params , " valid_data_initscores " , & tmp_str ) ) { <nl> + valid_data_initscores = Common : : Split ( tmp_str . c_str ( ) , ' , ' ) ; <nl> + } <nl> + <nl> GetBool ( params , " pre_partition " , & pre_partition ) ; <nl> <nl> + GetBool ( params , " enable_bundle " , & enable_bundle ) ; <nl> + <nl> + GetDouble ( params , " max_conflict_rate " , & max_conflict_rate ) ; <nl> + CHECK ( max_conflict_rate > = 0 . 0 ) ; <nl> + CHECK ( max_conflict_rate < 1 . 0 ) ; <nl> + <nl> GetBool ( params , " is_enable_sparse " , & is_enable_sparse ) ; <nl> <nl> GetDouble ( params , " sparse_threshold " , & sparse_threshold ) ; <nl> - CHECK ( sparse_threshold > 0 ) ; <nl> - CHECK ( sparse_threshold < = 1 ) ; <nl> + CHECK ( sparse_threshold > 0 . 0 ) ; <nl> + CHECK ( sparse_threshold < = 1 . 0 ) ; <nl> + <nl> + GetBool ( params , " use_missing " , & use_missing ) ; <nl> + <nl> + GetBool ( params , " zero_as_missing " , & zero_as_missing ) ; <nl> <nl> GetBool ( params , " two_round " , & two_round ) ; <nl> <nl> GetBool ( params , " save_binary " , & save_binary ) ; <nl> <nl> - GetInt ( params , " verbosity " , & verbosity ) ; <nl> + GetBool ( params , " enable_load_from_binary_file " , & enable_load_from_binary_file ) ; <nl> <nl> GetBool ( params , " header " , & header ) ; <nl> <nl> void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : str <nl> <nl> GetDouble ( params , " pred_early_stop_margin " , & pred_early_stop_margin ) ; <nl> <nl> - GetInt ( params , " bin_construct_sample_cnt " , & bin_construct_sample_cnt ) ; <nl> - CHECK ( bin_construct_sample_cnt > 0 ) ; <nl> - <nl> - GetBool ( params , " use_missing " , & use_missing ) ; <nl> - <nl> - GetBool ( params , " zero_as_missing " , & zero_as_missing ) ; <nl> - <nl> - GetString ( params , " initscore_filename " , & initscore_filename ) ; <nl> - <nl> - if ( GetString ( params , " valid_data_initscores " , & tmp_str ) ) { <nl> - valid_data_initscores = Common : : Split ( tmp_str . c_str ( ) , ' , ' ) ; <nl> - } <nl> - <nl> - GetDouble ( params , " histogram_pool_size " , & histogram_pool_size ) ; <nl> - <nl> - GetBool ( params , " enable_load_from_binary_file " , & enable_load_from_binary_file ) ; <nl> - <nl> - GetBool ( params , " enable_bundle " , & enable_bundle ) ; <nl> - <nl> - GetDouble ( params , " max_conflict_rate " , & max_conflict_rate ) ; <nl> - CHECK ( max_conflict_rate > = 0 ) ; <nl> - CHECK ( max_conflict_rate < 1 ) ; <nl> - <nl> - GetInt ( params , " snapshot_freq " , & snapshot_freq ) ; <nl> - <nl> GetString ( params , " convert_model_language " , & convert_model_language ) ; <nl> <nl> GetString ( params , " convert_model " , & convert_model ) ; <nl> <nl> GetInt ( params , " num_class " , & num_class ) ; <nl> + CHECK ( num_class > 0 ) ; <nl> <nl> - GetDouble ( params , " sigmoid " , & sigmoid ) ; <nl> - CHECK ( sigmoid > 0 ) ; <nl> - <nl> - GetDouble ( params , " alpha " , & alpha ) ; <nl> + GetBool ( params , " is_unbalance " , & is_unbalance ) ; <nl> <nl> - GetDouble ( params , " fair_c " , & fair_c ) ; <nl> + GetDouble ( params , " scale_pos_weight " , & scale_pos_weight ) ; <nl> + CHECK ( scale_pos_weight > 0 . 0 ) ; <nl> <nl> - GetDouble ( params , " poisson_max_delta_step " , & poisson_max_delta_step ) ; <nl> + GetDouble ( params , " sigmoid " , & sigmoid ) ; <nl> + CHECK ( sigmoid > 0 . 0 ) ; <nl> <nl> GetBool ( params , " boost_from_average " , & boost_from_average ) ; <nl> <nl> - GetBool ( params , " is_unbalance " , & is_unbalance ) ; <nl> + GetBool ( params , " reg_sqrt " , & reg_sqrt ) ; <nl> <nl> - GetDouble ( params , " scale_pos_weight " , & scale_pos_weight ) ; <nl> - CHECK ( scale_pos_weight > 0 ) ; <nl> + GetDouble ( params , " alpha " , & alpha ) ; <nl> + CHECK ( alpha > 0 . 0 ) ; <nl> + CHECK ( alpha < 1 . 0 ) ; <nl> <nl> - GetBool ( params , " reg_sqrt " , & reg_sqrt ) ; <nl> + GetDouble ( params , " fair_c " , & fair_c ) ; <nl> + CHECK ( fair_c > 0 . 0 ) ; <nl> + <nl> + GetDouble ( params , " poisson_max_delta_step " , & poisson_max_delta_step ) ; <nl> + CHECK ( poisson_max_delta_step > 0 . 0 ) ; <nl> <nl> GetDouble ( params , " tweedie_variance_power " , & tweedie_variance_power ) ; <nl> + CHECK ( tweedie_variance_power > = 1 . 0 ) ; <nl> + CHECK ( tweedie_variance_power < 2 . 0 ) ; <nl> + <nl> + GetInt ( params , " max_position " , & max_position ) ; <nl> + CHECK ( max_position > 0 ) ; <nl> <nl> if ( GetString ( params , " label_gain " , & tmp_str ) ) { <nl> label_gain = Common : : StringToArray < double > ( tmp_str , ' , ' ) ; <nl> } <nl> <nl> - GetInt ( params , " max_position " , & max_position ) ; <nl> - CHECK ( max_position > 0 ) ; <nl> - <nl> GetInt ( params , " metric_freq " , & metric_freq ) ; <nl> CHECK ( metric_freq > 0 ) ; <nl> <nl> void Config : : GetMembersFromString ( const std : : unordered_map < std : : string , std : : str <nl> } <nl> <nl> GetInt ( params , " num_machines " , & num_machines ) ; <nl> + CHECK ( num_machines > 0 ) ; <nl> <nl> GetInt ( params , " local_listen_port " , & local_listen_port ) ; <nl> + CHECK ( local_listen_port > 0 ) ; <nl> <nl> GetInt ( params , " time_out " , & time_out ) ; <nl> + CHECK ( time_out > 0 ) ; <nl> <nl> GetString ( params , " machine_list_filename " , & machine_list_filename ) ; <nl> <nl> std : : string Config : : SaveMembersToString ( ) const { <nl> str_buf < < " [ top_k : " < < top_k < < " ] \ n " ; <nl> str_buf < < " [ monotone_constraints : " < < Common : : Join ( Common : : ArrayCast < int8_t , int > ( monotone_constraints ) , " , " ) < < " ] \ n " ; <nl> str_buf < < " [ forcedsplits_filename : " < < forcedsplits_filename < < " ] \ n " ; <nl> + str_buf < < " [ verbosity : " < < verbosity < < " ] \ n " ; <nl> str_buf < < " [ max_bin : " < < max_bin < < " ] \ n " ; <nl> str_buf < < " [ min_data_in_bin : " < < min_data_in_bin < < " ] \ n " ; <nl> + str_buf < < " [ bin_construct_sample_cnt : " < < bin_construct_sample_cnt < < " ] \ n " ; <nl> + str_buf < < " [ histogram_pool_size : " < < histogram_pool_size < < " ] \ n " ; <nl> str_buf < < " [ data_random_seed : " < < data_random_seed < < " ] \ n " ; <nl> str_buf < < " [ output_model : " < < output_model < < " ] \ n " ; <nl> + str_buf < < " [ snapshot_freq : " < < snapshot_freq < < " ] \ n " ; <nl> str_buf < < " [ input_model : " < < input_model < < " ] \ n " ; <nl> str_buf < < " [ output_result : " < < output_result < < " ] \ n " ; <nl> + str_buf < < " [ initscore_filename : " < < initscore_filename < < " ] \ n " ; <nl> + str_buf < < " [ valid_data_initscores : " < < Common : : Join ( valid_data_initscores , " , " ) < < " ] \ n " ; <nl> str_buf < < " [ pre_partition : " < < pre_partition < < " ] \ n " ; <nl> + str_buf < < " [ enable_bundle : " < < enable_bundle < < " ] \ n " ; <nl> + str_buf < < " [ max_conflict_rate : " < < max_conflict_rate < < " ] \ n " ; <nl> str_buf < < " [ is_enable_sparse : " < < is_enable_sparse < < " ] \ n " ; <nl> str_buf < < " [ sparse_threshold : " < < sparse_threshold < < " ] \ n " ; <nl> + str_buf < < " [ use_missing : " < < use_missing < < " ] \ n " ; <nl> + str_buf < < " [ zero_as_missing : " < < zero_as_missing < < " ] \ n " ; <nl> str_buf < < " [ two_round : " < < two_round < < " ] \ n " ; <nl> str_buf < < " [ save_binary : " < < save_binary < < " ] \ n " ; <nl> - str_buf < < " [ verbosity : " < < verbosity < < " ] \ n " ; <nl> + str_buf < < " [ enable_load_from_binary_file : " < < enable_load_from_binary_file < < " ] \ n " ; <nl> str_buf < < " [ header : " < < header < < " ] \ n " ; <nl> str_buf < < " [ label_column : " < < label_column < < " ] \ n " ; <nl> str_buf < < " [ weight_column : " < < weight_column < < " ] \ n " ; <nl> std : : string Config : : SaveMembersToString ( ) const { <nl> str_buf < < " [ pred_early_stop : " < < pred_early_stop < < " ] \ n " ; <nl> str_buf < < " [ pred_early_stop_freq : " < < pred_early_stop_freq < < " ] \ n " ; <nl> str_buf < < " [ pred_early_stop_margin : " < < pred_early_stop_margin < < " ] \ n " ; <nl> - str_buf < < " [ bin_construct_sample_cnt : " < < bin_construct_sample_cnt < < " ] \ n " ; <nl> - str_buf < < " [ use_missing : " < < use_missing < < " ] \ n " ; <nl> - str_buf < < " [ zero_as_missing : " < < zero_as_missing < < " ] \ n " ; <nl> - str_buf < < " [ initscore_filename : " < < initscore_filename < < " ] \ n " ; <nl> - str_buf < < " [ valid_data_initscores : " < < Common : : Join ( valid_data_initscores , " , " ) < < " ] \ n " ; <nl> - str_buf < < " [ histogram_pool_size : " < < histogram_pool_size < < " ] \ n " ; <nl> - str_buf < < " [ enable_load_from_binary_file : " < < enable_load_from_binary_file < < " ] \ n " ; <nl> - str_buf < < " [ enable_bundle : " < < enable_bundle < < " ] \ n " ; <nl> - str_buf < < " [ max_conflict_rate : " < < max_conflict_rate < < " ] \ n " ; <nl> - str_buf < < " [ snapshot_freq : " < < snapshot_freq < < " ] \ n " ; <nl> str_buf < < " [ convert_model_language : " < < convert_model_language < < " ] \ n " ; <nl> str_buf < < " [ convert_model : " < < convert_model < < " ] \ n " ; <nl> str_buf < < " [ num_class : " < < num_class < < " ] \ n " ; <nl> + str_buf < < " [ is_unbalance : " < < is_unbalance < < " ] \ n " ; <nl> + str_buf < < " [ scale_pos_weight : " < < scale_pos_weight < < " ] \ n " ; <nl> str_buf < < " [ sigmoid : " < < sigmoid < < " ] \ n " ; <nl> + str_buf < < " [ boost_from_average : " < < boost_from_average < < " ] \ n " ; <nl> + str_buf < < " [ reg_sqrt : " < < reg_sqrt < < " ] \ n " ; <nl> str_buf < < " [ alpha : " < < alpha < < " ] \ n " ; <nl> str_buf < < " [ fair_c : " < < fair_c < < " ] \ n " ; <nl> str_buf < < " [ poisson_max_delta_step : " < < poisson_max_delta_step < < " ] \ n " ; <nl> - str_buf < < " [ boost_from_average : " < < boost_from_average < < " ] \ n " ; <nl> - str_buf < < " [ is_unbalance : " < < is_unbalance < < " ] \ n " ; <nl> - str_buf < < " [ scale_pos_weight : " < < scale_pos_weight < < " ] \ n " ; <nl> - str_buf < < " [ reg_sqrt : " < < reg_sqrt < < " ] \ n " ; <nl> str_buf < < " [ tweedie_variance_power : " < < tweedie_variance_power < < " ] \ n " ; <nl> - str_buf < < " [ label_gain : " < < Common : : Join ( label_gain , " , " ) < < " ] \ n " ; <nl> str_buf < < " [ max_position : " < < max_position < < " ] \ n " ; <nl> + str_buf < < " [ label_gain : " < < Common : : Join ( label_gain , " , " ) < < " ] \ n " ; <nl> str_buf < < " [ metric_freq : " < < metric_freq < < " ] \ n " ; <nl> str_buf < < " [ is_provide_training_metric : " < < is_provide_training_metric < < " ] \ n " ; <nl> str_buf < < " [ eval_at : " < < Common : : Join ( eval_at , " , " ) < < " ] \ n " ; <nl>
[ docs ] generate parameters description from config file . Final stage ( )
microsoft/LightGBM
0a9d4cc2e56e47f5cef02ae3e8110dc567517863
2018-06-06T02:28:14Z
mmm a / src / clustering / administration / jobs / report . hpp <nl> ppp b / src / clustering / administration / jobs / report . hpp <nl> class job_report_t { <nl> peer_id_t const & source_peer , <nl> server_id_t const & destination_server ) ; <nl> <nl> - / / For ` " disk_compation " ` and ` " index_construction " ` jobs <nl> + / / For ` " disk_compation " ` and ` " index_construction " ` jobs , the former only uses <nl> + / / ` id ` , ` type ` , and ` duration ` . <nl> job_report_t ( <nl> uuid_u const & id , <nl> std : : string const & type , <nl> class query_job_t { <nl> <nl> class parallel_traversal_progress_t ; <nl> <nl> + / / TODO , as part of the ` report_t ` cleanup this should be moved to ` reactor_driver . hpp ` <nl> + / / to reduce the circular dependency between the jobs logic and the reactor driver . <nl> class sindex_job_t { <nl> public : <nl> sindex_job_t ( <nl> mmm a / src / clustering / administration / reactor_driver . hpp <nl> ppp b / src / clustering / administration / reactor_driver . hpp <nl> class stores_lifetimer_t { <nl> <nl> bool is_gc_active ( ) const ; <nl> <nl> - typedef std : : multimap < std : : pair < uuid_u , std : : string > , sindex_job_t > sindex_jobs_t ; <nl> + / / The ` multimap ` key is the pair of table id and sindex name <nl> + typedef std : : multimap < std : : pair < namespace_id_t , std : : string > , sindex_job_t > <nl> + sindex_jobs_t ; <nl> sindex_jobs_t get_sindex_jobs ( ) const ; <nl> <nl> private : <nl> class reactor_driver_t { <nl> <nl> bool is_gc_active ( ) ; <nl> <nl> - typedef std : : multimap < std : : pair < uuid_u , std : : string > , sindex_job_t > sindex_jobs_t ; <nl> + / / As above , the ` multimap ` key is the pair of table id and sindex name <nl> + typedef std : : multimap < std : : pair < namespace_id_t , std : : string > , sindex_job_t > <nl> + sindex_jobs_t ; <nl> sindex_jobs_t get_sindex_jobs ( ) ; <nl> <nl> typedef std : : map < std : : pair < namespace_id_t , region_t > , reactor_progress_report_t > <nl>
Fixes review feedback
rethinkdb/rethinkdb
a297edf59572d66fd2201247dcb9e6beb56178e5
2015-01-16T19:40:23Z
mmm a / include / rapidjson / document . h <nl> ppp b / include / rapidjson / document . h <nl> struct TypeHelper < ValueType , unsigned > { <nl> static ValueType & Set ( ValueType & v , unsigned data , typename ValueType : : AllocatorType & ) { return v . SetUint ( data ) ; } <nl> } ; <nl> <nl> + # ifdef _MSC_VER <nl> + RAPIDJSON_STATIC_ASSERT ( sizeof ( long ) = = sizeof ( int ) ) ; <nl> + template < typename ValueType > <nl> + struct TypeHelper < ValueType , long > { <nl> + static bool Is ( const ValueType & v ) { return v . IsInt ( ) ; } <nl> + static long Get ( const ValueType & v ) { return v . GetInt ( ) ; } <nl> + static ValueType & Set ( ValueType & v , long data ) { return v . SetInt ( data ) ; } <nl> + static ValueType & Set ( ValueType & v , long data , typename ValueType : : AllocatorType & ) { return v . SetInt ( data ) ; } <nl> + } ; <nl> + <nl> + RAPIDJSON_STATIC_ASSERT ( sizeof ( unsigned long ) = = sizeof ( unsigned ) ) ; <nl> + template < typename ValueType > <nl> + struct TypeHelper < ValueType , unsigned long > { <nl> + static bool Is ( const ValueType & v ) { return v . IsUint ( ) ; } <nl> + static unsigned long Get ( const ValueType & v ) { return v . GetUint ( ) ; } <nl> + static ValueType & Set ( ValueType & v , unsigned long data ) { return v . SetUint ( data ) ; } <nl> + static ValueType & Set ( ValueType & v , unsigned long data , typename ValueType : : AllocatorType & ) { return v . SetUint ( data ) ; } <nl> + } ; <nl> + # endif <nl> + <nl> template < typename ValueType > <nl> struct TypeHelper < ValueType , int64_t > { <nl> static bool Is ( const ValueType & v ) { return v . IsInt64 ( ) ; } <nl> mmm a / test / unittest / valuetest . cpp <nl> ppp b / test / unittest / valuetest . cpp <nl> TEST ( Value , Int ) { <nl> EXPECT_EQ ( 5678 , z . Get < int > ( ) ) ; <nl> EXPECT_EQ ( 5679 , z . Set ( 5679 ) . Get < int > ( ) ) ; <nl> EXPECT_EQ ( 5680 , z . Set < int > ( 5680 ) . Get < int > ( ) ) ; <nl> + <nl> + # ifdef _MSC_VER <nl> + / / long as int on MSC platforms <nl> + RAPIDJSON_STATIC_ASSERT ( sizeof ( long ) = = sizeof ( int ) ) ; <nl> + z . SetInt ( 1234 ) ; <nl> + EXPECT_TRUE ( z . Is < long > ( ) ) ; <nl> + EXPECT_EQ ( 1234l , z . Get < long > ( ) ) ; <nl> + # endif <nl> } <nl> <nl> TEST ( Value , Uint ) { <nl> TEST ( Value , Uint ) { <nl> EXPECT_EQ ( 2147483648u , z . Get < unsigned > ( ) ) ; <nl> EXPECT_EQ ( 2147483649u , z . Set ( 2147483649u ) . Get < unsigned > ( ) ) ; <nl> EXPECT_EQ ( 2147483650u , z . Set < unsigned > ( 2147483650u ) . Get < unsigned > ( ) ) ; <nl> + <nl> + # ifdef _MSC_VER <nl> + / / unsigned long as unsigned on MSC platforms <nl> + RAPIDJSON_STATIC_ASSERT ( sizeof ( unsigned long ) = = sizeof ( unsigned ) ) ; <nl> + z . SetUint ( 1234 ) ; <nl> + EXPECT_TRUE ( z . Is < unsigned long > ( ) ) ; <nl> + EXPECT_EQ ( 1234ul , z . Get < unsigned long > ( ) ) ; <nl> + # endif <nl> } <nl> <nl> TEST ( Value , Int64 ) { <nl>
Merge pull request from Sumoren / msc_long
Tencent/rapidjson
3b638e67150783303aebf1fc0789d6c44a026b53
2018-03-09T03:33:12Z
mmm a / . travis . yml <nl> ppp b / . travis . yml <nl> matrix : <nl> <nl> before_script : <nl> - if [ - n " $ GCC_VERSION " ] ; then export CXX = " g + + - $ { GCC_VERSION } " CC = " gcc - $ { GCC_VERSION } " ; fi <nl> - - if [ - n " $ CLANG_VERSION " ] ; then export CXX = " clang + + - $ { CLANG_VERSION } - $ { CLANG_VERSION } " CC = " clang - $ { CLANG_VERSION } " ; fi <nl> + - if [ - n " $ CLANG_VERSION " ] ; then export CXX = " clang + + - $ { CLANG_VERSION } " CC = " clang - $ { CLANG_VERSION } " ; fi <nl> - if [ [ " $ TRAVIS_OS_NAME " = = " osx " ] ] ; then export CXX = " clang + + " CC = " clang " ; fi <nl> - which $ CXX <nl> - which $ CC <nl>
Update . travis . yml
gabime/spdlog
1f0513cf4e331928a80d7c98994aff777ec5a0f9
2019-09-21T12:35:22Z
mmm a / tests / runner . py <nl> ppp b / tests / runner . py <nl> def test_jcache ( self ) : <nl> ( [ ' - - jcache ' ] , ' hello_libcxx . cpp ' , False , True , False , True , False , True , [ ] ) , <nl> ( [ ] , ' hello_libcxx . cpp ' , False , False , False , False , False , False , [ ] ) , <nl> # finally , build a file close to the previous , to see that some chunks are found in the cache and some not <nl> - ( [ ' - - jcache ' ] , ' hello_libcxx_mod1 . cpp ' , False , True , True , True , True , False , [ ] ) , # win on pre , mix on funcs , lose on jsfuncs <nl> + ( [ ' - - jcache ' ] , ' hello_libcxx_mod1 . cpp ' , False , True , True , True , True , True , [ ] ) , # win on pre , mix on funcs , mix on jsfuncs <nl> ( [ ' - - jcache ' ] , ' hello_libcxx_mod1 . cpp ' , False , True , False , True , False , True , [ ] ) , <nl> ] : <nl> print > > sys . stderr , args , input_file , expect_pre_save , expect_pre_load , expect_funcs_save , expect_funcs_load , expect_jsfuncs_save , expect_jsfuncs_load , expected <nl> mmm a / tools / js_optimizer . py <nl> ppp b / tools / js_optimizer . py <nl> def run_on_js ( filename , passes , js_engine , jcache ) : <nl> if i < len ( parts ) - 1 : func + = ' \ n } \ n ' # last part needs no } <nl> m = func_sig . search ( func ) <nl> if m : <nl> - ident = m . group ( 1 ) <nl> + ident = m . group ( 2 ) <nl> else : <nl> if suffix : continue # ignore whitespace <nl> ident = ' anon_ % d ' % i <nl> + assert ident <nl> funcs . append ( ( ident , func ) ) <nl> parts = None <nl> total_size = len ( js ) <nl>
fix jsfuncchunking bug
emscripten-core/emscripten
7537fe280b24dcbe7733685cc20e2abde259f082
2013-02-23T00:48:35Z
mmm a / docs / README . osx <nl> ppp b / docs / README . osx <nl> TOC <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> This is a platform port of XBMC for the Apple OSX operating system . 10 . 6 , 10 . 7 <nl> - and 10 . 8 Intel development platforms are supported . Xcode 3 . 2 . 6 and 4 . 3 and newer <nl> + 10 . 8 and 10 . 9 Intel development platforms are supported . Xcode 3 . 2 . 6 and 4 . 3 and newer <nl> are the recommended versions . <nl> There are 3 ways to build XBMC for Mac , from command - line with make , from command - line <nl> using xcodebuild or from Xcode . <nl> codecs that support a multitude of music and video formats . <nl> On Snow Leopard ( OSX 10 . 6 . x ) we recommend using Xcode 3 . 2 . 6 . <nl> On Lion ( OSX 10 . 7 . x ) we recommend using Xcode 4 . 3 . x . <nl> On Mountain Lion ( OSX 10 . 8 . 1 ) we recommend using Xcode 4 . 4 . <nl> + On Mavericks ( OSX 10 . 9 . 3 ) we recommend using Xcode 5 . 1 . 1 . <nl> <nl> NOTE TO NEW OS X USERS : All lines that are prefixed with the ' $ ' character are <nl> commands that need to be typed into a Terminal window . Note that the ' $ ' <nl> character itself should NOT be typed as part of the command . <nl> <nl> - ATTENTION : When using Mountain Lion ( OSX 10 . 8 . x ) you need to download and install <nl> + ATTENTION : When using Mountain Lion ( OSX 10 . 8 . x ) or Mavericks ( 10 . 9 . x ) you need to download and install <nl> XQuartz from https : / / xquartz . macosforge . org / landing / since its not part of OSX <nl> anymore . <nl> <nl> anymore . <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> See point 3 . 0a below for an updated list of supported / tested Xcode / osx constellations ! ! ! <nl> <nl> - Install latest Xcode ( 4 . 3 . 2 or 3 . 2 . 6 as of the writing ) . You can download it from <nl> + Install latest Xcode ( 5 . 1 . 1 or 3 . 2 . 6 as of the writing ) . You can download it from <nl> <nl> 1 . Apple ' s site after registration at http : / / developer . apple . com / tools / download ( Xcode 3 . 2 . 6 ) <nl> - 2 . In the MacOSX AppStore ( Xcode 4 . 3 . x ) . <nl> + 2 . In the MacOSX AppStore ( Xcode 4 . 3 . x and later ) . <nl> <nl> If you are using XCode 4 . 3 . x or later you also need to install the " Command Line Tools " . To do so <nl> after installing Xcode you have to go to " Xcode - > Preferences - > Downloads " and install the <nl> - package " Command Line Tools " . <nl> + package " Command Line Tools " . This is not needed anymore in Xcode 5 . x . Command Line Tools are installed <nl> + automagically on first invoke . <nl> <nl> Xcode 3 . 2 . 6 only runs on 10 . 6 . x ( Snow Leopard ) . <nl> Xcode 4 . 3 . x only runs on 10 . 7 . x ( Lion ) . <nl> Xcode 4 . 4 only runs on 10 . 8 . x ( Mountain Lion ) . <nl> + Xcode 5 . 1 . 1 runs on 10 . 8 . x and 10 . 9 . x ( Mavericks ) . <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> 3 . 0a Supported Xcode and OSX constellations <nl> constellations of Xcode and osx versions ( to be updated once we know more ) : <nl> 1 . XCode 3 . 2 . 6 against OSX SDK 10 . 6 on 10 . 6 . x ( Snow Leopard ) <nl> 2 . XCode 4 . 3 . x against OSX SDK 10 . 6 and 10 . 7 on 10 . 7 . x ( Lion ) <nl> 3 . XCode 4 . 6 against OSX SDK 10 . 6 , 10 . 7 and 10 . 8 on 10 . 7 . x ( Lion ) and 10 . 8 . x ( ML ) <nl> + 4 . XCode 5 . 1 . 1 against OSX SDK 1 . 8 ( ML ) and 10 . 9 ( M ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> 3 . 1 Install XBMC build depends <nl>
[ osx / docs ] - update README . osx - we support building with Xcode 5 . 1 . 1 on Mavericks 10 . 9 . x against SDK 10 . 8 and 10 . 9
xbmc/xbmc
bbf6fcb52eb127869066ae532ffe1c504532d1c3
2014-06-19T21:24:29Z
mmm a / Marlin / src / inc / Version . h <nl> ppp b / Marlin / src / inc / Version . h <nl> <nl> * version was tagged . <nl> * / <nl> # ifndef STRING_DISTRIBUTION_DATE <nl> - # define STRING_DISTRIBUTION_DATE " 2020 - 08 - 24 " <nl> + # define STRING_DISTRIBUTION_DATE " 2020 - 08 - 25 " <nl> # endif <nl> <nl> / * * <nl>
[ cron ] Bump distribution date ( 2020 - 08 - 25 )
MarlinFirmware/Marlin
e2edfabc3c9e3d1c4d4fbd98d3878a7876b78ca7
2020-08-25T00:11:11Z
mmm a / python - package / xgboost / training . py <nl> ppp b / python - package / xgboost / training . py <nl> def _train_internal ( params , dtrain , <nl> xgb_model = xgb_model . save_raw ( ) <nl> bst = Booster ( params , [ dtrain ] + [ d [ 0 ] for d in evals ] , model_file = xgb_model ) <nl> nboost = len ( bst . get_dump ( ) ) <nl> - else : <nl> - bst = Booster ( params , [ dtrain ] + [ d [ 0 ] for d in evals ] ) <nl> <nl> _params = dict ( params ) if isinstance ( params , list ) else params <nl> <nl> def train ( params , dtrain , num_boost_round = 10 , evals = ( ) , obj = None , feval = None , <nl> evals_result : dict <nl> This dictionary stores the evaluation results of all the items in watchlist . <nl> Example : with a watchlist containing [ ( dtest , ' eval ' ) , ( dtrain , ' train ' ) ] and <nl> - and a paramater containing ( ' eval_metric ' , ' logloss ' ) <nl> + a paramater containing ( ' eval_metric ' , ' logloss ' ) <nl> Returns : { ' train ' : { ' logloss ' : [ ' 0 . 48253 ' , ' 0 . 35953 ' ] } , <nl> ' eval ' : { ' logloss ' : [ ' 0 . 480385 ' , ' 0 . 357756 ' ] } } <nl> verbose_eval : bool or int <nl>
remove a redundant sentence , and a word ' and ' ( )
dmlc/xgboost
8cdfec71b337d79c7576ee0ccd741e97ea575274
2016-08-31T18:51:40Z
mmm a / src / debug / debug . cc <nl> ppp b / src / debug / debug . cc <nl> <nl> # include " src / objects / debug - objects - inl . h " <nl> # include " src / objects / js - generator - inl . h " <nl> # include " src / objects / js - promise - inl . h " <nl> - # include " src / parsing / scanner - character - streams . h " <nl> - # include " src / parsing / scanner . h " <nl> # include " src / snapshot / natives . h " <nl> # include " src / snapshot / snapshot . h " <nl> # include " src / wasm / wasm - objects - inl . h " <nl> bool Debug : : SetScriptSource ( Handle < Script > script , Handle < String > source , <nl> return result - > status = = debug : : LiveEditResult : : OK ; <nl> } <nl> <nl> - void Debug : : OnParseJSONError ( Handle < Script > script ) { <nl> - ProcessCompileEvent ( CompileStatus : : JSON_PARSE_ERROR , script ) ; <nl> - } <nl> - <nl> void Debug : : OnCompileError ( Handle < Script > script ) { <nl> - ProcessCompileEvent ( CompileStatus : : COMPILE_ERROR , script ) ; <nl> + ProcessCompileEvent ( true , script ) ; <nl> } <nl> <nl> void Debug : : OnAfterCompile ( Handle < Script > script ) { <nl> - ProcessCompileEvent ( CompileStatus : : OK , script ) ; <nl> - } <nl> - <nl> - namespace { <nl> - void EnsureMagicComments ( Isolate * isolate , Handle < Script > script ) { <nl> - Handle < Object > source_value ( script - > source ( ) , isolate ) ; <nl> - DCHECK ( source_value - > IsString ( ) ) ; <nl> - Handle < String > comment_start = <nl> - isolate - > factory ( ) - > NewStringFromStaticChars ( " / / " ) ; <nl> - Handle < String > source ( Handle < String > : : cast ( source_value ) ) ; <nl> - std : : unique_ptr < Utf16CharacterStream > scanner_stream ( <nl> - ScannerStream : : For ( isolate , source ) ) ; <nl> - Scanner scanner ( isolate - > unicode_cache ( ) , scanner_stream . get ( ) , false ) ; <nl> - scanner . Initialize ( ) ; <nl> - <nl> - bool has_source_url = script - > source_url ( ) - > IsString ( ) ; <nl> - bool has_source_mapping_url = script - > source_mapping_url ( ) - > IsString ( ) ; <nl> - <nl> - int prev_start = source - > length ( ) ; <nl> - while ( prev_start > 0 & & ( ! has_source_mapping_url | | ! has_source_url ) ) { <nl> - int start = Smi : : ToInt ( <nl> - String : : LastIndexOf ( isolate , source , comment_start , <nl> - handle ( Smi : : FromInt ( prev_start ) , isolate ) ) ) ; <nl> - if ( start = = - 1 ) return ; <nl> - <nl> - scanner . SeekForward ( start ) ; <nl> - scanner . Next ( ) ; <nl> - <nl> - Handle < String > source_url = scanner . SourceUrl ( isolate ) ; <nl> - if ( ! has_source_url & & ! source_url . is_null ( ) ) { <nl> - script - > set_source_url ( * source_url ) ; <nl> - has_source_url = true ; <nl> - } <nl> - Handle < String > source_mapping_url = scanner . SourceMappingUrl ( isolate ) ; <nl> - if ( ! has_source_mapping_url & & ! source_mapping_url . is_null ( ) ) { <nl> - script - > set_source_mapping_url ( * source_mapping_url ) ; <nl> - has_source_mapping_url = true ; <nl> - } <nl> - prev_start = start - 1 ; <nl> - } <nl> + ProcessCompileEvent ( false , script ) ; <nl> } <nl> - } / / namespace <nl> <nl> - void Debug : : ProcessCompileEvent ( CompileStatus status , Handle < Script > script ) { <nl> + void Debug : : ProcessCompileEvent ( bool has_compile_error , Handle < Script > script ) { <nl> / / TODO ( kozyatinskiy ) : teach devtools to work with liveedit scripts better <nl> / / first and then remove this fast return . <nl> if ( running_live_edit_ ) return ; <nl> void Debug : : ProcessCompileEvent ( CompileStatus status , Handle < Script > script ) { <nl> return ; <nl> } <nl> if ( ! debug_delegate_ ) return ; <nl> - <nl> - if ( status = = CompileStatus : : COMPILE_ERROR ) { <nl> - EnsureMagicComments ( isolate_ , script ) ; <nl> - } <nl> - <nl> SuppressDebug while_processing ( this ) ; <nl> DebugScope debug_scope ( this ) ; <nl> HandleScope scope ( isolate_ ) ; <nl> DisableBreak no_recursive_break ( this ) ; <nl> AllowJavascriptExecution allow_script ( isolate_ ) ; <nl> debug_delegate_ - > ScriptCompiled ( ToApiHandle < debug : : Script > ( script ) , <nl> - running_live_edit_ , <nl> - status ! = CompileStatus : : OK ) ; <nl> + running_live_edit_ , has_compile_error ) ; <nl> } <nl> <nl> int Debug : : CurrentFrameCount ( ) { <nl> mmm a / src / debug / debug . h <nl> ppp b / src / debug / debug . h <nl> class Debug { <nl> void OnThrow ( Handle < Object > exception ) ; <nl> void OnPromiseReject ( Handle < Object > promise , Handle < Object > value ) ; <nl> void OnCompileError ( Handle < Script > script ) ; <nl> - void OnParseJSONError ( Handle < Script > script ) ; <nl> void OnAfterCompile ( Handle < Script > script ) ; <nl> <nl> void HandleDebugBreak ( IgnoreBreakMode ignore_break_mode ) ; <nl> class Debug { <nl> <nl> void OnException ( Handle < Object > exception , Handle < Object > promise ) ; <nl> <nl> - enum CompileStatus { OK , COMPILE_ERROR , JSON_PARSE_ERROR } ; <nl> - void ProcessCompileEvent ( CompileStatus status , Handle < Script > script ) ; <nl> + void ProcessCompileEvent ( bool has_compile_error , Handle < Script > script ) ; <nl> <nl> / / Find the closest source position for a break point for a given position . <nl> int FindBreakablePosition ( Handle < DebugInfo > debug_info , int source_position ) ; <nl> mmm a / src / inspector / search - util . cc <nl> ppp b / src / inspector / search - util . cc <nl> namespace v8_inspector { <nl> <nl> namespace { <nl> <nl> + String16 findMagicComment ( const String16 & content , const String16 & name , <nl> + bool multiline ) { <nl> + DCHECK_EQ ( String16 : : kNotFound , name . find ( " = " ) ) ; <nl> + size_t length = content . length ( ) ; <nl> + size_t nameLength = name . length ( ) ; <nl> + <nl> + size_t pos = length ; <nl> + size_t equalSignPos = 0 ; <nl> + size_t closingCommentPos = 0 ; <nl> + while ( true ) { <nl> + pos = content . reverseFind ( name , pos ) ; <nl> + if ( pos = = String16 : : kNotFound ) return String16 ( ) ; <nl> + <nl> + / / Check for a / \ / [ \ / * ] [ @ # ] [ \ t ] / regexp ( length of 4 ) before found name . <nl> + if ( pos < 4 ) return String16 ( ) ; <nl> + pos - = 4 ; <nl> + if ( content [ pos ] ! = ' / ' ) continue ; <nl> + if ( ( content [ pos + 1 ] ! = ' / ' | | multiline ) & & <nl> + ( content [ pos + 1 ] ! = ' * ' | | ! multiline ) ) <nl> + continue ; <nl> + if ( content [ pos + 2 ] ! = ' # ' & & content [ pos + 2 ] ! = ' @ ' ) continue ; <nl> + if ( content [ pos + 3 ] ! = ' ' & & content [ pos + 3 ] ! = ' \ t ' ) continue ; <nl> + equalSignPos = pos + 4 + nameLength ; <nl> + if ( equalSignPos < length & & content [ equalSignPos ] ! = ' = ' ) continue ; <nl> + if ( multiline ) { <nl> + closingCommentPos = content . find ( " * / " , equalSignPos + 1 ) ; <nl> + if ( closingCommentPos = = String16 : : kNotFound ) return String16 ( ) ; <nl> + } <nl> + <nl> + break ; <nl> + } <nl> + <nl> + DCHECK ( equalSignPos ) ; <nl> + DCHECK ( ! multiline | | closingCommentPos ) ; <nl> + size_t urlPos = equalSignPos + 1 ; <nl> + String16 match = multiline <nl> + ? content . substring ( urlPos , closingCommentPos - urlPos ) <nl> + : content . substring ( urlPos ) ; <nl> + <nl> + size_t newLine = match . find ( " \ n " ) ; <nl> + if ( newLine ! = String16 : : kNotFound ) match = match . substring ( 0 , newLine ) ; <nl> + match = match . stripWhiteSpace ( ) ; <nl> + <nl> + for ( size_t i = 0 ; i < match . length ( ) ; + + i ) { <nl> + UChar c = match [ i ] ; <nl> + if ( c = = ' " ' | | c = = ' \ ' ' | | c = = ' ' | | c = = ' \ t ' ) return " " ; <nl> + } <nl> + <nl> + return match ; <nl> + } <nl> + <nl> String16 createSearchRegexSource ( const String16 & text ) { <nl> String16Builder result ; <nl> <nl> searchInTextByLinesImpl ( V8InspectorSession * session , const String16 & text , <nl> result . push_back ( buildObjectForSearchMatch ( match . first , match . second ) ) ; <nl> return result ; <nl> } <nl> + <nl> + String16 findSourceURL ( const String16 & content , bool multiline ) { <nl> + return findMagicComment ( content , " sourceURL " , multiline ) ; <nl> + } <nl> + <nl> + String16 findSourceMapURL ( const String16 & content , bool multiline ) { <nl> + return findMagicComment ( content , " sourceMappingURL " , multiline ) ; <nl> + } <nl> + <nl> } / / namespace v8_inspector <nl> mmm a / src / inspector / search - util . h <nl> ppp b / src / inspector / search - util . h <nl> namespace v8_inspector { <nl> <nl> class V8InspectorSession ; <nl> <nl> + String16 findSourceURL ( const String16 & content , bool multiline ) ; <nl> + String16 findSourceMapURL ( const String16 & content , bool multiline ) ; <nl> std : : vector < std : : unique_ptr < protocol : : Debugger : : SearchMatch > > <nl> searchInTextByLinesImpl ( V8InspectorSession * , const String16 & text , <nl> const String16 & query , bool caseSensitive , <nl> mmm a / src / inspector / v8 - debugger - agent - impl . cc <nl> ppp b / src / inspector / v8 - debugger - agent - impl . cc <nl> bool V8DebuggerAgentImpl : : isPaused ( ) const { <nl> void V8DebuggerAgentImpl : : didParseSource ( <nl> std : : unique_ptr < V8DebuggerScript > script , bool success ) { <nl> v8 : : HandleScope handles ( m_isolate ) ; <nl> + if ( ! success ) { <nl> + DCHECK ( ! script - > isSourceLoadedLazily ( ) ) ; <nl> + String16 scriptSource = script - > source ( ) ; <nl> + script - > setSourceURL ( findSourceURL ( scriptSource , false ) ) ; <nl> + script - > setSourceMappingURL ( findSourceMapURL ( scriptSource , false ) ) ; <nl> + } <nl> <nl> int contextId = script - > executionContextId ( ) ; <nl> int contextGroupId = m_inspector - > contextGroupId ( contextId ) ; <nl> mmm a / src / json - parser . cc <nl> ppp b / src / json - parser . cc <nl> MaybeHandle < Object > JsonParser < seq_one_byte > : : ParseJson ( ) { <nl> } <nl> / / We should sent compile error event because we compile JSON object in <nl> / / separated source file . <nl> - isolate ( ) - > debug ( ) - > OnParseJSONError ( script ) ; <nl> + isolate ( ) - > debug ( ) - > OnCompileError ( script ) ; <nl> MessageLocation location ( script , position_ , position_ + 1 ) ; <nl> Handle < Object > error = factory - > NewSyntaxError ( message , arg1 , arg2 ) ; <nl> return isolate ( ) - > template Throw < Object > ( error , & location ) ; <nl> mmm a / test / inspector / debugger / script - on - after - compile - expected . txt <nl> ppp b / test / inspector / debugger / script - on - after - compile - expected . txt <nl> scriptFailedToParse <nl> startLine : 0 <nl> url : failed . js <nl> } <nl> - scriptFailedToParse <nl> - { <nl> - scriptSource : { a : 2 : / / # sourceURL = failed . js < nl > / / # sourceMappingURL = failed - map <nl> - } <nl> - { <nl> - endColumn : 31 <nl> - endLine : 1 <nl> - executionContextId : < executionContextId > <nl> - hasSourceURL : true <nl> - hash : 370d368557b75a8e281e4a84625a9e0263647da6 <nl> - isModule : false <nl> - length : 60 <nl> - scriptId : < scriptId > <nl> - sourceMapURL : failed - map <nl> - startColumn : 0 <nl> - startLine : 0 <nl> - url : failed . js <nl> - } <nl> scriptParsed <nl> { <nl> scriptSource : function foo16 ( ) { } < nl > <nl> mmm a / test / inspector / debugger / script - on - after - compile . js <nl> ppp b / test / inspector / debugger / script - on - after - compile . js <nl> function addScripts ( ) { <nl> . then ( ( ) = > addScript ( " function foo15 ( ) { } ; eval ( \ " function foo14 ( ) { } / / # sourceURL = eval . js \ " ) / / # sourceURL = eval - wrapper . js " ) ) <nl> / / sourceURL and sourceMappingURL works even for script with syntax error <nl> . then ( ( ) = > addScript ( " } / / # sourceURL = failed . js \ n / / # sourceMappingURL = failed - map " ) ) <nl> - . then ( ( ) = > addScript ( " { a : 2 : / / # sourceURL = failed . js \ n / / # sourceMappingURL = failed - map " ) ) <nl> / / empty lines at end <nl> . then ( ( ) = > addScript ( " function foo16 ( ) { } \ n " ) ) <nl> . then ( ( ) = > addScript ( " function foo17 ( ) { } \ n \ n " ) ) <nl>
Revert " inspector : find magic comment using V8 scanner "
v8/v8
4a54b18467dd73f81cbc144b3a35335bf39b6c6c
2018-08-22T11:13:16Z
mmm a / lib / StandardOps / Ops . cpp <nl> ppp b / lib / StandardOps / Ops . cpp <nl> static LogicalResult verify ( ConstantOp & op ) { <nl> return op . emitOpError ( ) < < " requires attribute ' s type ( " < < value . getType ( ) <nl> < < " ) to match op ' s return type ( " < < type < < " ) " ; <nl> <nl> - if ( type . isa < IndexType > ( ) ) <nl> + if ( type . isa < IndexType > ( ) | | value . isa < BoolAttr > ( ) ) <nl> return success ( ) ; <nl> <nl> if ( auto intAttr = value . dyn_cast < IntegerAttr > ( ) ) { <nl> static LogicalResult verify ( ConstantOp & op ) { <nl> if ( type . isa < NoneType > ( ) & & value . isa < UnitAttr > ( ) ) <nl> return success ( ) ; <nl> <nl> - return op . emitOpError ( <nl> - " requires a result type that aligns with the ' value ' attribute " ) ; <nl> + return op . emitOpError ( " unsupported ' value ' attribute : " ) < < value ; <nl> } <nl> <nl> OpFoldResult ConstantOp : : fold ( ArrayRef < Attribute > operands ) { <nl> bool ConstantOp : : isBuildableWith ( Attribute value , Type type ) { <nl> if ( value . getType ( ) ! = type ) <nl> return false ; <nl> / / Finally , check that the attribute kind is handled . <nl> - return value . isa < IntegerAttr > ( ) | | value . isa < FloatAttr > ( ) | | <nl> - value . isa < ElementsAttr > ( ) | | value . isa < UnitAttr > ( ) ; <nl> + return value . isa < BoolAttr > ( ) | | value . isa < IntegerAttr > ( ) | | <nl> + value . isa < FloatAttr > ( ) | | value . isa < ElementsAttr > ( ) | | <nl> + value . isa < UnitAttr > ( ) ; <nl> } <nl> <nl> void ConstantFloatOp : : build ( Builder * builder , OperationState * result , <nl> mmm a / test / IR / core - ops . mlir <nl> ppp b / test / IR / core - ops . mlir <nl> func @ standard_instrs ( tensor < 4x4x ? xf32 > , f32 , i32 , index ) { <nl> / / CHECK : = constant unit <nl> % 73 = constant unit <nl> <nl> + / / CHECK : constant true <nl> + % 74 = constant true <nl> + <nl> + / / CHECK : constant false <nl> + % 75 = constant false <nl> + <nl> / / CHECK : = index_cast { { . * } } : index to i64 <nl> - % 74 = index_cast % idx : index to i64 <nl> + % 76 = index_cast % idx : index to i64 <nl> <nl> / / CHECK : = index_cast { { . * } } : i32 to index <nl> - % 75 = index_cast % i : i32 to index <nl> + % 77 = index_cast % i : i32 to index <nl> <nl> return <nl> } <nl> mmm a / test / IR / invalid - ops . mlir <nl> ppp b / test / IR / invalid - ops . mlir <nl> func @ rank ( f32 ) { <nl> <nl> func @ constant ( ) { <nl> ^ bb : <nl> - % x = " std . constant " ( ) { value = " xyz " } : ( ) - > i32 / / expected - error { { requires a result type that aligns with the ' value ' attribute } } <nl> + % x = " std . constant " ( ) { value = " xyz " } : ( ) - > i32 / / expected - error { { unsupported ' value ' attribute } } <nl> return <nl> } <nl> <nl>
Allow std . constant to hold a boolean value .
tensorflow/tensorflow
ed5f076cab07e7f299f8141c34a5ec3b737f199f
2019-07-23T04:43:37Z
new file mode 100644 <nl> index 0000000000 . . f7dbee721f <nl> mmm / dev / null <nl> ppp b / code / data_structures / src / list / skip_list / skiplist . rb <nl> <nl> + class Node <nl> + attr_accessor : key <nl> + attr_accessor : value <nl> + attr_accessor : forward <nl> + <nl> + def initialize ( k , v = nil ) <nl> + @ key = k <nl> + @ value = v . nil ? ? k : v <nl> + @ forward = [ ] <nl> + end <nl> + end <nl> + <nl> + class SkipList <nl> + attr_accessor : level <nl> + attr_accessor : header <nl> + <nl> + def initialize <nl> + @ header = Node . new ( 1 ) <nl> + @ level = 0 <nl> + @ max_level = 3 <nl> + @ p = 0 . 5 <nl> + @ node_nil = Node . new ( 1000000 ) <nl> + @ header . forward [ 0 ] = @ node_nil <nl> + end <nl> + <nl> + def search ( search_key ) <nl> + x = @ header <nl> + @ level . downto ( 0 ) do | i | <nl> + while x . forward [ i ] . key < search_key do <nl> + x = x . forward [ i ] <nl> + end <nl> + end <nl> + x = x . forward [ 0 ] <nl> + if x . key = = search_key <nl> + return x . value <nl> + else <nl> + return nil <nl> + end <nl> + end <nl> + <nl> + def random_level <nl> + v = 0 <nl> + while rand < @ p & & v < @ max_level <nl> + v + = 1 <nl> + end <nl> + v <nl> + end <nl> + <nl> + def insert ( search_key , new_value = nil ) <nl> + new_value = search_key if new_value . nil ? <nl> + update = [ ] <nl> + x = @ header <nl> + @ level . downto ( 0 ) do | i | <nl> + while x . forward [ i ] . key < search_key do <nl> + x = x . forward [ i ] <nl> + end <nl> + update [ i ] = x <nl> + end <nl> + x = x . forward [ 0 ] <nl> + if x . key = = search_key <nl> + x . value = new_value <nl> + else <nl> + v = random_level <nl> + if v > @ level <nl> + ( @ level + 1 ) . upto ( v ) do | i | <nl> + update [ i ] = @ header <nl> + @ header . forward [ i ] = @ node_nil <nl> + end <nl> + @ level = v <nl> + end <nl> + x = Node . new ( search_key , new_value ) <nl> + 0 . upto ( v ) do | i | <nl> + x . forward [ i ] = update [ i ] . forward [ i ] <nl> + update [ i ] . forward [ i ] = x <nl> + end <nl> + end <nl> + end <nl> + end <nl>
skiplist . rb
OpenGenus/cosmos
8c6448c09d43732c6e5b75689d5864831ee2c7a1
2018-02-28T13:48:14Z
mmm a / xbmc / cores / VideoPlayer / DVDInputStreams / DVDInputStreamBluray . cpp <nl> ppp b / xbmc / cores / VideoPlayer / DVDInputStreams / DVDInputStreamBluray . cpp <nl> bool CDVDInputStreamBluray : : Open ( ) <nl> CLog : : Log ( LOGDEBUG , " CDVDInputStreamBluray : : Open - libbdplus detected : % d " , disc_info - > libbdplus_detected ) ; <nl> CLog : : Log ( LOGDEBUG , " CDVDInputStreamBluray : : Open - BD + handled : % d " , disc_info - > bdplus_handled ) ; <nl> # if ( BLURAY_VERSION > = BLURAY_VERSION_CODE ( 1 , 0 , 0 ) ) <nl> - CLog : : Log ( LOGDEBUG , " CDVDInputStreamBluray : : Open - no menus ( libmmbd ) : % d " , disc_info - > no_menu_support ) ; <nl> + CLog : : Log ( LOGDEBUG , " CDVDInputStreamBluray : : Open - no menus ( libmmbd , or profile 6 bdj ) : % d " , disc_info - > no_menu_support ) ; <nl> # endif <nl> } <nl> else <nl> mmm a / xbmc / filesystem / BlurayDirectory . cpp <nl> ppp b / xbmc / filesystem / BlurayDirectory . cpp <nl> void CBlurayDirectory : : GetRoot ( CFileItemList & items ) <nl> item - > SetIconImage ( " DefaultVideoPlaylists . png " ) ; <nl> items . Add ( item ) ; <nl> <nl> + const BLURAY_DISC_INFO * disc_info = bd_get_disc_info ( m_bd ) ; <nl> + if ( disc_info & & disc_info - > no_menu_support ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " CBlurayDirectory : : GetRoot - no menu support , skipping menu entry " ) ; <nl> + return ; <nl> + } <nl> + <nl> path . SetFileName ( " menu " ) ; <nl> item . reset ( new CFileItem ( ) ) ; <nl> item - > SetPath ( path . Get ( ) ) ; <nl>
[ bluray ] Simple menu : Don ' t show menu entry if menu isn ' t supported .
xbmc/xbmc
4e30c1df586e761365cb7fa004b1bbfd7860593e
2018-08-30T06:35:21Z
mmm a / editor / script_editor_debugger . cpp <nl> ppp b / editor / script_editor_debugger . cpp <nl> void ScriptEditorDebugger : : debug_next ( ) { <nl> msg . push_back ( " next " ) ; <nl> ppeer - > put_var ( msg ) ; <nl> stack_dump - > clear ( ) ; <nl> - inspector - > edit ( NULL ) ; <nl> } <nl> void ScriptEditorDebugger : : debug_step ( ) { <nl> <nl> void ScriptEditorDebugger : : debug_step ( ) { <nl> msg . push_back ( " step " ) ; <nl> ppeer - > put_var ( msg ) ; <nl> stack_dump - > clear ( ) ; <nl> - inspector - > edit ( NULL ) ; <nl> } <nl> <nl> void ScriptEditorDebugger : : debug_break ( ) { <nl> void ScriptEditorDebugger : : _parse_message ( const String & p_msg , const Array & p_da <nl> emit_signal ( " breaked " , false , false , Variant ( ) ) ; <nl> profiler - > set_enabled ( true ) ; <nl> profiler - > disable_seeking ( ) ; <nl> - inspector - > edit ( NULL ) ; <nl> EditorNode : : get_singleton ( ) - > get_pause_button ( ) - > set_pressed ( false ) ; <nl> } else if ( p_msg = = " message : click_ctrl " ) { <nl> <nl> void ScriptEditorDebugger : : stop ( ) { <nl> profiler - > set_enabled ( true ) ; <nl> <nl> inspect_scene_tree - > clear ( ) ; <nl> - <nl> + inspector - > edit ( NULL ) ; <nl> EditorNode : : get_singleton ( ) - > get_pause_button ( ) - > set_pressed ( false ) ; <nl> EditorNode : : get_singleton ( ) - > get_pause_button ( ) - > set_disabled ( true ) ; <nl> EditorNode : : get_singleton ( ) - > get_scene_tree_dock ( ) - > hide_remote_tree ( ) ; <nl>
Merge pull request from erammos / debugger_inspector_fix
godotengine/godot
8f337b6652f63c31eba00a285fffaaeabfb66a0b
2019-04-29T15:03:14Z
mmm a / HISTORY . md <nl> ppp b / HISTORY . md <nl> <nl> # # # Public API Changes <nl> * Change default of BlockBasedTableOptions . format_version to 2 . It means default DB created by 4 . 6 or up cannot be opened by RocksDB version 3 . 9 or earlier . <nl> * Added strict_capacity_limit option to NewLRUCache . If the flag is set to true , insert to cache will fail if no enough capacity can be free . Signiture of Cache : : Insert ( ) is updated accordingly . <nl> + * Tickers [ NUMBER_DB_NEXT , NUMBER_DB_PREV , NUMBER_DB_NEXT_FOUND , NUMBER_DB_PREV_FOUND , ITER_BYTES_READ ] are not updated immediately . The are updated when the Iterator is deleted . <nl> # # # New Features <nl> * Add CompactionPri : : kMinOverlappingRatio , a compaction picking mode friendly to write amplification . <nl> * Deprecate Iterator : : IsKeyPinned ( ) and replace it with Iterator : : GetProperty ( ) with prop_name = " rocksdb . iterator . is . key . pinned " <nl> mmm a / db / db_iter . cc <nl> ppp b / db / db_iter . cc <nl> class DBIter : public Iterator { <nl> kReverse <nl> } ; <nl> <nl> + / / LocalStatistics contain Statistics counters that will be aggregated per <nl> + / / each iterator instance and then will be sent to the global statistics when <nl> + / / the iterator is destroyed . <nl> + / / <nl> + / / The purpose of this approach is to avoid perf regression happening <nl> + / / when multiple threads bump the atomic counters from a DBIter : : Next ( ) . <nl> + struct LocalStatistics { <nl> + explicit LocalStatistics ( ) { ResetCounters ( ) ; } <nl> + <nl> + void ResetCounters ( ) { <nl> + next_count_ = 0 ; <nl> + next_found_count_ = 0 ; <nl> + prev_count_ = 0 ; <nl> + prev_found_count_ = 0 ; <nl> + bytes_read_ = 0 ; <nl> + } <nl> + <nl> + void BumpGlobalStatistics ( Statistics * global_statistics ) { <nl> + RecordTick ( global_statistics , NUMBER_DB_NEXT , next_count_ ) ; <nl> + RecordTick ( global_statistics , NUMBER_DB_NEXT_FOUND , next_found_count_ ) ; <nl> + RecordTick ( global_statistics , NUMBER_DB_PREV , prev_count_ ) ; <nl> + RecordTick ( global_statistics , NUMBER_DB_PREV_FOUND , prev_found_count_ ) ; <nl> + RecordTick ( global_statistics , ITER_BYTES_READ , bytes_read_ ) ; <nl> + ResetCounters ( ) ; <nl> + } <nl> + <nl> + / / Map to Tickers : : NUMBER_DB_NEXT <nl> + uint64_t next_count_ ; <nl> + / / Map to Tickers : : NUMBER_DB_NEXT_FOUND <nl> + uint64_t next_found_count_ ; <nl> + / / Map to Tickers : : NUMBER_DB_PREV <nl> + uint64_t prev_count_ ; <nl> + / / Map to Tickers : : NUMBER_DB_PREV_FOUND <nl> + uint64_t prev_found_count_ ; <nl> + / / Map to Tickers : : ITER_BYTES_READ <nl> + uint64_t bytes_read_ ; <nl> + } ; <nl> + <nl> DBIter ( Env * env , const ImmutableCFOptions & ioptions , const Comparator * cmp , <nl> InternalIterator * iter , SequenceNumber s , bool arena_mode , <nl> uint64_t max_sequential_skip_in_iterations , uint64_t version_number , <nl> class DBIter : public Iterator { <nl> } <nl> virtual ~ DBIter ( ) { <nl> RecordTick ( statistics_ , NO_ITERATORS , - 1 ) ; <nl> + local_stats_ . BumpGlobalStatistics ( statistics_ ) ; <nl> if ( ! arena_mode_ ) { <nl> delete iter_ ; <nl> } else { <nl> class DBIter : public Iterator { <nl> bool iter_pinned_ ; <nl> / / List of operands for merge operator . <nl> std : : deque < std : : string > merge_operands_ ; <nl> + LocalStatistics local_stats_ ; <nl> <nl> / / No copying allowed <nl> DBIter ( const DBIter & ) ; <nl> void DBIter : : Next ( ) { <nl> PERF_COUNTER_ADD ( internal_key_skipped_count , 1 ) ; <nl> } <nl> <nl> + if ( statistics_ ! = nullptr ) { <nl> + local_stats_ . next_count_ + + ; <nl> + } <nl> / / Now we point to the next internal position , for both of merge and <nl> / / not merge cases . <nl> if ( ! iter_ - > Valid ( ) ) { <nl> void DBIter : : Next ( ) { <nl> return ; <nl> } <nl> FindNextUserEntry ( true / * skipping the current user key * / ) ; <nl> - if ( statistics_ ! = nullptr ) { <nl> - RecordTick ( statistics_ , NUMBER_DB_NEXT ) ; <nl> - if ( valid_ ) { <nl> - RecordTick ( statistics_ , NUMBER_DB_NEXT_FOUND ) ; <nl> - RecordTick ( statistics_ , ITER_BYTES_READ , key ( ) . size ( ) + value ( ) . size ( ) ) ; <nl> - } <nl> - } <nl> if ( valid_ & & prefix_extractor_ & & prefix_same_as_start_ & & <nl> prefix_extractor_ - > Transform ( saved_key_ . GetKey ( ) ) <nl> . compare ( prefix_start_ . GetKey ( ) ) ! = 0 ) { <nl> valid_ = false ; <nl> } <nl> + if ( statistics_ ! = nullptr & & valid_ ) { <nl> + local_stats_ . next_found_count_ + + ; <nl> + local_stats_ . bytes_read_ + = ( key ( ) . size ( ) + value ( ) . size ( ) ) ; <nl> + } <nl> } <nl> <nl> / / PRE : saved_key_ has the current user key if skipping <nl> void DBIter : : Prev ( ) { <nl> } <nl> PrevInternal ( ) ; <nl> if ( statistics_ ! = nullptr ) { <nl> - RecordTick ( statistics_ , NUMBER_DB_PREV ) ; <nl> + local_stats_ . prev_count_ + + ; <nl> if ( valid_ ) { <nl> - RecordTick ( statistics_ , NUMBER_DB_PREV_FOUND ) ; <nl> - RecordTick ( statistics_ , ITER_BYTES_READ , key ( ) . size ( ) + value ( ) . size ( ) ) ; <nl> + local_stats_ . prev_found_count_ + + ; <nl> + local_stats_ . bytes_read_ + = ( key ( ) . size ( ) + value ( ) . size ( ) ) ; <nl> } <nl> } <nl> if ( valid_ & & prefix_extractor_ & & prefix_same_as_start_ & & <nl> mmm a / db / db_test . cc <nl> ppp b / db / db_test . cc <nl> TEST_F ( DBTest , PrefixExtractorBlockFilter ) { <nl> delete iter ; <nl> } <nl> <nl> + TEST_F ( DBTest , IteratorWithLocalStatistics ) { <nl> + Options options = CurrentOptions ( ) ; <nl> + options . statistics = rocksdb : : CreateDBStatistics ( ) ; <nl> + DestroyAndReopen ( options ) ; <nl> + <nl> + Random rnd ( 301 ) ; <nl> + for ( int i = 0 ; i < 1000 ; i + + ) { <nl> + / / Key 10 bytes / Value 10 bytes <nl> + ASSERT_OK ( Put ( RandomString ( & rnd , 10 ) , RandomString ( & rnd , 10 ) ) ) ; <nl> + } <nl> + <nl> + std : : atomic < uint64_t > total_next ( 0 ) ; <nl> + std : : atomic < uint64_t > total_next_found ( 0 ) ; <nl> + std : : atomic < uint64_t > total_prev ( 0 ) ; <nl> + std : : atomic < uint64_t > total_prev_found ( 0 ) ; <nl> + std : : atomic < uint64_t > total_bytes ( 0 ) ; <nl> + <nl> + std : : vector < std : : thread > threads ; <nl> + std : : function < void ( ) > reader_func_next = [ & ] ( ) { <nl> + Iterator * iter = db_ - > NewIterator ( ReadOptions ( ) ) ; <nl> + <nl> + iter - > SeekToFirst ( ) ; <nl> + / / Seek will bump ITER_BYTES_READ <nl> + total_bytes + = iter - > key ( ) . size ( ) ; <nl> + total_bytes + = iter - > value ( ) . size ( ) ; <nl> + while ( true ) { <nl> + iter - > Next ( ) ; <nl> + total_next + + ; <nl> + <nl> + if ( ! iter - > Valid ( ) ) { <nl> + break ; <nl> + } <nl> + total_next_found + + ; <nl> + total_bytes + = iter - > key ( ) . size ( ) ; <nl> + total_bytes + = iter - > value ( ) . size ( ) ; <nl> + } <nl> + <nl> + delete iter ; <nl> + } ; <nl> + <nl> + std : : function < void ( ) > reader_func_prev = [ & ] ( ) { <nl> + Iterator * iter = db_ - > NewIterator ( ReadOptions ( ) ) ; <nl> + <nl> + iter - > SeekToLast ( ) ; <nl> + / / Seek will bump ITER_BYTES_READ <nl> + total_bytes + = iter - > key ( ) . size ( ) ; <nl> + total_bytes + = iter - > value ( ) . size ( ) ; <nl> + while ( true ) { <nl> + iter - > Prev ( ) ; <nl> + total_prev + + ; <nl> + <nl> + if ( ! iter - > Valid ( ) ) { <nl> + break ; <nl> + } <nl> + total_prev_found + + ; <nl> + total_bytes + = iter - > key ( ) . size ( ) ; <nl> + total_bytes + = iter - > value ( ) . size ( ) ; <nl> + } <nl> + <nl> + delete iter ; <nl> + } ; <nl> + <nl> + for ( int i = 0 ; i < 10 ; i + + ) { <nl> + threads . emplace_back ( reader_func_next ) ; <nl> + } <nl> + for ( int i = 0 ; i < 15 ; i + + ) { <nl> + threads . emplace_back ( reader_func_prev ) ; <nl> + } <nl> + <nl> + for ( auto & t : threads ) { <nl> + t . join ( ) ; <nl> + } <nl> + <nl> + ASSERT_EQ ( TestGetTickerCount ( options , NUMBER_DB_NEXT ) , total_next ) ; <nl> + ASSERT_EQ ( TestGetTickerCount ( options , NUMBER_DB_NEXT_FOUND ) , <nl> + total_next_found ) ; <nl> + ASSERT_EQ ( TestGetTickerCount ( options , NUMBER_DB_PREV ) , total_prev ) ; <nl> + ASSERT_EQ ( TestGetTickerCount ( options , NUMBER_DB_PREV_FOUND ) , <nl> + total_prev_found ) ; <nl> + ASSERT_EQ ( TestGetTickerCount ( options , ITER_BYTES_READ ) , total_bytes ) ; <nl> + } <nl> + <nl> # ifndef ROCKSDB_LITE <nl> class BloomStatsTestWithParam <nl> : public DBTest , <nl>
Aggregate hot Iterator counters in LocalStatistics ( DBIter : : Next perf regression )
facebook/rocksdb
580fede347abaccfc019b207e7f592893ab17914
2016-03-12T03:01:12Z
mmm a / admin / static / coffee / dataexplorer . coffee <nl> ppp b / admin / static / coffee / dataexplorer . coffee <nl> module ' DataExplorerView ' , - > <nl> <nl> remove : = > <nl> @ removed_self = true <nl> + if @ query_result . is_feed <nl> + @ query_result . ended = true <nl> super ( ) <nl> <nl> max_datum_threshold : 1000 <nl> module ' DataExplorerView ' , - > <nl> $ ( window ) . on ( ' scroll ' , @ scroll_handler ) <nl> @ handle_scroll ( ) <nl> <nl> - remove : = > <nl> - $ ( window ) . off ( ' scroll ' , @ scroll_handler ) <nl> - super ( ) <nl> - <nl> handle_scroll : = > <nl> scroll = $ ( window ) . scrollTop ( ) <nl> pos = @ $ ( ' . results_header ' ) . offset ( ) ? . top + 2 <nl> module ' DataExplorerView ' , - > <nl> @ $ ( ' . more_results_paragraph ' ) . html @ cursor_timed_out_template ( ) <nl> <nl> remove : = > <nl> - $ ( window ) . unbind ' scroll ' <nl> + @ view_object ? . remove ( ) <nl> + if @ set_scrollbar_scroll_handler ? <nl> + $ ( window ) . unbind ' scroll ' , @ set_scrollbar_scroll_handler <nl> $ ( window ) . unbind ' resize ' <nl> + $ ( window ) . off ( ' scroll ' , @ scroll_handler ) <nl> super ( ) <nl> <nl> handle_mouseup : ( event ) = > <nl>
fix what happens on remove
rethinkdb/rethinkdb
54d8c5d8a37cbcc360cd1a327b446d192899e0ee
2015-01-19T22:12:13Z
mmm a / include / catch_session . hpp <nl> ppp b / include / catch_session . hpp <nl> namespace Catch { <nl> return reporters ; <nl> } <nl> <nl> - void openStreamInto ( Ptr < Config > const & config , std : : ofstream & ofs ) { <nl> - / / Open output file , if specified <nl> - if ( ! config - > getFilename ( ) . empty ( ) ) { <nl> - ofs . open ( config - > getFilename ( ) . c_str ( ) ) ; <nl> - if ( ofs . fail ( ) ) { <nl> - std : : ostringstream oss ; <nl> - oss < < " Unable to open file : ' " < < config - > getFilename ( ) < < " ' " ; <nl> - throw std : : domain_error ( oss . str ( ) ) ; <nl> - } <nl> - config - > setStreamBuf ( ofs . rdbuf ( ) ) ; <nl> - } <nl> - } <nl> <nl> Totals runTests ( Ptr < Config > const & config ) { <nl> <nl> Ptr < IConfig const > iconfig = config . get ( ) ; <nl> <nl> - std : : ofstream ofs ; <nl> - openStreamInto ( config , ofs ) ; <nl> Ptr < IStreamingReporter > reporter = makeReporter ( config ) ; <nl> reporter = addListeners ( iconfig , reporter ) ; <nl> <nl> mmm a / include / internal / catch_config . hpp <nl> ppp b / include / internal / catch_config . hpp <nl> namespace Catch { <nl> public : <nl> <nl> Config ( ) <nl> - : m_os ( Catch : : cout ( ) . rdbuf ( ) ) <nl> { } <nl> <nl> Config ( ConfigData const & data ) <nl> : m_data ( data ) , <nl> - m_os ( Catch : : cout ( ) . rdbuf ( ) ) <nl> + m_stream ( openStream ( ) ) <nl> { <nl> if ( ! data . testsOrTags . empty ( ) ) { <nl> TestSpecParser parser ( ITagAliasRegistry : : get ( ) ) ; <nl> namespace Catch { <nl> } <nl> <nl> virtual ~ Config ( ) { <nl> - m_os . rdbuf ( Catch : : cout ( ) . rdbuf ( ) ) ; <nl> - m_stream . release ( ) ; <nl> - } <nl> - <nl> - void setFilename ( std : : string const & filename ) { <nl> - m_data . outputFilename = filename ; <nl> } <nl> <nl> std : : string const & getFilename ( ) const { <nl> namespace Catch { <nl> <nl> bool shouldDebugBreak ( ) const { return m_data . shouldDebugBreak ; } <nl> <nl> - void setStreamBuf ( std : : streambuf * buf ) { <nl> - m_os . rdbuf ( buf ? buf : Catch : : cout ( ) . rdbuf ( ) ) ; <nl> - } <nl> - <nl> - void useStream ( std : : string const & streamName ) { <nl> - Stream stream = createStream ( streamName ) ; <nl> - setStreamBuf ( stream . streamBuf ) ; <nl> - m_stream . release ( ) ; <nl> - m_stream = stream ; <nl> - } <nl> - <nl> std : : vector < std : : string > getReporterNames ( ) const { return m_data . reporterNames ; } <nl> <nl> int abortAfter ( ) const { return m_data . abortAfter ; } <nl> namespace Catch { <nl> <nl> / / IConfig interface <nl> virtual bool allowThrows ( ) const { return ! m_data . noThrow ; } <nl> - virtual std : : ostream & stream ( ) const { return m_os ; } <nl> + virtual std : : ostream & stream ( ) const { return m_stream - > stream ( ) ; } <nl> virtual std : : string name ( ) const { return m_data . name . empty ( ) ? m_data . processName : m_data . name ; } <nl> virtual bool includeSuccessfulResults ( ) const { return m_data . showSuccessfulTests ; } <nl> virtual bool warnAboutMissingAssertions ( ) const { return m_data . warnings & WarnAbout : : NoAssertions ; } <nl> namespace Catch { <nl> virtual bool forceColour ( ) const { return m_data . forceColour ; } <nl> <nl> private : <nl> + <nl> + IStream const * openStream ( ) { <nl> + if ( m_data . outputFilename . empty ( ) ) <nl> + return new CoutStream ( ) ; <nl> + else if ( m_data . outputFilename [ 0 ] = = ' % ' ) { <nl> + if ( m_data . outputFilename = = " % debug " ) <nl> + return new DebugOutStream ( ) ; <nl> + else <nl> + throw std : : domain_error ( " Unrecognised stream : " + m_data . outputFilename ) ; <nl> + } <nl> + else <nl> + return new FileStream ( m_data . outputFilename ) ; <nl> + } <nl> ConfigData m_data ; <nl> <nl> - Stream m_stream ; <nl> - mutable std : : ostream m_os ; <nl> + std : : auto_ptr < IStream const > m_stream ; <nl> TestSpec m_testSpec ; <nl> } ; <nl> <nl> mmm a / include / internal / catch_context_impl . hpp <nl> ppp b / include / internal / catch_context_impl . hpp <nl> namespace Catch { <nl> return getCurrentMutableContext ( ) ; <nl> } <nl> <nl> - Stream createStream ( std : : string const & streamName ) { <nl> - if ( streamName = = " stdout " ) return Stream ( Catch : : cout ( ) . rdbuf ( ) , false ) ; <nl> - if ( streamName = = " stderr " ) return Stream ( Catch : : cerr ( ) . rdbuf ( ) , false ) ; <nl> - if ( streamName = = " debug " ) return Stream ( new StreamBufImpl < OutputDebugWriter > , true ) ; <nl> - <nl> - throw std : : domain_error ( " Unknown stream : " + streamName ) ; <nl> - } <nl> - <nl> void cleanUpContext ( ) { <nl> delete currentContext ; <nl> currentContext = CATCH_NULL ; <nl> mmm a / include / internal / catch_impl . hpp <nl> ppp b / include / internal / catch_impl . hpp <nl> <nl> namespace Catch { <nl> NonCopyable : : ~ NonCopyable ( ) { } <nl> IShared : : ~ IShared ( ) { } <nl> + IStream : : ~ IStream ( ) CATCH_NOEXCEPT { } <nl> StreamBufBase : : ~ StreamBufBase ( ) CATCH_NOEXCEPT { } <nl> IContext : : ~ IContext ( ) { } <nl> IResultCapture : : ~ IResultCapture ( ) { } <nl> mmm a / include / internal / catch_stream . h <nl> ppp b / include / internal / catch_stream . h <nl> <nl> # ifndef TWOBLUECUBES_CATCH_STREAM_H_INCLUDED <nl> # define TWOBLUECUBES_CATCH_STREAM_H_INCLUDED <nl> <nl> - # include < streambuf > <nl> + # include " catch_compiler_capabilities . h " <nl> + # include " catch_streambuf . h " <nl> <nl> - # ifdef __clang__ <nl> - # pragma clang diagnostic ignored " - Wpadded " <nl> - # endif <nl> + # include < streambuf > <nl> + # include < ostream > <nl> + # include < fstream > <nl> <nl> namespace Catch { <nl> <nl> - class Stream { <nl> + std : : ostream & cout ( ) ; <nl> + std : : ostream & cerr ( ) ; <nl> + <nl> + <nl> + struct IStream { <nl> + virtual ~ IStream ( ) CATCH_NOEXCEPT ; <nl> + virtual std : : ostream & stream ( ) const = 0 ; <nl> + } ; <nl> + <nl> + class FileStream : public IStream { <nl> + mutable std : : ofstream m_ofs ; <nl> public : <nl> - Stream ( ) ; <nl> - Stream ( std : : streambuf * _streamBuf , bool _isOwned ) ; <nl> - void release ( ) ; <nl> + FileStream ( std : : string const & filename ) ; <nl> + public : / / IStream <nl> + virtual std : : ostream & stream ( ) const CATCH_OVERRIDE ; <nl> + } ; <nl> + <nl> <nl> - std : : streambuf * streamBuf ; <nl> + class CoutStream : public IStream { <nl> + mutable std : : ostream m_os ; <nl> + public : <nl> + CoutStream ( ) ; <nl> <nl> - private : <nl> - bool isOwned ; <nl> + public : / / IStream <nl> + virtual std : : ostream & stream ( ) const CATCH_OVERRIDE ; <nl> } ; <nl> <nl> - std : : ostream & cout ( ) ; <nl> - std : : ostream & cerr ( ) ; <nl> + <nl> + class DebugOutStream : public IStream { <nl> + std : : auto_ptr < StreamBufBase > m_streamBuf ; <nl> + mutable std : : ostream m_os ; <nl> + public : <nl> + DebugOutStream ( ) ; <nl> + <nl> + public : / / IStream <nl> + virtual std : : ostream & stream ( ) const CATCH_OVERRIDE ; <nl> + } ; <nl> } <nl> <nl> # endif / / TWOBLUECUBES_CATCH_STREAM_H_INCLUDED <nl> mmm a / include / internal / catch_stream . hpp <nl> ppp b / include / internal / catch_stream . hpp <nl> <nl> # define TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED <nl> <nl> # include " catch_stream . h " <nl> - # include " catch_streambuf . h " <nl> # include " catch_debugger . h " <nl> <nl> # include < stdexcept > <nl> namespace Catch { <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - struct OutputDebugWriter { <nl> <nl> + FileStream : : FileStream ( std : : string const & filename ) { <nl> + m_ofs . open ( filename . c_str ( ) ) ; <nl> + if ( m_ofs . fail ( ) ) { <nl> + std : : ostringstream oss ; <nl> + oss < < " Unable to open file : ' " < < filename < < " ' " ; <nl> + throw std : : domain_error ( oss . str ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + std : : ostream & FileStream : : stream ( ) const { <nl> + return m_ofs ; <nl> + } <nl> + <nl> + struct OutputDebugWriter { <nl> + <nl> void operator ( ) ( std : : string const & str ) { <nl> writeToDebugConsole ( str ) ; <nl> } <nl> } ; <nl> - <nl> - Stream : : Stream ( ) <nl> - : streamBuf ( CATCH_NULL ) , isOwned ( false ) <nl> + <nl> + DebugOutStream : : DebugOutStream ( ) <nl> + : m_streamBuf ( new StreamBufImpl < OutputDebugWriter > ( ) ) , <nl> + m_os ( m_streamBuf . get ( ) ) <nl> { } <nl> - <nl> - Stream : : Stream ( std : : streambuf * _streamBuf , bool _isOwned ) <nl> - : streamBuf ( _streamBuf ) , isOwned ( _isOwned ) <nl> + <nl> + std : : ostream & DebugOutStream : : stream ( ) const { <nl> + return m_os ; <nl> + } <nl> + <nl> + / / Store the streambuf from cout up - front because <nl> + / / cout may get redirected when running tests <nl> + CoutStream : : CoutStream ( ) <nl> + : m_os ( Catch : : cout ( ) . rdbuf ( ) ) <nl> { } <nl> <nl> - void Stream : : release ( ) { <nl> - if ( isOwned ) { <nl> - delete streamBuf ; <nl> - streamBuf = CATCH_NULL ; <nl> - isOwned = false ; <nl> - } <nl> + std : : ostream & CoutStream : : stream ( ) const { <nl> + return m_os ; <nl> } <nl> - <nl> + <nl> + <nl> # ifndef CATCH_CONFIG_NOSTDOUT / / If you # define this you must implement this functions <nl> std : : ostream & cout ( ) { <nl> return std : : cout ; <nl> mmm a / projects / SelfTest / SurrogateCpps / catch_stream . cpp <nl> ppp b / projects / SelfTest / SurrogateCpps / catch_stream . cpp <nl> <nl> / / This file is only here to verify ( to the extent possible ) the self sufficiency of the header <nl> + # include " catch_suppress_warnings . h " <nl> # include " catch_stream . h " <nl>
Refactored stream related stuff
catchorg/Catch2
d43a47efca81129eb079b924e61d8cbcd12d8f3c
2015-09-29T18:23:06Z
new file mode 100644 <nl> index 0000000000 . . 3c6e79cf31 <nl> mmm / dev / null <nl> ppp b / python / setup . cfg <nl> <nl> + [ bdist_wheel ] <nl> + universal = 1 <nl>
Added setup . cfg to default to python 2 / 3 wheels for pypi .
google/flatbuffers
e9912e92981d1edd25c91714e1275be6a9f5046b
2018-06-25T22:08:06Z
mmm a / xbmc / platform / android / activity / XBMCApp . cpp <nl> ppp b / xbmc / platform / android / activity / XBMCApp . cpp <nl> void CXBMCApp : : onStart ( ) <nl> registerReceiver ( * this , intentFilter ) ; <nl> m_mediaSession . reset ( new CJNIXBMCMediaSession ( ) ) ; <nl> } <nl> - if ( g_application . IsInitialized ( ) ) <nl> - { <nl> - IPowerSyscall * syscall = CServiceBroker : : GetPowerManager ( ) . GetPowerSyscall ( ) ; <nl> - if ( syscall ) <nl> - static_cast < CAndroidPowerSyscall * > ( syscall ) - > SetOnResume ( ) ; <nl> - } <nl> } <nl> <nl> void CXBMCApp : : onResume ( ) <nl> void CXBMCApp : : onStop ( ) <nl> else if ( m_playback_state & PLAYBACK_STATE_VIDEO ) <nl> CApplicationMessenger : : GetInstance ( ) . SendMsg ( TMSG_GUI_ACTION , WINDOW_INVALID , - 1 , static_cast < void * > ( new CAction ( ACTION_PAUSE ) ) ) ; <nl> } <nl> - <nl> - if ( ! g_application . IsStopping ( ) ) <nl> - { <nl> - IPowerSyscall * syscall = CServiceBroker : : GetPowerManager ( ) . GetPowerSyscall ( ) ; <nl> - if ( syscall ) <nl> - static_cast < CAndroidPowerSyscall * > ( syscall ) - > SetOnPause ( ) ; <nl> - } <nl> } <nl> <nl> void CXBMCApp : : onDestroy ( ) <nl> void CXBMCApp : : onReceive ( CJNIIntent intent ) <nl> CLog : : Log ( LOGDEBUG , " CXBMCApp : : onReceive - Got intent . Action : % s " , action . c_str ( ) ) ; <nl> if ( action = = " android . intent . action . BATTERY_CHANGED " ) <nl> m_batteryLevel = intent . getIntExtra ( " level " , - 1 ) ; <nl> - else if ( action = = " android . intent . action . DREAMING_STOPPED " | | action = = " android . intent . action . SCREEN_ON " ) <nl> + else if ( action = = " android . intent . action . DREAMING_STOPPED " ) <nl> { <nl> if ( HasFocus ( ) ) <nl> g_application . WakeUpScreenSaverAndDPMS ( ) ; <nl> void CXBMCApp : : onReceive ( CJNIIntent intent ) <nl> dynamic_cast < CWinSystemAndroid * > ( winSystem ) - > SetHdmiState ( m_hdmiPlugged ) ; <nl> } <nl> } <nl> + else if ( action = = " android . intent . action . SCREEN_ON " ) <nl> + { <nl> + / / Sent when the device wakes up and becomes interactive . <nl> + / / <nl> + / / For historical reasons , the name of this broadcast action refers to the power state of the <nl> + / / screen but it is actually sent in response to changes in the overall interactive state of <nl> + / / the device . <nl> + IPowerSyscall * syscall = CServiceBroker : : GetPowerManager ( ) . GetPowerSyscall ( ) ; <nl> + if ( syscall ) <nl> + { <nl> + CLog : : Log ( LOGINFO , " Got device wakeup intent " ) ; <nl> + static_cast < CAndroidPowerSyscall * > ( syscall ) - > SetResumed ( ) ; <nl> + } <nl> + <nl> + if ( HasFocus ( ) ) <nl> + g_application . WakeUpScreenSaverAndDPMS ( ) ; <nl> + } <nl> else if ( action = = " android . intent . action . SCREEN_OFF " ) <nl> { <nl> - if ( m_playback_state & PLAYBACK_STATE_VIDEO ) <nl> - CApplicationMessenger : : GetInstance ( ) . PostMsg ( TMSG_GUI_ACTION , WINDOW_INVALID , - 1 , static_cast < void * > ( new CAction ( ACTION_STOP ) ) ) ; <nl> + / / Sent when the device goes to sleep and becomes non - interactive . <nl> + / / <nl> + / / For historical reasons , the name of this broadcast action refers to the power state of the <nl> + / / screen but it is actually sent in response to changes in the overall interactive state of <nl> + / / the device . <nl> + IPowerSyscall * syscall = CServiceBroker : : GetPowerManager ( ) . GetPowerSyscall ( ) ; <nl> + if ( syscall ) <nl> + { <nl> + CLog : : Log ( LOGINFO , " Got device sleep intent " ) ; <nl> + static_cast < CAndroidPowerSyscall * > ( syscall ) - > SetSuspended ( ) ; <nl> + } <nl> } <nl> else if ( action = = " android . intent . action . MEDIA_BUTTON " ) <nl> { <nl> mmm a / xbmc / platform / android / powermanagement / AndroidPowerSyscall . h <nl> ppp b / xbmc / platform / android / powermanagement / AndroidPowerSyscall . h <nl> class CAndroidPowerSyscall : public CPowerSyscallWithoutEvents <nl> <nl> bool PumpPowerEvents ( IPowerEventsCallback * callback ) override ; <nl> <nl> - void SetOnPause ( ) { m_state = SUSPENDED ; } <nl> - void SetOnResume ( ) { m_state = RESUMED ; } <nl> + void SetSuspended ( ) { m_state = SUSPENDED ; } <nl> + void SetResumed ( ) { m_state = RESUMED ; } <nl> <nl> private : <nl> enum STATE : unsigned int <nl>
Merge pull request from ksooo / android - suspend - resume
xbmc/xbmc
519cbd6e66404475b63fa512279c8250a8da5241
2020-12-31T11:04:00Z
mmm a / cmake / modules / FindGBM . cmake <nl> ppp b / cmake / modules / FindGBM . cmake <nl> check_c_source_compiles ( " # include < gbm . h > <nl> } <nl> " GBM_HAS_BO_MAP ) <nl> <nl> + check_c_source_compiles ( " # include < gbm . h > <nl> + <nl> + int main ( ) <nl> + { <nl> + gbm_surface_create_with_modifiers ( NULL , 0 , 0 , 0 , NULL , 0 ) ; <nl> + } <nl> + " GBM_HAS_MODIFIERS ) <nl> + <nl> if ( GBM_FOUND ) <nl> set ( GBM_LIBRARIES $ { GBM_LIBRARY } ) <nl> set ( GBM_INCLUDE_DIRS $ { GBM_INCLUDE_DIR } ) <nl> if ( GBM_FOUND ) <nl> if ( GBM_HAS_BO_MAP ) <nl> list ( APPEND GBM_DEFINITIONS - DHAS_GBM_BO_MAP = 1 ) <nl> endif ( ) <nl> + if ( GBM_HAS_MODIFIERS ) <nl> + list ( APPEND GBM_DEFINITIONS - DHAS_GBM_MODIFIERS = 1 ) <nl> + endif ( ) <nl> if ( NOT TARGET GBM : : GBM ) <nl> add_library ( GBM : : GBM UNKNOWN IMPORTED ) <nl> set_target_properties ( GBM : : GBM PROPERTIES <nl> mmm a / xbmc / windowing / gbm / DRMUtils . cpp <nl> ppp b / xbmc / windowing / gbm / DRMUtils . cpp <nl> drm_fb * CDRMUtils : : DrmFbGetFromBo ( struct gbm_bo * bo ) <nl> strides [ 4 ] = { 0 } , <nl> offsets [ 4 ] = { 0 } ; <nl> <nl> + uint64_t modifiers [ 4 ] = { 0 } ; <nl> + <nl> width = gbm_bo_get_width ( bo ) ; <nl> height = gbm_bo_get_height ( bo ) ; <nl> <nl> + # if defined ( HAS_GBM_MODIFIERS ) <nl> + for ( int i = 0 ; i < gbm_bo_get_plane_count ( bo ) ; i + + ) <nl> + { <nl> + handles [ i ] = gbm_bo_get_handle_for_plane ( bo , i ) . u32 ; <nl> + strides [ i ] = gbm_bo_get_stride_for_plane ( bo , i ) ; <nl> + offsets [ i ] = gbm_bo_get_offset ( bo , i ) ; <nl> + modifiers [ i ] = gbm_bo_get_modifier ( bo ) ; <nl> + } <nl> + # else <nl> handles [ 0 ] = gbm_bo_get_handle ( bo ) . u32 ; <nl> strides [ 0 ] = gbm_bo_get_stride ( bo ) ; <nl> memset ( offsets , 0 , 16 ) ; <nl> + # endif <nl> + <nl> + if ( modifiers [ 0 ] = = DRM_FORMAT_MOD_INVALID ) <nl> + modifiers [ 0 ] = DRM_FORMAT_MOD_LINEAR ; <nl> <nl> - auto ret = drmModeAddFB2 ( m_fd , <nl> - width , <nl> - height , <nl> - fb - > format , <nl> - handles , <nl> - strides , <nl> - offsets , <nl> - & fb - > fb_id , <nl> - 0 ) ; <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - using modifier : % lli " , __FUNCTION__ , modifiers [ 0 ] ) ; <nl> + <nl> + auto ret = drmModeAddFB2WithModifiers ( m_fd , <nl> + width , <nl> + height , <nl> + fb - > format , <nl> + handles , <nl> + strides , <nl> + offsets , <nl> + modifiers , <nl> + & fb - > fb_id , <nl> + ( modifiers [ 0 ] > 0 ) ? DRM_MODE_FB_MODIFIERS : 0 ) ; <nl> <nl> if ( ret ) <nl> { <nl> bool CDRMUtils : : FindPlanes ( ) <nl> CLog : : Log ( LOGERROR , " CDRMUtils : : % s - could not get primary plane % u properties : % s " , __FUNCTION__ , m_primary_plane - > plane - > plane_id , strerror ( errno ) ) ; <nl> return false ; <nl> } <nl> + <nl> + if ( ! FindModifiersForPlane ( m_primary_plane ) ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - no drm modifiers present for the primary plane " , __FUNCTION__ ) ; <nl> + } <nl> } <nl> <nl> / / overlay plane should always be available <nl> bool CDRMUtils : : FindPlanes ( ) <nl> return false ; <nl> } <nl> <nl> + if ( ! FindModifiersForPlane ( m_overlay_plane ) ) <nl> + { <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - no drm modifiers present for the overlay plane " , __FUNCTION__ ) ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + bool CDRMUtils : : FindModifiersForPlane ( struct plane * object ) <nl> + { <nl> + uint64_t blob_id = 0 ; <nl> + <nl> + for ( uint32_t i = 0 ; i < object - > props - > count_props ; i + + ) <nl> + { <nl> + if ( strcmp ( object - > props_info [ i ] - > name , " IN_FORMATS " ) = = 0 ) <nl> + blob_id = object - > props - > prop_values [ i ] ; <nl> + } <nl> + <nl> + if ( blob_id = = 0 ) <nl> + return false ; <nl> + <nl> + drmModePropertyBlobPtr blob = drmModeGetPropertyBlob ( m_fd , blob_id ) ; <nl> + if ( ! blob ) <nl> + return false ; <nl> + <nl> + drm_format_modifier_blob * header = static_cast < drm_format_modifier_blob * > ( blob - > data ) ; <nl> + uint32_t * formats = reinterpret_cast < uint32_t * > ( reinterpret_cast < char * > ( header ) + header - > formats_offset ) ; <nl> + drm_format_modifier * mod = reinterpret_cast < drm_format_modifier * > ( reinterpret_cast < char * > ( header ) + header - > modifiers_offset ) ; <nl> + <nl> + for ( uint32_t i = 0 ; i < header - > count_formats ; i + + ) <nl> + { <nl> + std : : vector < uint64_t > modifiers ; <nl> + for ( uint32_t j = 0 ; j < header - > count_modifiers ; j + + ) <nl> + { <nl> + if ( mod [ j ] . formats & 1ULL < < i ) <nl> + modifiers . emplace_back ( mod [ j ] . modifier ) ; <nl> + } <nl> + <nl> + object - > modifiers_map . emplace ( formats [ i ] , modifiers ) ; <nl> + } <nl> + <nl> + if ( blob ) <nl> + drmModeFreePropertyBlob ( blob ) ; <nl> + <nl> return true ; <nl> } <nl> <nl> mmm a / xbmc / windowing / gbm / DRMUtils . h <nl> ppp b / xbmc / windowing / gbm / DRMUtils . h <nl> <nl> # include < xf86drm . h > <nl> # include < xf86drmMode . h > <nl> # include < gbm . h > <nl> + # include < map > <nl> # include < vector > <nl> <nl> # include " windowing / Resolution . h " <nl> struct plane : drm_object <nl> { <nl> drmModePlanePtr plane = nullptr ; <nl> uint32_t format = DRM_FORMAT_XRGB8888 ; <nl> + std : : map < uint32_t , std : : vector < uint64_t > > modifiers_map ; <nl> } ; <nl> <nl> struct connector : drm_object <nl> class CDRMUtils <nl> int GetFileDescriptor ( ) const { return m_fd ; } <nl> struct plane * GetPrimaryPlane ( ) const { return m_primary_plane ; } <nl> struct plane * GetOverlayPlane ( ) const { return m_overlay_plane ; } <nl> + std : : vector < uint64_t > * GetPrimaryPlaneModifiersForFormat ( uint32_t format ) { return & m_primary_plane - > modifiers_map [ format ] ; } <nl> + std : : vector < uint64_t > * GetOverlayPlaneModifiersForFormat ( uint32_t format ) { return & m_overlay_plane - > modifiers_map [ format ] ; } <nl> struct crtc * GetCrtc ( ) const { return m_crtc ; } <nl> <nl> virtual RESOLUTION_INFO GetCurrentMode ( ) ; <nl> class CDRMUtils <nl> bool FindEncoder ( ) ; <nl> bool FindCrtc ( ) ; <nl> bool FindPlanes ( ) ; <nl> + bool FindModifiersForPlane ( struct plane * object ) ; <nl> bool FindPreferredMode ( ) ; <nl> bool RestoreOriginalMode ( ) ; <nl> static void DrmFbDestroyCallback ( struct gbm_bo * bo , void * data ) ; <nl> mmm a / xbmc / windowing / gbm / GBMUtils . cpp <nl> ppp b / xbmc / windowing / gbm / GBMUtils . cpp <nl> void CGBMUtils : : DestroyDevice ( ) <nl> } <nl> } <nl> <nl> - bool CGBMUtils : : CreateSurface ( int width , int height ) <nl> + bool CGBMUtils : : CreateSurface ( int width , int height , const uint64_t * modifiers , const int modifiers_count ) <nl> { <nl> if ( m_surface ) <nl> CLog : : Log ( LOGWARNING , " CGBMUtils : : % s - surface already created " , __FUNCTION__ ) ; <nl> <nl> + # if defined ( HAS_GBM_MODIFIERS ) <nl> + m_surface = gbm_surface_create_with_modifiers ( m_device , <nl> + width , <nl> + height , <nl> + GBM_FORMAT_ARGB8888 , <nl> + modifiers , <nl> + modifiers_count ) ; <nl> + # else <nl> m_surface = gbm_surface_create ( m_device , <nl> width , <nl> height , <nl> GBM_FORMAT_ARGB8888 , <nl> GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING ) ; <nl> + # endif <nl> <nl> if ( ! m_surface ) <nl> { <nl> mmm a / xbmc / windowing / gbm / GBMUtils . h <nl> ppp b / xbmc / windowing / gbm / GBMUtils . h <nl> class CGBMUtils <nl> ~ CGBMUtils ( ) = default ; <nl> bool CreateDevice ( int fd ) ; <nl> void DestroyDevice ( ) ; <nl> - bool CreateSurface ( int width , int height ) ; <nl> + bool CreateSurface ( int width , int height , const uint64_t * modifiers , const int modifiers_count ) ; <nl> void DestroySurface ( ) ; <nl> struct gbm_bo * LockFrontBuffer ( ) ; <nl> void ReleaseBuffer ( ) ; <nl> mmm a / xbmc / windowing / gbm / WinSystemGbm . cpp <nl> ppp b / xbmc / windowing / gbm / WinSystemGbm . cpp <nl> bool CWinSystemGbm : : CreateNewWindow ( const std : : string & name , <nl> return false ; <nl> } <nl> <nl> - if ( ! m_GBM - > CreateSurface ( res . iWidth , res . iHeight ) ) <nl> + std : : vector < uint64_t > * modifiers = m_DRM - > GetOverlayPlaneModifiersForFormat ( m_DRM - > GetOverlayPlane ( ) - > format ) ; <nl> + <nl> + if ( ! m_GBM - > CreateSurface ( res . iWidth , res . iHeight , modifiers - > data ( ) , modifiers - > size ( ) ) ) <nl> { <nl> CLog : : Log ( LOGERROR , " CWinSystemGbm : : % s - failed to initialize GBM " , __FUNCTION__ ) ; <nl> return false ; <nl>
windowing / gbm : add drm modifiers
xbmc/xbmc
21de917759132ffac66e71901eb92d109dacac2b
2018-07-27T02:10:57Z
mmm a / hphp / hack / src / typing / typing . ml <nl> ppp b / hphp / hack / src / typing / typing . ml <nl> and class_def_ env_up c tc = <nl> then begin <nl> List . iter ( class_implements_type env c ) impl ; <nl> SMap . iter ( fun _ ty - > class_implements_type env c ty ) dimpl ; <nl> - List . iter ( class_var_def env false c ) c . c_vars ; <nl> - List . iter ( method_def env ) c . c_methods ; <nl> - let const_types = List . map ( class_const_def env ) c . c_consts in <nl> - let env = Typing_enum . enum_class_check env tc c . c_consts const_types in <nl> - class_constr_def env c ; <nl> - let env = Env . set_static env in <nl> - List . iter ( class_var_def env true c ) c . c_static_vars ; <nl> - List . iter ( method_def env ) c . c_static_methods <nl> end ; <nl> + List . iter ( class_var_def env false c ) c . c_vars ; <nl> + List . iter ( method_def env ) c . c_methods ; <nl> + let const_types = List . map ( class_const_def env ) c . c_consts in <nl> + let env = Typing_enum . enum_class_check env tc c . c_consts const_types in <nl> + class_constr_def env c ; <nl> + let env = Env . set_static env in <nl> + List . iter ( class_var_def env true c ) c . c_static_vars ; <nl> + List . iter ( method_def env ) c . c_static_methods ; <nl> Typing_hooks . dispatch_exit_class_def_hook c tc <nl> <nl> and check_extend_abstract_meth p smap = <nl>
Check types of declared methods / vars / consts in decl mode
facebook/hhvm
f6b41e1a8b700653eff20ba3045c65f96683a18d
2015-05-09T02:41:36Z
mmm a / src / harmony - array . js <nl> ppp b / src / harmony - array . js <nl> var GlobalSymbol = global . Symbol ; <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - / / ES6 draft 03 - 17 - 15 , section 22 . 1 . 3 . 3 <nl> - function ArrayCopyWithin ( target , start , end ) { <nl> - CHECK_OBJECT_COERCIBLE ( this , " Array . prototype . copyWithin " ) ; <nl> - <nl> - var array = TO_OBJECT_INLINE ( this ) ; <nl> - var length = ToLength ( array . length ) ; <nl> - <nl> - target = TO_INTEGER ( target ) ; <nl> - var to ; <nl> - if ( target < 0 ) { <nl> - to = $ max ( length + target , 0 ) ; <nl> - } else { <nl> - to = $ min ( target , length ) ; <nl> - } <nl> - <nl> - start = TO_INTEGER ( start ) ; <nl> - var from ; <nl> - if ( start < 0 ) { <nl> - from = $ max ( length + start , 0 ) ; <nl> - } else { <nl> - from = $ min ( start , length ) ; <nl> - } <nl> - <nl> - end = IS_UNDEFINED ( end ) ? length : TO_INTEGER ( end ) ; <nl> - var final ; <nl> - if ( end < 0 ) { <nl> - final = $ max ( length + end , 0 ) ; <nl> - } else { <nl> - final = $ min ( end , length ) ; <nl> - } <nl> - <nl> - var count = $ min ( final - from , length - to ) ; <nl> - var direction = 1 ; <nl> - if ( from < to & & to < ( from + count ) ) { <nl> - direction = - 1 ; <nl> - from = from + count - 1 ; <nl> - to = to + count - 1 ; <nl> - } <nl> - <nl> - while ( count > 0 ) { <nl> - if ( from in array ) { <nl> - array [ to ] = array [ from ] ; <nl> - } else { <nl> - delete array [ to ] ; <nl> - } <nl> - from = from + direction ; <nl> - to = to + direction ; <nl> - count - - ; <nl> - } <nl> - <nl> - return array ; <nl> - } <nl> - <nl> / / ES6 draft 07 - 15 - 13 , section 15 . 4 . 3 . 23 <nl> function ArrayFind ( predicate / * thisArg * / ) { / / length = = 1 <nl> CHECK_OBJECT_COERCIBLE ( this , " Array . prototype . find " ) ; <nl> InstallConstants ( GlobalSymbol , [ <nl> " isConcatSpreadable " , symbolIsConcatSpreadable <nl> ] ) ; <nl> <nl> - % FunctionSetLength ( ArrayCopyWithin , 2 ) ; <nl> % FunctionSetLength ( ArrayFrom , 1 ) ; <nl> <nl> / / Set up non - enumerable functions on the Array object . <nl> InstallFunctions ( GlobalArray , DONT_ENUM , [ <nl> <nl> / / Set up the non - enumerable functions on the Array prototype object . <nl> InstallFunctions ( GlobalArray . prototype , DONT_ENUM , [ <nl> - " copyWithin " , ArrayCopyWithin , <nl> " find " , ArrayFind , <nl> " findIndex " , ArrayFindIndex , <nl> " fill " , ArrayFill <nl> deleted file mode 100644 <nl> index c3a0c14663b . . 00000000000 <nl> mmm a / test / mjsunit / harmony / array - copywithin . js <nl> ppp / dev / null <nl> <nl> - / / Copyright 2014 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> - / / Flags : - - harmony - arrays <nl> - <nl> - ( function copyWithinArity ( ) { <nl> - assertEquals ( Array . prototype . copyWithin . length , 2 ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinTargetAndStart ( ) { <nl> - / / works with two arguemnts <nl> - assertArrayEquals ( [ 4 , 5 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 0 , 3 ) ) ; <nl> - assertArrayEquals ( [ 1 , 4 , 5 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 1 , 3 ) ) ; <nl> - assertArrayEquals ( [ 1 , 3 , 4 , 5 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 1 , 2 ) ) ; <nl> - assertArrayEquals ( [ 1 , 2 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 2 , 2 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinTargetStartAndEnd ( ) { <nl> - / / works with three arguments <nl> - assertArrayEquals ( [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 0 , 3 , 4 ) , [ 4 , 2 , 3 , 4 , 5 ] ) ; <nl> - assertArrayEquals ( [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 1 , 3 , 4 ) , [ 1 , 4 , 3 , 4 , 5 ] ) ; <nl> - assertArrayEquals ( [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 1 , 2 , 4 ) , [ 1 , 3 , 4 , 4 , 5 ] ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinNegativeRelativeOffsets ( ) { <nl> - / / works with negative arguments <nl> - assertArrayEquals ( [ 4 , 5 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 0 , - 2 ) ) ; <nl> - assertArrayEquals ( [ 4 , 2 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 0 , - 2 , - 1 ) ) ; <nl> - assertArrayEquals ( [ 1 , 3 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( - 4 , - 3 , - 2 ) ) ; <nl> - assertArrayEquals ( [ 1 , 3 , 4 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( - 4 , - 3 , - 1 ) ) ; <nl> - assertArrayEquals ( [ 1 , 3 , 4 , 5 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( - 4 , - 3 ) ) ; <nl> - / / test with arguments equal to - this . length <nl> - assertArrayEquals ( [ 1 , 2 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( - 5 , 0 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinArrayLikeValues ( ) { <nl> - / / works with array - like values <nl> - var args = ( function ( ) { return arguments ; } ( 1 , 2 , 3 ) ) ; <nl> - Array . prototype . copyWithin . call ( args , - 2 , 0 ) ; <nl> - assertArrayEquals ( [ 1 , 1 , 2 ] , Array . prototype . slice . call ( args ) ) ; <nl> - <nl> - / / [ [ Class ] ] does not change <nl> - assertArrayEquals ( " [ object Arguments ] " , Object . prototype . toString . call ( args ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinNullThis ( ) { <nl> - / / throws on null / undefined values <nl> - assertThrows ( function ( ) { <nl> - return Array . prototype . copyWithin . call ( null , 0 , 3 ) ; <nl> - } , TypeError ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinUndefinedThis ( ) { <nl> - assertThrows ( function ( ) { <nl> - return Array . prototype . copyWithin . call ( undefined , 0 , 3 ) ; <nl> - } , TypeError ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - / / TODO ( caitp ) : indexed properties of String are read - only and setting them <nl> - / / should throw in strict mode . See bug v8 : 4042 <nl> - / / ( function copyWithinStringThis ( ) { <nl> - / / / / test with this value as string <nl> - / / assertThrows ( function ( ) { <nl> - / / return Array . prototype . copyWithin . call ( " hello world " , 0 , 3 ) ; <nl> - / / } , TypeError ) ; <nl> - / / } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinNumberThis ( ) { <nl> - / / test with this value as number <nl> - assertEquals ( 34 , Array . prototype . copyWithin . call ( 34 , 0 , 3 ) . valueOf ( ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinSymbolThis ( ) { <nl> - / / test with this value as number <nl> - var sym = Symbol ( " test " ) ; <nl> - assertEquals ( sym , Array . prototype . copyWithin . call ( sym , 0 , 3 ) . valueOf ( ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyyWithinTypedArray ( ) { <nl> - / / test with this value as TypedArray <nl> - var buffer = new ArrayBuffer ( 16 ) ; <nl> - var int32View = new Int32Array ( buffer ) ; <nl> - for ( var i = 0 ; i < int32View . length ; i + + ) { <nl> - int32View [ i ] = i * 2 ; <nl> - } <nl> - assertArrayEquals ( new Int32Array ( [ 2 , 4 , 6 , 6 ] ) , <nl> - Array . prototype . copyWithin . call ( int32View , 0 , 1 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinSloppyArguments ( ) { <nl> - / / if arguments object is sloppy , copyWithin must move the arguments around <nl> - function f ( a , b , c , d , e ) { <nl> - [ ] . copyWithin . call ( arguments , 1 , 3 ) ; <nl> - return [ a , b , c , d , e ] ; <nl> - } <nl> - assertArrayEquals ( [ 1 , 4 , 5 , 4 , 5 ] , f ( 1 , 2 , 3 , 4 , 5 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinStartLessThanTarget ( ) { <nl> - / / test with target > start on 2 arguments <nl> - assertArrayEquals ( [ 1 , 2 , 3 , 1 , 2 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 3 , 0 ) ) ; <nl> - <nl> - / / test with target > start on 3 arguments <nl> - assertArrayEquals ( [ 1 , 2 , 3 , 1 , 2 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 3 , 0 , 4 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinArrayWithHoles ( ) { <nl> - / / test on array with holes <nl> - var arr = new Array ( 6 ) ; <nl> - for ( var i = 0 ; i < arr . length ; i + = 2 ) { <nl> - arr [ i ] = i ; <nl> - } <nl> - assertArrayEquals ( [ , 4 , , , 4 , , ] , arr . copyWithin ( 0 , 3 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinArrayLikeWithHoles ( ) { <nl> - / / test on array - like object with holes <nl> - assertArrayEquals ( { <nl> - length : 6 , <nl> - 1 : 4 , <nl> - 4 : 4 <nl> - } , Array . prototype . copyWithin . call ( { <nl> - length : 6 , <nl> - 0 : 0 , <nl> - 2 : 2 , <nl> - 4 : 4 <nl> - } , 0 , 3 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinNonIntegerRelativeOffsets ( ) { <nl> - / / test on fractional arguments <nl> - assertArrayEquals ( [ 4 , 5 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 0 . 2 , 3 . 9 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinNegativeZeroTarget ( ) { <nl> - / / test with - 0 <nl> - assertArrayEquals ( [ 4 , 5 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( - 0 , 3 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinTargetOutsideStart ( ) { <nl> - / / test with arguments more than this . length <nl> - assertArrayEquals ( [ 1 , 2 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 0 , 7 ) ) ; <nl> - <nl> - / / test with arguments less than - this . length <nl> - assertArrayEquals ( [ 1 , 2 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( - 7 , 0 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinEmptyArray ( ) { <nl> - / / test on empty array <nl> - assertArrayEquals ( [ ] , [ ] . copyWithin ( 0 , 3 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinTargetCutOff ( ) { <nl> - / / test with target range being shorter than end - start <nl> - assertArrayEquals ( [ 1 , 2 , 2 , 3 , 4 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 2 , 1 , 4 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinOverlappingRanges ( ) { <nl> - / / test overlapping ranges <nl> - var arr = [ 1 , 2 , 3 , 4 , 5 ] ; <nl> - arr . copyWithin ( 2 , 1 , 4 ) ; <nl> - assertArrayEquals ( [ 1 , 2 , 2 , 2 , 3 ] , arr . copyWithin ( 2 , 1 , 4 ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinStrictDelete ( ) { <nl> - / / check that [ [ Delete ] ] is strict ( non - extensible via freeze ) <nl> - assertThrows ( function ( ) { <nl> - return Object . freeze ( [ 1 , , 3 , , 4 , 5 ] ) . copyWithin ( 2 , 1 , 4 ) ; <nl> - } , TypeError ) ; <nl> - <nl> - / / check that [ [ Delete ] ] is strict ( non - extensible via seal ) <nl> - assertThrows ( function ( ) { <nl> - return Object . seal ( [ 1 , , 3 , , 4 , 5 ] ) . copyWithin ( 2 , 1 , 4 ) ; <nl> - } , TypeError ) ; <nl> - <nl> - / / check that [ [ Delete ] ] is strict ( non - extensible via preventExtensions ) <nl> - assertThrows ( function ( ) { <nl> - return Object . preventExtensions ( [ 1 , , 3 , , 4 , 5 ] ) . copyWithin ( 2 , 1 , 4 ) ; <nl> - } , TypeError ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinStrictSet ( ) { <nl> - / / check that [ [ Set ] ] is strict ( non - extensible via freeze ) <nl> - assertThrows ( function ( ) { <nl> - return Object . freeze ( [ 1 , 2 , 3 , 4 , 5 ] ) . copyWithin ( 0 , 3 ) ; <nl> - } , TypeError ) ; <nl> - <nl> - / / check that [ [ Set ] ] is strict ( non - extensible via seal ) <nl> - assertThrows ( function ( ) { <nl> - return Object . seal ( [ , 2 , 3 , 4 , 5 ] ) . copyWithin ( 0 , 3 ) ; <nl> - } , TypeError ) ; <nl> - <nl> - / / check that [ [ Set ] ] is strict ( non - extensible via preventExtensions ) <nl> - assertThrows ( function ( ) { <nl> - return Object . preventExtensions ( [ , 2 , 3 , 4 , 5 ] ) . copyWithin ( 0 , 3 ) ; <nl> - } , TypeError ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinSetterThrows ( ) { <nl> - function Boom ( ) { } <nl> - / / test if we throw in between <nl> - var arr = Object . defineProperty ( [ 1 , 2 , 3 , 4 , 5 ] , 1 , { <nl> - set : function ( ) { <nl> - throw new Boom ( ) ; <nl> - } <nl> - } ) ; <nl> - <nl> - assertThrows ( function ( ) { <nl> - return arr . copyWithin ( 1 , 3 ) ; <nl> - } , Boom ) ; <nl> - <nl> - assertArrayEquals ( [ 1 , , 3 , 4 , 5 ] , arr ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinDefaultEnd ( ) { <nl> - / / undefined as third argument <nl> - assertArrayEquals ( <nl> - [ 4 , 5 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 0 , 3 , undefined ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinGetLengthOnce ( ) { <nl> - / / test that this . length is called only once <nl> - var count = 0 ; <nl> - var arr = Object . defineProperty ( { 0 : 1 , 1 : 2 , 2 : 3 , 3 : 4 , 4 : 5 } , " length " , { <nl> - get : function ( ) { <nl> - count + + ; <nl> - return 5 ; <nl> - } <nl> - } ) ; <nl> - Array . prototype . copyWithin . call ( arr , 1 , 3 ) ; <nl> - assertEquals ( 1 , count ) ; <nl> - <nl> - Array . prototype . copyWithin . call ( arr , 1 , 3 , 4 ) ; <nl> - assertEquals ( 2 , count ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinLargeArray ( ) { <nl> - var large = 10000 ; <nl> - <nl> - / / test on a large array <nl> - var arr = new Array ( large ) ; <nl> - assertArrayEquals ( arr , arr . copyWithin ( 45 , 9000 ) ) ; <nl> - <nl> - var expected = new Array ( large ) ; <nl> - / / test on floating point numbers <nl> - for ( var i = 0 ; i < large ; i + + ) { <nl> - arr [ i ] = Math . random ( ) ; <nl> - expected [ i ] = arr [ i ] ; <nl> - if ( i > = 9000 ) { <nl> - expected [ ( i - 9000 ) + 45 ] = arr [ i ] ; <nl> - } <nl> - } <nl> - assertArrayEquals ( expected , arr . copyWithin ( 45 , 9000 ) ) ; <nl> - <nl> - / / test on array of objects <nl> - for ( var i = 0 ; i < large ; i + + ) { <nl> - arr [ i ] = { num : Math . random ( ) } ; <nl> - } + 45 <nl> - arr . copyWithin ( 45 , 9000 ) ; <nl> - <nl> - / / test copied by reference <nl> - for ( var i = 9000 ; i < large ; + + i ) { <nl> - assertSame ( arr [ ( i - 9000 ) + 45 ] , arr [ i ] ) ; <nl> - } <nl> - <nl> - / / test array length remains same <nl> - assertEquals ( large , arr . length ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinSuperLargeLength ( ) { <nl> - / / 2 ^ 53 - 1 is the maximum value returned from ToLength ( ) <nl> - var large = Math . pow ( 2 , 53 ) - 1 ; <nl> - var object = { length : large } ; <nl> - <nl> - / / Initialize last 10 entries <nl> - for ( var i = 1 ; i < = 10 ; + + i ) { <nl> - object [ ( large - 11 ) + i ] = { num : i } ; <nl> - } <nl> - <nl> - Array . prototype . copyWithin . call ( object , 1 , large - 10 ) ; <nl> - <nl> - / / Test copied values <nl> - for ( var i = 1 ; i < = 10 ; + + i ) { <nl> - var old_ref = object [ ( large - 11 ) + i ] ; <nl> - var new_ref = object [ i ] ; <nl> - assertSame ( old_ref , new_ref ) ; <nl> - assertSame ( new_ref . num , i ) ; <nl> - } <nl> - <nl> - / / Assert length has not changed <nl> - assertEquals ( large , object . length ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinNullEnd ( ) { <nl> - / / test null on third argument is converted to + 0 <nl> - assertArrayEquals ( [ 1 , 2 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 0 , 3 , null ) ) ; <nl> - } ) ( ) ; <nl> - <nl> - <nl> - ( function copyWithinElementsInObjectsPrototype ( ) { <nl> - / / tamper the global Object prototype and test this works <nl> - Object . prototype [ 2 ] = 1 ; <nl> - assertArrayEquals ( [ 4 , 5 , 3 , 4 , 5 ] , [ 1 , 2 , 3 , 4 , 5 ] . copyWithin ( 0 , 3 ) ) ; <nl> - delete Object . prototype [ 2 ] ; <nl> - <nl> - Object . prototype [ 3 ] = " FAKE " ; <nl> - assertArrayEquals ( [ " FAKE " , 5 , 3 , " FAKE " , 5 ] , [ 1 , 2 , 3 , , 5 ] . copyWithin ( 0 , 3 ) ) ; <nl> - delete Object . prototype [ 3 ] ; <nl> - } ) ( ) ; <nl>
Revert of [ es6 ] implement Array . prototype . copyWithin ( ) ( patchset id : 120001 of https : / / codereview . chromium . org / 376623004 / )
v8/v8
9283fc89710e59445bdc4479454fba97ab9ebdd7
2015-04-21T21:11:31Z
mmm a / Code / CryEngine / CryCommon / CryRenderer / IShader . h <nl> ppp b / Code / CryEngine / CryCommon / CryRenderer / IShader . h <nl> enum eDynamicLightFlags <nl> DLF_AMBIENT = BIT ( 21 ) , / / ! < Ambient light ( has name indicates , used for replacing ambient ) . <nl> DLF_INDOOR_ONLY = BIT ( 22 ) , / / ! < Do not affect height map . <nl> DLF_VOLUMETRIC_FOG = BIT ( 23 ) , / / ! < Affects volumetric fog . <nl> - / / UNUSED = BIT ( 24 ) , / / ! < Add only to Light Propagation Volume if it ' s possible . <nl> + DLF_LINK_TO_SKY_COLOR = BIT ( 24 ) , / / ! < Multiply light color with current sky color ( use GI sky color if available ) . <nl> DLF_ATTACH_TO_SUN = BIT ( 25 ) , / / ! < Add only to Light Propagation Volume if it ' s possible . <nl> DLF_TRACKVIEW_TIMESCRUBBING = BIT ( 26 ) , / / ! < Add only to Light Propagation Volume if it ' s possible . <nl> DLF_VOLUMETRIC_FOG_ONLY = BIT ( 27 ) , / / ! < Affects only volumetric fog . <nl> mmm a / Code / CryEngine / CryEntitySystem / ScriptBind_Entity . cpp <nl> ppp b / Code / CryEngine / CryEntitySystem / ScriptBind_Entity . cpp <nl> bool CScriptBind_Entity : : ParseLightParams ( IScriptTable * pLightTable , CDLight & li <nl> light . m_Flags | = DLF_INDOOR_ONLY ; <nl> if ( chain . GetValue ( " ambient " , flag ) & & flag ) <nl> light . m_Flags | = DLF_AMBIENT ; <nl> + if ( chain . GetValue ( " link_to_sky_color " , flag ) & & flag ) <nl> + light . m_Flags | = DLF_LINK_TO_SKY_COLOR ; <nl> if ( chain . GetValue ( " area_light " , flag ) & & flag ) <nl> light . m_Flags | = DLF_AREA_LIGHT ; <nl> if ( chain . GetValue ( " deferred_light " , flag ) & & flag ) <nl> mmm a / Code / CryEngine / RenderDll / XRenderD3D9 / D3DDeferredShading . cpp <nl> ppp b / Code / CryEngine / RenderDll / XRenderD3D9 / D3DDeferredShading . cpp <nl> RenderLightIndex CDeferredShading : : AddLight ( const CDLight & pDL , float fMult , con <nl> nLightId = pAddedLight - > m_Id ; <nl> } <nl> <nl> + if ( pDL . m_Flags & DLF_LINK_TO_SKY_COLOR ) <nl> + { <nl> + # if defined ( FEATURE_SVO_GI ) <nl> + CSvoRenderer * pSR = CSvoRenderer : : GetInstance ( ) ; <nl> + if ( pSR ) <nl> + { <nl> + pAddedLight - > m_Color * = pSR - > GetSkyColor ( ) ; <nl> + } <nl> + else <nl> + # endif <nl> + <nl> + { <nl> + pAddedLight - > m_Color * = gEnv - > p3DEngine - > GetSkyColor ( ) ; <nl> + } <nl> + } <nl> + <nl> IF_LIKELY ( ( pDL . m_Flags & ( DLF_DEFERRED_CUBEMAPS | DLF_AMBIENT ) ) = = 0 ) <nl> { <nl> pAddedLight - > m_Color * = fMult ; <nl> mmm a / Code / CryEngine / RenderDll / XRenderD3D9 / D3D_SVO . h <nl> ppp b / Code / CryEngine / RenderDll / XRenderD3D9 / D3D_SVO . h <nl> class CSvoRenderer : public ISvoRenderer <nl> CTexture * GetRsmPoolCol ( ) { return IsActive ( ) ? m_pRsmPoolCol : NULL ; } <nl> CTexture * GetRsmPoolNor ( ) { return IsActive ( ) ? m_pRsmPoolNor : NULL ; } <nl> static void GetRsmTextures ( _smart_ptr < CTexture > & pRsmColorMap , _smart_ptr < CTexture > & pRsmNormlMap , _smart_ptr < CTexture > & pRsmPoolCol , _smart_ptr < CTexture > & pRsmPoolNor ) ; <nl> + ColorF GetSkyColor ( ) { return m_texInfo . vSkyColorTop ; } <nl> <nl> protected : <nl> <nl> mmm a / Code / CryPlugins / CryDefaultEntities / Module / DefaultComponents / Lights / PointLightComponent . cpp <nl> ppp b / Code / CryPlugins / CryDefaultEntities / Module / DefaultComponents / Lights / PointLightComponent . cpp <nl> namespace Cry <nl> if ( m_options . m_bAffectsVolumetricFog ) <nl> light . m_Flags | = DLF_VOLUMETRIC_FOG ; <nl> <nl> + if ( m_options . m_bLinkToSkyColor ) <nl> + light . m_Flags | = DLF_LINK_TO_SKY_COLOR ; <nl> + <nl> if ( m_options . m_bAmbient ) <nl> light . m_Flags | = DLF_AMBIENT ; <nl> <nl> mmm a / Code / CryPlugins / CryDefaultEntities / Module / DefaultComponents / Lights / PointLightComponent . h <nl> ppp b / Code / CryPlugins / CryDefaultEntities / Module / DefaultComponents / Lights / PointLightComponent . h <nl> namespace Cry <nl> bool m_bVolumetricFogOnly = false ; <nl> bool m_bAffectsVolumetricFog = true ; <nl> bool m_bAffectsOnlyThisArea = true ; <nl> + bool m_bLinkToSkyColor = false ; <nl> bool m_bAmbient = false ; <nl> Schematyc : : Range < 0 , 10000 > m_fogRadialLobe = CDLight ( ) . m_fFogRadialLobe ; <nl> <nl> namespace Cry <nl> desc . AddMember ( & CPointLightComponent : : SOptions : : m_bAffectsVolumetricFog , ' volf ' , " AffectVolumetricFog " , " Affect Volumetric Fog " , nullptr , true ) ; <nl> desc . AddMember ( & CPointLightComponent : : SOptions : : m_bVolumetricFogOnly , ' volo ' , " VolumetricFogOnly " , " Only Affect Volumetric Fog " , nullptr , false ) ; <nl> desc . AddMember ( & CPointLightComponent : : SOptions : : m_bAffectsOnlyThisArea , ' area ' , " OnlyAffectThisArea " , " Only Affect This Area " , nullptr , true ) ; <nl> + desc . AddMember ( & CPointLightComponent : : SOptions : : m_bLinkToSkyColor , ' ltsc ' , " LinkToSkyColor " , " Link To Sky Color " , " Multiply light color with current sky color ( use GI sky color if available ) . " , false ) ; <nl> desc . AddMember ( & CPointLightComponent : : SOptions : : m_bAmbient , ' ambi ' , " Ambient " , " Ambient " , nullptr , false ) ; <nl> desc . AddMember ( & CPointLightComponent : : SOptions : : m_fogRadialLobe , ' fogr ' , " FogRadialLobe " , " Fog Radial Lobe " , nullptr , CDLight ( ) . m_fFogRadialLobe ) ; <nl> desc . AddMember ( & CPointLightComponent : : SOptions : : m_giMode , ' gimo ' , " GIMode " , " Global Illumination " , nullptr , ELightGIMode : : Disabled ) ; <nl> mmm a / Code / CryPlugins / CryDefaultEntities / Module / DefaultComponents / Lights / ProjectorLightComponent . cpp <nl> ppp b / Code / CryPlugins / CryDefaultEntities / Module / DefaultComponents / Lights / ProjectorLightComponent . cpp <nl> void CProjectorLightComponent : : Initialize ( ) <nl> if ( m_options . m_bAffectsVolumetricFog ) <nl> light . m_Flags | = DLF_VOLUMETRIC_FOG ; <nl> <nl> + if ( m_options . m_bLinkToSkyColor ) <nl> + light . m_Flags | = DLF_LINK_TO_SKY_COLOR ; <nl> + <nl> if ( m_options . m_bAmbient ) <nl> light . m_Flags | = DLF_AMBIENT ; <nl> <nl> mmm a / Code / CryPlugins / CryDefaultEntities / Module / Legacy / Lights / EnvironmentProbe . cpp <nl> ppp b / Code / CryPlugins / CryDefaultEntities / Module / Legacy / Lights / EnvironmentProbe . cpp <nl> void CEnvironmentProbeEntity : : OnResetState ( ) <nl> if ( m_bIgnoreVisAreas ) <nl> m_light . m_Flags | = DLF_IGNORES_VISAREAS ; <nl> <nl> + if ( m_bLinkToSkyColor ) <nl> + m_light . m_Flags | = DLF_LINK_TO_SKY_COLOR ; <nl> + <nl> if ( m_bBoxProjection ) <nl> m_light . m_Flags | = DLF_BOX_PROJECTED_CM ; <nl> <nl> mmm a / Code / CryPlugins / CryDefaultEntities / Module / Legacy / Lights / EnvironmentProbe . h <nl> ppp b / Code / CryPlugins / CryDefaultEntities / Module / Legacy / Lights / EnvironmentProbe . h <nl> class CEnvironmentProbeEntity final <nl> archive ( m_bVolumetricFogOnly , " VolumetricFogOnly " , " Volumetric Fog Only " ) ; <nl> archive ( m_bAffectsVolumetricFog , " AffectsVolumetricFog " , " Affects Volumetric Fog " ) ; <nl> archive ( m_bAffectsOnlyThisArea , " AffectsOnlyThisArea " , " Affects Only This Area " ) ; <nl> + archive ( m_bLinkToSkyColor , " LinkToSkyColor " , " Link To Sky Color " ) ; <nl> <nl> archive . closeBlock ( ) ; <nl> } <nl> class CEnvironmentProbeEntity final <nl> bool m_bVolumetricFogOnly = false ; <nl> bool m_bAffectsVolumetricFog = true ; <nl> bool m_bAffectsOnlyThisArea = true ; <nl> + bool m_bLinkToSkyColor = false ; <nl> <nl> bool m_bActive = true ; <nl> string m_cubemapPath ; <nl> mmm a / Code / CryPlugins / CryDefaultEntities / Module / Legacy / Lights / LightEntity . cpp <nl> ppp b / Code / CryPlugins / CryDefaultEntities / Module / Legacy / Lights / LightEntity . cpp <nl> void CDefaultLightEntity : : OnResetState ( ) <nl> { <nl> m_light . m_Flags | = DLF_IGNORES_VISAREAS ; <nl> } <nl> + if ( m_bLinkToSkyColor ) <nl> + { <nl> + m_light . m_Flags | = DLF_LINK_TO_SKY_COLOR ; <nl> + } <nl> if ( m_bAmbient ) <nl> { <nl> m_light . m_Flags | = DLF_AMBIENT ; <nl> mmm a / Code / CryPlugins / CryDefaultEntities / Module / Legacy / Lights / LightEntity . h <nl> ppp b / Code / CryPlugins / CryDefaultEntities / Module / Legacy / Lights / LightEntity . h <nl> class CDefaultLightEntity final <nl> archive ( m_bIgnoreVisAreas , " IgnoreVisAreas " , " IgnoreVisAreas " ) ; <nl> archive ( m_bAffectsThisAreaOnly , " AffectsThisAreaOnly " , " AffectsThisAreaOnly " ) ; <nl> archive ( m_bAmbient , " Ambient " , " Ambient " ) ; <nl> + archive ( m_bLinkToSkyColor , " LinkToSkyColor " , " LinkToSkyColor " ) ; <nl> archive ( m_bFake , " FakeLight " , " FakeLight " ) ; <nl> archive ( m_bAffectVolumetricFog , " AffectVolumetricFog " , " AffectVolumetricFog " ) ; <nl> archive ( m_bAffectVolumetricFogOnly , " AffectVolumetricFogOnly " , " AffectVolumetricFogOnly " ) ; <nl> class CDefaultLightEntity final <nl> bool m_bIgnoreVisAreas = false ; <nl> bool m_bAffectsThisAreaOnly = true ; <nl> bool m_bAmbient = false ; <nl> + bool m_bLinkToSkyColor = false ; <nl> bool m_bFake = false ; <nl> bool m_bAffectVolumetricFog = true ; <nl> bool m_bAffectVolumetricFogOnly = false ; <nl>
! F ( Renderer ) ( Plugins ) Added new light entity UI parameter - " Link To Sky Color " . Helps to simulate sky light thru the windows and have it consistent with TOD and GI .
CRYTEK/CRYENGINE
68ee3c8917b9fdcfdf0c9db8a3ab99b5afdceeab
2017-10-05T13:01:43Z
mmm a / modules / common / math / box2d . h <nl> ppp b / modules / common / math / box2d . h <nl> class Box2d { <nl> <nl> std : : vector < Vec2d > corners_ ; <nl> <nl> - double max_x_ = std : : numeric_limits < double > : : min ( ) ; <nl> + double max_x_ = std : : numeric_limits < double > : : lowest ( ) ; <nl> double min_x_ = std : : numeric_limits < double > : : max ( ) ; <nl> - double max_y_ = std : : numeric_limits < double > : : min ( ) ; <nl> + double max_y_ = std : : numeric_limits < double > : : lowest ( ) ; <nl> double min_y_ = std : : numeric_limits < double > : : max ( ) ; <nl> } ; <nl> <nl>
replace max_x , max_y initializers in modules / common / math / box2d . h . Using std : : numeric_limits < double > : : lowest ( ) instead std : : numeric_limits < double > : : min ( ) which is positive . Fixes
ApolloAuto/apollo
a7d34fe439a241e70d0b0dd7f2b3d1116a395ab4
2019-03-20T14:36:59Z
mmm a / Code / Sandbox / EditorQt / Commands / KeybindEditor . cpp <nl> ppp b / Code / Sandbox / EditorQt / Commands / KeybindEditor . cpp <nl> REGISTER_HIDDEN_VIEWPANE_FACTORY ( CKeybindEditor , " Keyboard Shortcuts " , " Settings <nl> <nl> namespace Private_KeybindEditor <nl> { <nl> + <nl> + const char * szKeybindsPath = " Keybinds . json " ; <nl> + <nl> QString KeySequenceListToString ( const QList < QKeySequence > & list ) <nl> { <nl> QString string ( QKeySequence : : listToString ( list , QKeySequence : : NativeText ) ) ; <nl> class CKeybindEditor : : KeybindItemDelegate : public QStyledItemDelegate <nl> case QEvent : : Shortcut : <nl> case QEvent : : ShortcutOverride : <nl> case QEvent : : KeyPress : <nl> - { <nl> - QKeyEvent * keyEvent = static_cast < QKeyEvent * > ( event ) ; <nl> - keyPressEvent ( keyEvent ) ; <nl> - keyEvent - > accept ( ) ; <nl> - return true ; <nl> - } <nl> + { <nl> + QKeyEvent * keyEvent = static_cast < QKeyEvent * > ( event ) ; <nl> + keyPressEvent ( keyEvent ) ; <nl> + keyEvent - > accept ( ) ; <nl> + return true ; <nl> + } <nl> case QEvent : : FocusOut : <nl> - { <nl> - / / Destroy the in - place editing widget when focus is lost so we don ' t have a non - focused <nl> - / / line edit in the Keybinds view <nl> - deleteLater ( ) ; <nl> - } <nl> + { <nl> + / / Destroy the in - place editing widget when focus is lost so we don ' t have a non - focused <nl> + / / line edit in the Keybinds view <nl> + deleteLater ( ) ; <nl> + } <nl> default : <nl> return false ; <nl> } <nl> class CKeybindEditor : : KeybindItemDelegate : public QStyledItemDelegate <nl> <nl> CKeybindEditor : : CKeybindEditor ( QWidget * parent ) <nl> : CDockableWidget ( parent ) <nl> + , CUserData ( { Private_KeybindEditor : : szKeybindsPath } ) <nl> , m_treeView ( new QAdvancedTreeView ( ) ) <nl> { <nl> m_model = CommandModelFactory : : Create < KeybindModel > ( ) ; <nl> void CKeybindEditor : : SetState ( const QVariant & state ) <nl> QCommandAction * action = comMgr - > GetCommandAction ( commandStr ) ; <nl> if ( action ) <nl> { <nl> - if ( shortcutsVar . isValid ( ) ) / / read valid shortcuts even if shortcutsAsKeySeq is empty <nl> + if ( shortcutsVar . isValid ( ) ) / / read valid shortcuts even if shortcutsAsKeySeq is empty <nl> action - > setShortcuts ( shortcutsAsKeySeq ) ; <nl> } <nl> } <nl> void CKeybindEditor : : LoadKeybindsFromFile ( const char * filename ) <nl> SetState ( keybindsVariant ) ; <nl> GetIEditorImpl ( ) - > GetCommandManager ( ) - > signalChanged ( ) ; <nl> } <nl> - / / TODO : error message <nl> + else <nl> + { <nl> + CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_COMMENT , " Failed to load corrupted Keybinds file : % s " , filename ) ; <nl> + return ; <nl> + } <nl> } <nl> <nl> void CKeybindEditor : : OnKeybindsChanged ( ) <nl> void CKeybindEditor : : OnKeybindsChanged ( ) <nl> <nl> void CKeybindEditor : : SaveUserKeybinds ( ) <nl> { <nl> - QString userKeybinds = QtUtil : : GetAppDataFolder ( ) ; <nl> - QDir ( userKeybinds ) . mkpath ( userKeybinds ) ; <nl> - userKeybinds + = " / Keybinds . json " ; <nl> - SaveKeybindsToFile ( userKeybinds . toStdString ( ) . c_str ( ) ) ; <nl> + QJsonDocument doc ( QJsonDocument : : fromVariant ( GetState ( ) ) ) ; <nl> + UserDataUtil : : Save ( Private_KeybindEditor : : szKeybindsPath , doc . toJson ( ) ) ; <nl> } <nl> <nl> void CKeybindEditor : : LoadUserKeybinds ( ) <nl> { <nl> - QString userKeybinds = QtUtil : : GetAppDataFolder ( ) ; <nl> - userKeybinds + = " / Keybinds . json " ; <nl> - QFile file ( userKeybinds ) ; <nl> - <nl> - / / If there ' s no user keybinds , try and load project keybinds <nl> - if ( file . exists ( ) ) <nl> - return LoadKeybindsFromFile ( userKeybinds . toStdString ( ) . c_str ( ) ) ; <nl> - <nl> - QString projKeybinds ( GetIEditorImpl ( ) - > GetProjectManager ( ) - > GetCurrentProjectDirectoryAbsolute ( ) ) ; <nl> - projKeybinds = projKeybinds + " / Editor / Keybinds . json " ; <nl> - <nl> - if ( QFile ( projKeybinds ) . exists ( ) ) <nl> - return LoadKeybindsFromFile ( projKeybinds . toUtf8 ( ) ) ; <nl> - <nl> - LoadKeybindsFromFile ( PathUtil : : Make ( PathUtil : : GetEnginePath ( ) , " % EDITOR % / Keybinds . json " ) . c_str ( ) ) ; <nl> + QVariant keybindsVariant = UserDataUtil : : Load ( Private_KeybindEditor : : szKeybindsPath ) ; <nl> + if ( keybindsVariant . isValid ( ) ) <nl> + { <nl> + SetState ( keybindsVariant ) ; <nl> + GetIEditorImpl ( ) - > GetCommandManager ( ) - > signalChanged ( ) ; <nl> + } <nl> } <nl> - <nl> mmm a / Code / Sandbox / EditorQt / Commands / KeybindEditor . h <nl> ppp b / Code / Sandbox / EditorQt / Commands / KeybindEditor . h <nl> <nl> <nl> # pragma once <nl> <nl> + # include < Util / UserDataUtil . h > <nl> # include < QWidget > <nl> <nl> class QAdvancedTreeView ; <nl> class CCustomCommand ; <nl> <nl> - class CKeybindEditor : public CDockableWidget <nl> + class CKeybindEditor : public CDockableWidget , public CUserData <nl> { <nl> Q_OBJECT <nl> <nl> class CKeybindEditor : public CDockableWidget <nl> <nl> virtual void customEvent ( QEvent * event ) override ; <nl> protected : <nl> - static void OnKeybindsChanged ( ) ; <nl> + static void OnKeybindsChanged ( ) ; <nl> <nl> private : <nl> <nl> class CKeybindEditor : public CDockableWidget <nl> void OnAddCustomCommand ( ) const ; <nl> void OnRemoveCustomCommand ( CCustomCommand * command ) const ; <nl> <nl> - KeybindModel * m_model ; <nl> - QAdvancedTreeView * m_treeView ; <nl> + KeybindModel * m_model ; <nl> + QAdvancedTreeView * m_treeView ; <nl> } ; <nl> - <nl> mmm a / Code / Sandbox / EditorQt / QT / MainToolBars / QMainToolBarManager . cpp <nl> ppp b / Code / Sandbox / EditorQt / QT / MainToolBars / QMainToolBarManager . cpp <nl> <nl> # include " Commands / QCommandAction . h " <nl> # include " Commands / CustomCommand . h " <nl> # include < CryIcon . h > <nl> + # include < Util / UserDataUtil . h > <nl> + # include < FilePathUtil . h > <nl> + <nl> # include < CrySystem / IProjectManager . h > <nl> + # include < CryString / CryPath . h > <nl> <nl> + namespace Private_ToolbarManager <nl> + { <nl> + static const char * szUserToolbarsPath = " Toolbars " ; <nl> static const char * s_defaultPath = " Editor / ToolBars " ; <nl> static const char * s_actionPropertyName = " cvarDescValue " ; <nl> static const char * s_actionCVarBitFlagName = " cvarDescIsBitFlag " ; <nl> static const int s_version = 2 ; <nl> + } <nl> <nl> # define ADD_TO_VARIANT_MAP ( var , map ) map [ # var ] = var <nl> <nl> int QMainToolBarManager : : QToolBarDesc : : IndexOfCommand ( const CCommand * pCommand ) <nl> <nl> void QMainToolBarManager : : QToolBarDesc : : InsertItem ( const QVariant & itemVariant , int idx ) <nl> { <nl> - InsertItem ( CreateItem ( itemVariant , s_version ) , idx ) ; <nl> + InsertItem ( CreateItem ( itemVariant , Private_ToolbarManager : : s_version ) , idx ) ; <nl> } <nl> <nl> void QMainToolBarManager : : QToolBarDesc : : InsertItem ( std : : shared_ptr < QItemDesc > pItem , int idx ) <nl> bool QMainToolBarManager : : QToolBarDesc : : RequiresUpdate ( ) const <nl> <nl> QMainToolBarManager : : QMainToolBarManager ( CEditorMainFrame * pMainFrame ) <nl> : QObject ( pMainFrame ) <nl> + , CUserData ( { Private_ToolbarManager : : szUserToolbarsPath } ) <nl> , m_pMainFrame ( pMainFrame ) <nl> { <nl> LoadAll ( ) ; <nl> void QMainToolBarManager : : RemoveToolBar ( const QString & name ) <nl> { <nl> m_ToolBarsDesc . remove ( name ) ; <nl> <nl> - QString path = QtUtil : : GetAppDataFolder ( ) ; <nl> - path + = " / ToolBars / " + name + " . json " ; <nl> - QFile : : remove ( path ) ; <nl> + QString fullPath ( UserDataUtil : : GetUserPath ( PathUtil : : Make ( Private_ToolbarManager : : szUserToolbarsPath , QtUtil : : ToConstCharPtr ( name ) , " . json " ) . c_str ( ) ) ) ; <nl> + PathUtil : : Remove ( QtUtil : : ToConstCharPtr ( fullPath ) ) ; <nl> <nl> CEditorMainFrame * pMainFrame = CEditorMainFrame : : GetInstance ( ) ; <nl> QToolBar * pToolBar = pMainFrame - > findChild < QToolBar * > ( name + " ToolBar " ) ; <nl> void QMainToolBarManager : : RemoveToolBar ( const QString & name ) <nl> <nl> void QMainToolBarManager : : SaveToolBar ( const QString & name ) const <nl> { <nl> - QString path = QtUtil : : GetAppDataFolder ( ) ; <nl> - path + = " / ToolBars " ; <nl> - QDir dir ( path ) ; <nl> - if ( ! dir . exists ( ) ) <nl> - dir . mkdir ( path ) ; <nl> - <nl> const std : : shared_ptr < QMainToolBarManager : : QToolBarDesc > toolBar = m_ToolBarsDesc [ name ] ; <nl> - QString toolBarPath = path + " / " + name + " . json " ; <nl> - QFile file ( toolBarPath ) ; <nl> - if ( ! file . open ( QIODevice : : WriteOnly ) ) <nl> - { <nl> - QString msg = " Failed to open path : " + path ; <nl> - CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_ERROR , msg . toLocal8Bit ( ) ) ; <nl> - return ; <nl> - } <nl> - <nl> QVariantMap toDisk ; <nl> - toDisk [ " version " ] = s_version ; <nl> + toDisk [ " version " ] = Private_ToolbarManager : : s_version ; <nl> toDisk [ " toolBar " ] = toolBar - > ToVariant ( ) ; <nl> <nl> + QString path ( PathUtil : : Make ( Private_ToolbarManager : : szUserToolbarsPath , QtUtil : : ToConstCharPtr ( name ) , " . json " ) . c_str ( ) ) ; <nl> + <nl> QJsonDocument doc ( QJsonDocument : : fromVariant ( toDisk ) ) ; <nl> - file . write ( doc . toJson ( ) ) ; <nl> + UserDataUtil : : Save ( path . toLocal8Bit ( ) , doc . toJson ( ) ) ; <nl> } <nl> <nl> void QMainToolBarManager : : LoadAll ( ) <nl> { <nl> / / Load built in toolbars <nl> - LoadToolBarsFromDir ( PathUtil : : Make ( PathUtil : : GetEnginePath ( ) , s_defaultPath ) . c_str ( ) ) ; <nl> + LoadToolBarsFromDir ( PathUtil : : Make ( PathUtil : : GetEnginePath ( ) , Private_ToolbarManager : : s_defaultPath ) . c_str ( ) ) ; <nl> <nl> / / Load game project specific toolbars <nl> QString projectPath ( GetIEditorImpl ( ) - > GetProjectManager ( ) - > GetCurrentProjectDirectoryAbsolute ( ) ) ; <nl> - projectPath = projectPath + " / " + s_defaultPath ; <nl> + projectPath = projectPath + " / " + Private_ToolbarManager : : s_defaultPath ; <nl> LoadToolBarsFromDir ( projectPath ) ; <nl> <nl> / / Load user toolbars <nl> - QString userPath = QtUtil : : GetAppDataFolder ( ) ; <nl> - userPath + = " / ToolBars " ; <nl> - <nl> - LoadToolBarsFromDir ( userPath ) ; <nl> + LoadToolBarsFromDir ( UserDataUtil : : GetUserPath ( " ToolBars " ) ) ; <nl> } <nl> <nl> void QMainToolBarManager : : LoadToolBarsFromDir ( const QString & dirPath ) <nl> void QMainToolBarManager : : CreateMainFrameToolBars ( ) <nl> { <nl> return ; <nl> } <nl> - <nl> - QString msg = " Some of the actions used in your toolbars have been replaced . \ nWould you like Sandbox to patch your toolbars ? " ; <nl> - if ( CQuestionDialog : : SQuestion ( " Old Commands Used in Toolbars " , msg ) ! = QDialogButtonBox : : Yes ) <nl> - { <nl> - return ; <nl> - } <nl> <nl> for ( QMap < QString , std : : shared_ptr < QToolBarDesc > > : : const_iterator ite = m_ToolBarsDesc . begin ( ) ; ite ! = m_ToolBarsDesc . end ( ) ; + + ite ) <nl> { <nl> void QMainToolBarManager : : CreateMainFrameToolBars ( ) <nl> } <nl> } <nl> <nl> - QString QMainToolBarManager : : GetToolBarPath ( const QString & name ) const <nl> - { <nl> - / / First check if there ' s a suer toolbar for the given name <nl> - QString path = QtUtil : : GetAppDataFolder ( ) ; <nl> - path + = QString ( " / ToolBars / % 1 . json " ) . arg ( name ) ; <nl> - <nl> - if ( QFileInfo : : exists ( path ) ) <nl> - { <nl> - return path ; <nl> - } <nl> - <nl> - / / If the file doesn ' t exist , check for a project toolbar <nl> - path = GetIEditorImpl ( ) - > GetProjectManager ( ) - > GetCurrentProjectDirectoryAbsolute ( ) ; <nl> - path + = QString ( " / % 1 / % 2 . json " ) . arg ( s_defaultPath ) . arg ( name ) ; <nl> - if ( QFileInfo : : exists ( path ) ) <nl> - { <nl> - return path ; <nl> - } <nl> - <nl> - / / If not , then check the install folder for the toolbar <nl> - path = PathUtil : : Make ( PathUtil : : GetEnginePath ( ) , s_defaultPath ) . c_str ( ) ; <nl> - path + = QString ( " / % 2 . json " ) . arg ( name ) ; <nl> - if ( QFileInfo : : exists ( path ) ) <nl> - { <nl> - return path ; <nl> - } <nl> - <nl> - return " " ; <nl> - } <nl> - <nl> void QMainToolBarManager : : UpdateToolBarOnDisk ( const QString & name , const std : : shared_ptr < QToolBarDesc > toolBarDesc ) const <nl> { <nl> - QString path = GetToolBarPath ( name ) ; <nl> - <nl> - if ( path . isEmpty ( ) ) <nl> - { <nl> - CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_ERROR , " Trying to update missing Toolbar : % s " , name . toLocal8Bit ( ) ) ; <nl> - return ; <nl> - } <nl> - <nl> - QFile file ( path ) ; <nl> - if ( ! file . open ( QIODevice : : WriteOnly ) ) <nl> - { <nl> - CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_ERROR , " Couldn ' t update Toolbar : % s " , name . toLocal8Bit ( ) ) ; <nl> - return ; <nl> - } <nl> - <nl> QVariantMap toDisk ; <nl> - toDisk [ " version " ] = s_version ; <nl> + toDisk [ " version " ] = Private_ToolbarManager : : s_version ; <nl> toDisk [ " toolBar " ] = toolBarDesc - > ToVariant ( ) ; <nl> <nl> QJsonDocument doc ( QJsonDocument : : fromVariant ( toDisk ) ) ; <nl> - file . write ( doc . toJson ( ) ) ; <nl> + UserDataUtil : : Save ( PathUtil : : Make ( Private_ToolbarManager : : szUserToolbarsPath , QtUtil : : ToConstCharPtr ( name ) , " . json " ) . c_str ( ) , doc . toJson ( ) ) ; <nl> } <nl> <nl> void QMainToolBarManager : : CreateMainFrameToolBar ( const QString & name , const std : : shared_ptr < QToolBarDesc > toolBarDesc ) <nl> void QMainToolBarManager : : CreateToolBar ( const std : : shared_ptr < QToolBarDesc > tool <nl> if ( ite ! = m_pCVarActions . end ( ) ) <nl> actions = ite . value ( ) ; <nl> else <nl> - pCVar - > AddOnChangeFunctor ( SFunctor ( [ this , pCVar ] { this - > OnCVarChanged ( pCVar ) ; } ) ) ; <nl> + pCVar - > AddOnChangeFunctor ( SFunctor ( [ this , pCVar ] <nl> + { <nl> + this - > OnCVarChanged ( pCVar ) ; <nl> + } ) ) ; <nl> <nl> - pAction - > setProperty ( s_actionPropertyName , pCVarDesc - > GetValue ( ) ) ; <nl> - pAction - > setProperty ( s_actionCVarBitFlagName , pCVarDesc - > IsBitFlag ( ) ) ; <nl> + pAction - > setProperty ( Private_ToolbarManager : : s_actionPropertyName , pCVarDesc - > GetValue ( ) ) ; <nl> + pAction - > setProperty ( Private_ToolbarManager : : s_actionCVarBitFlagName , pCVarDesc - > IsBitFlag ( ) ) ; <nl> actions . push_back ( pAction ) ; <nl> m_pCVarActions . insert ( pCVar , actions ) ; <nl> <nl> void QMainToolBarManager : : CreateToolBar ( const std : : shared_ptr < QToolBarDesc > tool <nl> switch ( pCVar - > GetType ( ) ) <nl> { <nl> case ECVarType : : Int : <nl> - { <nl> - int currValue = pCVar - > GetIVal ( ) ; <nl> - int newValue = variant . toInt ( ) ; <nl> + { <nl> + int currValue = pCVar - > GetIVal ( ) ; <nl> + int newValue = variant . toInt ( ) ; <nl> <nl> - bool isBitFlag = pCVarDesc - > IsBitFlag ( ) ; <nl> + bool isBitFlag = pCVarDesc - > IsBitFlag ( ) ; <nl> <nl> - if ( isBitFlag ) <nl> - pCVar - > Set ( currValue & newValue ? currValue & ~ newValue : currValue | newValue ) ; <nl> - else <nl> - pCVar - > Set ( pCVar - > GetIVal ( ) = = newValue ? 0 : newValue ) ; <nl> - } <nl> + if ( isBitFlag ) <nl> + pCVar - > Set ( currValue & newValue ? currValue & ~ newValue : currValue | newValue ) ; <nl> + else <nl> + pCVar - > Set ( pCVar - > GetIVal ( ) = = newValue ? 0 : newValue ) ; <nl> + } <nl> break ; <nl> case ECVarType : : Float : <nl> pCVar - > Set ( pCVar - > GetFVal ( ) = = variant . toFloat ( ) ? 0 . 0f : variant . toFloat ( ) ) ; <nl> void QMainToolBarManager : : OnCVarChanged ( ICVar * pCVar ) <nl> case ECVarType : : Int : <nl> for ( QAction * pAction : actions ) <nl> { <nl> - bool isBitFlag = pAction - > property ( s_actionCVarBitFlagName ) . toBool ( ) ; <nl> - int value = pAction - > property ( s_actionPropertyName ) . toInt ( ) ; <nl> - pAction - > setChecked ( isBitFlag ? value & pCVar - > GetIVal ( ) : value = = pCVar - > GetIVal ( ) ) ; <nl> + bool isBitFlag = pAction - > property ( Private_ToolbarManager : : s_actionCVarBitFlagName ) . toBool ( ) ; <nl> + int value = pAction - > property ( Private_ToolbarManager : : s_actionPropertyName ) . toInt ( ) ; <nl> + pAction - > setChecked ( isBitFlag ? value & pCVar - > GetIVal ( ) : value = = pCVar - > GetIVal ( ) ) ; <nl> } <nl> break ; <nl> case ECVarType : : Float : <nl> for ( QAction * pAction : actions ) <nl> - pAction - > setChecked ( pAction - > property ( s_actionPropertyName ) = = pCVar - > GetFVal ( ) ) ; <nl> + pAction - > setChecked ( pAction - > property ( Private_ToolbarManager : : s_actionPropertyName ) = = pCVar - > GetFVal ( ) ) ; <nl> break ; <nl> case ECVarType : : String : <nl> for ( QAction * pAction : actions ) <nl> - pAction - > setChecked ( pAction - > property ( s_actionPropertyName ) = = QString ( pCVar - > GetString ( ) ) ) ; <nl> + pAction - > setChecked ( pAction - > property ( Private_ToolbarManager : : s_actionPropertyName ) = = QString ( pCVar - > GetString ( ) ) ) ; <nl> case ECVarType : : Int64 : <nl> CRY_ASSERT_MESSAGE ( false , " QMainToolBarManager : : OnCVarChanged int64 cvar not implemented " ) ; <nl> break ; <nl> void QMainToolBarManager : : OnCVarChanged ( ICVar * pCVar ) <nl> break ; <nl> } <nl> } <nl> - <nl> mmm a / Code / Sandbox / EditorQt / QT / MainToolBars / QMainToolBarManager . h <nl> ppp b / Code / Sandbox / EditorQt / QT / MainToolBars / QMainToolBarManager . h <nl> <nl> <nl> class CEditorMainFrame ; <nl> <nl> - class QMainToolBarManager : public QObject <nl> + class QMainToolBarManager : public QObject , public CUserData <nl> { <nl> Q_OBJECT <nl> public : <nl> class QMainToolBarManager : public QObject <nl> <nl> / / If a command is deprecated or replaced , the toolbar should be serialized back to disk and updated <nl> bool RequiresUpdate ( ) const ; <nl> - void MarkAsUpdated ( ) { updated = true ; } <nl> + void MarkAsUpdated ( ) { updated = true ; } <nl> <nl> void OnCommandChanged ( ) { toolBarChangedSignal ( this ) ; } <nl> CCrySignal < void ( const QToolBarDesc * ) > toolBarChangedSignal ; <nl> class QMainToolBarManager : public QObject <nl> void CreateToolBar ( const std : : shared_ptr < QToolBarDesc > toolBarDesc , QToolBar * pToolBar ) ; <nl> <nl> protected : <nl> - QString GetToolBarPath ( const QString & name ) const ; <nl> - void SaveToolBar ( const QString & name ) const ; <nl> - void LoadAll ( ) ; <nl> - void LoadToolBarsFromDir ( const QString & dirPath ) ; <nl> - void UpdateToolBarOnDisk ( const QString & name , const std : : shared_ptr < QToolBarDesc > toolBarDesc ) const ; <nl> + void SaveToolBar ( const QString & name ) const ; <nl> + void LoadAll ( ) ; <nl> + void LoadToolBarsFromDir ( const QString & dirPath ) ; <nl> + void UpdateToolBarOnDisk ( const QString & name , const std : : shared_ptr < QToolBarDesc > toolBarDesc ) const ; <nl> <nl> - void OnCVarActionDestroyed ( ICVar * pCVar , QAction * pObject ) ; <nl> - void OnCVarChanged ( ICVar * pCVar ) ; <nl> + void OnCVarActionDestroyed ( ICVar * pCVar , QAction * pObject ) ; <nl> + void OnCVarChanged ( ICVar * pCVar ) ; <nl> <nl> protected : <nl> QMap < QString , std : : shared_ptr < QToolBarDesc > > m_ToolBarsDesc ; <nl> class QMainToolBarManager : public QObject <nl> QHash < ICVar * , std : : vector < QAction * > > m_pCVarActions ; <nl> std : : vector < QMetaObject : : Connection > m_cvarActionConnections ; <nl> } ; <nl> - <nl> mmm a / Code / Sandbox / EditorQt / QT / QToolTabManager . cpp <nl> ppp b / Code / Sandbox / EditorQt / QT / QToolTabManager . cpp <nl> CTabPaneManager * s_pGlobalToolTabManager = 0 ; <nl> static const char * szAppDataLayoutDir = " Layouts " ; <nl> static const char * szDefaultLayoutDir = " Editor / Layouts " ; <nl> static const char * szDefaultLayout = " Editor / Layouts / Default Layout . json " ; <nl> + static const char * szUserLayout = " Layout . json " ; <nl> <nl> void PyLoadLayoutFromFile ( const char * fullFilename ) <nl> { <nl> void PyResetLayout ( ) <nl> <nl> void PyLoadLayoutDlg ( ) <nl> { <nl> - QDir dir ( QtUtil : : GetAppDataFolder ( ) ) ; <nl> + QDir dir ( UserDataUtil : : GetUserPath ( " " ) ) ; <nl> dir . cd ( szAppDataLayoutDir ) ; <nl> <nl> CSystemFileDialog : : RunParams runParams ; <nl> void PySaveLayoutAs ( ) <nl> { <nl> QDir dir ( QtUtil : : GetAppDataFolder ( ) ) ; <nl> / / This will build the folder structure required if it doesn ' t exist yet <nl> - dir . mkpath ( QtUtil : : GetAppDataFolder ( ) + " / " + szAppDataLayoutDir ) ; <nl> - dir . cd ( szAppDataLayoutDir ) ; <nl> + QString userDataPath = UserDataUtil : : GetUserPath ( szAppDataLayoutDir ) ; <nl> + dir . mkpath ( userDataPath ) ; <nl> + dir . cd ( userDataPath ) ; <nl> <nl> CSystemFileDialog : : RunParams runParams ; <nl> runParams . title = CEditorMainFrame : : tr ( " Save Layout " ) ; <nl> REGISTER_PYTHON_COMMAND_WITH_EXAMPLE ( PySaveLayoutAs , layout , save_as , <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CTabPaneManager : : CTabPaneManager ( QWidget * const pParent ) <nl> - : m_pParent ( pParent ) <nl> + : CUserData ( { szAppDataLayoutDir , szUserLayout } ) <nl> + , m_pParent ( pParent ) <nl> { <nl> s_pGlobalToolTabManager = this ; <nl> m_bToolsDirty = false ; <nl> IPane * CTabPaneManager : : FindPaneByTitle ( const char * title ) <nl> <nl> void CTabPaneManager : : SaveLayout ( ) <nl> { <nl> - QString userLayout = QtUtil : : GetAppDataFolder ( ) ; <nl> - QDir ( userLayout ) . mkpath ( userLayout ) ; <nl> - userLayout + = " / Layout . json " ; <nl> - SaveLayoutToFile ( userLayout . toStdString ( ) . c_str ( ) ) ; <nl> + QJsonDocument doc ( QJsonDocument : : fromVariant ( GetState ( ) ) ) ; <nl> + UserDataUtil : : Save ( szUserLayout , doc . toJson ( ) ) ; <nl> } <nl> <nl> bool CTabPaneManager : : LoadUserLayout ( ) <nl> { <nl> - QString userLayout = QtUtil : : GetAppDataFolder ( ) ; <nl> - userLayout + = " / Layout . json " ; <nl> - return LoadLayoutFromFile ( userLayout . toStdString ( ) . c_str ( ) ) ; <nl> + QVariant state = UserDataUtil : : Load ( szUserLayout ) ; <nl> + <nl> + if ( ! state . isValid ( ) ) <nl> + return false ; <nl> + <nl> + SetState ( state ) ; <nl> + m_layoutLoaded = true ; <nl> + <nl> + return true ; <nl> } <nl> <nl> bool CTabPaneManager : : LoadLayout ( const char * filePath ) <nl> QFileInfoList CTabPaneManager : : GetUserLayouts ( ) <nl> QStringList filter ; <nl> filter < < " * . json " ; <nl> <nl> - QDir dir ( QtUtil : : GetAppDataFolder ( ) ) ; <nl> - if ( dir . cd ( szAppDataLayoutDir ) ) <nl> + QDir dir ( UserDataUtil : : GetUserPath ( szAppDataLayoutDir ) ) ; <nl> + if ( dir . exists ( ) ) <nl> { <nl> return dir . entryInfoList ( filter , QDir : : Files ) ; <nl> } <nl> void QTabPane : : closeEvent ( QCloseEvent * event ) <nl> QTabPane : : ~ QTabPane ( ) <nl> { <nl> } <nl> - <nl> mmm a / Code / Sandbox / EditorQt / QT / QToolTabManager . h <nl> ppp b / Code / Sandbox / EditorQt / QT / QToolTabManager . h <nl> class CWnd ; <nl> # include < QFrame > <nl> # include < QDir > <nl> # include " Controls / SandboxWindowing . h " <nl> + # include < Util / UserDataUtil . h > <nl> <nl> / / Internal class for IPane management . <nl> class QTabPane : public QBaseTabPane <nl> class QTabPane : public QBaseTabPane <nl> virtual QSize minimumSizeHint ( ) const { return m_minimumSize ; } <nl> } ; <nl> <nl> - class SANDBOX_API CTabPaneManager <nl> + class SANDBOX_API CTabPaneManager : public CUserData <nl> { <nl> friend class QTabPane ; <nl> public : <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / CMakeLists . txt <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / CMakeLists . txt <nl> add_sources ( " Uber_QtWidgets . cpp " <nl> " Util / XmlArchive . h " <nl> " Util / NamedData . cpp " <nl> " Util / NamedData . h " <nl> + " Util / UserDataUtil . cpp " <nl> + " Util / UserDataUtil . h " <nl> " QtUtil . h " <nl> " QtUtil . cpp " <nl> " FilePathUtil . h " <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / EditorFramework / PersonalizationManager . cpp <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / EditorFramework / PersonalizationManager . cpp <nl> <nl> # include < QFile > <nl> # include < QEvent > <nl> <nl> + namespace Private_Personalization <nl> + { <nl> + const char * szPersonalizationPath = " Personalization . json " ; <nl> + } <nl> <nl> CPersonalizationManager : : CPersonalizationManager ( ) <nl> + : CUserData ( { Private_Personalization : : szPersonalizationPath } ) <nl> { <nl> m_saveSharedStateTimer . setInterval ( 5000 ) ; <nl> m_saveSharedStateTimer . setSingleShot ( true ) ; <nl> CPersonalizationManager : : ModuleStateMap CPersonalizationManager : : FromVariant ( con <nl> <nl> void CPersonalizationManager : : SaveSharedState ( ) const <nl> { <nl> - QString path = QtUtil : : GetAppDataFolder ( ) ; <nl> - QDir ( path ) . mkpath ( path ) ; <nl> - path + = " / Personalization . json " ; <nl> - <nl> - QFile file ( path ) ; <nl> - if ( ! file . open ( QIODevice : : WriteOnly ) ) <nl> - { <nl> - QString msg = " Failed to open path : " + path ; <nl> - CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_ERROR , msg . toLocal8Bit ( ) ) ; <nl> - return ; <nl> - } <nl> - <nl> QJsonDocument doc ( QJsonDocument : : fromVariant ( ToVariant ( m_sharedState ) ) ) ; <nl> - file . write ( doc . toJson ( ) ) ; <nl> + UserDataUtil : : Save ( Private_Personalization : : szPersonalizationPath , doc . toJson ( ) ) ; <nl> } <nl> <nl> void CPersonalizationManager : : LoadSharedState ( ) <nl> { <nl> - QString path = QtUtil : : GetAppDataFolder ( ) ; <nl> - path + = " / Personalization . json " ; <nl> - <nl> - QFile file ( path ) ; <nl> - if ( ! file . open ( QIODevice : : ReadOnly ) ) <nl> - { <nl> - QString msg = " Failed to open path : " + path ; <nl> - CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_COMMENT , msg . toLocal8Bit ( ) ) ; <nl> - return ; <nl> - } <nl> - <nl> - QJsonDocument doc ( QJsonDocument : : fromJson ( file . readAll ( ) ) ) ; <nl> - QVariant variant = doc . toVariant ( ) ; <nl> - m_sharedState = FromVariant ( variant ) ; <nl> + m_sharedState = FromVariant ( UserDataUtil : : Load ( Private_Personalization : : szPersonalizationPath ) ) ; <nl> } <nl> <nl> void CPersonalizationManager : : LoadProjectState ( ) <nl> void CPersonalizationManager : : SaveProjectState ( ) const <nl> QJsonDocument doc ( QJsonDocument : : fromVariant ( ToVariant ( m_projectState ) ) ) ; <nl> file . write ( doc . toJson ( ) ) ; <nl> } <nl> - <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / EditorFramework / PersonalizationManager . h <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / EditorFramework / PersonalizationManager . h <nl> <nl> / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> # pragma once <nl> # include " EditorCommonAPI . h " <nl> + # include " Util / UserDataUtil . h " <nl> <nl> # include < QHash > <nl> # include < QVector > <nl> <nl> # include < QTimer > <nl> <nl> # define SET_PERSONALIZATION_PROPERTY ( module , propName , value ) \ <nl> - GetIEditor ( ) - > GetPersonalizationManager ( ) - > SetProperty ( # module , propName , value ) <nl> + GetIEditor ( ) - > GetPersonalizationManager ( ) - > SetProperty ( # module , propName , value ) <nl> <nl> # define GET_PERSONALIZATION_PROPERTY ( module , propName ) \ <nl> - GetIEditor ( ) - > GetPersonalizationManager ( ) - > GetProperty ( # module , propName ) <nl> + GetIEditor ( ) - > GetPersonalizationManager ( ) - > GetProperty ( # module , propName ) <nl> <nl> # define GET_PERSONALIZATION_STATE ( module ) \ <nl> - GetIEditor ( ) - > GetPersonalizationManager ( ) - > GetState ( # module ) <nl> + GetIEditor ( ) - > GetPersonalizationManager ( ) - > GetState ( # module ) <nl> <nl> - class EDITOR_COMMON_API CPersonalizationManager <nl> + class EDITOR_COMMON_API CPersonalizationManager : public CUserData <nl> { <nl> public : <nl> CPersonalizationManager ( ) ; <nl> class EDITOR_COMMON_API CPersonalizationManager <nl> bool HasProjectProperty ( const QString & moduleName , const QString & propName ) const ; <nl> <nl> / / ! Saves the cached information to the personalization file on the hard drive . <nl> - void SavePersonalization ( ) const ; <nl> + void SavePersonalization ( ) const ; <nl> <nl> private : <nl> typedef QHash < QString , QVariantMap > ModuleStateMap ; <nl> <nl> - static QVariant ToVariant ( const ModuleStateMap & map ) ; <nl> - static ModuleStateMap FromVariant ( const QVariant & variant ) ; <nl> + static QVariant ToVariant ( const ModuleStateMap & map ) ; <nl> + static ModuleStateMap FromVariant ( const QVariant & variant ) ; <nl> <nl> - void SaveSharedState ( ) const ; <nl> - void LoadSharedState ( ) ; <nl> + void SaveSharedState ( ) const ; <nl> + void LoadSharedState ( ) ; <nl> <nl> - void SaveProjectState ( ) const ; <nl> - void LoadProjectState ( ) ; <nl> + void SaveProjectState ( ) const ; <nl> + void LoadProjectState ( ) ; <nl> <nl> private : <nl> - <nl> + <nl> ModuleStateMap m_sharedState ; <nl> ModuleStateMap m_projectState ; <nl> <nl> - QTimer m_saveSharedStateTimer ; <nl> - QTimer m_saveProjectStateTimer ; <nl> + QTimer m_saveSharedStateTimer ; <nl> + QTimer m_saveProjectStateTimer ; <nl> } ; <nl> - <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / EditorFramework / Preferences . cpp <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / EditorFramework / Preferences . cpp <nl> <nl> # include < QJsonDocument > <nl> # include < QFile > <nl> <nl> - static const char * s_defaultPath = " Editor / Preferences " ; <nl> - static const char * s_fileSuffix = " pref " ; <nl> + namespace Private_Preferences <nl> + { <nl> + const char * szDefaultPath = " Editor / Preferences " ; <nl> + const char * szPreferencesPath = " Preferences . pref " ; <nl> + } <nl> <nl> QString SPreferencePage : : GetSerializedProperties ( ) <nl> { <nl> void SPreferencePage : : FromSerializedProperties ( const QByteArray & jsonBlob ) <nl> } <nl> <nl> CPreferences : : CPreferences ( ) <nl> - : m_bIsLoading ( false ) <nl> + : CUserData ( { Private_Preferences : : szPreferencesPath } ) <nl> + , m_bIsLoading ( false ) <nl> { <nl> signalSettingsChanged . Connect ( this , & CPreferences : : Save ) ; <nl> } <nl> void CPreferences : : Init ( ) <nl> <nl> void CPreferences : : Load ( ) <nl> { <nl> - m_bIsLoading = true ; <nl> - <nl> - QString path = QtUtil : : GetAppDataFolder ( ) ; <nl> - path + = " / Preferences . pref " ; <nl> + struct LoadingPreferences <nl> + { <nl> + LoadingPreferences ( bool & loading ) : m_bIsLoading ( loading ) { m_bIsLoading = true ; } <nl> + ~ LoadingPreferences ( ) { m_bIsLoading = false ; } <nl> + bool & m_bIsLoading ; <nl> + } ; <nl> <nl> - QFile file ( path ) ; <nl> + LoadingPreferences isLoading ( m_bIsLoading ) ; <nl> + QVariant state = UserDataUtil : : Load ( Private_Preferences : : szPreferencesPath ) ; <nl> <nl> - if ( file . exists ( ) ) <nl> - return Load ( path ) ; <nl> + if ( state . isValid ( ) ) <nl> + { <nl> + SetState ( state ) ; <nl> + return ; <nl> + } <nl> <nl> + / / If the user doesn ' t have any set preferences , then load project preferences <nl> QString projectPreferences ( GetIEditor ( ) - > GetProjectManager ( ) - > GetCurrentProjectDirectoryAbsolute ( ) ) ; <nl> - projectPreferences = projectPreferences + " / Editor / Preferences . pref " ; <nl> - Load ( projectPreferences ) ; <nl> - } <nl> + projectPreferences = projectPreferences + " / " + Private_Preferences : : szDefaultPath ; <nl> <nl> - void CPreferences : : Load ( const QString & path ) <nl> - { <nl> - QFile file ( path ) ; <nl> + QFile file ( projectPreferences ) ; <nl> + <nl> + / / If no project preferences exist either , then just use engine deafaults <nl> if ( ! file . open ( QIODevice : : ReadOnly ) ) <nl> - { <nl> - QString msg = " Failed to open path : " + path ; <nl> - CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_COMMENT , msg . toLocal8Bit ( ) ) ; <nl> - m_bIsLoading = false ; <nl> return ; <nl> - } <nl> <nl> - QJsonDocument doc ( QJsonDocument : : fromJson ( file . readAll ( ) ) ) ; <nl> - QVariantMap preferenceMap = doc . toVariant ( ) . toMap ( ) ; <nl> + SetState ( QJsonDocument : : fromJson ( file . readAll ( ) ) . toVariant ( ) ) ; <nl> + } <nl> + <nl> + void CPreferences : : SetState ( const QVariant & state ) <nl> + { <nl> + QVariantMap preferenceMap = state . toMap ( ) ; <nl> + QList < QString > keys = preferenceMap . keys ( ) ; <nl> <nl> - for ( auto variantIte = preferenceMap . constBegin ( ) ; variantIte ! = preferenceMap . constEnd ( ) ; + + variantIte ) <nl> + for ( const auto & path : keys ) <nl> { <nl> - const QString & path = variantIte . key ( ) ; <nl> auto ite = m_preferences . find ( QtUtil : : ToString ( path ) ) ; <nl> <nl> if ( ite = = m_preferences . end ( ) ) <nl> void CPreferences : : Load ( const QString & path ) <nl> } <nl> } <nl> } <nl> - <nl> - m_bIsLoading = false ; <nl> } <nl> <nl> void CPreferences : : Save ( ) <nl> void CPreferences : : Save ( ) <nl> if ( m_bIsLoading ) <nl> return ; <nl> <nl> - QString path = QtUtil : : GetAppDataFolder ( ) ; <nl> - QDir ( path ) . mkpath ( path ) ; <nl> - path + = " / Preferences . pref " ; <nl> - <nl> - QFile file ( path ) ; <nl> - if ( ! file . open ( QIODevice : : WriteOnly ) ) <nl> - { <nl> - QString msg = " Failed to open path : " + path ; <nl> - CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_ERROR , msg . toLocal8Bit ( ) ) ; <nl> - return ; <nl> - } <nl> - <nl> QVariantMap preferencesVariant ; <nl> for ( auto ite = m_preferences . begin ( ) ; ite ! = m_preferences . end ( ) ; + + ite ) <nl> { <nl> void CPreferences : : Save ( ) <nl> preferencesVariant [ QtUtil : : ToQString ( ite - > first ) ] = pagesVariant ; <nl> } <nl> <nl> - QJsonDocument doc ( QJsonDocument : : fromVariant ( preferencesVariant ) ) ; <nl> - file . write ( doc . toJson ( ) ) ; <nl> + UserDataUtil : : Save ( Private_Preferences : : szPreferencesPath , QJsonDocument : : fromVariant ( preferencesVariant ) . toJson ( ) ) ; <nl> } <nl> <nl> void CPreferences : : Reset ( const char * path ) <nl> bool CPreferences : : Serialize ( yasli : : Archive & ar ) <nl> } <nl> return true ; <nl> } <nl> - <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / EditorFramework / Preferences . h <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / EditorFramework / Preferences . h <nl> <nl> # include " QtViewPane . h " <nl> <nl> # include " PreferencesDialog . h " <nl> + # include " Util / UserDataUtil . h " <nl> <nl> # include < CrySerialization / Enum . h > <nl> # include < CryString / CryString . h > <nl> class CPreferences ; <nl> typedef CAutoRegister < CPreferences > CAutoRegisterPreferencesHelper ; <nl> <nl> # define REGISTER_PREFERENCES_PAGE ( Type ) \ <nl> - namespace Internal \ <nl> - { \ <nl> - void RegisterPreferencesPage # # Type ( ) \ <nl> - { \ <nl> - GetIEditor ( ) - > GetPreferences ( ) - > RegisterPage < Type > ( ) ; \ <nl> - } \ <nl> - CAutoRegisterPreferencesHelper g_AutoRegPreferencesHelper # # Type ( RegisterPreferencesPage # # Type ) ; \ <nl> - } <nl> + namespace Internal \ <nl> + { \ <nl> + void RegisterPreferencesPage # # Type ( ) \ <nl> + { \ <nl> + GetIEditor ( ) - > GetPreferences ( ) - > RegisterPage < Type > ( ) ; \ <nl> + } \ <nl> + CAutoRegisterPreferencesHelper g_AutoRegPreferencesHelper # # Type ( RegisterPreferencesPage # # Type ) ; \ <nl> + } <nl> <nl> # define REGISTER_PREFERENCES_PAGE_PTR ( Type , TypePtr ) \ <nl> - namespace Internal \ <nl> - { \ <nl> - void RegisterPreferencesPage # # Type ( ) \ <nl> - { \ <nl> - GetIEditor ( ) - > GetPreferences ( ) - > RegisterPage < Type > ( TypePtr ) ; \ <nl> - } \ <nl> - CAutoRegisterPreferencesHelper g_AutoRegPreferencesHelper # # Type ( RegisterPreferencesPage # # Type ) ; \ <nl> - } <nl> + namespace Internal \ <nl> + { \ <nl> + void RegisterPreferencesPage # # Type ( ) \ <nl> + { \ <nl> + GetIEditor ( ) - > GetPreferences ( ) - > RegisterPage < Type > ( TypePtr ) ; \ <nl> + } \ <nl> + CAutoRegisterPreferencesHelper g_AutoRegPreferencesHelper # # Type ( RegisterPreferencesPage # # Type ) ; \ <nl> + } <nl> <nl> # define ADD_PREFERENCE_PAGE_PROPERTY ( type , accessor , mutator ) \ <nl> - public : \ <nl> - void mutator ( const type val ) \ <nl> - { \ <nl> - if ( m_ # # accessor ! = val ) \ <nl> - { \ <nl> - m_ # # accessor = val ; \ <nl> - accessor # # Changed ( ) ; \ <nl> - signalSettingsChanged ( ) ; \ <nl> - } \ <nl> - } \ <nl> - const type & accessor ( ) const { return m_ # # accessor ; } \ <nl> - CCrySignal < void ( ) > accessor # # Changed ; \ <nl> - private : \ <nl> - type m_ # # accessor ; \ <nl> + public : \ <nl> + void mutator ( const type val ) \ <nl> + { \ <nl> + if ( m_ # # accessor ! = val ) \ <nl> + { \ <nl> + m_ # # accessor = val ; \ <nl> + accessor # # Changed ( ) ; \ <nl> + signalSettingsChanged ( ) ; \ <nl> + } \ <nl> + } \ <nl> + const type & accessor ( ) const { return m_ # # accessor ; } \ <nl> + CCrySignal < void ( ) > accessor # # Changed ; \ <nl> + private : \ <nl> + type m_ # # accessor ; \ <nl> <nl> struct SPreferencePage ; <nl> <nl> struct EDITOR_COMMON_API SPreferencePage <nl> string m_path ; <nl> } ; <nl> <nl> - class EDITOR_COMMON_API CPreferences <nl> + class EDITOR_COMMON_API CPreferences : public CUserData <nl> { <nl> - friend yasli : : Serializer ; <nl> + friend yasli : : Serializer ; <nl> public : <nl> CPreferences ( ) ; <nl> virtual ~ CPreferences ( ) ; <nl> class EDITOR_COMMON_API CPreferences <nl> <nl> private : <nl> void Load ( ) ; <nl> - void Load ( const QString & path ) ; <nl> + void SetState ( const QVariant & state ) ; <nl> void AddPage ( SPreferencePage * pPreferencePage ) ; <nl> <nl> virtual bool Serialize ( yasli : : Archive & ar ) ; <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / FilePathUtil . cpp <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / FilePathUtil . cpp <nl> namespace PathUtil <nl> bool Remove ( const char * szPath ) <nl> { <nl> QFileInfo info ( szPath ) ; <nl> - <nl> + <nl> if ( info . isDir ( ) ) <nl> return RemoveDirectory ( szPath ) ; <nl> else <nl> EDITOR_COMMON_API bool CopyFileAllowOverwrite ( const char * szSourceFilePath , cons <nl> return QFile : : remove ( szDestinationFilePath ) & & QFile : : copy ( szSourceFilePath , szDestinationFilePath ) ; <nl> } <nl> <nl> - bool RemoveDirectory ( const char * szPath , bool bRecursive / * = true * / ) <nl> + bool RemoveDirectory ( const char * szPath , bool bRecursive / * = true * / ) <nl> { <nl> QDir dir ( szPath ) ; <nl> <nl> if ( ! bRecursive ) <nl> { <nl> - const QString dirName = dir . dirName ( ) ; <nl> + const QString dirName = dir . dirName ( ) ; <nl> if ( dir . cdUp ( ) ) <nl> { <nl> CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_WARNING , " Unable to remove directory : % s " , szPath ) ; <nl> return false ; <nl> } <nl> - <nl> + <nl> if ( dir . remove ( dirName ) ) <nl> return true ; <nl> } <nl> void Unpak ( const char * szArchivePath , const char * szDestPath , std : : function < void <nl> stack . pop ( ) ; <nl> <nl> GetISystem ( ) - > GetIPak ( ) - > ForEachArchiveFolderEntry ( szArchivePath , mask , [ szDestPath , & pakFolder , & stack , & folder , & buffer , & progressValue , progress ] ( const ICryPak : : ArchiveEntryInfo & entry ) <nl> - { <nl> - const CryPathString path ( PathUtil : : Make ( folder . c_str ( ) , entry . szName ) ) ; <nl> - if ( entry . bIsFolder ) <nl> - { <nl> - stack . push ( path ) ; <nl> - return ; <nl> - } <nl> - <nl> - ICryPak * const pPak = GetISystem ( ) - > GetIPak ( ) ; <nl> - FILE * file = pPak - > FOpen ( PathUtil : : Make ( pakFolder , path ) , " rbx " ) ; <nl> - if ( ! file ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> - if ( ! pPak - > MakeDir ( PathUtil : : Make ( szDestPath , folder ) ) ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> - buffer . resize ( pPak - > FGetSize ( file ) ) ; <nl> - const size_t numberOfBytesRead = pPak - > FReadRawAll ( buffer . data ( ) , buffer . size ( ) , file ) ; <nl> - pPak - > FClose ( file ) ; <nl> - <nl> - CryPathString destPath ( PathUtil : : Make ( szDestPath , path ) ) ; <nl> - QFile destFile ( QtUtil : : ToQString ( destPath . c_str ( ) ) ) ; <nl> - destFile . open ( QIODevice : : WriteOnly | QIODevice : : Truncate ) ; <nl> - destFile . write ( buffer . data ( ) , numberOfBytesRead ) ; <nl> - <nl> - if ( progress ) <nl> { <nl> - progressValue = std : : min ( 1 . 0f , progressValue + 0 . 01f ) ; <nl> - progress ( progressValue ) ; <nl> - } <nl> - } ) ; <nl> + const CryPathString path ( PathUtil : : Make ( folder . c_str ( ) , entry . szName ) ) ; <nl> + if ( entry . bIsFolder ) <nl> + { <nl> + stack . push ( path ) ; <nl> + return ; <nl> + } <nl> + <nl> + ICryPak * const pPak = GetISystem ( ) - > GetIPak ( ) ; <nl> + FILE * file = pPak - > FOpen ( PathUtil : : Make ( pakFolder , path ) , " rbx " ) ; <nl> + if ( ! file ) <nl> + { <nl> + return ; <nl> + } <nl> + <nl> + if ( ! pPak - > MakeDir ( PathUtil : : Make ( szDestPath , folder ) ) ) <nl> + { <nl> + return ; <nl> + } <nl> + <nl> + buffer . resize ( pPak - > FGetSize ( file ) ) ; <nl> + const size_t numberOfBytesRead = pPak - > FReadRawAll ( buffer . data ( ) , buffer . size ( ) , file ) ; <nl> + pPak - > FClose ( file ) ; <nl> + <nl> + CryPathString destPath ( PathUtil : : Make ( szDestPath , path ) ) ; <nl> + QFile destFile ( QtUtil : : ToQString ( destPath . c_str ( ) ) ) ; <nl> + destFile . open ( QIODevice : : WriteOnly | QIODevice : : Truncate ) ; <nl> + destFile . write ( buffer . data ( ) , numberOfBytesRead ) ; <nl> + <nl> + if ( progress ) <nl> + { <nl> + progressValue = std : : min ( 1 . 0f , progressValue + 0 . 01f ) ; <nl> + progress ( progressValue ) ; <nl> + } <nl> + } ) ; <nl> } <nl> } <nl> <nl> string GetGameProjectAssetsPath ( ) <nl> return gEnv - > pSystem - > GetIProjectManager ( ) - > GetCurrentAssetDirectoryAbsolute ( ) ; <nl> } <nl> <nl> - <nl> string GetCurrentPlatformFolder ( ) <nl> { <nl> # ifdef CRY_PLATFORM_WINDOWS <nl> EDITOR_COMMON_API string GetUniqueName ( const string & fileName , const string & fol <nl> QDirIterator iterator ( QtUtil : : ToQString ( absFolder ) , QStringList ( ) < < mask . c_str ( ) , QDir : : Files ) ; <nl> while ( iterator . hasNext ( ) ) <nl> { <nl> - string filePath = QtUtil : : ToString ( iterator . next ( ) ) . substr ( absFolderLen ) ; <nl> + string filePath = QtUtil : : ToString ( iterator . next ( ) ) . substr ( absFolderLen ) ; <nl> PathUtil : : RemoveExtension ( filePath ) ; <nl> PathUtil : : RemoveExtension ( filePath ) ; <nl> resultSet . push_back ( filePath ) ; <nl> inline string AbsoluteToRelativePath ( const string & absolutePath , const char * dir <nl> return path ; <nl> } <nl> <nl> - <nl> inline string AbsolutePathToCryPakPath ( const string & path ) <nl> { <nl> if ( path . empty ( ) ) <nl> inline string AbsolutePathToCryPakPath ( const string & path ) <nl> return AbsoluteToRelativePath ( path , rootpath ) ; <nl> } <nl> <nl> - <nl> string AbsolutePathToGamePath ( const string & path ) <nl> { <nl> if ( path . empty ( ) ) <nl> string GamePathToCryPakPath ( const string & path , bool bForWriting / * = false * / ) <nl> return szAdjustedFile ; <nl> } <nl> <nl> - <nl> QString ToGamePath ( const QString & path ) <nl> { <nl> QString fixedPath = path ; <nl> EDITOR_COMMON_API bool IsValidFileName ( const QString & name ) <nl> } <nl> <nl> } <nl> - <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / FilePathUtil . h <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / FilePathUtil . h <nl> EDITOR_COMMON_API bool RemoveDirectory ( const char * szPath , bool bRecursive = tru <nl> / / ! Sets the file permission from read only to read - write . <nl> EDITOR_COMMON_API bool MakeFileWritable ( const char * szFilePath ) ; <nl> <nl> - <nl> / / ! Extracts all the files from a pak file . The pak should already be open by GetISystem ( ) - > GetIPak ( ) - > OpenPack ( ) ; <nl> / / ! The function will silently overwrite existing files . <nl> / / ! \ param szArchivePath Path to the existing pak file to be unpacked . <nl> / / ! \ param szDestPath Path to the destination folder . <nl> / / ! \ param progress . A function object that is called each time another portion of the pak file has been extracted . The progress value is in the range 0 . . 1 inclusive . <nl> / / ! \ see ICryPak : : OpenPack ( ) <nl> - EDITOR_COMMON_API void Unpak ( const char * szArchivePath , const char * szDestPath , std : : function < void ( float ) > progress ) ; <nl> - <nl> + EDITOR_COMMON_API void Unpak ( const char * szArchivePath , const char * szDestPath , std : : function < void ( float ) > progress ) ; <nl> <nl> EDITOR_COMMON_API string GetAudioLocalizationFolder ( ) ; <nl> <nl> EDITOR_COMMON_API string GetGameProjectAssetsPath ( ) ; <nl> / / ! GameSDK / Objects / bird . cgf - > Objects / bird . cgf <nl> / / ! Objects / bird . cgf - > Objects / bird . cgf <nl> / / ! where project root is A : / p4 , and game directory is GameSDK . <nl> - EDITOR_COMMON_API string ToGamePath ( const string & path ) ; <nl> + EDITOR_COMMON_API string ToGamePath ( const string & path ) ; <nl> EDITOR_COMMON_API QString ToGamePath ( const QString & path ) ; <nl> - EDITOR_COMMON_API string ToGamePath ( const char * path ) ; <nl> + EDITOR_COMMON_API string ToGamePath ( const char * path ) ; <nl> <nl> EDITOR_COMMON_API QString ToUnixPath ( const QString & path ) ; <nl> <nl> EDITOR_COMMON_API bool IsValidFileName ( const QString & name ) ; <nl> / / ! Returns current platform specific folder name , used when the user wants to store platform specific data . <nl> EDITOR_COMMON_API string GetCurrentPlatformFolder ( ) ; <nl> } <nl> - <nl> mmm a / Code / Sandbox / Plugins / EditorCommon / QtUtil . h <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / QtUtil . h <nl> inline CryStringT < char > ToString ( const QString & str ) <nl> return Unicode : : Convert < CryStringT < char > > ( str ) ; <nl> } <nl> <nl> + inline const char * ToConstCharPtr ( const QString & str ) <nl> + { <nl> + return str . toLocal8Bit ( ) ; <nl> + } <nl> + <nl> / / From CryString to QString <nl> inline QString ToQString ( const CryStringT < char > & str ) <nl> { <nl> EDITOR_COMMON_API QScrollArea * MakeScrollable ( QWidget * widget ) ; <nl> EDITOR_COMMON_API QScrollArea * MakeScrollable ( QLayout * widget ) ; <nl> <nl> / / ! Opens an Explorer / Finder window at specific location , selects file if exists <nl> - EDITOR_COMMON_API void OpenInExplorer ( const char * path ) ; <nl> + EDITOR_COMMON_API void OpenInExplorer ( const char * path ) ; <nl> / / ! Lets the operating system open the file for edit with the associated application <nl> - EDITOR_COMMON_API void OpenFileForEdit ( const char * filePath ) ; <nl> + EDITOR_COMMON_API void OpenFileForEdit ( const char * filePath ) ; <nl> <nl> - EDITOR_COMMON_API void RecursiveInstallEventFilter ( QWidget * pListener , QWidget * pWatched ) ; <nl> + EDITOR_COMMON_API void RecursiveInstallEventFilter ( QWidget * pListener , QWidget * pWatched ) ; <nl> <nl> / / ! Will create the menu action based on the path separated by ' / ' . Last section of the path will be the action text . <nl> EDITOR_COMMON_API QAction * AddActionFromPath ( const QString & menuPath , QMenu * parentMenu ) ; <nl> EDITOR_COMMON_API bool MapFromSourceIndirect ( const QAbstractItemModel * pProxyMod <nl> / / ! Takes a source model index and returns an index in the view ' s model <nl> EDITOR_COMMON_API bool MapFromSourceIndirect ( const QAbstractItemView * pView , const QModelIndex & sourceIndexIn , QModelIndex & viewIndexOut ) ; <nl> } <nl> - <nl> new file mode 100644 <nl> index 0000000000 . . 443d9bb5ab <nl> mmm / dev / null <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / Util / UserDataUtil . cpp <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include < StdAfx . h > <nl> + # include " UserDataUtil . h " <nl> + <nl> + # include < QFile > <nl> + # include < QJsonDocument > <nl> + <nl> + # include < QtUtil . h > <nl> + <nl> + namespace UserDataUtil <nl> + { <nl> + const unsigned currentVersion = 1 ; <nl> + <nl> + bool Migrate ( const QString & from , const QString & to ) <nl> + { <nl> + QFileInfo fileInfo ( from ) ; <nl> + if ( fileInfo . isDir ( ) ) <nl> + { <nl> + QDir fromDir ( from ) ; <nl> + if ( ! fromDir . exists ( ) ) <nl> + return false ; <nl> + <nl> + QString newDir = to + " / " + fromDir . dirName ( ) ; <nl> + QDir toDir ( newDir ) ; <nl> + toDir . mkpath ( toDir . absolutePath ( ) ) ; <nl> + <nl> + QFileInfoList infoList = fromDir . entryInfoList ( QDir : : AllDirs | QDir : : Files | QDir : : NoDotAndDotDot ) ; <nl> + for ( const QFileInfo & fileInfo : infoList ) <nl> + { <nl> + if ( ! Migrate ( from + " / " + fileInfo . fileName ( ) , newDir ) ) <nl> + return false ; <nl> + } <nl> + } <nl> + else <nl> + { <nl> + QString destination ( to + " / " + fileInfo . fileName ( ) ) ; <nl> + <nl> + / / Don ' t replace any existing files <nl> + if ( QFile : : exists ( destination ) ) <nl> + return true ; <nl> + <nl> + return QFile : : copy ( from , destination ) ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + bool Migrate ( const char * szRelativeFilePath ) <nl> + { <nl> + unsigned lastVersion = currentVersion ; <nl> + <nl> + QString userDataRootPath ( QtUtil : : GetAppDataFolder ( ) + " / " ) ; <nl> + const QString currentVersionPath ( userDataRootPath + QString : : number ( currentVersion ) ) ; <nl> + <nl> + / / Get latest file version <nl> + while ( ! QFileInfo : : exists ( userDataRootPath + QString : : number ( lastVersion ) + " / " + szRelativeFilePath ) & & - - lastVersion ) <nl> + ; <nl> + <nl> + / / If there ' s a version mismatch , we must try to migrate data <nl> + if ( lastVersion ! = currentVersion ) <nl> + { <nl> + / / If last version is a valid version , then copy it ' s directory into current version for migration <nl> + QString lastVersionPath ; <nl> + if ( lastVersion ) <nl> + { <nl> + lastVersionPath = userDataRootPath + QString : : number ( lastVersion ) + " / " + szRelativeFilePath ; <nl> + } <nl> + else <nl> + { <nl> + lastVersionPath = userDataRootPath + szRelativeFilePath ; <nl> + } <nl> + <nl> + / / If directory was copied successfully , then return the current version path <nl> + return Migrate ( lastVersionPath , currentVersionPath ) ; <nl> + } <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + QString GetUserPath ( const char * szRelativeFilePath ) <nl> + { <nl> + return QtUtil : : GetAppDataFolder ( ) + " / " + QString : : number ( currentVersion ) + " / " + szRelativeFilePath ; <nl> + } <nl> + <nl> + QVariant Load ( const char * szRelativeFilePath ) <nl> + { <nl> + const QString filePath ( GetUserPath ( szRelativeFilePath ) ) ; <nl> + QFile file ( filePath ) ; <nl> + if ( ! file . open ( QIODevice : : ReadOnly ) ) <nl> + { <nl> + QString msg = " Failed to open path : " + filePath ; <nl> + CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_COMMENT , QtUtil : : ToConstCharPtr ( msg ) ) ; <nl> + return QVariant ( ) ; <nl> + } <nl> + <nl> + QJsonDocument doc ( QJsonDocument : : fromJson ( file . readAll ( ) ) ) ; <nl> + <nl> + return doc . toVariant ( ) ; <nl> + } <nl> + <nl> + void Save ( const char * szRelativeFilePath , const char * data ) <nl> + { <nl> + QString filePath ( GetUserPath ( szRelativeFilePath ) ) ; <nl> + / / Remove filename from path <nl> + QDir dir ( QFileInfo ( filePath ) . absolutePath ( ) ) ; <nl> + / / Make sure the directory exists <nl> + dir . mkpath ( dir . absolutePath ( ) ) ; <nl> + <nl> + QFile file ( filePath ) ; <nl> + if ( ! file . open ( QIODevice : : WriteOnly ) ) <nl> + { <nl> + CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_ERROR , " Failed to open path : % s " , QtUtil : : ToConstCharPtr ( filePath ) ) ; <nl> + return ; <nl> + } <nl> + <nl> + file . write ( data ) ; <nl> + } <nl> + } / / namespace UserDataUtil <nl> + <nl> + CUserData : : CUserData ( std : : vector < string > userDataPaths ) <nl> + { <nl> + / / Automatically migrate any relevant data to new version folder <nl> + for ( auto & userDataPath : userDataPaths ) <nl> + { <nl> + UserDataUtil : : Migrate ( userDataPath . c_str ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + CUserData : : ~ CUserData ( ) <nl> + { <nl> + <nl> + } <nl> new file mode 100644 <nl> index 0000000000 . . a5d82b7a05 <nl> mmm / dev / null <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / Util / UserDataUtil . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + # pragma once <nl> + <nl> + # include < QVariant > <nl> + <nl> + class EDITOR_COMMON_API CUserData <nl> + { <nl> + public : <nl> + CUserData ( std : : vector < string > userDataPaths ) ; <nl> + virtual ~ CUserData ( ) ; <nl> + } ; <nl> + <nl> + namespace UserDataUtil <nl> + { <nl> + / / Get path in user folder for given relative path <nl> + QString EDITOR_COMMON_API GetUserPath ( const char * relativeFilePath ) ; <nl> + <nl> + / / Load user data . Path should be relative to user data folder <nl> + QVariant EDITOR_COMMON_API Load ( const char * relativeFilePath ) ; <nl> + <nl> + / / Save user data . Path should be relative to user data folder <nl> + void EDITOR_COMMON_API Save ( const char * relativeFilePath , const char * data ) ; <nl> + } / / namespace UserDataUtil <nl>
! XI Copying / / ce / task_sandbox_versioned_user_data to main ( / / ce / main )
CRYTEK/CRYENGINE
be8c5db37605dc8fc28858f4043025cb2a7bfdec
2018-06-25T13:03:00Z
mmm a / src / library . js <nl> ppp b / src / library . js <nl> LibraryManager . library = { <nl> } <nl> var bytesRead = 0 ; <nl> var streamObj = FS . getStream ( stream ) ; <nl> + if ( ! streamObj ) return 0 ; <nl> while ( streamObj . ungotten . length & & bytesToRead > 0 ) { <nl> { { { makeSetValue ( ' ptr + + ' , ' 0 ' , ' streamObj . ungotten . pop ( ) ' , ' i8 ' ) } } } <nl> bytesToRead - - ; <nl>
return 0 on fread on invalid stream
emscripten-core/emscripten
10b92e403dd2128fb3df40658eb88bbc7c7bd517
2013-12-02T21:17:00Z
mmm a / include / swift / Parse / Parser . h <nl> ppp b / include / swift / Parse / Parser . h <nl> class Parser { <nl> / / / \ brief Parse layout constraint . <nl> LayoutConstraint parseLayoutConstraint ( Identifier LayoutConstraintID ) ; <nl> <nl> - bool parseGenericArguments ( SmallVectorImpl < TypeRepr * > & Args , <nl> - SourceLoc & LAngleLoc , <nl> - SourceLoc & RAngleLoc ) ; <nl> + ParserStatus parseGenericArguments ( SmallVectorImpl < TypeRepr * > & Args , <nl> + SourceLoc & LAngleLoc , <nl> + SourceLoc & RAngleLoc ) ; <nl> <nl> ParserResult < TypeRepr > parseTypeIdentifier ( ) ; <nl> ParserResult < TypeRepr > parseOldStyleProtocolComposition ( ) ; <nl> mmm a / lib / AST / LookupVisibleDecls . cpp <nl> ppp b / lib / AST / LookupVisibleDecls . cpp <nl> static void lookupVisibleMemberDecls ( <nl> Consumer . foundDecl ( DeclAndReason . D , DeclAndReason . Reason ) ; <nl> } <nl> <nl> - void swift : : lookupVisibleDecls ( VisibleDeclConsumer & Consumer , <nl> - const DeclContext * DC , <nl> - LazyResolver * TypeResolver , <nl> - bool IncludeTopLevel , <nl> - SourceLoc Loc ) { <nl> + static void lookupVisibleDeclsImpl ( VisibleDeclConsumer & Consumer , <nl> + const DeclContext * DC , <nl> + LazyResolver * TypeResolver , <nl> + bool IncludeTopLevel , SourceLoc Loc ) { <nl> const ModuleDecl & M = * DC - > getParentModule ( ) ; <nl> const SourceManager & SM = DC - > getASTContext ( ) . SourceMgr ; <nl> auto Reason = DeclVisibilityKind : : MemberOfCurrentNominal ; <nl> void swift : : lookupVisibleDecls ( VisibleDeclConsumer & Consumer , <nl> } <nl> } <nl> <nl> + void swift : : lookupVisibleDecls ( VisibleDeclConsumer & Consumer , <nl> + const DeclContext * DC , <nl> + LazyResolver * TypeResolver , <nl> + bool IncludeTopLevel , <nl> + SourceLoc Loc ) { <nl> + if ( Loc . isInvalid ( ) ) { <nl> + lookupVisibleDeclsImpl ( Consumer , DC , TypeResolver , IncludeTopLevel , Loc ) ; <nl> + return ; <nl> + } <nl> + <nl> + / / Filtering out unusable values . <nl> + class LocalConsumer : public VisibleDeclConsumer { <nl> + const SourceManager & SM ; <nl> + SourceLoc Loc ; <nl> + VisibleDeclConsumer & Consumer ; <nl> + <nl> + bool isUsableValue ( ValueDecl * VD , DeclVisibilityKind Reason ) { <nl> + <nl> + / / Check " use within its own initial value " case . <nl> + if ( auto * varD = dyn_cast < VarDecl > ( VD ) ) <nl> + if ( auto * PBD = varD - > getParentPatternBinding ( ) ) <nl> + if ( ! PBD - > isImplicit ( ) & & <nl> + SM . rangeContainsTokenLoc ( PBD - > getSourceRange ( ) , Loc ) ) <nl> + return false ; <nl> + <nl> + switch ( Reason ) { <nl> + case DeclVisibilityKind : : LocalVariable : <nl> + / / Use of ' TypeDecl ' s before declaration is allowed . <nl> + if ( isa < TypeDecl > ( VD ) ) <nl> + return true ; <nl> + <nl> + return SM . isBeforeInBuffer ( VD - > getLoc ( ) , Loc ) ; <nl> + <nl> + case DeclVisibilityKind : : VisibleAtTopLevel : <nl> + / / TODO : Implement forward reference rule for script mode ? Currently , <nl> + / / it ' s not needed because the rest of the file hasn ' t been parsed . <nl> + / / See : https : / / bugs . swift . org / browse / SR - 284 for the rule . <nl> + return true ; <nl> + <nl> + default : <nl> + / / Other visibility kind are always usable . <nl> + return true ; <nl> + } <nl> + } <nl> + <nl> + public : <nl> + LocalConsumer ( const SourceManager & SM , SourceLoc Loc , <nl> + VisibleDeclConsumer & Consumer ) <nl> + : SM ( SM ) , Loc ( Loc ) , Consumer ( Consumer ) { } <nl> + <nl> + void foundDecl ( ValueDecl * VD , DeclVisibilityKind Reason ) { <nl> + if ( isUsableValue ( VD , Reason ) ) <nl> + Consumer . foundDecl ( VD , Reason ) ; <nl> + } <nl> + } LocalConsumer ( DC - > getASTContext ( ) . SourceMgr , Loc , Consumer ) ; <nl> + <nl> + lookupVisibleDeclsImpl ( LocalConsumer , DC , TypeResolver , IncludeTopLevel , Loc ) ; <nl> + } <nl> + <nl> void swift : : lookupVisibleMemberDecls ( VisibleDeclConsumer & Consumer , Type BaseTy , <nl> const DeclContext * CurrDC , <nl> LazyResolver * TypeResolver , <nl> mmm a / lib / IDE / CodeCompletion . cpp <nl> ppp b / lib / IDE / CodeCompletion . cpp <nl> void collectPossibleCalleesByQualifiedLookup ( <nl> Type declaredMemberType = VD - > getInterfaceType ( ) ; <nl> if ( auto * AFD = dyn_cast < AbstractFunctionDecl > ( VD ) ) <nl> if ( AFD - > getDeclContext ( ) - > isTypeContext ( ) ) <nl> - declaredMemberType = AFD - > getMethodInterfaceType ( ) ; <nl> + declaredMemberType = <nl> + declaredMemberType - > castTo < AnyFunctionType > ( ) - > getResult ( ) ; <nl> <nl> auto fnType = <nl> baseTy - > getTypeOfMember ( DC . getParentModule ( ) , VD , declaredMemberType ) ; <nl> <nl> - if ( ! fnType | | fnType - > hasError ( ) ) <nl> + if ( ! fnType ) <nl> continue ; <nl> if ( auto * AFT = fnType - > getAs < AnyFunctionType > ( ) ) { <nl> candidates . emplace_back ( AFT , VD ) ; <nl> mmm a / lib / Parse / Lexer . cpp <nl> ppp b / lib / Parse / Lexer . cpp <nl> void Lexer : : lexImpl ( ) { <nl> case 0 : <nl> switch ( getNulCharacterKind ( CurPtr - 1 ) ) { <nl> case NulCharacterKind : : CodeCompletion : <nl> + while ( advanceIfValidContinuationOfIdentifier ( CurPtr , BufferEnd ) ) <nl> + ; <nl> return formToken ( tok : : code_complete , TokStart ) ; <nl> <nl> case NulCharacterKind : : BufferEnd : <nl> mmm a / lib / Parse / ParseExpr . cpp <nl> ppp b / lib / Parse / ParseExpr . cpp <nl> Parser : : parseExprPostfixSuffix ( ParserResult < Expr > Result , bool isExprBasic , <nl> if ( canParseAsGenericArgumentList ( ) ) { <nl> SmallVector < TypeRepr * , 8 > args ; <nl> SourceLoc LAngleLoc , RAngleLoc ; <nl> - if ( parseGenericArguments ( args , LAngleLoc , RAngleLoc ) ) { <nl> + auto argStat = parseGenericArguments ( args , LAngleLoc , RAngleLoc ) ; <nl> + if ( argStat . isError ( ) ) <nl> diagnose ( LAngleLoc , diag : : while_parsing_as_left_angle_bracket ) ; <nl> - } <nl> <nl> SmallVector < TypeLoc , 8 > locArgs ; <nl> for ( auto ty : args ) <nl> Expr * Parser : : parseExprIdentifier ( ) { <nl> if ( canParseAsGenericArgumentList ( ) ) { <nl> SyntaxContext - > createNodeInPlace ( SyntaxKind : : IdentifierExpr ) ; <nl> SyntaxContext - > setCreateSyntax ( SyntaxKind : : SpecializeExpr ) ; <nl> - if ( parseGenericArguments ( args , LAngleLoc , RAngleLoc ) ) { <nl> + auto argStat = parseGenericArguments ( args , LAngleLoc , RAngleLoc ) ; <nl> + if ( argStat . isError ( ) ) <nl> diagnose ( LAngleLoc , diag : : while_parsing_as_left_angle_bracket ) ; <nl> - } <nl> <nl> / / The result can be empty in error cases . <nl> hasGenericArgumentList = ! args . empty ( ) ; <nl> mmm a / lib / Parse / ParseType . cpp <nl> ppp b / lib / Parse / ParseType . cpp <nl> ParserResult < TypeRepr > Parser : : parseType ( Diag < > MessageID , <nl> specifierLoc ) ) ; <nl> } <nl> <nl> - bool Parser : : parseGenericArguments ( SmallVectorImpl < TypeRepr * > & Args , <nl> - SourceLoc & LAngleLoc , <nl> - SourceLoc & RAngleLoc ) { <nl> + ParserStatus Parser : : parseGenericArguments ( SmallVectorImpl < TypeRepr * > & Args , <nl> + SourceLoc & LAngleLoc , <nl> + SourceLoc & RAngleLoc ) { <nl> SyntaxParsingContext GenericArgumentsContext ( <nl> SyntaxContext , SyntaxKind : : GenericArgumentClause ) ; <nl> <nl> bool Parser : : parseGenericArguments ( SmallVectorImpl < TypeRepr * > & Args , <nl> if ( Ty . isNull ( ) | | Ty . hasCodeCompletion ( ) ) { <nl> / / Skip until we hit the ' > ' . <nl> RAngleLoc = skipUntilGreaterInTypeList ( ) ; <nl> - return true ; <nl> + return ParserStatus ( Ty ) ; <nl> } <nl> <nl> Args . push_back ( Ty . get ( ) ) ; <nl> bool Parser : : parseGenericArguments ( SmallVectorImpl < TypeRepr * > & Args , <nl> <nl> / / Skip until we hit the ' > ' . <nl> RAngleLoc = skipUntilGreaterInTypeList ( ) ; <nl> - return true ; <nl> + return makeParserError ( ) ; <nl> } else { <nl> RAngleLoc = consumeStartingGreater ( ) ; <nl> } <nl> <nl> - return false ; <nl> + return makeParserSuccess ( ) ; <nl> } <nl> <nl> / / / parseTypeIdentifier <nl> ParserResult < TypeRepr > Parser : : parseTypeIdentifier ( ) { <nl> SourceLoc LAngle , RAngle ; <nl> SmallVector < TypeRepr * , 8 > GenericArgs ; <nl> if ( startsWithLess ( Tok ) ) { <nl> - if ( parseGenericArguments ( GenericArgs , LAngle , RAngle ) ) <nl> - return nullptr ; <nl> + auto genericArgsStatus = parseGenericArguments ( GenericArgs , LAngle , RAngle ) ; <nl> + if ( genericArgsStatus . isError ( ) ) <nl> + return genericArgsStatus ; <nl> } <nl> EndLoc = Loc ; <nl> <nl> mmm a / lib / Sema / TypeCheckNameLookup . cpp <nl> ppp b / lib / Sema / TypeCheckNameLookup . cpp <nl> static bool isPlausibleTypo ( DeclRefKind refKind , DeclName typedName , <nl> return true ; <nl> } <nl> <nl> - static bool isLocInVarInit ( TypeChecker & TC , VarDecl * var , SourceLoc loc ) { <nl> - auto binding = var - > getParentPatternBinding ( ) ; <nl> - if ( ! binding | | binding - > isImplicit ( ) ) <nl> - return false ; <nl> - <nl> - auto initRange = binding - > getSourceRange ( ) ; <nl> - return TC . Context . SourceMgr . rangeContainsTokenLoc ( initRange , loc ) ; <nl> - } <nl> - <nl> void TypeChecker : : performTypoCorrection ( DeclContext * DC , DeclRefKind refKind , <nl> Type baseTypeOrNull , <nl> NameLookupOptions lookupOptions , <nl> void TypeChecker : : performTypoCorrection ( DeclContext * DC , DeclRefKind refKind , <nl> if ( ! isPlausibleTypo ( refKind , corrections . WrittenName , decl ) ) <nl> return ; <nl> <nl> - / / Don ' t suggest a variable within its own initializer . <nl> - if ( auto var = dyn_cast < VarDecl > ( decl ) ) { <nl> - if ( isLocInVarInit ( * this , var , corrections . Loc . getBaseNameLoc ( ) ) ) <nl> - return ; <nl> - } <nl> - <nl> auto candidateName = decl - > getFullName ( ) ; <nl> <nl> / / Don ' t waste time computing edit distances that are more than <nl> mmm a / test / IDE / complete_call_arg . swift <nl> ppp b / test / IDE / complete_call_arg . swift <nl> <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = OVERLOAD6 | % FileCheck % s - check - prefix = OVERLOAD6 <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = OVERLOAD7 | % FileCheck % s - check - prefix = OVERLOAD6 <nl> <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = HASERROR1 | % FileCheck % s - check - prefix = HASERROR1 <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = HASERROR2 | % FileCheck % s - check - prefix = HASERROR2 <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = HASERROR3 | % FileCheck % s - check - prefix = HASERROR3 <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = HASERROR4 | % FileCheck % s - check - prefix = HASERROR4 <nl> + <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = MEMBER1 | % FileCheck % s - check - prefix = MEMBER1 <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = MEMBER2 | % FileCheck % s - check - prefix = MEMBER2 <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = MEMBER3 | % FileCheck % s - check - prefix = MEMBER3 <nl> class C3 { <nl> / / OVERLOAD6 - DAG : Decl [ InstanceVar ] / CurrNominal : C2I [ # C2 # ] ; name = C2I <nl> / / OVERLOAD6 : End completions <nl> <nl> + extension C3 { <nl> + func hasError ( a1 : C1 , b1 : TypeInvalid ) - > Int { } <nl> + <nl> + func f7 ( obj : C3 ) { <nl> + let _ = obj . hasError ( # ^ HASERROR1 ^ # <nl> + let _ = obj . hasError ( a1 : # ^ HASERROR2 ^ # <nl> + let _ = obj . hasError ( a1 : IC1 , # ^ HASERROR3 ^ # <nl> + let _ = obj . hasError ( a1 : IC1 , b1 : # ^ HASERROR4 ^ # <nl> + } <nl> + } <nl> + <nl> + / / HASERROR1 : Begin completions <nl> + / / HASERROR1 - DAG : Pattern / CurrModule : [ ' ( ' ] { # a1 : C1 # } , { # b1 : < < error type > > # } [ ' ) ' ] [ # Int # ] ; <nl> + / / HASERROR1 : End completions <nl> + <nl> + / / HASERROR2 : Begin completions <nl> + / / HASERROR2 - DAG : Decl [ InstanceVar ] / CurrNominal / TypeRelation [ Identical ] : C1I [ # C1 # ] ; <nl> + / / HASERROR2 - DAG : Decl [ InstanceVar ] / CurrNominal : C2I [ # C2 # ] ; <nl> + / / HASERROR2 : End completions <nl> + <nl> + / / HASERROR3 : Begin completions <nl> + / / HASERROR3 - DAG : Keyword / ExprSpecific : b1 : [ # Argument name # ] ; <nl> + / / HASERROR3 : End completions <nl> + <nl> + / / HASERROR4 : Begin completions <nl> + / / HASERROR4 - DAG : Decl [ InstanceVar ] / CurrNominal : C1I [ # C1 # ] ; <nl> + / / HASERROR4 - DAG : Decl [ InstanceVar ] / CurrNominal : C2I [ # C2 # ] ; <nl> + / / HASERROR4 : End completions <nl> + <nl> class C4 { <nl> func f1 ( _ G : Gen ) { <nl> foo ( 1 , b1 : G . # ^ MEMBER1 ^ # <nl> mmm a / test / IDE / complete_decl_attribute . swift <nl> ppp b / test / IDE / complete_decl_attribute . swift <nl> <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = AVAILABILITY2 | % FileCheck % s - check - prefix = AVAILABILITY2 <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = KEYWORD2 | % FileCheck % s - check - prefix = KEYWORD2 <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = KEYWORD3 | % FileCheck % s - check - prefix = KEYWORD3 <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = KEYWORD3_2 | % FileCheck % s - check - prefix = KEYWORD3 <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = KEYWORD4 | % FileCheck % s - check - prefix = KEYWORD4 <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = KEYWORD5 | % FileCheck % s - check - prefix = KEYWORD5 <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = KEYWORD_LAST | % FileCheck % s - check - prefix = KEYWORD_LAST <nl> class C { } <nl> / / KEYWORD3 - NEXT : Keyword / None : usableFromInline [ # Class Attribute # ] ; name = usableFromInline <nl> / / KEYWORD3 - NEXT : End completions <nl> <nl> + @ # ^ KEYWORD3_2 ^ # IB <nl> + class C2 { } <nl> + / / Same as KEYWORD3 . <nl> + <nl> @ # ^ KEYWORD4 ^ # <nl> enum E { } <nl> / / KEYWORD4 : Begin completions , 5 items <nl> mmm a / test / IDE / complete_expr_postfix_begin . swift <nl> ppp b / test / IDE / complete_expr_postfix_begin . swift <nl> <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = IN_TUPLE_1 | % FileCheck % s - check - prefix = IN_TUPLE_1 <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = IN_TUPLE_2 | % FileCheck % s - check - prefix = IN_TUPLE_2 <nl> <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = OWN_INIT_1 | % FileCheck % s - check - prefix = OWN_INIT_1 <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = OWN_INIT_2 | % FileCheck % s - check - prefix = OWN_INIT_2 <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = OWN_INIT_3 | % FileCheck % s - check - prefix = OWN_INIT_3 <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = OWN_INIT_4 | % FileCheck % s - check - prefix = OWN_INIT_4 <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = OWN_INIT_5 | % FileCheck % s - check - prefix = OWN_INIT_5 <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = OWN_INIT_6 | % FileCheck % s - check - prefix = OWN_INIT_6 <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = OWN_INIT_7 | % FileCheck % s - check - prefix = OWN_INIT_7 <nl> + <nl> / / <nl> / / Test code completion at the beginning of expr - postfix . <nl> / / <nl> func testInForEach1 ( arg : Int ) { <nl> let after = 4 <nl> / / IN_FOR_EACH_1 - NOT : Decl [ LocalVar ] <nl> / / IN_FOR_EACH_1 : Decl [ LocalVar ] / Local : local [ # Int # ] ; <nl> - / / FIXME : shouldn ' t show ' after ' here . <nl> - / / IN_FOR_EACH_1 : Decl [ LocalVar ] / Local : after [ # Int # ] ; <nl> + / / IN_FOR_EACH_1 - NOT : after <nl> / / IN_FOR_EACH_1 : Decl [ LocalVar ] / Local : arg [ # Int # ] ; <nl> / / IN_FOR_EACH_1 - NOT : Decl [ LocalVar ] <nl> } <nl> func testInForEach2 ( arg : Int ) { <nl> let after = 4 <nl> / / IN_FOR_EACH_2 - NOT : Decl [ LocalVar ] <nl> / / IN_FOR_EACH_2 : Decl [ LocalVar ] / Local / TypeRelation [ Identical ] : local [ # Int # ] ; <nl> - / / FIXME : shouldn ' t show ' after ' here . <nl> - / / IN_FOR_EACH_2 : Decl [ LocalVar ] / Local / TypeRelation [ Identical ] : after [ # Int # ] ; <nl> + / / IN_FOR_EACH_2 - NOT : after <nl> / / IN_FOR_EACH_2 : Decl [ LocalVar ] / Local / TypeRelation [ Identical ] : arg [ # Int # ] ; <nl> / / IN_FOR_EACH_2 - NOT : Decl [ LocalVar ] <nl> } <nl> func testInForEach3 ( arg : Int ) { <nl> / / IN_FOR_EACH_3 : Decl [ LocalVar ] / Local : index [ # Int # ] ; <nl> / / IN_FOR_EACH_3 - NOT : Decl [ LocalVar ] <nl> / / IN_FOR_EACH_3 : Decl [ LocalVar ] / Local : local [ # Int # ] ; <nl> - / / FIXME : shouldn ' t show ' after ' here . <nl> - / / IN_FOR_EACH_3 : Decl [ LocalVar ] / Local : after [ # Int # ] ; <nl> + / / IN_FOR_EACH_3 - NOT : after <nl> / / IN_FOR_EACH_3 : Decl [ LocalVar ] / Local : arg [ # Int # ] ; <nl> / / IN_FOR_EACH_3 - NOT : Decl [ LocalVar ] <nl> } <nl> func testInForEach9 ( arg : Int ) { <nl> / / NOTE : [ Convertible ] to AnyHashable . <nl> / / IN_FOR_EACH_4 - NOT : Decl [ LocalVar ] <nl> / / IN_FOR_EACH_4 : Decl [ LocalVar ] / Local / TypeRelation [ Convertible ] : local [ # Int # ] ; <nl> - / / FIXME : shouldn ' t show ' after ' here . <nl> - / / IN_FOR_EACH_4 : Decl [ LocalVar ] / Local / TypeRelation [ Convertible ] : after [ # Int # ] ; <nl> + / / IN_FOR_EACH_4 - NOT : after <nl> / / IN_FOR_EACH_4 : Decl [ LocalVar ] / Local / TypeRelation [ Convertible ] : arg [ # Int # ] ; <nl> / / IN_FOR_EACH_4 - NOT : Decl [ LocalVar ] <nl> } <nl> func testTuple ( localInt : Int ) { <nl> / / IN_TUPLE_2 : Decl [ LocalVar ] / Local : localStr [ # String # ] ; name = localStr <nl> / / IN_TUPLE_2 : Decl [ LocalVar ] / Local / TypeRelation [ Identical ] : localInt [ # Int # ] ; name = localInt <nl> / / IN_TUPLE_2 : End completions <nl> + <nl> + var ownInit1 : Int = # ^ OWN_INIT_1 ^ # <nl> + / / OWN_INIT_1 : Begin completions <nl> + / / OWN_INIT_1 - NOT : ownInit1 <nl> + var ownInit2 : ( ) - > Void = { # ^ OWN_INIT_2 ^ # } <nl> + / / OWN_INIT_2 : Begin completions <nl> + / / OWN_INIT_2 - NOT : ownInit2 <nl> + struct OwnInitTester { <nl> + var ownInit3 : Int = # ^ OWN_INIT_3 ^ # <nl> + / / OWN_INIT_3 : Begin completions <nl> + / / OWN_INIT_3 - NOT : ownInit3 <nl> + var ownInit4 : ( ) - > Void = { # ^ OWN_INIT_4 ^ # } <nl> + / / OWN_INIT_4 : Begin completions <nl> + / / OWN_INIT_4 - NOT : ownInit4 <nl> + } <nl> + func ownInitTesting ( ) { <nl> + var ownInit5 : Int = # ^ OWN_INIT_5 ^ # <nl> + / / OWN_INIT_5 : Begin completions <nl> + / / OWN_INIT_5 - NOT : ownInit5 <nl> + var ownInit6 : ( ) - > Void = { # ^ OWN_INIT_6 ^ # } <nl> + / / OWN_INIT_6 : Begin completions <nl> + / / OWN_INIT_6 - NOT : ownInit6 <nl> + } <nl> + func ownInitTestingShadow ( ownInit7 : Int ) { <nl> + var ownInit7 : Int = # ^ OWN_INIT_7 ^ # <nl> + / / OWN_INIT_7 : Begin completions <nl> + / / OWN_INIT_7 : Decl [ LocalVar ] / Local / TypeRelation [ Identical ] : ownInit7 [ # Int # ] ; <nl> + } <nl> mmm a / test / IDE / complete_type . swift <nl> ppp b / test / IDE / complete_type . swift <nl> <nl> / / RUN : % FileCheck % s - check - prefix = GLOBAL_NEGATIVE < % t . types . txt <nl> <nl> <nl> - / / FIXME : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = TYPE_IDENTIFIER_GENERIC_1 > % t . types . txt <nl> - / / FIXME : % FileCheck % s - check - prefix = TYPE_IDENTIFIER_GENERIC_1 < % t . types . txt <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = TYPE_IDENTIFIER_GENERIC_1 > % t . types . txt <nl> + / / RUN : % FileCheck % s - check - prefix = TYPE_IDENTIFIER_GENERIC_1 < % t . types . txt <nl> / / RUN : % FileCheck % s - check - prefix = WITHOUT_GLOBAL_TYPES < % t . types . txt <nl> / / RUN : % FileCheck % s - check - prefix = GLOBAL_NEGATIVE < % t . types . txt <nl> <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = TYPE_IDENTIFIER_GENERIC_2 > % t . types . txt <nl> - / / FIXME : % FileCheck % s - check - prefix = TYPE_IDENTIFIER_GENERIC_2 < % t . types . txt <nl> + / / RUN : % FileCheck % s - check - prefix = TYPE_IDENTIFIER_GENERIC_2 < % t . types . txt <nl> / / RUN : % FileCheck % s - check - prefix = WITHOUT_GLOBAL_TYPES < % t . types . txt <nl> / / RUN : % FileCheck % s - check - prefix = GLOBAL_NEGATIVE < % t . types . txt <nl> <nl> <nl> / / RUN : % FileCheck % s - check - prefix = WITH_GLOBAL_TYPES < % t . gentypealias . txt <nl> / / RUN : % FileCheck % s - check - prefix = GLOBAL_NEGATIVE < % t . gentypealias . txt <nl> <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC_ARGS_TOPLEVEL_VAR | % FileCheck % s - check - prefix = WITH_GLOBAL_TYPES <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC_ARGS_TOPLEVEL_PARAM | % FileCheck % s - check - prefix = WITH_GLOBAL_TYPES <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC_ARGS_TOPLEVEL_RETURN | % FileCheck % s - check - prefix = WITH_GLOBAL_TYPES <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC_ARGS_MEMBER_VAR | % FileCheck % s - check - prefix = WITH_GLOBAL_TYPES <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC_ARGS_MEMBER_PARAM | % FileCheck % s - check - prefix = WITH_GLOBAL_TYPES <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC_ARGS_MEMBER_RETURN | % FileCheck % s - check - prefix = WITH_GLOBAL_TYPES <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC_ARGS_LOCAL_VAR | % FileCheck % s - check - prefix = WITH_GLOBAL_TYPES <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC_ARGS_LOCAL_PARAM | % FileCheck % s - check - prefix = WITH_GLOBAL_TYPES <nl> + / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC_ARGS_LOCAL_RETURN | % FileCheck % s - check - prefix = WITH_GLOBAL_TYPES <nl> + <nl> / / = = = mmm Helper types that are used in this test <nl> <nl> struct FooStruct { <nl> func testTypeIdentifierGeneric1 < <nl> > ( a : GenericFoo . # ^ TYPE_IDENTIFIER_GENERIC_1 ^ # <nl> <nl> / / TYPE_IDENTIFIER_GENERIC_1 : Begin completions <nl> - / / TYPE_IDENTIFIER_GENERIC_1 - NEXT : Decl [ TypeAlias ] / Super : FooTypeAlias1 { { ; name = . + $ } } <nl> + / / TYPE_IDENTIFIER_GENERIC_1 - NEXT : Decl [ AssociatedType ] / Super : FooTypeAlias1 { { ; name = . + $ } } <nl> / / TYPE_IDENTIFIER_GENERIC_1 - NEXT : Keyword / None : Type [ # GenericFoo . Type # ] <nl> - / / TYPE_IDENTIFIER_GENERIC_1 - NEXT : Keyword / None : self [ # GenericFoo # ] <nl> / / TYPE_IDENTIFIER_GENERIC_1 - NEXT : End completions <nl> <nl> func testTypeIdentifierGeneric2 < <nl> func testTypeIdentifierGeneric2 < <nl> > ( a : GenericFoo . # ^ TYPE_IDENTIFIER_GENERIC_2 ^ # <nl> <nl> / / TYPE_IDENTIFIER_GENERIC_2 : Begin completions <nl> - / / TYPE_IDENTIFIER_GENERIC_2 - NEXT : Decl [ TypeAlias ] / Super : BarTypeAlias1 { { ; name = . + $ } } <nl> - / / TYPE_IDENTIFIER_GENERIC_2 - NEXT : Decl [ TypeAlias ] / Super : FooTypeAlias1 { { ; name = . + $ } } <nl> + / / TYPE_IDENTIFIER_GENERIC_2 - NEXT : Decl [ AssociatedType ] / Super : BarTypeAlias1 { { ; name = . + $ } } <nl> + / / TYPE_IDENTIFIER_GENERIC_2 - NEXT : Decl [ AssociatedType ] / Super : FooTypeAlias1 { { ; name = . + $ } } <nl> / / TYPE_IDENTIFIER_GENERIC_2 - NEXT : Keyword / None : Type [ # GenericFoo . Type # ] <nl> - / / TYPE_IDENTIFIER_GENERIC_2 - NEXT : Keyword / None : self [ # GenericFoo # ] <nl> / / TYPE_IDENTIFIER_GENERIC_2 - NEXT : End completions <nl> <nl> func testTypeIdentifierGeneric3 < <nl> func testGenericTypealias2 ( ) { <nl> typealias MyPair < T > = ( T , T ) <nl> let x : MyPair < # ^ GENERIC_TYPEALIAS_2 ^ # > <nl> } <nl> + <nl> + / / In generic argument <nl> + struct GenStruct < T > { } <nl> + let a : GenStruct < # ^ GENERIC_ARGS_TOPLEVEL_VAR ^ # <nl> + func foo1 ( x : GenStruct < # ^ GENERIC_ARGS_TOPLEVEL_PARAM ^ # <nl> + func foo2 ( ) - > GenStruct < # ^ GENERIC_ARGS_TOPLEVEL_RETURN ^ # <nl> + class _TestForGenericArg_ { <nl> + let a : GenStruct < # ^ GENERIC_ARGS_MEMBER_VAR ^ # <nl> + func foo1 ( x : GenStruct < # ^ GENERIC_ARGS_MEMBER_PARAM ^ # <nl> + func foo2 ( ) - > GenStruct < # ^ GENERIC_ARGS_MEMBER_RETURN ^ # <nl> + } <nl> + func _testForGenericArg_ ( ) { <nl> + let a : GenStruct < # ^ GENERIC_ARGS_LOCAL_VAR ^ # <nl> + func foo1 ( x : GenStruct < # ^ GENERIC_ARGS_LOCAL_PARAM ^ # <nl> + func foo2 ( ) - > GenStruct < # ^ GENERIC_ARGS_LOCAL_RETURN ^ # <nl> + } <nl> mmm a / test / Sema / typo_correction . swift <nl> ppp b / test / Sema / typo_correction . swift <nl> <nl> - / / RUN : % target - typecheck - verify - swift - typo - correction - limit 22 <nl> + / / RUN : % target - typecheck - verify - swift - typo - correction - limit 23 <nl> / / RUN : not % target - swift - frontend - typecheck - disable - typo - correction % s 2 > & 1 | % FileCheck % s - check - prefix = DISABLED <nl> / / RUN : not % target - swift - frontend - typecheck - typo - correction - limit 0 % s 2 > & 1 | % FileCheck % s - check - prefix = DISABLED <nl> / / RUN : not % target - swift - frontend - typecheck - DIMPORT_FAIL % s 2 > & 1 | % FileCheck % s - check - prefix = DISABLED <nl> func test_underscored_match ( ) { <nl> _ = _fggs + 1 <nl> / / expected - error @ - 1 { { use of unresolved identifier ' _fggs ' ; did you mean ' _eggs ' ? } } <nl> } <nl> + <nl> + / / Don ' t show values before declaration . <nl> + func testFwdRef ( ) { <nl> + let _ = forward_refX + 1 / / expected - error { { use of unresolved identifier ' forward_refX ' } } <nl> + let forward_ref1 = 4 <nl> + } <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
313ffe87c88603e23cfa354896e3bf3b64aba658
2018-12-04T01:36:42Z
mmm a / doc / build . py <nl> ppp b / doc / build . py <nl> def build_docs ( ) : <nl> ' 511b0887293e7c6b12310bb61b3659068f48f0f4 ' ) <nl> print ( check_output ( [ ' sphinx - build ' , ' - - version ' ] ) ) <nl> print ( ' PATH : ' , os . environ [ ' PATH ' ] ) <nl> + print ( check_output ( [ ' which ' , ' sphinx - build ' ] ) ) <nl> # Build docs . <nl> cmd = [ ' doxygen ' , ' - ' ] <nl> p = Popen ( cmd , stdin = PIPE ) <nl>
Add more diagnostics
fmtlib/fmt
6dae7f3ba6e3d0bb0ec55c629bbacddc2aa41188
2015-10-14T13:39:07Z
mmm a / docs / en / query_language / functions / array_functions . md <nl> ppp b / docs / en / query_language / functions / array_functions . md <nl> SELECT arraySort ( ( x ) - > - x , [ 1 , 2 , 3 ] ) as res ; <nl> └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - In this example , for each element of the source array , the lambda function returns the " weight " of the element that will be applied for sorting , that is , [ 1 – > - 1 , 2 – > - 2 , 3 – > - 3 ] . Since the elements are sorted by increasing of their " weight " , the result is [ 3 , 2 , 1 ] . <nl> + For each element of the source array , the lambda function returns the sorting key , that is , [ 1 – > - 1 , 2 – > - 2 , 3 – > - 3 ] . Since the ` arraySort ` function sorts the keys in ascending order , the result is [ 3 , 2 , 1 ] . Thus , the ` ( x ) – > - x ` lambda function sets the [ descending order ] ( # array_functions - reverse - sort ) in a sorting . <nl> <nl> - The lambda function can accept multiple arguments . In this case , you need to pass the ` arraySort ` function several arrays of identical length that the arguments of lambda function will correspond to . For example : <nl> + The lambda function can accept multiple arguments . In this case , you need to pass the ` arraySort ` function several arrays of identical length that the arguments of lambda function will correspond to . The resulting array will consist of elements from the first input array ; elements from the next input array ( s ) specify the sorting keys . For example : <nl> <nl> ` ` ` sql <nl> SELECT arraySort ( ( x , y ) - > y , [ ' hello ' , ' world ' ] , [ 2 , 1 ] ) as res ; <nl> SELECT arraySort ( ( x , y ) - > y , [ ' hello ' , ' world ' ] , [ 2 , 1 ] ) as res ; <nl> └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Here , the elements that are passed in the second array ( [ 2 , 1 ] ) define a new position of each corresponding element from the source array ( [ ' hello ' , ' world ' ] ) , that is , [ ' hello ' – > 2 , ' world ' – > 1 ] . So , ' hello ' will be the second element in a result , and ' world ' will be the first . <nl> + Here , the elements that are passed in the second array ( [ 2 , 1 ] ) define a sorting key for the corresponding element from the source array ( [ ' hello ' , ' world ' ] ) , that is , [ ' hello ' – > 2 , ' world ' – > 1 ] . Since the lambda function doesn ' t use ` x ` , actual values of the source array don ' t affect the order in the result . So , ' hello ' will be the second element in the result , and ' world ' will be the first . <nl> <nl> - Another examples are shown below . <nl> + Other examples are shown below . <nl> <nl> ` ` ` sql <nl> SELECT arraySort ( ( x , y ) - > y , [ 0 , 1 , 2 ] , [ ' c ' , ' b ' , ' a ' ] ) as res ; <nl> SELECT arrayReverseSort ( ( x ) - > - x , [ 1 , 2 , 3 ] ) as res ; <nl> The array is sorted in the following way : <nl> <nl> 1 . At first , the source array ( [ 1 , 2 , 3 ] ) is sorted according to the result of the lambda function applied to the elements of the array . The result is an array [ 3 , 2 , 1 ] . <nl> - 2 . Array that was sorted on the previous step , is reversed . So , the final result is [ 1 , 2 , 3 ] . <nl> + 2 . Array that is obtained on the previous step , is reversed . So , the final result is [ 1 , 2 , 3 ] . <nl> <nl> - The lambda function can accept multiple arguments . In this case , you need to pass the ` arraySort ` function several arrays of identical length that the arguments of lambda function will correspond to . For example : <nl> + The lambda function can accept multiple arguments . In this case , you need to pass the ` arrayReverseSort ` function several arrays of identical length that the arguments of lambda function will correspond to . The resulting array will consist of elements from the first input array ; elements from the next input array ( s ) specify the sorting keys . For example : <nl> <nl> ` ` ` sql <nl> SELECT arrayReverseSort ( ( x , y ) - > y , [ ' hello ' , ' world ' ] , [ 2 , 1 ] ) as res ; <nl> SELECT arrayReverseSort ( ( x , y ) - > y , [ ' hello ' , ' world ' ] , [ 2 , 1 ] ) as res ; <nl> <nl> In this example , the array is sorted in the following way : <nl> <nl> - 1 . At first , the source array ( [ ' hello ' , ' world ' ] ) is sorted according to the result of the lambda function applied to the elements of the arrays . The elements that are passed in the second array ( [ 2 , 1 ] ) , define a new position of corresponding elements from the source array . The result is an array [ ' world ' , ' hello ' ] . <nl> + 1 . At first , the source array ( [ ' hello ' , ' world ' ] ) is sorted according to the result of the lambda function applied to the elements of the arrays . The elements that are passed in the second array ( [ 2 , 1 ] ) , define the sorting keys for corresponding elements from the source array . The result is an array [ ' world ' , ' hello ' ] . <nl> 2 . Array that was sorted on the previous step , is reversed . So , the final result is [ ' hello ' , ' world ' ] . <nl> <nl> - Another examples are shown below . <nl> + Other examples are shown below . <nl> <nl> ` ` ` sql <nl> SELECT arrayReverseSort ( ( x , y ) - > y , [ 4 , 3 , 5 ] , [ ' a ' , ' b ' , ' c ' ] ) AS res ; <nl> mmm a / docs / ru / query_language / functions / array_functions . md <nl> ppp b / docs / ru / query_language / functions / array_functions . md <nl> SELECT arraySort ( ( x ) - > - x , [ 1 , 2 , 3 ] ) as res ; <nl> └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Для каждого элемента исходного массива лямбда - функция возвращает " вес " этого элемента — он будет использоваться при сортировке . То есть [ 1 – > - 1 , 2 – > - 2 , 3 – > - 3 ] . Так как элементы сортируются по возрастанию их " веса " , результат будет [ 3 , 2 , 1 ] . <nl> + Для каждого элемента исходного массива лямбда - функция возвращает ключ сортировки , то есть [ 1 – > - 1 , 2 – > - 2 , 3 – > - 3 ] . Так как ` arraySort ` сортирует элементы в порядке возрастания ключей , результат будет [ 3 , 2 , 1 ] . Как можно заметить , функция ` x – > - x ` устанавливает [ обратный порядок сортировки ] ( # array_functions - reverse - sort ) . <nl> <nl> - Лямбда - функция может принимать несколько аргументов . В этом случае , в функцию ` arraySort ` нужно передавать несколько массивов , которые будут соответствовать аргументам лямбда - функции . Обратите внимание , массивы должны быть одинаковой длины . Например : <nl> + Лямбда - функция может принимать несколько аргументов . В этом случае , в функцию ` arraySort ` нужно передавать несколько массивов , которые будут соответствовать аргументам лямбда - функции ( массивы должны быть одинаковой длины ) . Следует иметь в виду , что результат будет содержать элементы только из первого массива ; элементы из всех последующих массивов будут задавать ключи сортировки . Например : <nl> <nl> ` ` ` sql <nl> SELECT arraySort ( ( x , y ) - > y , [ ' hello ' , ' world ' ] , [ 2 , 1 ] ) as res ; <nl> SELECT arraySort ( ( x , y ) - > y , [ ' hello ' , ' world ' ] , [ 2 , 1 ] ) as res ; <nl> └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - Элементы , указанные во втором массиве ( [ 2 , 1 ] ) , определяют позицию соответствующих элементов из исходного массива ( [ ' hello ' , ' world ' ] ) , то есть [ ' hello ' – > 2 , ' world ' – > 1 ] . Таким образом , ' hello ' будет вторым элементом в отсортированном массиве , а ' world ' — первым . <nl> + Элементы , указанные во втором массиве ( [ 2 , 1 ] ) , определяют ключ сортировки для элементов из исходного массива ( [ ' hello ' , ' world ' ] ) , то есть [ ' hello ' – > 2 , ' world ' – > 1 ] . Так как лямбда - функция не использует ` x ` , элементы исходного массива не влияют на порядок сортировки . Таким образом , ' hello ' будет вторым элементом в отсортированном массиве , а ' world ' — первым . <nl> <nl> Ниже приведены другие примеры . <nl> <nl> SELECT arraySort ( ( x , y ) - > - y , [ 0 , 1 , 2 ] , [ 1 , 2 , 3 ] ) as res ; <nl> ` ` ` <nl> <nl> ! ! ! note " Примечание " <nl> - Для улучшения эффективности сортировки применяется [ Преобразование Шварца ] ( https : / / ru . wikipedia . org / wiki / % D0 % 9F % D1 % 80 % D0 % B5 % D0 % BE % D0 % B1 % D1 % 80 % D0 % B0 % D0 % B7 % D0 % BE % D0 % B2 % D0 % B0 % D0 % BD % D0 % B8 % D0 % B5_ % D0 % A8 % D0 % B2 % D0 % B0 % D1 % 80 % D1 % 86 % D0 % B0 ) . <nl> + Для улучшения эффективности сортировки применяется [ преобразование Шварца ] ( https : / / ru . wikipedia . org / wiki / % D0 % 9F % D1 % 80 % D0 % B5 % D0 % BE % D0 % B1 % D1 % 80 % D0 % B0 % D0 % B7 % D0 % BE % D0 % B2 % D0 % B0 % D0 % BD % D0 % B8 % D0 % B5_ % D0 % A8 % D0 % B2 % D0 % B0 % D1 % 80 % D1 % 86 % D0 % B0 ) . <nl> <nl> # # arrayReverseSort ( [ func , ] arr , . . . ) { # array_functions - reverse - sort } <nl> <nl> SELECT arrayReverseSort ( [ 1 , nan , 2 , NULL , 3 , nan , - 4 , NULL , inf , - inf ] ) as res ; <nl> <nl> Функция ` arrayReverseSort ` является [ функцией высшего порядка ] ( higher_order_functions . md ) . Вы можете передать ей в качестве первого аргумента лямбда - функцию . Например : <nl> <nl> + ` ` ` sql <nl> + SELECT arrayReverseSort ( ( x ) - > - x , [ 1 , 2 , 3 ] ) as res ; <nl> + ` ` ` <nl> + ` ` ` <nl> + ┌ ─ res ─ ─ ─ ─ ─ ┐ <nl> + │ [ 1 , 2 , 3 ] │ <nl> + └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> + ` ` ` <nl> + <nl> + В этом примере , порядок сортировки устанавливается следующим образом : <nl> + <nl> + 1 . Сначала исходный массив ( [ 1 , 2 , 3 ] ) сортируется в том порядке , который определяется лямбда - функцией . Результатом будет массив [ 3 , 2 , 1 ] . <nl> + 2 . Массив , который был получен на предыдущем шаге , переворачивается . То есть , получается массив [ 1 , 2 , 3 ] . <nl> + <nl> + Лямбда - функция может принимать на вход несколько аргументов . В этом случае , в функцию ` arrayReverseSort ` нужно передавать несколько массивов , которые будут соответствовать аргументам лямбда - функции ( массивы должны быть одинаковой длины ) . Следует иметь в виду , что результат будет содержать элементы только из первого массива ; элементы из всех последующих массивов будут определять ключи сортировки . Например : <nl> + <nl> ` ` ` sql <nl> SELECT arrayReverseSort ( ( x , y ) - > y , [ ' hello ' , ' world ' ] , [ 2 , 1 ] ) as res ; <nl> ` ` ` <nl> SELECT arrayReverseSort ( ( x , y ) - > y , [ ' hello ' , ' world ' ] , [ 2 , 1 ] ) as res ; <nl> └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> ` ` ` <nl> <nl> - В этом случае , массив сортируется следующим образом : <nl> + В этом примере , массив сортируется следующим образом : <nl> <nl> - 1 . Сначала массив сортируется в том порядке , который определяется лямбда - функцией . Элементы , указанные во втором массиве ( [ 2 , 1 ] ) , определяют позицию соответствующих элементов из исходного массива ( [ ' hello ' , ' world ' ] ) . То есть , промежуточным результатом будет массив [ ' world ' , ' hello ' ] . <nl> + 1 . Сначала массив сортируется в том порядке , который определяется лямбда - функцией . Элементы , указанные во втором массиве ( [ 2 , 1 ] ) , определяют ключи сортировки соответствующих элементов из исходного массива ( [ ' hello ' , ' world ' ] ) . То есть , будет массив [ ' world ' , ' hello ' ] . <nl> 2 . Массив , который был отсортирован на предыдущем шаге , переворачивается . Получается массив [ ' hello ' , ' world ' ] . <nl> <nl> Ниже приведены ещё примеры . <nl>
Review2
ClickHouse/ClickHouse
25fafde574585bdd968065505b5fecb8b0a2c033
2019-04-24T21:08:49Z
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> endif ( ) <nl> list ( APPEND CMAKE_MODULE_PATH <nl> " $ { CMAKE_CURRENT_SOURCE_DIR } / cmake / modules " ) <nl> <nl> + set ( CMAKE_DISABLE_IN_SOURCE_BUILD YES ) <nl> + <nl> if ( DEFINED CMAKE_JOB_POOLS ) <nl> # CMake < 3 . 11 doesn ' t support CMAKE_JOB_POOLS . Manually set the property . <nl> set_property ( GLOBAL PROPERTY JOB_POOLS " $ { CMAKE_JOB_POOLS } " ) <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
1a8e6a0a4a8abb5ffaec198ce42cd13cd1bc6168
2019-10-12T19:49:49Z
mmm a / dbms / src / Storages / StorageFile . cpp <nl> ppp b / dbms / src / Storages / StorageFile . cpp <nl> void StorageFile : : rename ( const String & new_path_to_table_data , const String & n <nl> <nl> void StorageFile : : truncate ( const ASTPtr & / * query * / , const Context & / * context * / , TableStructureWriteLockHolder & ) <nl> { <nl> + / / / NOTE : It will throw exception if the file is not created yet . <nl> + <nl> if ( paths . size ( ) ! = 1 ) <nl> throw Exception ( " Can ' t truncate table ' " + table_name + " ' in readonly mode " , ErrorCodes : : DATABASE_ACCESS_DENIED ) ; <nl> <nl>
Added a comment
ClickHouse/ClickHouse
ba6a56a485f0b6f9511e0b597d047b6f0eeee3b1
2020-01-05T05:45:13Z
mmm a / xbmc / URL . cpp <nl> ppp b / xbmc / URL . cpp <nl> void CURL : : Encode ( CStdString & strURLData ) <nl> for ( int i = 0 ; i < ( int ) strURLData . size ( ) ; + + i ) <nl> { <nl> int kar = ( unsigned char ) strURLData [ i ] ; <nl> - / / if ( kar = = ' ' ) strResult + = ' + ' ; <nl> - if ( isalnum ( kar ) ) strResult + = kar ; <nl> + / / if ( kar = = ' ' ) strResult + = ' + ' ; / / obsolete <nl> + if ( isalnum ( kar ) | | strchr ( " - _ . ! ( ) " , kar ) ) / / Don ' t URL encode these according to RFC1738s <nl> + { <nl> + strResult + = kar ; <nl> + } <nl> else <nl> { <nl> CStdString strTmp ; <nl>
fixed : We should only URL encode characters that should indeed be URL encoded according to RFC1738
xbmc/xbmc
982f4e258f0324b6716ab35de1de9cdfc233e8bb
2012-07-02T17:50:35Z
mmm a / lib / SIL / SILInstruction . cpp <nl> ppp b / lib / SIL / SILInstruction . cpp <nl> namespace { <nl> return true ; <nl> } <nl> <nl> + bool visitRefToRawPointerInst ( RefToRawPointerInst * RHS ) { <nl> + / / We already checked operands and types . <nl> + return true ; <nl> + } <nl> + <nl> private : <nl> const SILInstruction * LHS ; <nl> } ; <nl>
Add RefToRawPointerInst to isIdenticalTo
apple/swift
1aad2faaf57056da5a8d375741e8e1990161f84d
2014-07-09T20:19:41Z
mmm a / THHalf . c <nl> ppp b / THHalf . c <nl> float TH_half2float ( THHalf h ) <nl> } <nl> <nl> int temp = ( ( sign < < 31 ) | ( exponent < < 23 ) | mantissa ) ; <nl> - <nl> - return * ( ( float * ) ( ( void * ) & temp ) ) ; <nl> + float x ; <nl> + memcpy ( & x , & temp , sizeof ( float ) ) ; <nl> + return x ; <nl> } <nl> <nl> THHalf TH_float2half ( float f ) <nl> { <nl> THHalf ret ; <nl> <nl> - unsigned x = * ( ( int * ) ( void * ) ( & f ) ) ; <nl> + unsigned x ; <nl> + memcpy ( & x , & f , sizeof ( f ) ) ; <nl> unsigned u = ( x & 0x7fffffff ) , remainder , shift , lsb , lsb_s1 , lsb_m1 ; <nl> unsigned sign , exponent , mantissa ; <nl> <nl>
Merge pull request from gchanan / convWarning
pytorch/pytorch
e67b525388a5ae11ed243e94bbc25b4934b03a66
2017-01-13T22:06:17Z
mmm a / CONTRIBUTING . md <nl> ppp b / CONTRIBUTING . md <nl> <nl> <nl> # # Contributor License Agreements <nl> <nl> - We ' d love to accept your patches ! Before we can take them , we <nl> - have to jump a couple of legal hurdles . <nl> + We ' d love to accept your patches ! Before we can take them , we have to jump a <nl> + couple of legal hurdles . <nl> <nl> Please fill out either the individual or corporate Contributor License Agreement <nl> ( CLA ) . <nl> <nl> - * If you are an individual writing original source code and you ' re sure you <nl> + * If you are an individual writing original source code and you ' re sure you <nl> own the intellectual property , then you ' ll need to sign an <nl> [ individual CLA ] ( https : / / developers . google . com / open - source / cla / individual ) . <nl> - * If you work for a company that wants to allow you to contribute your work , <nl> + * If you work for a company that wants to allow you to contribute your work , <nl> then you ' ll need to sign a <nl> [ corporate CLA ] ( https : / / developers . google . com / open - source / cla / corporate ) . <nl> <nl> instructions for how to sign and return it . Once we receive it , we ' ll be able to <nl> accept your pull requests . <nl> <nl> # # Are you a Googler ? <nl> - If you are a Googler , plese make an attempt to submit an internal change rather <nl> - than a GitHub Pull Request . If you are not able to submit an internal change <nl> - a PR is acceptable as an alternative . <nl> <nl> + If you are a Googler , plese make an attempt to submit an internal change rather <nl> + than a GitHub Pull Request . If you are not able to submit an internal change a <nl> + PR is acceptable as an alternative . <nl> <nl> # # Contributing A Patch <nl> <nl> - 1 . Submit an issue describing your proposed change to the <nl> - [ issue tracker ] ( https : / / github . com / google / googletest ) . <nl> - 1 . Please don ' t mix more than one logical change per submittal , <nl> - because it makes the history hard to follow . If you want to make a <nl> - change that doesn ' t have a corresponding issue in the issue <nl> - tracker , please create one . <nl> - 1 . Also , coordinate with team members that are listed on the issue in <nl> - question . This ensures that work isn ' t being duplicated and <nl> - communicating your plan early also generally leads to better <nl> - patches . <nl> - 1 . If your proposed change is accepted , and you haven ' t already done so , sign a <nl> - Contributor License Agreement ( see details above ) . <nl> - 1 . Fork the desired repo , develop and test your code changes . <nl> - 1 . Ensure that your code adheres to the existing style in the sample to which <nl> - you are contributing . <nl> - 1 . Ensure that your code has an appropriate set of unit tests which all pass . <nl> - 1 . Submit a pull request . <nl> - <nl> - # # The Google Test and Google Mock Communities # # <nl> + 1 . Submit an issue describing your proposed change to the <nl> + [ issue tracker ] ( https : / / github . com / google / googletest ) . <nl> + 1 . Please don ' t mix more than one logical change per submittal , because it <nl> + makes the history hard to follow . If you want to make a change that doesn ' t <nl> + have a corresponding issue in the issue tracker , please create one . <nl> + 1 . Also , coordinate with team members that are listed on the issue in question . <nl> + This ensures that work isn ' t being duplicated and communicating your plan <nl> + early also generally leads to better patches . <nl> + 1 . If your proposed change is accepted , and you haven ' t already done so , sign a <nl> + Contributor License Agreement ( see details above ) . <nl> + 1 . Fork the desired repo , develop and test your code changes . <nl> + 1 . Ensure that your code adheres to the existing style in the sample to which <nl> + you are contributing . <nl> + 1 . Ensure that your code has an appropriate set of unit tests which all pass . <nl> + 1 . Submit a pull request . <nl> + <nl> + # # The Google Test and Google Mock Communities <nl> <nl> The Google Test community exists primarily through the <nl> - [ discussion group ] ( http : / / groups . google . com / group / googletestframework ) <nl> - and the GitHub repository . <nl> - Likewise , the Google Mock community exists primarily through their own <nl> - [ discussion group ] ( http : / / groups . google . com / group / googlemock ) . <nl> - You are definitely encouraged to contribute to the <nl> - discussion and you can also help us to keep the effectiveness of the <nl> - group high by following and promoting the guidelines listed here . <nl> - <nl> - # # # Please Be Friendly # # # <nl> - <nl> - Showing courtesy and respect to others is a vital part of the Google <nl> - culture , and we strongly encourage everyone participating in Google <nl> - Test development to join us in accepting nothing less . Of course , <nl> - being courteous is not the same as failing to constructively disagree <nl> - with each other , but it does mean that we should be respectful of each <nl> - other when enumerating the 42 technical reasons that a particular <nl> - proposal may not be the best choice . There ' s never a reason to be <nl> - antagonistic or dismissive toward anyone who is sincerely trying to <nl> + [ discussion group ] ( http : / / groups . google . com / group / googletestframework ) and the <nl> + GitHub repository . Likewise , the Google Mock community exists primarily through <nl> + their own [ discussion group ] ( http : / / groups . google . com / group / googlemock ) . You are <nl> + definitely encouraged to contribute to the discussion and you can also help us <nl> + to keep the effectiveness of the group high by following and promoting the <nl> + guidelines listed here . <nl> + <nl> + # # # Please Be Friendly <nl> + <nl> + Showing courtesy and respect to others is a vital part of the Google culture , <nl> + and we strongly encourage everyone participating in Google Test development to <nl> + join us in accepting nothing less . Of course , being courteous is not the same as <nl> + failing to constructively disagree with each other , but it does mean that we <nl> + should be respectful of each other when enumerating the 42 technical reasons <nl> + that a particular proposal may not be the best choice . There ' s never a reason to <nl> + be antagonistic or dismissive toward anyone who is sincerely trying to <nl> contribute to a discussion . <nl> <nl> - Sure , C + + testing is serious business and all that , but it ' s also <nl> - a lot of fun . Let ' s keep it that way . Let ' s strive to be one of the <nl> - friendliest communities in all of open source . <nl> + Sure , C + + testing is serious business and all that , but it ' s also a lot of fun . <nl> + Let ' s keep it that way . Let ' s strive to be one of the friendliest communities in <nl> + all of open source . <nl> <nl> - As always , discuss Google Test in the official GoogleTest discussion group . <nl> - You don ' t have to actually submit code in order to sign up . Your participation <nl> + As always , discuss Google Test in the official GoogleTest discussion group . You <nl> + don ' t have to actually submit code in order to sign up . Your participation <nl> itself is a valuable contribution . <nl> <nl> # # Style <nl> <nl> - To keep the source consistent , readable , diffable and easy to merge , <nl> - we use a fairly rigid coding style , as defined by the [ google - styleguide ] ( https : / / github . com / google / styleguide ) project . All patches will be expected <nl> - to conform to the style outlined [ here ] ( https : / / google . github . io / styleguide / cppguide . html ) . <nl> - Use [ . clang - format ] ( https : / / github . com / google / googletest / blob / master / . clang - format ) to check your formatting <nl> + To keep the source consistent , readable , diffable and easy to merge , we use a <nl> + fairly rigid coding style , as defined by the <nl> + [ google - styleguide ] ( https : / / github . com / google / styleguide ) project . All patches <nl> + will be expected to conform to the style outlined <nl> + [ here ] ( https : / / google . github . io / styleguide / cppguide . html ) . Use <nl> + [ . clang - format ] ( https : / / github . com / google / googletest / blob / master / . clang - format ) <nl> + to check your formatting <nl> <nl> - # # Requirements for Contributors # # # <nl> + # # Requirements for Contributors <nl> <nl> - If you plan to contribute a patch , you need to build Google Test , <nl> - Google Mock , and their own tests from a git checkout , which has <nl> - further requirements : <nl> + If you plan to contribute a patch , you need to build Google Test , Google Mock , <nl> + and their own tests from a git checkout , which has further requirements : <nl> <nl> - * [ Python ] ( https : / / www . python . org / ) v2 . 3 or newer ( for running some of <nl> - the tests and re - generating certain source files from templates ) <nl> - * [ CMake ] ( https : / / cmake . org / ) v2 . 6 . 4 or newer <nl> - * [ GNU Build System ] ( https : / / en . wikipedia . org / wiki / GNU_Build_System ) <nl> - including automake ( > = 1 . 9 ) , autoconf ( > = 2 . 59 ) , and <nl> - libtool / libtoolize . <nl> + * [ Python ] ( https : / / www . python . org / ) v2 . 3 or newer ( for running some of the <nl> + tests and re - generating certain source files from templates ) <nl> + * [ CMake ] ( https : / / cmake . org / ) v2 . 6 . 4 or newer <nl> + * [ GNU Build System ] ( https : / / en . wikipedia . org / wiki / GNU_Build_System ) including <nl> + automake ( > = 1 . 9 ) , autoconf ( > = 2 . 59 ) , and libtool / libtoolize . <nl> <nl> - # # Developing Google Test # # <nl> + # # Developing Google Test <nl> <nl> This section discusses how to make your own changes to Google Test . <nl> <nl> - # # # Testing Google Test Itself # # # <nl> + # # # Testing Google Test Itself <nl> <nl> To make sure your changes work as intended and don ' t break existing <nl> - functionality , you ' ll want to compile and run Google Test ' s own tests . <nl> - For that you can use CMake : <nl> + functionality , you ' ll want to compile and run Google Test ' s own tests . For that <nl> + you can use CMake : <nl> <nl> mkdir mybuild <nl> cd mybuild <nl> cmake - Dgtest_build_tests = ON $ { GTEST_DIR } <nl> <nl> - Make sure you have Python installed , as some of Google Test ' s tests <nl> - are written in Python . If the cmake command complains about not being <nl> - able to find Python ( ` Could NOT find PythonInterp ( missing : <nl> - PYTHON_EXECUTABLE ) ` ) , try telling it explicitly where your Python <nl> - executable can be found : <nl> + Make sure you have Python installed , as some of Google Test ' s tests are written <nl> + in Python . If the cmake command complains about not being able to find Python <nl> + ( ` Could NOT find PythonInterp ( missing : PYTHON_EXECUTABLE ) ` ) , try telling it <nl> + explicitly where your Python executable can be found : <nl> <nl> cmake - DPYTHON_EXECUTABLE = path / to / python - Dgtest_build_tests = ON $ { GTEST_DIR } <nl> <nl> - Next , you can build Google Test and all of its own tests . On \ * nix , <nl> - this is usually done by ' make ' . To run the tests , do <nl> + Next , you can build Google Test and all of its own tests . On \ * nix , this is <nl> + usually done by ' make ' . To run the tests , do <nl> <nl> make test <nl> <nl> All tests should pass . <nl> <nl> - # # # Regenerating Source Files # # <nl> + # # # Regenerating Source Files <nl> <nl> - Some of Google Test ' s source files are generated from templates ( not <nl> - in the C + + sense ) using a script . <nl> - For example , the <nl> - file include / gtest / internal / gtest - type - util . h . pump is used to generate <nl> + Some of Google Test ' s source files are generated from templates ( not in the C + + <nl> + sense ) using a script . For example , the file <nl> + include / gtest / internal / gtest - type - util . h . pump is used to generate <nl> gtest - type - util . h in the same directory . <nl> <nl> - You don ' t need to worry about regenerating the source files <nl> - unless you need to modify them . You would then modify the <nl> - corresponding ` . pump ` files and run the ' [ pump . py ] ( googletest / scripts / pump . py ) ' <nl> - generator script . See the [ Pump Manual ] ( googletest / docs / PumpManual . md ) . <nl> + You don ' t need to worry about regenerating the source files unless you need to <nl> + modify them . You would then modify the corresponding ` . pump ` files and run the <nl> + ' [ pump . py ] ( googletest / scripts / pump . py ) ' generator script . See the <nl> + [ Pump Manual ] ( googletest / g3doc / PumpManual . md ) . <nl> <nl> - # # Developing Google Mock # # # <nl> + # # Developing Google Mock <nl> <nl> This section discusses how to make your own changes to Google Mock . <nl> <nl> - # # # # Testing Google Mock Itself # # # # <nl> + # # # # Testing Google Mock Itself <nl> <nl> To make sure your changes work as intended and don ' t break existing <nl> - functionality , you ' ll want to compile and run Google Test ' s own tests . <nl> - For that you ' ll need Autotools . First , make sure you have followed <nl> - the instructions above to configure Google Mock . <nl> - Then , create a build output directory and enter it . Next , <nl> + functionality , you ' ll want to compile and run Google Test ' s own tests . For that <nl> + you ' ll need Autotools . First , make sure you have followed the instructions above <nl> + to configure Google Mock . Then , create a build output directory and enter it . <nl> + Next , <nl> <nl> $ { GMOCK_DIR } / configure # try - - help for more info <nl> <nl> - Once you have successfully configured Google Mock , the build steps are <nl> - standard for GNU - style OSS packages . <nl> + Once you have successfully configured Google Mock , the build steps are standard <nl> + for GNU - style OSS packages . <nl> <nl> make # Standard makefile following GNU conventions <nl> make check # Builds and runs all tests - all should pass . <nl> <nl> Note that when building your project against Google Mock , you are building <nl> - against Google Test as well . There is no need to configure Google Test <nl> + against Google Test as well . There is no need to configure Google Test <nl> separately . <nl>
Googletest export
google/googletest
0a5efc11e383923402715ff919a2bf41c2afc1d2
2019-07-26T00:53:26Z
mmm a / src / webui / abstractwebapplication . cpp <nl> ppp b / src / webui / abstractwebapplication . cpp <nl> void AbstractWebApplication : : translateDocument ( QString & data ) <nl> " HttpServer " , " confirmDeletionDlg " , " TrackerList " , " TorrentFilesModel " , <nl> " options_imp " , " Preferences " , " TrackersAdditionDlg " , " ScanFoldersModel " , <nl> " PropTabBar " , " TorrentModel " , " downloadFromURL " , " MainWindow " , " misc " , <nl> - " StatusBar " , " AboutDlg " , " about " , " PeerListWidget " <nl> + " StatusBar " , " AboutDlg " , " about " , " PeerListWidget " , " StatusFiltersWidget " <nl> } ; <nl> const size_t context_count = sizeof ( contexts ) / sizeof ( contexts [ 0 ] ) ; <nl> int i = 0 ; <nl> mmm a / src / webui / www / public / filters . html <nl> ppp b / src / webui / www / public / filters . html <nl> <nl> QBT_TR ( Torrents ) QBT_TR <nl> < ul class = " filterList " > <nl> - < li id = " all_filter " > < a href = " # " onclick = " setFilter ( ' all ' ) ; return false ; " > < img src = " images / skin / filterall . png " / > QBT_TR ( All ) QBT_TR < / a > < / li > <nl> - < li id = " downloading_filter " > < a href = " # " onclick = " setFilter ( ' downloading ' ) ; return false ; " > < img src = " images / skin / downloading . png " / > QBT_TR ( Downloading ) QBT_TR < / a > < / li > <nl> - < li id = " seeding_filter " > < a href = " # " onclick = " setFilter ( ' seeding ' ) ; return false ; " > < img src = " images / skin / uploading . png " / > QBT_TR ( Seeding ) QBT_TR < / a > < / li > <nl> - < li id = " completed_filter " > < a href = " # " onclick = " setFilter ( ' completed ' ) ; return false ; " > < img src = " images / skin / completed . png " / > QBT_TR ( Completed ) QBT_TR < / a > < / li > <nl> - < li id = " resumed_filter " > < a href = " # " onclick = " setFilter ( ' resumed ' ) ; return false ; " > < img src = " images / skin / resumed . png " / > QBT_TR ( Resumed ) QBT_TR < / a > < / li > <nl> - < li id = " paused_filter " > < a href = " # " onclick = " setFilter ( ' paused ' ) ; return false ; " > < img src = " images / skin / paused . png " / > QBT_TR ( Paused ) QBT_TR < / a > < / li > <nl> - < li id = " active_filter " > < a href = " # " onclick = " setFilter ( ' active ' ) ; return false ; " > < img src = " images / skin / filteractive . png " / > QBT_TR ( Active ) QBT_TR < / a > < / li > <nl> - < li id = " inactive_filter " > < a href = " # " onclick = " setFilter ( ' inactive ' ) ; return false ; " > < img src = " images / skin / filterinactive . png " / > QBT_TR ( Inactive ) QBT_TR < / a > < / li > <nl> + < li id = " all_filter " > < a href = " # " onclick = " setFilter ( ' all ' ) ; return false ; " > < img src = " images / skin / filterall . png " / > QBT_TR ( All ( 0 ) ) QBT_TR < / a > < / li > <nl> + < li id = " downloading_filter " > < a href = " # " onclick = " setFilter ( ' downloading ' ) ; return false ; " > < img src = " images / skin / downloading . png " / > QBT_TR ( Downloading ( 0 ) ) QBT_TR < / a > < / li > <nl> + < li id = " seeding_filter " > < a href = " # " onclick = " setFilter ( ' seeding ' ) ; return false ; " > < img src = " images / skin / uploading . png " / > QBT_TR ( Seeding ( 0 ) ) QBT_TR < / a > < / li > <nl> + < li id = " completed_filter " > < a href = " # " onclick = " setFilter ( ' completed ' ) ; return false ; " > < img src = " images / skin / completed . png " / > QBT_TR ( Completed ( 0 ) ) QBT_TR < / a > < / li > <nl> + < li id = " resumed_filter " > < a href = " # " onclick = " setFilter ( ' resumed ' ) ; return false ; " > < img src = " images / skin / resumed . png " / > QBT_TR ( Resumed ( 0 ) ) QBT_TR < / a > < / li > <nl> + < li id = " paused_filter " > < a href = " # " onclick = " setFilter ( ' paused ' ) ; return false ; " > < img src = " images / skin / paused . png " / > QBT_TR ( Paused ( 0 ) ) QBT_TR < / a > < / li > <nl> + < li id = " active_filter " > < a href = " # " onclick = " setFilter ( ' active ' ) ; return false ; " > < img src = " images / skin / filteractive . png " / > QBT_TR ( Active ( 0 ) ) QBT_TR < / a > < / li > <nl> + < li id = " inactive_filter " > < a href = " # " onclick = " setFilter ( ' inactive ' ) ; return false ; " > < img src = " images / skin / filterinactive . png " / > QBT_TR ( Inactive ( 0 ) ) QBT_TR < / a > < / li > <nl> + < li id = " errored_filter " > < a href = " # " onclick = " setFilter ( ' errored ' ) ; return false ; " > < img src = " images / skin / error . png " / > QBT_TR ( Errored ( 0 ) ) QBT_TR < / a > < / li > <nl> < / ul > <nl> < br / > <nl> QBT_TR ( Labels ) QBT_TR <nl> mmm a / src / webui / www / public / scripts / client . js <nl> ppp b / src / webui / www / public / scripts / client . js <nl> window . addEvent ( ' load ' , function ( ) { <nl> $ ( " resumed_filter " ) . removeClass ( " selectedFilter " ) ; <nl> $ ( " active_filter " ) . removeClass ( " selectedFilter " ) ; <nl> $ ( " inactive_filter " ) . removeClass ( " selectedFilter " ) ; <nl> + $ ( " errored_filter " ) . removeClass ( " selectedFilter " ) ; <nl> $ ( f + " _filter " ) . addClass ( " selectedFilter " ) ; <nl> selected_filter = f ; <nl> localStorage . setItem ( ' selected_filter ' , f ) ; <nl> window . addEvent ( ' load ' , function ( ) { <nl> } ) ; <nl> } ; <nl> <nl> + var updateFilter = function ( filter , filterTitle ) { <nl> + $ ( filter + ' _filter ' ) . firstChild . childNodes [ 1 ] . nodeValue = filterTitle . replace ( ' % 1 ' , torrentsTable . getFilteredTorrentsNumber ( filter ) ) ; <nl> + } ; <nl> + <nl> + var updateFiltersList = function ( ) { <nl> + updateFilter ( ' all ' , ' QBT_TR ( All ( % 1 ) ) QBT_TR ' ) ; <nl> + updateFilter ( ' downloading ' , ' QBT_TR ( Downloading ( % 1 ) ) QBT_TR ' ) ; <nl> + updateFilter ( ' seeding ' , ' QBT_TR ( Seeding ( % 1 ) ) QBT_TR ' ) ; <nl> + updateFilter ( ' completed ' , ' QBT_TR ( Completed ( % 1 ) ) QBT_TR ' ) ; <nl> + updateFilter ( ' resumed ' , ' QBT_TR ( Resumed ( % 1 ) ) QBT_TR ' ) ; <nl> + updateFilter ( ' paused ' , ' QBT_TR ( Paused ( % 1 ) ) QBT_TR ' ) ; <nl> + updateFilter ( ' active ' , ' QBT_TR ( Active ( % 1 ) ) QBT_TR ' ) ; <nl> + updateFilter ( ' inactive ' , ' QBT_TR ( Inactive ( % 1 ) ) QBT_TR ' ) ; <nl> + updateFilter ( ' errored ' , ' QBT_TR ( Errored ( % 1 ) ) QBT_TR ' ) ; <nl> + } ; <nl> + <nl> var updateLabelList = function ( ) { <nl> var labelList = $ ( ' filterLabelList ' ) ; <nl> if ( ! labelList ) <nl> window . addEvent ( ' load ' , function ( ) { <nl> serverState [ key ] = tmp [ key ] ; <nl> processServerState ( ) ; <nl> } <nl> + updateFiltersList ( ) ; <nl> if ( update_labels ) { <nl> updateLabelList ( ) ; <nl> updateContextMenu ( ) ; <nl> mmm a / src / webui / www / public / scripts / dynamicTable . js <nl> ppp b / src / webui / www / public / scripts / dynamicTable . js <nl> var TorrentsTable = new Class ( { <nl> else if ( state = = " checkingDL " | | state = = " checkingUP " | | <nl> state = = " queuedForChecking " | | state = = " checkingResumeData " ) <nl> state = " checking " ; <nl> - else if ( state = = " unknown " ) <nl> + else if ( state = = " unknown " | | state = = " error " | | state = = " missingFiles " ) <nl> state = " error " ; <nl> <nl> var img_path = ' images / skin / ' + state + ' . png ' ; <nl> var TorrentsTable = new Class ( { <nl> <nl> applyFilter : function ( row , filterName , labelName ) { <nl> var state = row [ ' full_data ' ] . state ; <nl> + var inactive = false ; <nl> + var r ; <nl> + <nl> switch ( filterName ) { <nl> case ' downloading ' : <nl> if ( state ! = ' downloading ' & & ! ~ state . indexOf ( ' DL ' ) ) <nl> var TorrentsTable = new Class ( { <nl> return false ; <nl> break ; <nl> case ' paused ' : <nl> - if ( state ! = ' pausedDL ' ) <nl> + if ( ! ~ state . indexOf ( ' paused ' ) ) <nl> return false ; <nl> break ; <nl> case ' resumed ' : <nl> if ( ~ state . indexOf ( ' paused ' ) ) <nl> return false ; <nl> break ; <nl> + case ' inactive ' : <nl> + inactive = true ; <nl> case ' active ' : <nl> - if ( state ! = ' downloading ' & & state ! = ' forcedDL ' & & state ! = ' uploading ' & & state ! = ' forcedUP ' ) <nl> + if ( state = = ' stalledDL ' ) <nl> + r = ( row [ ' full_data ' ] . upspeed > 0 ) <nl> + else <nl> + r = state = = ' metaDL ' | | state = = ' downloading ' | | state = = ' forcedDL ' | | state = = ' uploading ' | | state = = ' forcedUP ' ; <nl> + if ( r = = inactive ) <nl> return false ; <nl> break ; <nl> - case ' inactive ' : <nl> - if ( state = = ' downloading ' | | state = = ' forcedDL ' | | state = = ' uploading ' | | state = = ' forcedUP ' ) <nl> + case ' errored ' : <nl> + if ( state ! = ' error ' & & state ! = " unknown " & & state ! = " missingFiles " ) <nl> return false ; <nl> break ; <nl> } <nl> var TorrentsTable = new Class ( { <nl> return true ; <nl> } , <nl> <nl> + getFilteredTorrentsNumber : function ( filterName ) { <nl> + var cnt = 0 ; <nl> + var rows = this . rows . getValues ( ) ; <nl> + <nl> + for ( i = 0 ; i < rows . length ; i + + ) <nl> + if ( this . applyFilter ( rows [ i ] , filterName , LABELS_ALL ) ) cnt + + ; <nl> + <nl> + return cnt ; <nl> + } , <nl> + <nl> getFilteredAndSortedRows : function ( ) { <nl> var filteredRows = new Array ( ) ; <nl> <nl>
Merge pull request from buinsky / master
qbittorrent/qBittorrent
719e71264badfa2120e41871985758f6ea348250
2015-12-28T23:23:49Z
mmm a / yarn . lock <nl> ppp b / yarn . lock <nl> <nl> write - file - atomic " ^ 2 . 3 . 0 " <nl> <nl> " @ microsoft / api - documenter @ ^ 7 . 3 . 8 " : <nl> - version " 7 . 8 . 19 " <nl> - resolved " https : / / registry . yarnpkg . com / @ microsoft / api - documenter / - / api - documenter - 7 . 8 . 19 . tgz # 8a0356184c0f4400a211032a5f5c203f2b13ba1c " <nl> - integrity sha512 - pod7Fy / ItMgJFTdq9o4 / YPxl5n2wF + oQCjuRgYG6rAhS + tC / EmW / AwnqZxfLi6Fe8ePNBgUHY / ko6Qlnydx05w = = <nl> + version " 7 . 8 . 21 " <nl> + resolved " https : / / registry . yarnpkg . com / @ microsoft / api - documenter / - / api - documenter - 7 . 8 . 21 . tgz # 96dba0c1b6b7db9c1acae9dd1e32e801cdecb853 " <nl> + integrity sha512 - ffrJEVNykhSVJL8W / fX95GOF8LsG1BjVjp1exGVdmKltrmpDAlFL6WVs24ii1WUY62lcIjMqgBK4F9DszFZ5UQ = = <nl> dependencies : <nl> - " @ microsoft / api - extractor - model " " 7 . 8 . 11 " <nl> + " @ microsoft / api - extractor - model " " 7 . 8 . 12 " <nl> " @ microsoft / tsdoc " " 0 . 12 . 19 " <nl> - " @ rushstack / node - core - library " " 3 . 24 . 4 " <nl> - " @ rushstack / ts - command - line " " 4 . 4 . 5 " <nl> + " @ rushstack / node - core - library " " 3 . 25 . 0 " <nl> + " @ rushstack / ts - command - line " " 4 . 4 . 6 " <nl> colors " ~ 1 . 2 . 1 " <nl> js - yaml " ~ 3 . 13 . 1 " <nl> resolve " ~ 1 . 17 . 0 " <nl> <nl> " @ microsoft / tsdoc " " 0 . 12 . 19 " <nl> " @ rushstack / node - core - library " " 3 . 24 . 4 " <nl> <nl> + " @ microsoft / api - extractor - model @ 7 . 8 . 12 " : <nl> + version " 7 . 8 . 12 " <nl> + resolved " https : / / registry . yarnpkg . com / @ microsoft / api - extractor - model / - / api - extractor - model - 7 . 8 . 12 . tgz # d089193ef29275b8b20802498c6bdfab80dcef59 " <nl> + integrity sha512 - lE9xcNStS2hf5K + ZQy4L9DQ9Xd62bNsMqW + SyPQWXuQ5HJqUBSXJ2yxCWXP / + rcAkFCvZrikbql9M8Z88nKvwQ = = <nl> + dependencies : <nl> + " @ microsoft / tsdoc " " 0 . 12 . 19 " <nl> + " @ rushstack / node - core - library " " 3 . 25 . 0 " <nl> + <nl> " @ microsoft / api - extractor @ ^ 7 . 3 . 8 " : <nl> version " 7 . 8 . 15 " <nl> resolved " https : / / registry . yarnpkg . com / @ microsoft / api - extractor / - / api - extractor - 7 . 8 . 15 . tgz # f5392de83cfd21906e1aed73638d126e3b67a00e " <nl> <nl> timsort " ~ 0 . 3 . 0 " <nl> z - schema " ~ 3 . 18 . 3 " <nl> <nl> + " @ rushstack / node - core - library @ 3 . 25 . 0 " : <nl> + version " 3 . 25 . 0 " <nl> + resolved " https : / / registry . yarnpkg . com / @ rushstack / node - core - library / - / node - core - library - 3 . 25 . 0 . tgz # ba40bc1b188ab5d31f5705999cd2b3b56b8a32cf " <nl> + integrity sha512 - e2NCFtAu / eu14b8nlzRX6ZrE9Sb3J2wVt + pninQmTn / IgfnRLAtM0D4PzUO4 + ktZwF9fCnpqrOGokLzw6RSVNw = = <nl> + dependencies : <nl> + " @ types / node " " 10 . 17 . 13 " <nl> + colors " ~ 1 . 2 . 1 " <nl> + fs - extra " ~ 7 . 0 . 1 " <nl> + jju " ~ 1 . 4 . 0 " <nl> + semver " ~ 7 . 3 . 0 " <nl> + timsort " ~ 0 . 3 . 0 " <nl> + z - schema " ~ 3 . 18 . 3 " <nl> + <nl> " @ rushstack / ts - command - line @ 4 . 4 . 5 " : <nl> version " 4 . 4 . 5 " <nl> resolved " https : / / registry . yarnpkg . com / @ rushstack / ts - command - line / - / ts - command - line - 4 . 4 . 5 . tgz # 924a810177a821571297925dfdd04563d28fe2ab " <nl> <nl> argparse " ~ 1 . 0 . 9 " <nl> colors " ~ 1 . 2 . 1 " <nl> <nl> + " @ rushstack / ts - command - line @ 4 . 4 . 6 " : <nl> + version " 4 . 4 . 6 " <nl> + resolved " https : / / registry . yarnpkg . com / @ rushstack / ts - command - line / - / ts - command - line - 4 . 4 . 6 . tgz # 7818f19e444274e68564a756ef62a2b4e0ced0f8 " <nl> + integrity sha512 - ue3p2m773Yea / s4Ef2Q3gEyLd9T0NDjXCl + PlodGTrJHgxoiRwbROSWHAdYJL / LceGWa6Biqizu9qxUDEWFweQ = = <nl> + dependencies : <nl> + " @ types / argparse " " 1 . 0 . 38 " <nl> + argparse " ~ 1 . 0 . 9 " <nl> + colors " ~ 1 . 2 . 1 " <nl> + <nl> " @ types / argparse @ 1 . 0 . 38 " : <nl> version " 1 . 0 . 38 " <nl> resolved " https : / / registry . yarnpkg . com / @ types / argparse / - / argparse - 1 . 0 . 38 . tgz # a81fd8606d481f873a3800c6ebae4f1d768a56a9 " <nl> semver @ ^ 6 . 0 . 0 , semver @ ^ 6 . 1 . 0 , semver @ ^ 6 . 1 . 1 , semver @ ^ 6 . 1 . 2 , semver @ ^ 6 . 2 . 0 , semve <nl> resolved " https : / / registry . yarnpkg . com / semver / - / semver - 6 . 3 . 0 . tgz # ee0a64c8af5e8ceea67687b133761e1becbd1d3d " <nl> integrity sha512 - b39TBaTSfV6yBrapU89p5fKekE2m / NwnDocOVruQFS1 / veMgdzuPcnOM34M6CwxW8jH / lxEa5rBoDeUwu5HHTw = = <nl> <nl> - semver @ ^ 7 . 1 . 3 , semver @ ^ 7 . 3 . 2 : <nl> + semver @ ^ 7 . 1 . 3 , semver @ ^ 7 . 3 . 2 , semver @ ~ 7 . 3 . 0 : <nl> version " 7 . 3 . 2 " <nl> resolved " https : / / registry . yarnpkg . com / semver / - / semver - 7 . 3 . 2 . tgz # 604962b052b81ed0786aae84389ffba70ffd3938 " <nl> integrity sha512 - OrOb32TeeambH6UrhtShmF7CRDqhL6 / 5XpPNp2DuRH6 + 9QLw / orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ = = <nl>
Bump @ microsoft / api - documenter from 7 . 8 . 19 to 7 . 8 . 21 ( )
microsoft/react-native-windows
c4bf2e894603a47c1e9213a5174c4a662b542d91
2020-07-04T17:46:09Z
mmm a / platform / windows / os_windows . cpp <nl> ppp b / platform / windows / os_windows . cpp <nl> void OS_Windows : : set_mouse_mode ( MouseMode p_mode ) { <nl> POINT pos = { ( int ) center . x , ( int ) center . y } ; <nl> ClientToScreen ( hWnd , & pos ) ; <nl> SetCursorPos ( pos . x , pos . y ) ; <nl> - ShowCursor ( false ) ; <nl> } else { <nl> - ShowCursor ( true ) ; <nl> ReleaseCapture ( ) ; <nl> ClipCursor ( NULL ) ; <nl> } <nl> <nl> + if ( p_mode = = MOUSE_MODE_CAPTURED | | p_mode = = MOUSE_MODE_HIDDEN ) { <nl> + hCursor = SetCursor ( NULL ) ; <nl> + } else { <nl> + SetCursor ( hCursor ) ; <nl> + } <nl> } <nl> <nl> OS_Windows : : MouseMode OS_Windows : : get_mouse_mode ( ) const { <nl>
Fix the hiding of mouse cursor before interaction
godotengine/godot
414d58e6c0ab8d3a75206127fac8e2b80cc67f29
2016-10-20T22:01:28Z
mmm a / src / main . cpp <nl> ppp b / src / main . cpp <nl> bool CheckTransaction ( const CTransaction & tx , CValidationState & state ) <nl> <nl> int64_t GetMinFee ( const CTransaction & tx , unsigned int nBytes , bool fAllowFree , enum GetMinFee_mode mode ) <nl> { <nl> + { <nl> + LOCK ( mempool . cs ) ; <nl> + uint256 hash = tx . GetHash ( ) ; <nl> + double dPriorityDelta = 0 ; <nl> + int64_t nFeeDelta = 0 ; <nl> + mempool . ApplyDeltas ( hash , dPriorityDelta , nFeeDelta ) ; <nl> + if ( dPriorityDelta > 0 | | nFeeDelta > 0 ) <nl> + return 0 ; <nl> + } <nl> + <nl> / / Base fee is either minTxFee or minRelayTxFee <nl> CFeeRate baseFeeRate = ( mode = = GMF_RELAY ) ? tx . minRelayTxFee : tx . minTxFee ; <nl> <nl> mmm a / src / miner . cpp <nl> ppp b / src / miner . cpp <nl> <nl> / / Distributed under the MIT / X11 software license , see the accompanying <nl> / / file COPYING or http : / / www . opensource . org / licenses / mit - license . php . <nl> <nl> + # include < inttypes . h > <nl> + <nl> # include " miner . h " <nl> <nl> # include " core . h " <nl> CBlockTemplate * CreateNewBlock ( const CScript & scriptPubKeyIn ) <nl> unsigned int nTxSize = : : GetSerializeSize ( tx , SER_NETWORK , PROTOCOL_VERSION ) ; <nl> dPriority = tx . ComputePriority ( dPriority , nTxSize ) ; <nl> <nl> + uint256 hash = tx . GetHash ( ) ; <nl> + mempool . ApplyDeltas ( hash , dPriority , nTotalIn ) ; <nl> + <nl> CFeeRate feeRate ( nTotalIn - tx . GetValueOut ( ) , nTxSize ) ; <nl> <nl> if ( porphan ) <nl> CBlockTemplate * CreateNewBlock ( const CScript & scriptPubKeyIn ) <nl> continue ; <nl> <nl> / / Skip free transactions if we ' re past the minimum block size : <nl> - if ( fSortedByFee & & ( feeRate < CTransaction : : minRelayTxFee ) & & ( nBlockSize + nTxSize > = nBlockMinSize ) ) <nl> + const uint256 & hash = tx . GetHash ( ) ; <nl> + double dPriorityDelta = 0 ; <nl> + int64_t nFeeDelta = 0 ; <nl> + mempool . ApplyDeltas ( hash , dPriorityDelta , nFeeDelta ) ; <nl> + if ( fSortedByFee & & ( dPriorityDelta < = 0 ) & & ( nFeeDelta < = 0 ) & & ( feeRate < CTransaction : : minRelayTxFee ) & & ( nBlockSize + nTxSize > = nBlockMinSize ) ) <nl> continue ; <nl> <nl> - / / Prioritize by fee once past the priority size or we run out of high - priority <nl> + / / Prioritise by fee once past the priority size or we run out of high - priority <nl> / / transactions : <nl> if ( ! fSortedByFee & & <nl> ( ( nBlockSize + nTxSize > = nBlockPrioritySize ) | | ! AllowFree ( dPriority ) ) ) <nl> CBlockTemplate * CreateNewBlock ( const CScript & scriptPubKeyIn ) <nl> continue ; <nl> <nl> CTxUndo txundo ; <nl> - const uint256 & hash = tx . GetHash ( ) ; <nl> UpdateCoins ( tx , state , view , txundo , pindexPrev - > nHeight + 1 ) ; <nl> <nl> / / Added <nl> mmm a / src / rpcclient . cpp <nl> ppp b / src / rpcclient . cpp <nl> Array RPCConvertValues ( const std : : string & strMethod , const std : : vector < std : : stri <nl> if ( strMethod = = " listtransactions " & & n > 2 ) ConvertTo < int64_t > ( params [ 2 ] ) ; <nl> if ( strMethod = = " listaccounts " & & n > 0 ) ConvertTo < int64_t > ( params [ 0 ] ) ; <nl> if ( strMethod = = " walletpassphrase " & & n > 1 ) ConvertTo < int64_t > ( params [ 1 ] ) ; <nl> + if ( strMethod = = " prioritisetransaction " & & n > 1 ) ConvertTo < double > ( params [ 1 ] ) ; <nl> + if ( strMethod = = " prioritisetransaction " & & n > 2 ) ConvertTo < int64_t > ( params [ 2 ] ) ; <nl> if ( strMethod = = " getblocktemplate " & & n > 0 ) ConvertTo < Object > ( params [ 0 ] ) ; <nl> if ( strMethod = = " listsinceblock " & & n > 1 ) ConvertTo < int64_t > ( params [ 1 ] ) ; <nl> if ( strMethod = = " sendmany " & & n > 1 ) ConvertTo < Object > ( params [ 1 ] ) ; <nl> mmm a / src / rpcmining . cpp <nl> ppp b / src / rpcmining . cpp <nl> Value getmininginfo ( const Array & params , bool fHelp ) <nl> } <nl> <nl> <nl> + Value prioritisetransaction ( const Array & params , bool fHelp ) <nl> + { <nl> + if ( fHelp | | params . size ( ) ! = 3 ) <nl> + throw runtime_error ( <nl> + " prioritisetransaction < txid > < priority delta > < fee delta > \ n " <nl> + " Accepts the transaction into mined blocks at a higher ( or lower ) priority " ) ; <nl> + <nl> + uint256 hash ; <nl> + hash . SetHex ( params [ 0 ] . get_str ( ) ) ; <nl> + mempool . PrioritiseTransaction ( hash , params [ 0 ] . get_str ( ) , params [ 1 ] . get_real ( ) , params [ 2 ] . get_int64 ( ) ) ; <nl> + return true ; <nl> + } <nl> + <nl> + <nl> Value getblocktemplate ( const Array & params , bool fHelp ) <nl> { <nl> if ( fHelp | | params . size ( ) > 1 ) <nl> mmm a / src / rpcserver . cpp <nl> ppp b / src / rpcserver . cpp <nl> static const CRPCCommand vRPCCommands [ ] = <nl> { " getblocktemplate " , & getblocktemplate , true , false , false } , <nl> { " getmininginfo " , & getmininginfo , true , false , false } , <nl> { " getnetworkhashps " , & getnetworkhashps , true , false , false } , <nl> + { " prioritisetransaction " , & prioritisetransaction , true , false , false } , <nl> { " submitblock " , & submitblock , false , true , false } , <nl> <nl> / * Raw transactions * / <nl> mmm a / src / rpcserver . h <nl> ppp b / src / rpcserver . h <nl> extern json_spirit : : Value setgenerate ( const json_spirit : : Array & params , bool fHe <nl> extern json_spirit : : Value getnetworkhashps ( const json_spirit : : Array & params , bool fHelp ) ; <nl> extern json_spirit : : Value gethashespersec ( const json_spirit : : Array & params , bool fHelp ) ; <nl> extern json_spirit : : Value getmininginfo ( const json_spirit : : Array & params , bool fHelp ) ; <nl> + extern json_spirit : : Value prioritisetransaction ( const json_spirit : : Array & params , bool fHelp ) ; <nl> extern json_spirit : : Value getblocktemplate ( const json_spirit : : Array & params , bool fHelp ) ; <nl> extern json_spirit : : Value submitblock ( const json_spirit : : Array & params , bool fHelp ) ; <nl> extern json_spirit : : Value estimatefee ( const json_spirit : : Array & params , bool fHelp ) ; <nl> mmm a / src / txmempool . cpp <nl> ppp b / src / txmempool . cpp <nl> void CTxMemPool : : removeForBlock ( const std : : vector < CTransaction > & vtx , unsigned i <nl> std : : list < CTransaction > dummy ; <nl> remove ( tx , dummy , false ) ; <nl> removeConflicts ( tx , conflicts ) ; <nl> + ClearPrioritisation ( tx . GetHash ( ) ) ; <nl> } <nl> } <nl> <nl> CTxMemPool : : ReadFeeEstimates ( CAutoFile & filein ) <nl> return true ; <nl> } <nl> <nl> + void CTxMemPool : : PrioritiseTransaction ( const uint256 hash , const string strHash , double dPriorityDelta , int64_t nFeeDelta ) <nl> + { <nl> + { <nl> + LOCK ( cs ) ; <nl> + std : : pair < double , int64_t > & deltas = mapDeltas [ hash ] ; <nl> + deltas . first + = dPriorityDelta ; <nl> + deltas . second + = nFeeDelta ; <nl> + } <nl> + LogPrintf ( " PrioritiseTransaction : % s priority + = % f , fee + = % d \ n " , strHash . c_str ( ) , dPriorityDelta , nFeeDelta ) ; <nl> + } <nl> + <nl> + void CTxMemPool : : ApplyDeltas ( const uint256 hash , double & dPriorityDelta , int64_t & nFeeDelta ) <nl> + { <nl> + LOCK ( cs ) ; <nl> + std : : map < uint256 , std : : pair < double , int64_t > > : : iterator pos = mapDeltas . find ( hash ) ; <nl> + if ( pos = = mapDeltas . end ( ) ) <nl> + return ; <nl> + const std : : pair < double , int64_t > & deltas = pos - > second ; <nl> + dPriorityDelta + = deltas . first ; <nl> + nFeeDelta + = deltas . second ; <nl> + } <nl> + <nl> + void CTxMemPool : : ClearPrioritisation ( const uint256 hash ) <nl> + { <nl> + LOCK ( cs ) ; <nl> + mapDeltas . erase ( hash ) ; <nl> + } <nl> + <nl> <nl> CCoinsViewMemPool : : CCoinsViewMemPool ( CCoinsView & baseIn , CTxMemPool & mempoolIn ) : CCoinsViewBacked ( baseIn ) , mempool ( mempoolIn ) { } <nl> <nl> mmm a / src / txmempool . h <nl> ppp b / src / txmempool . h <nl> class CTxMemPool <nl> mutable CCriticalSection cs ; <nl> std : : map < uint256 , CTxMemPoolEntry > mapTx ; <nl> std : : map < COutPoint , CInPoint > mapNextTx ; <nl> + std : : map < uint256 , std : : pair < double , int64_t > > mapDeltas ; <nl> <nl> CTxMemPool ( ) ; <nl> ~ CTxMemPool ( ) ; <nl> class CTxMemPool <nl> unsigned int GetTransactionsUpdated ( ) const ; <nl> void AddTransactionsUpdated ( unsigned int n ) ; <nl> <nl> + / * * Affect CreateNewBlock prioritisation of transactions * / <nl> + void PrioritiseTransaction ( const uint256 hash , const std : : string strHash , double dPriorityDelta , int64_t nFeeDelta ) ; <nl> + void ApplyDeltas ( const uint256 hash , double & dPriorityDelta , int64_t & nFeeDelta ) ; <nl> + void ClearPrioritisation ( const uint256 hash ) ; <nl> + <nl> unsigned long size ( ) <nl> { <nl> LOCK ( cs ) ; <nl>
Merge pull request
bitcoin/bitcoin
ffb32acfab33a58c32e0249a22dd56e39c82d417
2014-06-26T14:20:01Z
mmm a / src / hydrogen - instructions . cc <nl> ppp b / src / hydrogen - instructions . cc <nl> HCheckMaps * HCheckMaps : : New ( Zone * zone , <nl> check_map - > Add ( map , zone ) ; <nl> if ( map - > CanOmitMapChecks ( ) & & <nl> value - > IsConstant ( ) & & <nl> - HConstant : : cast ( value ) - > InstanceOf ( map ) ) { <nl> + HConstant : : cast ( value ) - > HasMap ( map ) ) { <nl> check_map - > omit ( info ) ; <nl> } <nl> return check_map ; <nl> mmm a / src / hydrogen - instructions . h <nl> ppp b / src / hydrogen - instructions . h <nl> class HCheckMaps V8_FINAL : public HTemplateInstruction < 2 > { <nl> omit_ = true ; <nl> for ( int i = 0 ; i < map_set_ . length ( ) ; i + + ) { <nl> Handle < Map > map = map_set_ . at ( i ) ; <nl> + if ( ! map - > CanTransition ( ) ) continue ; <nl> map - > AddDependentCompilationInfo ( DependentCode : : kPrototypeCheckGroup , <nl> info ) ; <nl> } <nl> class HConstant V8_FINAL : public HTemplateInstruction < 0 > { <nl> return handle_ ; <nl> } <nl> <nl> - bool InstanceOf ( Handle < Map > map ) { <nl> + bool HasMap ( Handle < Map > map ) { <nl> Handle < Object > constant_object = handle ( ) ; <nl> - return constant_object - > IsJSObject ( ) & & <nl> - Handle < JSObject > : : cast ( constant_object ) - > map ( ) = = * map ; <nl> + return constant_object - > IsHeapObject ( ) & & <nl> + Handle < HeapObject > : : cast ( constant_object ) - > map ( ) = = * map ; <nl> } <nl> <nl> bool IsSpecialDouble ( ) const { <nl>
Make HConstant : : InstanceOf less ambiguous .
v8/v8
a8e5b658fc2a1498da4757495fa4a25e9a1a63a1
2013-08-22T14:22:55Z
mmm a / googlemock / docs / CookBook . md <nl> ppp b / googlemock / docs / CookBook . md <nl> Note that the mock class doesn ' t define ` AppendPacket ( ) ` , unlike the <nl> real class . That ' s fine as long as the test doesn ' t need to call it . <nl> <nl> Next , you need a way to say that you want to use <nl> - ` ConcretePacketStream ` in production code , and use ` MockPacketStream ` <nl> + ` ConcretePacketStream ` in production code and to use ` MockPacketStream ` <nl> in tests . Since the functions are not virtual and the two classes are <nl> unrelated , you must specify your choice at _compile time_ ( as opposed <nl> to run time ) . <nl>
remove Yob ' s comma mentioned in issue
google/googletest
29c07aa9dbeb622a6f8f0d1d07c9f139e18b5dca
2017-08-29T19:19:45Z
mmm a / project / Win32BuildSetup / readme . txt <nl> ppp b / project / Win32BuildSetup / readme . txt <nl> <nl> Prerequisites for building an XBMC for Windows installer : <nl> <nl> - 1 ) A working Visual C + + 2008 Express XBMC environment ( See also http : / / wiki . xbmc . org / ? title = HOW - TO_compile_XBMC_for_Windows_from_source_code # Compiling_XBMC_using_Visual_C . 2B . 2B_2008_Express_Edition ) <nl> + 1 ) A working Visual C + + 2010 Express XBMC environment ( See also http : / / wiki . xbmc . org / index . php ? title = How - to : Compile_XBMC_for_Windows ) <nl> 2 ) Nullsoft sciptable install system ( http : / / nsis . sourceforge . net / Download ) <nl> + 3 ) DirectX SDK dated August 2009 or later ( latest installer here : http : / / www . microsoft . com / downloads / en / details . aspx ? displaylang = en & FamilyID = 3021d52b - 514e - 41d3 - ad02 - 438a3ba730ba ) <nl> + 4 ) Java Runtime Environment ( download here : http : / / www . oracle . com / technetwork / java / javase / downloads / index . html ) <nl> + 5 ) Java Runtime Environment added to PATH ( see here : http : / / www . java . com / en / download / help / path . xml ) <nl> <nl> <nl> Usage : <nl>
Merge pull request from mad - max / build_readme
xbmc/xbmc
1bb378c9e91db06a36f593b1077ee04831f157e9
2012-10-15T13:34:19Z
mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> v8_source_set ( " v8_initializers " ) { <nl> " src / builtins / builtins - promise - gen . h " , <nl> " src / builtins / builtins - proxy - gen . cc " , <nl> " src / builtins / builtins - proxy - gen . h " , <nl> - " src / builtins / builtins - reflect - gen . cc " , <nl> " src / builtins / builtins - regexp - gen . cc " , <nl> " src / builtins / builtins - regexp - gen . h " , <nl> " src / builtins / builtins - sharedarraybuffer - gen . cc " , <nl> mmm a / src / builtins / builtins - definitions . h <nl> ppp b / src / builtins / builtins - definitions . h <nl> namespace internal { <nl> ASM ( ReflectConstruct , Dummy ) \ <nl> CPP ( ReflectDefineProperty ) \ <nl> CPP ( ReflectGetOwnPropertyDescriptor ) \ <nl> - TFJ ( ReflectHas , 2 , kReceiver , kTarget , kKey ) \ <nl> CPP ( ReflectOwnKeys ) \ <nl> CPP ( ReflectSet ) \ <nl> \ <nl> deleted file mode 100644 <nl> index 6cffd6ed55b . . 00000000000 <nl> mmm a / src / builtins / builtins - reflect - gen . cc <nl> ppp / dev / null <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 / builtins / builtins - utils - gen . h " <nl> - # include " src / builtins / builtins . h " <nl> - # include " src / codegen / code - stub - assembler . h " <nl> - <nl> - namespace v8 { <nl> - namespace internal { <nl> - <nl> - / / ES section # sec - reflect . has <nl> - TF_BUILTIN ( ReflectHas , CodeStubAssembler ) { <nl> - TNode < Object > target = CAST ( Parameter ( Descriptor : : kTarget ) ) ; <nl> - TNode < Object > key = CAST ( Parameter ( Descriptor : : kKey ) ) ; <nl> - TNode < Context > context = CAST ( Parameter ( Descriptor : : kContext ) ) ; <nl> - <nl> - ThrowIfNotJSReceiver ( context , target , MessageTemplate : : kCalledOnNonObject , <nl> - " Reflect . has " ) ; <nl> - <nl> - Return ( CallBuiltin ( Builtins : : kHasProperty , context , target , key ) ) ; <nl> - } <nl> - <nl> - } / / namespace internal <nl> - } / / namespace v8 <nl> mmm a / src / builtins / reflect . tq <nl> ppp b / src / builtins / reflect . tq <nl> namespace reflect { <nl> otherwise ThrowTypeError ( kCalledOnNonObject , ' Reflect . deleteProperty ' ) ; <nl> return DeleteProperty ( objectJSReceiver , key , kSloppy ) ; <nl> } <nl> + <nl> + / / ES section # sec - reflect . has <nl> + transitioning javascript builtin <nl> + ReflectHas ( js - implicit context : Context ) ( object : JSAny , key : JSAny ) : JSAny { <nl> + const objectJSReceiver = Cast < JSReceiver > ( object ) <nl> + otherwise ThrowTypeError ( kCalledOnNonObject , ' Reflect . has ' ) ; <nl> + return HasProperty ( objectJSReceiver , key ) ; <nl> + } <nl> } / / namespace reflect <nl>
[ Torque ] port Reflect . has to Torque
v8/v8
adb97b35a307e96d8fb19ea10fbb4713bcf0f553
2019-10-17T06:00:15Z
mmm a / xbmc / cores / paplayer / CodecFactory . cpp <nl> ppp b / xbmc / cores / paplayer / CodecFactory . cpp <nl> ICodec * CodecFactory : : CreateCodec ( const std : : string & strFileType ) <nl> for ( size_t i = 0 ; i < codecs . size ( ) ; + + i ) <nl> { <nl> std : : shared_ptr < CAudioDecoder > dec ( std : : static_pointer_cast < CAudioDecoder > ( codecs [ i ] ) ) ; <nl> - if ( dec - > GetExtensions ( ) . find ( " . " + fileType ) ! = std : : string : : npos ) <nl> + std : : vector < std : : string > exts = StringUtils : : Split ( dec - > GetExtensions ( ) , " | " ) ; <nl> + if ( std : : find ( exts . begin ( ) , exts . end ( ) , " . " + fileType ) ! = exts . end ( ) ) <nl> { <nl> CAudioDecoder * result = new CAudioDecoder ( * dec ) ; <nl> static_cast < AudioDecoderDll & > ( * result ) . Create ( ) ; <nl> ICodec * CodecFactory : : CreateCodecDemux ( const std : : string & strFile , const std : : st <nl> for ( size_t i = 0 ; i < codecs . size ( ) ; + + i ) <nl> { <nl> std : : shared_ptr < CAudioDecoder > dec ( std : : static_pointer_cast < CAudioDecoder > ( codecs [ i ] ) ) ; <nl> - if ( dec - > GetMimetypes ( ) . find ( content ) ! = std : : string : : npos ) <nl> + std : : vector < std : : string > mime = StringUtils : : Split ( dec - > GetMimetypes ( ) , " | " ) ; <nl> + if ( std : : find ( mime . begin ( ) , mime . end ( ) , content ) ! = mime . end ( ) ) <nl> { <nl> CAudioDecoder * result = new CAudioDecoder ( * dec ) ; <nl> static_cast < AudioDecoderDll & > ( * result ) . Create ( ) ; <nl>
fixed : make sure we don ' t match a substring of an extension or a mime type
xbmc/xbmc
e66a2d1573de0bcb39c148744c3f3541782443ea
2015-05-06T16:44:14Z
mmm a / vnext / docs / GettingStarted . md <nl> ppp b / vnext / docs / GettingStarted . md <nl> <nl> - # Getting Started Guide for React Native Windows C + + <nl> + # Getting Started Guide for React Native Windows ( vnext ) <nl> <nl> - This is a summary of setup steps needed to install and work with React Native for Windows10 ( C + + ) . See the [ React Native Getting Started Guide ] ( http : / / facebook . github . io / react - native / docs / getting - started . html ) for React Native details . <nl> + This is a summary of setup steps needed to install and work with React Native for Windows ( vnext ) . See the [ React Native Getting Started Guide ] ( http : / / facebook . github . io / react - native / docs / getting - started . html ) for React Native details and see [ Getting Started Guide - current ] ( https : / / github . com / microsoft / react - native - windows / blob / master / current / docs / GettingStarted . md ) for working with the ` current ` React Native for Windows implementation . <nl> <nl> # # System requirements <nl> - * You can run React - Native for Windows10 apps only on Windows 10 devices ; sdk version : 10 . 0 . 14393 . 795 or higher . <nl> + * You can run React - Native for Windows10 apps only on Windows 10 devices and Windows version : 10 . 0 . 16299 . 0 or higher . <nl> * [ Visual Studio 2017 ] ( https : / / www . visualstudio . com / downloads ) with the following options : <nl> * Workloads <nl> * Universal Windows Platform development <nl> This is a summary of setup steps needed to install and work with React Native fo <nl> * Development activities <nl> * Node . js development support <nl> * SDKs , libraries , and frameworks <nl> - * Windows 10 SDK ( 10 . 0 . 14393 . 0 ) <nl> + * Windows 10 SDK ( 10 . 0 . 16299 . 0 ) <nl> * Windows 10 SDK ( 10 . 0 . 17763 . 0 ) <nl> <nl> # # Dependencies <nl> choco install nodejs <nl> ` ` ` <nl> * Install [ Chrome ] ( https : / / www . google . com / chrome / ) ( * optional * , but needed for JS debugging ) <nl> <nl> - # # Installing React Native <nl> + # # Installing React Native for Windows ( vnext ) <nl> + There are two ways to install and work with React Native for Windows ( vnext ) : <nl> + 1 . [ Simple ] ( # simple - install - method ) : Using our simple CLI that does all of the work for you behind the scenes . <nl> + 2 . [ Advanced ] ( # advanced - install - method ) : Manually by cloning the repo and running all install steps yourself . <nl> + <nl> + # # # 1 . Simple install method <nl> + <nl> + # # # # Installing React Native <nl> <nl> * Install React Native command line interface using NPM : <nl> ` ` ` <nl> Navigate into this newly created directory : <nl> cd < project name > <nl> ` ` ` <nl> <nl> - # # Installing React Native Windows C + + <nl> + # # # # Installing React Native Windows ( vnext ) <nl> <nl> * Install the React Native Windows command line interface ( [ rnpm - plugin - windows ] ( https : / / www . npmjs . com / package / rnpm - plugin - windows ) ) . <nl> If you are using NPM , run <nl> If you are using Yarn , run <nl> yarn add rnpm - plugin - windows <nl> ` ` ` <nl> <nl> - * Next , initialize your React Native Windows C + + project in the project directory by running : <nl> + * Next , initialize your React Native Windows ` vnext ` in the project directory . This step may take a while during first run due to dependency download . <nl> ` ` ` <nl> react - native windows - - template vnext <nl> ` ` ` <nl> <nl> - # # Running a React Native Windows App <nl> + # # # # Running a React Native Windows App <nl> <nl> * Note : Make sure Chrome is launched and running before running a React Native Windows app . * <nl> <nl> - # # # Without Visual Studio <nl> + - Without Visual Studio <nl> <nl> In your React Native Windows project directory , run : <nl> ` ` ` <nl> react - native run - windows <nl> ` ` ` <nl> - A new Command Prompt window will open with the React packager as well as a React Native Windows app . You can now start developing ! : tada : <nl> + A new Command Prompt window will open with the React packager as well as a ` react - native - windows ` app . This step may take a while during first run since it involves building the entire project and all dependencies . You can now start developing ! : tada : <nl> + <nl> + - With Visual Studio <nl> + <nl> + - Open the solution file in the application folder in Visual Studio ( e . g . , ` AwesomeProject / windows / AwesomeProject . sln ` ) <nl> + - Select the ` Debug ` configuration and the ` x64 ` platform from the combo box controls to the left of the ` Run ` button and underneath the ` Team ` and ` Tools ` menu item . <nl> + - Run ` yarn start ` from your project directory , and wait for the React Native packager to report success . <nl> + - Click the ` Run ` button to the right of the platform combo box control in VS , or select the ` Debug ` - > ` Start without Debugging ` menu item . You now see your new app and Chrome should have loaded ` http : / / localhost : 8081 / debugger - ui / ` in a new tab . Press ` F12 ` or ` Ctrl + Shift + I ` in Chrome to open its Developer Tools . : tada : <nl> + <nl> + <nl> + # # # 2 . Advanced install method <nl> + <nl> + - Make sure you have installed [ dependencies ] ( # dependencies ) <nl> + - Install [ Git ] ( https : / / git - scm . com / download / win ) if you don ' t have it installed in your development machine <nl> + <nl> + # # # # Build Steps <nl> + * Clone the repo <nl> + ` ` ` cmd <nl> + git clone https : / / github . com / Microsoft / react - native - windows . git <nl> + cd react - native - windows <nl> + ` ` ` <nl> + <nl> + * Install dependencies . This step may take a while on the first run due to dependency download . <nl> + ` ` ` cmd <nl> + cd vnext <nl> + npm install <nl> + ` ` ` <nl> + <nl> + * Run ` npm run build ` in the vnext folder . <nl> + <nl> + * Run ` Scripts \ launchPackager . bat ` . This is needed to ensure the JS files can be packaged and bundled to the UWP app . <nl> + <nl> + * Make sure Chrome is running if you ' re not already running it <nl> + <nl> + # # # # Running the Playground app <nl> + * Nuget restore through the command line . There is an outstanding issue [ # 2312 ] ( https : / / github . com / microsoft / react - native - windows / issues / 2312 ) that blocks restoring Nuget dependencies using VS . <nl> + ` ` ` cmd <nl> + cd Playground <nl> + . . \ react - native - windows \ vnext \ Playground > nuget restore Playground . sln - PackagesDirectory packages <nl> + ` ` ` <nl> + <nl> + * Build solution . <nl> + * Using MSBuild <nl> + ` ` ` cmd <nl> + MSBuild . exe [ / p : Platform = $ ( TargetPlatform ) ] [ / p : Configuration = $ ( TargetConfiguration ) ] <nl> + ` ` ` <nl> + <nl> + * Using Visual Studio IDE <nl> + 1 . Open ` Playground . sln ` . <nl> + 2 . Set your ` Platform ` to ` x86 ` or ` x64 ` and ` Configuration ` to ` Debug ` . <nl> + 3 . Select ` Project / Build Solution ( Ctrl + Shift + B ) ` <nl> + <nl> + * In Visual Studio , set Playground as the StartUp Project . <nl> + <nl> + * Run project ( ` F5 ` or ` Debug / Start Debugging ` ) . <nl> + <nl> + You now see your new app and Chrome should have loaded ` http : / / localhost : 8081 / debugger - ui / ` in a new tab . Press ` F12 ` or ` Ctrl + Shift + I ` in Chrome to open its Developer Tools . : tada : <nl> + <nl> + # # # # Running the Sample Universal Windows App <nl> + * Build solution . <nl> + * Using MSBuild <nl> + ` ` ` cmd <nl> + MSBuild . exe [ / p : Platform = $ ( TargetPlatform ) ] [ / p : Configuration = $ ( TargetConfiguration ) ] <nl> + ` ` ` <nl> + <nl> + * Using Visual Studio IDE <nl> + 1 . Open ` ReactWindows - UWP . sln ` . <nl> + 2 . Set your ` Platform ` to ` x86 ` or ` x64 ` and ` Configuration ` to ` Debug ` . <nl> + 3 . Select ` Project / Build Solution ( Ctrl + Shift + B ) ` <nl> + <nl> + <nl> + * In Visual Studio , set React . Windows . Universal . SampleApp as the StartUp Project . <nl> + <nl> + * If you didn ' t already , make sure to set your ` Platform ` to ` x86 ` or ` x64 ` and ` Configuration ` to ` Debug ` . <nl> + <nl> + * Run project ( ` F5 ` or ` Debug / Start Debugging ` ) . <nl> <nl> - # # # With Visual Studio <nl> + * Press the " Load " button on the left side of the Windows 10 application window that appears . <nl> <nl> - - Open the solution file in the application folder in Visual Studio ( e . g . , ` AwesomeProject / windows / AwesomeProject . sln ` ) <nl> - - Select the ` Debug ` configuration and the ` x64 ` platform from the combo box controls to the left of the ` Run ` button and underneath the ` Team ` and ` Tools ` menu item . <nl> - - Run ` yarn start ` from your project directory , and wait for the React Native packager to report success . <nl> - - Click the ` Run ` button to the right of the platform combo box control in VS , or select the ` Debug ` - > ` Start without Debugging ` menu item . You now see your new app ! : tada : <nl> + The selected React Native component ( defaulted to ` Bootstrap ` ) should get loaded in the bottom of the application window . Chrome should have loaded ` http : / / localhost : 8081 / debugger - ui / ` in a new tab . Press ` F12 ` or ` Ctrl + Shift + I ` in Chrome to open its Developer Tools . : tada : <nl> <nl> + Try these samples by entering the JS file name and App names below into the textboxes at the top of the application window before pressing " Load " : <nl> + - Sample : JavaScript file : ` Universal . SampleApp \ index . uwp ` App Name : ` Bootstrap ` <nl> + - RNTester : JavaScript file : ` lib \ RNTester \ RNTesterApp . uwp ` App Name : ` RNTesterApp ` <nl> + <nl> # # Troubleshooting <nl> - * Use VS 2017 . Issue [ # 2320 ] ( https : / / github . com / Microsoft / react - native - windows / issues / 2320 ) tracks support for CLI with VS 2019 . <nl> + * Use VS 2017 when using the CLI . Issue [ # 2320 ] ( https : / / github . com / Microsoft / react - native - windows / issues / 2320 ) tracks support for CLI with VS 2019 . <nl> * If after running the app the packager does not update ( or ) app does not show React Native content - close the packager command prompt window and the app , run ` yarn start ` and run the app again . Issue [ # 2311 ] ( https : / / github . com / Microsoft / react - native - windows / issues / 2311 ) is tracking a known issue on this . <nl> + * If you get a red error box in your UWP app window with the error message : ` ERROR : Instance failed to start . A connection with the server cannot be established ` , make sure you have the packager running using ` yarn start ` and run the app again . <nl>
Updating Getting Started ( vnext ) ( )
microsoft/react-native-windows
df3907d0823bf0230f42f38a297bdb00117b91cd
2019-05-08T00:09:14Z
mmm a / src / citra_qt / CMakeLists . txt <nl> ppp b / src / citra_qt / CMakeLists . txt <nl> set ( SRCS <nl> configuration / configure_graphics . cpp <nl> configuration / configure_input . cpp <nl> configuration / configure_system . cpp <nl> - debugger / callstack . cpp <nl> - debugger / disassembler . cpp <nl> debugger / graphics / graphics . cpp <nl> debugger / graphics / graphics_breakpoint_observer . cpp <nl> debugger / graphics / graphics_breakpoints . cpp <nl> set ( HEADERS <nl> configuration / configure_graphics . h <nl> configuration / configure_input . h <nl> configuration / configure_system . h <nl> - debugger / callstack . h <nl> - debugger / disassembler . h <nl> debugger / graphics / graphics . h <nl> debugger / graphics / graphics_breakpoint_observer . h <nl> debugger / graphics / graphics_breakpoints . h <nl> set ( UIS <nl> configuration / configure_graphics . ui <nl> configuration / configure_input . ui <nl> configuration / configure_system . ui <nl> - debugger / callstack . ui <nl> - debugger / disassembler . ui <nl> debugger / registers . ui <nl> hotkeys . ui <nl> main . ui <nl> deleted file mode 100644 <nl> index 08d2e7a229a . . 00000000000 <nl> mmm a / src / citra_qt / debugger / callstack . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2014 Citra Emulator Project <nl> - / / Licensed under GPLv2 or any later version <nl> - / / Refer to the license . txt file included . <nl> - <nl> - # include < QStandardItemModel > <nl> - # include " citra_qt / debugger / callstack . h " <nl> - # include " common / common_types . h " <nl> - # include " common / symbols . h " <nl> - # include " core / arm / arm_interface . h " <nl> - # include " core / arm / disassembler / arm_disasm . h " <nl> - # include " core / core . h " <nl> - # include " core / memory . h " <nl> - <nl> - CallstackWidget : : CallstackWidget ( QWidget * parent ) : QDockWidget ( parent ) { <nl> - ui . setupUi ( this ) ; <nl> - <nl> - callstack_model = new QStandardItemModel ( this ) ; <nl> - callstack_model - > setColumnCount ( 4 ) ; <nl> - callstack_model - > setHeaderData ( 0 , Qt : : Horizontal , " Stack Pointer " ) ; <nl> - callstack_model - > setHeaderData ( 2 , Qt : : Horizontal , " Return Address " ) ; <nl> - callstack_model - > setHeaderData ( 1 , Qt : : Horizontal , " Call Address " ) ; <nl> - callstack_model - > setHeaderData ( 3 , Qt : : Horizontal , " Function " ) ; <nl> - ui . treeView - > setModel ( callstack_model ) ; <nl> - } <nl> - <nl> - void CallstackWidget : : OnDebugModeEntered ( ) { <nl> - / / Stack pointer <nl> - const u32 sp = Core : : CPU ( ) . GetReg ( 13 ) ; <nl> - <nl> - Clear ( ) ; <nl> - <nl> - int counter = 0 ; <nl> - for ( u32 addr = 0x10000000 ; addr > = sp ; addr - = 4 ) { <nl> - if ( ! Memory : : IsValidVirtualAddress ( addr ) ) <nl> - break ; <nl> - <nl> - const u32 ret_addr = Memory : : Read32 ( addr ) ; <nl> - const u32 call_addr = ret_addr - 4 ; / / get call address ? ? ? <nl> - <nl> - if ( ! Memory : : IsValidVirtualAddress ( call_addr ) ) <nl> - break ; <nl> - <nl> - / * TODO ( mattvail ) clean me , move to debugger interface * / <nl> - u32 insn = Memory : : Read32 ( call_addr ) ; <nl> - if ( ARM_Disasm : : Decode ( insn ) = = OP_BL ) { <nl> - std : : string name ; <nl> - / / ripped from disasm <nl> - u32 i_offset = insn & 0xffffff ; <nl> - / / Sign - extend the 24 - bit offset <nl> - if ( ( i_offset > > 23 ) & 1 ) <nl> - i_offset | = 0xff000000 ; <nl> - <nl> - / / Pre - compute the left - shift and the prefetch offset <nl> - i_offset < < = 2 ; <nl> - i_offset + = 8 ; <nl> - const u32 func_addr = call_addr + i_offset ; <nl> - <nl> - callstack_model - > setItem ( <nl> - counter , 0 , new QStandardItem ( QString ( " 0x % 1 " ) . arg ( addr , 8 , 16 , QLatin1Char ( ' 0 ' ) ) ) ) ; <nl> - callstack_model - > setItem ( counter , 1 , new QStandardItem ( QString ( " 0x % 1 " ) . arg ( <nl> - ret_addr , 8 , 16 , QLatin1Char ( ' 0 ' ) ) ) ) ; <nl> - callstack_model - > setItem ( counter , 2 , new QStandardItem ( QString ( " 0x % 1 " ) . arg ( <nl> - call_addr , 8 , 16 , QLatin1Char ( ' 0 ' ) ) ) ) ; <nl> - <nl> - name = Symbols : : HasSymbol ( func_addr ) ? Symbols : : GetSymbol ( func_addr ) . name : " unknown " ; <nl> - callstack_model - > setItem ( <nl> - counter , 3 , new QStandardItem ( <nl> - QString ( " % 1_ % 2 " ) <nl> - . arg ( QString : : fromStdString ( name ) ) <nl> - . arg ( QString ( " 0x % 1 " ) . arg ( func_addr , 8 , 16 , QLatin1Char ( ' 0 ' ) ) ) ) ) ; <nl> - <nl> - counter + + ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - void CallstackWidget : : OnDebugModeLeft ( ) { } <nl> - <nl> - void CallstackWidget : : Clear ( ) { <nl> - for ( int row = 0 ; row < callstack_model - > rowCount ( ) ; row + + ) { <nl> - for ( int column = 0 ; column < callstack_model - > columnCount ( ) ; column + + ) { <nl> - callstack_model - > setItem ( row , column , new QStandardItem ( ) ) ; <nl> - } <nl> - } <nl> - } <nl> deleted file mode 100644 <nl> index f04ab9c7e21 . . 00000000000 <nl> mmm a / src / citra_qt / debugger / callstack . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2014 Citra Emulator Project <nl> - / / Licensed under GPLv2 or any later version <nl> - / / Refer to the license . txt file included . <nl> - <nl> - # pragma once <nl> - <nl> - # include < QDockWidget > <nl> - # include " ui_callstack . h " <nl> - <nl> - class QStandardItemModel ; <nl> - <nl> - class CallstackWidget : public QDockWidget { <nl> - Q_OBJECT <nl> - <nl> - public : <nl> - explicit CallstackWidget ( QWidget * parent = nullptr ) ; <nl> - <nl> - public slots : <nl> - void OnDebugModeEntered ( ) ; <nl> - void OnDebugModeLeft ( ) ; <nl> - <nl> - private : <nl> - Ui : : CallStack ui ; <nl> - QStandardItemModel * callstack_model ; <nl> - <nl> - / / / Clears the callstack widget while keeping the column widths the same <nl> - void Clear ( ) ; <nl> - } ; <nl> deleted file mode 100644 <nl> index 248ea3dd7dd . . 00000000000 <nl> mmm a / src / citra_qt / debugger / callstack . ui <nl> ppp / dev / null <nl> <nl> - < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> - < ui version = " 4 . 0 " > <nl> - < class > CallStack < / class > <nl> - < widget class = " QDockWidget " name = " CallStack " > <nl> - < property name = " geometry " > <nl> - < rect > <nl> - < x > 0 < / x > <nl> - < y > 0 < / y > <nl> - < width > 400 < / width > <nl> - < height > 300 < / height > <nl> - < / rect > <nl> - < / property > <nl> - < property name = " windowTitle " > <nl> - < string > Call Stack < / string > <nl> - < / property > <nl> - < widget class = " QWidget " name = " dockWidgetContents " > <nl> - < layout class = " QVBoxLayout " name = " verticalLayout " > <nl> - < item > <nl> - < widget class = " QTreeView " name = " treeView " > <nl> - < property name = " editTriggers " > <nl> - < set > QAbstractItemView : : NoEditTriggers < / set > <nl> - < / property > <nl> - < property name = " alternatingRowColors " > <nl> - < bool > true < / bool > <nl> - < / property > <nl> - < property name = " rootIsDecorated " > <nl> - < bool > false < / bool > <nl> - < / property > <nl> - < property name = " itemsExpandable " > <nl> - < bool > false < / bool > <nl> - < / property > <nl> - < / widget > <nl> - < / item > <nl> - < / layout > <nl> - < / widget > <nl> - < / widget > <nl> - < resources / > <nl> - < connections / > <nl> - < / ui > <nl> deleted file mode 100644 <nl> index e9c8ad85813 . . 00000000000 <nl> mmm a / src / citra_qt / debugger / disassembler . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2014 Citra Emulator Project <nl> - / / Licensed under GPLv2 or any later version <nl> - / / Refer to the license . txt file included . <nl> - <nl> - # include < QShortcut > <nl> - # include " citra_qt / bootmanager . h " <nl> - # include " citra_qt / debugger / disassembler . h " <nl> - # include " citra_qt / hotkeys . h " <nl> - # include " citra_qt / util / util . h " <nl> - # include " common / break_points . h " <nl> - # include " common / symbols . h " <nl> - # include " core / arm / arm_interface . h " <nl> - # include " core / arm / disassembler / arm_disasm . h " <nl> - # include " core / core . h " <nl> - # include " core / memory . h " <nl> - <nl> - DisassemblerModel : : DisassemblerModel ( QObject * parent ) <nl> - : QAbstractListModel ( parent ) , base_address ( 0 ) , code_size ( 0 ) , program_counter ( 0 ) , <nl> - selection ( QModelIndex ( ) ) { } <nl> - <nl> - int DisassemblerModel : : columnCount ( const QModelIndex & parent ) const { <nl> - return 3 ; <nl> - } <nl> - <nl> - int DisassemblerModel : : rowCount ( const QModelIndex & parent ) const { <nl> - return code_size ; <nl> - } <nl> - <nl> - QVariant DisassemblerModel : : data ( const QModelIndex & index , int role ) const { <nl> - switch ( role ) { <nl> - case Qt : : DisplayRole : { <nl> - u32 address = base_address + index . row ( ) * 4 ; <nl> - u32 instr = Memory : : Read32 ( address ) ; <nl> - std : : string disassembly = ARM_Disasm : : Disassemble ( address , instr ) ; <nl> - <nl> - if ( index . column ( ) = = 0 ) { <nl> - return QString ( " 0x % 1 " ) . arg ( ( uint ) ( address ) , 8 , 16 , QLatin1Char ( ' 0 ' ) ) ; <nl> - } else if ( index . column ( ) = = 1 ) { <nl> - return QString : : fromStdString ( disassembly ) ; <nl> - } else if ( index . column ( ) = = 2 ) { <nl> - if ( Symbols : : HasSymbol ( address ) ) { <nl> - TSymbol symbol = Symbols : : GetSymbol ( address ) ; <nl> - return QString ( " % 1 - Size : % 2 " ) <nl> - . arg ( QString : : fromStdString ( symbol . name ) ) <nl> - . arg ( symbol . size / 4 ) ; / / divide by 4 to get instruction count <nl> - } else if ( ARM_Disasm : : Decode ( instr ) = = OP_BL ) { <nl> - u32 offset = instr & 0xFFFFFF ; <nl> - <nl> - / / Sign - extend the 24 - bit offset <nl> - if ( ( offset > > 23 ) & 1 ) <nl> - offset | = 0xFF000000 ; <nl> - <nl> - / / Pre - compute the left - shift and the prefetch offset <nl> - offset < < = 2 ; <nl> - offset + = 8 ; <nl> - <nl> - TSymbol symbol = Symbols : : GetSymbol ( address + offset ) ; <nl> - return QString ( " - - > % 1 " ) . arg ( QString : : fromStdString ( symbol . name ) ) ; <nl> - } <nl> - } <nl> - <nl> - break ; <nl> - } <nl> - <nl> - case Qt : : BackgroundRole : { <nl> - unsigned int address = base_address + 4 * index . row ( ) ; <nl> - <nl> - if ( breakpoints . IsAddressBreakPoint ( address ) ) <nl> - return QBrush ( QColor ( 0xFF , 0xC0 , 0xC0 ) ) ; <nl> - else if ( address = = program_counter ) <nl> - return QBrush ( QColor ( 0xC0 , 0xC0 , 0xFF ) ) ; <nl> - <nl> - break ; <nl> - } <nl> - <nl> - case Qt : : FontRole : { <nl> - if ( index . column ( ) = = 0 | | index . column ( ) = = 1 ) { / / 2 is the symbols column <nl> - return GetMonospaceFont ( ) ; <nl> - } <nl> - break ; <nl> - } <nl> - <nl> - default : <nl> - break ; <nl> - } <nl> - <nl> - return QVariant ( ) ; <nl> - } <nl> - <nl> - QModelIndex DisassemblerModel : : IndexFromAbsoluteAddress ( unsigned int address ) const { <nl> - return index ( ( address - base_address ) / 4 , 0 ) ; <nl> - } <nl> - <nl> - const BreakPoints & DisassemblerModel : : GetBreakPoints ( ) const { <nl> - return breakpoints ; <nl> - } <nl> - <nl> - void DisassemblerModel : : ParseFromAddress ( unsigned int address ) { <nl> - <nl> - / / NOTE : A too large value causes lagging when scrolling the disassembly <nl> - const unsigned int chunk_size = 1000 * 500 ; <nl> - <nl> - / / If we haven ' t loaded anything yet , initialize base address to the parameter address <nl> - if ( code_size = = 0 ) <nl> - base_address = address ; <nl> - <nl> - / / If the new area is already loaded , just continue <nl> - if ( base_address + code_size > address + chunk_size & & base_address < = address ) <nl> - return ; <nl> - <nl> - / / Insert rows before currently loaded data <nl> - if ( base_address > address ) { <nl> - unsigned int num_rows = ( address - base_address ) / 4 ; <nl> - <nl> - beginInsertRows ( QModelIndex ( ) , 0 , num_rows ) ; <nl> - code_size + = num_rows ; <nl> - base_address = address ; <nl> - <nl> - endInsertRows ( ) ; <nl> - } <nl> - <nl> - / / Insert rows after currently loaded data <nl> - if ( base_address + code_size < address + chunk_size ) { <nl> - unsigned int num_rows = ( base_address + chunk_size - code_size - address ) / 4 ; <nl> - <nl> - beginInsertRows ( QModelIndex ( ) , 0 , num_rows ) ; <nl> - code_size + = num_rows ; <nl> - endInsertRows ( ) ; <nl> - } <nl> - <nl> - SetNextInstruction ( address ) ; <nl> - } <nl> - <nl> - void DisassemblerModel : : OnSelectionChanged ( const QModelIndex & new_selection ) { <nl> - selection = new_selection ; <nl> - } <nl> - <nl> - void DisassemblerModel : : OnSetOrUnsetBreakpoint ( ) { <nl> - if ( ! selection . isValid ( ) ) <nl> - return ; <nl> - <nl> - unsigned int address = base_address + selection . row ( ) * 4 ; <nl> - <nl> - if ( breakpoints . IsAddressBreakPoint ( address ) ) { <nl> - breakpoints . Remove ( address ) ; <nl> - } else { <nl> - breakpoints . Add ( address ) ; <nl> - } <nl> - <nl> - emit dataChanged ( selection , selection ) ; <nl> - } <nl> - <nl> - void DisassemblerModel : : SetNextInstruction ( unsigned int address ) { <nl> - QModelIndex cur_index = IndexFromAbsoluteAddress ( program_counter ) ; <nl> - QModelIndex prev_index = IndexFromAbsoluteAddress ( address ) ; <nl> - <nl> - program_counter = address ; <nl> - <nl> - emit dataChanged ( cur_index , cur_index ) ; <nl> - emit dataChanged ( prev_index , prev_index ) ; <nl> - } <nl> - <nl> - DisassemblerWidget : : DisassemblerWidget ( QWidget * parent , EmuThread * emu_thread ) <nl> - : QDockWidget ( parent ) , base_addr ( 0 ) , emu_thread ( emu_thread ) { <nl> - <nl> - disasm_ui . setupUi ( this ) ; <nl> - <nl> - RegisterHotkey ( " Disassembler " , " Start / Stop " , QKeySequence ( Qt : : Key_F5 ) , Qt : : ApplicationShortcut ) ; <nl> - RegisterHotkey ( " Disassembler " , " Step " , QKeySequence ( Qt : : Key_F10 ) , Qt : : ApplicationShortcut ) ; <nl> - RegisterHotkey ( " Disassembler " , " Step into " , QKeySequence ( Qt : : Key_F11 ) , Qt : : ApplicationShortcut ) ; <nl> - RegisterHotkey ( " Disassembler " , " Set Breakpoint " , QKeySequence ( Qt : : Key_F9 ) , <nl> - Qt : : ApplicationShortcut ) ; <nl> - <nl> - connect ( disasm_ui . button_step , SIGNAL ( clicked ( ) ) , this , SLOT ( OnStep ( ) ) ) ; <nl> - connect ( disasm_ui . button_pause , SIGNAL ( clicked ( ) ) , this , SLOT ( OnPause ( ) ) ) ; <nl> - connect ( disasm_ui . button_continue , SIGNAL ( clicked ( ) ) , this , SLOT ( OnContinue ( ) ) ) ; <nl> - <nl> - connect ( GetHotkey ( " Disassembler " , " Start / Stop " , this ) , SIGNAL ( activated ( ) ) , this , <nl> - SLOT ( OnToggleStartStop ( ) ) ) ; <nl> - connect ( GetHotkey ( " Disassembler " , " Step " , this ) , SIGNAL ( activated ( ) ) , this , SLOT ( OnStep ( ) ) ) ; <nl> - connect ( GetHotkey ( " Disassembler " , " Step into " , this ) , SIGNAL ( activated ( ) ) , this , <nl> - SLOT ( OnStepInto ( ) ) ) ; <nl> - <nl> - setEnabled ( false ) ; <nl> - } <nl> - <nl> - void DisassemblerWidget : : Init ( ) { <nl> - model - > ParseFromAddress ( Core : : CPU ( ) . GetPC ( ) ) ; <nl> - <nl> - disasm_ui . treeView - > resizeColumnToContents ( 0 ) ; <nl> - disasm_ui . treeView - > resizeColumnToContents ( 1 ) ; <nl> - disasm_ui . treeView - > resizeColumnToContents ( 2 ) ; <nl> - <nl> - QModelIndex model_index = model - > IndexFromAbsoluteAddress ( Core : : CPU ( ) . GetPC ( ) ) ; <nl> - disasm_ui . treeView - > scrollTo ( model_index ) ; <nl> - disasm_ui . treeView - > selectionModel ( ) - > setCurrentIndex ( <nl> - model_index , QItemSelectionModel : : SelectCurrent | QItemSelectionModel : : Rows ) ; <nl> - } <nl> - <nl> - void DisassemblerWidget : : OnContinue ( ) { <nl> - emu_thread - > SetRunning ( true ) ; <nl> - } <nl> - <nl> - void DisassemblerWidget : : OnStep ( ) { <nl> - OnStepInto ( ) ; / / change later <nl> - } <nl> - <nl> - void DisassemblerWidget : : OnStepInto ( ) { <nl> - emu_thread - > SetRunning ( false ) ; <nl> - emu_thread - > ExecStep ( ) ; <nl> - } <nl> - <nl> - void DisassemblerWidget : : OnPause ( ) { <nl> - emu_thread - > SetRunning ( false ) ; <nl> - <nl> - / / TODO : By now , the CPU might not have actually stopped . . . <nl> - if ( Core : : System : : GetInstance ( ) . IsPoweredOn ( ) ) { <nl> - model - > SetNextInstruction ( Core : : CPU ( ) . GetPC ( ) ) ; <nl> - } <nl> - } <nl> - <nl> - void DisassemblerWidget : : OnToggleStartStop ( ) { <nl> - emu_thread - > SetRunning ( ! emu_thread - > IsRunning ( ) ) ; <nl> - } <nl> - <nl> - void DisassemblerWidget : : OnDebugModeEntered ( ) { <nl> - u32 next_instr = Core : : CPU ( ) . GetPC ( ) ; <nl> - <nl> - if ( model - > GetBreakPoints ( ) . IsAddressBreakPoint ( next_instr ) ) <nl> - emu_thread - > SetRunning ( false ) ; <nl> - <nl> - model - > SetNextInstruction ( next_instr ) ; <nl> - <nl> - QModelIndex model_index = model - > IndexFromAbsoluteAddress ( next_instr ) ; <nl> - disasm_ui . treeView - > scrollTo ( model_index ) ; <nl> - disasm_ui . treeView - > selectionModel ( ) - > setCurrentIndex ( <nl> - model_index , QItemSelectionModel : : SelectCurrent | QItemSelectionModel : : Rows ) ; <nl> - } <nl> - <nl> - void DisassemblerWidget : : OnDebugModeLeft ( ) { } <nl> - <nl> - int DisassemblerWidget : : SelectedRow ( ) { <nl> - QModelIndex index = disasm_ui . treeView - > selectionModel ( ) - > currentIndex ( ) ; <nl> - if ( ! index . isValid ( ) ) <nl> - return - 1 ; <nl> - <nl> - return disasm_ui . treeView - > selectionModel ( ) - > currentIndex ( ) . row ( ) ; <nl> - } <nl> - <nl> - void DisassemblerWidget : : OnEmulationStarting ( EmuThread * emu_thread ) { <nl> - this - > emu_thread = emu_thread ; <nl> - <nl> - model = new DisassemblerModel ( this ) ; <nl> - disasm_ui . treeView - > setModel ( model ) ; <nl> - <nl> - connect ( disasm_ui . treeView - > selectionModel ( ) , <nl> - SIGNAL ( currentChanged ( const QModelIndex & , const QModelIndex & ) ) , model , <nl> - SLOT ( OnSelectionChanged ( const QModelIndex & ) ) ) ; <nl> - connect ( disasm_ui . button_breakpoint , SIGNAL ( clicked ( ) ) , model , SLOT ( OnSetOrUnsetBreakpoint ( ) ) ) ; <nl> - connect ( GetHotkey ( " Disassembler " , " Set Breakpoint " , this ) , SIGNAL ( activated ( ) ) , model , <nl> - SLOT ( OnSetOrUnsetBreakpoint ( ) ) ) ; <nl> - <nl> - Init ( ) ; <nl> - setEnabled ( true ) ; <nl> - } <nl> - <nl> - void DisassemblerWidget : : OnEmulationStopping ( ) { <nl> - disasm_ui . treeView - > setModel ( nullptr ) ; <nl> - delete model ; <nl> - emu_thread = nullptr ; <nl> - setEnabled ( false ) ; <nl> - } <nl> deleted file mode 100644 <nl> index a6e59515c1f . . 00000000000 <nl> mmm a / src / citra_qt / debugger / disassembler . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2014 Citra Emulator Project <nl> - / / Licensed under GPLv2 or any later version <nl> - / / Refer to the license . txt file included . <nl> - <nl> - # pragma once <nl> - <nl> - # include < QAbstractListModel > <nl> - # include < QDockWidget > <nl> - # include " common / break_points . h " <nl> - # include " common / common_types . h " <nl> - # include " ui_disassembler . h " <nl> - <nl> - class QAction ; <nl> - class EmuThread ; <nl> - <nl> - class DisassemblerModel : public QAbstractListModel { <nl> - Q_OBJECT <nl> - <nl> - public : <nl> - explicit DisassemblerModel ( QObject * parent ) ; <nl> - <nl> - int columnCount ( const QModelIndex & parent = QModelIndex ( ) ) const override ; <nl> - int rowCount ( const QModelIndex & parent = QModelIndex ( ) ) const override ; <nl> - QVariant data ( const QModelIndex & index , int role = Qt : : DisplayRole ) const override ; <nl> - <nl> - QModelIndex IndexFromAbsoluteAddress ( unsigned int address ) const ; <nl> - const BreakPoints & GetBreakPoints ( ) const ; <nl> - <nl> - public slots : <nl> - void ParseFromAddress ( unsigned int address ) ; <nl> - void OnSelectionChanged ( const QModelIndex & ) ; <nl> - void OnSetOrUnsetBreakpoint ( ) ; <nl> - void SetNextInstruction ( unsigned int address ) ; <nl> - <nl> - private : <nl> - unsigned int base_address ; <nl> - unsigned int code_size ; <nl> - unsigned int program_counter ; <nl> - <nl> - QModelIndex selection ; <nl> - BreakPoints breakpoints ; <nl> - } ; <nl> - <nl> - class DisassemblerWidget : public QDockWidget { <nl> - Q_OBJECT <nl> - <nl> - public : <nl> - DisassemblerWidget ( QWidget * parent , EmuThread * emu_thread ) ; <nl> - <nl> - void Init ( ) ; <nl> - <nl> - public slots : <nl> - void OnContinue ( ) ; <nl> - void OnStep ( ) ; <nl> - void OnStepInto ( ) ; <nl> - void OnPause ( ) ; <nl> - void OnToggleStartStop ( ) ; <nl> - <nl> - void OnDebugModeEntered ( ) ; <nl> - void OnDebugModeLeft ( ) ; <nl> - <nl> - void OnEmulationStarting ( EmuThread * emu_thread ) ; <nl> - void OnEmulationStopping ( ) ; <nl> - <nl> - private : <nl> - / / returns - 1 if no row is selected <nl> - int SelectedRow ( ) ; <nl> - <nl> - Ui : : DockWidget disasm_ui ; <nl> - <nl> - DisassemblerModel * model ; <nl> - <nl> - u32 base_addr ; <nl> - <nl> - EmuThread * emu_thread ; <nl> - } ; <nl> deleted file mode 100644 <nl> index 5ca6dc5d2fa . . 00000000000 <nl> mmm a / src / citra_qt / debugger / disassembler . ui <nl> ppp / dev / null <nl> <nl> - < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> - < ui version = " 4 . 0 " > <nl> - < class > DockWidget < / class > <nl> - < widget class = " QDockWidget " name = " DockWidget " > <nl> - < property name = " geometry " > <nl> - < rect > <nl> - < x > 0 < / x > <nl> - < y > 0 < / y > <nl> - < width > 430 < / width > <nl> - < height > 401 < / height > <nl> - < / rect > <nl> - < / property > <nl> - < property name = " windowTitle " > <nl> - < string > Disassembly < / string > <nl> - < / property > <nl> - < widget class = " QWidget " name = " dockWidgetContents " > <nl> - < layout class = " QVBoxLayout " name = " verticalLayout " > <nl> - < item > <nl> - < layout class = " QHBoxLayout " name = " horizontalLayout " > <nl> - < item > <nl> - < widget class = " QPushButton " name = " button_step " > <nl> - < property name = " text " > <nl> - < string > Step < / string > <nl> - < / property > <nl> - < / widget > <nl> - < / item > <nl> - < item > <nl> - < widget class = " QPushButton " name = " button_pause " > <nl> - < property name = " text " > <nl> - < string > Pause < / string > <nl> - < / property > <nl> - < / widget > <nl> - < / item > <nl> - < item > <nl> - < widget class = " QPushButton " name = " button_continue " > <nl> - < property name = " text " > <nl> - < string > Continue < / string > <nl> - < / property > <nl> - < / widget > <nl> - < / item > <nl> - < item > <nl> - < widget class = " QPushButton " name = " pushButton " > <nl> - < property name = " text " > <nl> - < string > Step Into < / string > <nl> - < / property > <nl> - < / widget > <nl> - < / item > <nl> - < item > <nl> - < widget class = " QPushButton " name = " button_breakpoint " > <nl> - < property name = " text " > <nl> - < string > Set Breakpoint < / string > <nl> - < / property > <nl> - < / widget > <nl> - < / item > <nl> - < / layout > <nl> - < / item > <nl> - < item > <nl> - < widget class = " QTreeView " name = " treeView " > <nl> - < property name = " alternatingRowColors " > <nl> - < bool > true < / bool > <nl> - < / property > <nl> - < property name = " indentation " > <nl> - < number > 20 < / number > <nl> - < / property > <nl> - < property name = " rootIsDecorated " > <nl> - < bool > false < / bool > <nl> - < / property > <nl> - < property name = " uniformRowHeights " > <nl> - < bool > true < / bool > <nl> - < / property > <nl> - < attribute name = " headerVisible " > <nl> - < bool > false < / bool > <nl> - < / attribute > <nl> - < / widget > <nl> - < / item > <nl> - < / layout > <nl> - < / widget > <nl> - < / widget > <nl> - < resources / > <nl> - < connections / > <nl> - < / ui > <nl> mmm a / src / citra_qt / main . cpp <nl> ppp b / src / citra_qt / main . cpp <nl> <nl> # include " citra_qt / bootmanager . h " <nl> # include " citra_qt / configuration / config . h " <nl> # include " citra_qt / configuration / configure_dialog . h " <nl> - # include " citra_qt / debugger / callstack . h " <nl> - # include " citra_qt / debugger / disassembler . h " <nl> # include " citra_qt / debugger / graphics / graphics . h " <nl> # include " citra_qt / debugger / graphics / graphics_breakpoints . h " <nl> # include " citra_qt / debugger / graphics / graphics_cmdlists . h " <nl> <nl> # include " common / scm_rev . h " <nl> # include " common / scope_exit . h " <nl> # include " common / string_util . h " <nl> - # include " core / arm / disassembler / load_symbol_map . h " <nl> # include " core / core . h " <nl> # include " core / file_sys / archive_source_sd_savedata . h " <nl> # include " core / gdbstub / gdbstub . h " <nl> void GMainWindow : : InitializeDebugWidgets ( ) { <nl> debug_menu - > addAction ( microProfileDialog - > toggleViewAction ( ) ) ; <nl> # endif <nl> <nl> - disasmWidget = new DisassemblerWidget ( this , emu_thread . get ( ) ) ; <nl> - addDockWidget ( Qt : : BottomDockWidgetArea , disasmWidget ) ; <nl> - disasmWidget - > hide ( ) ; <nl> - debug_menu - > addAction ( disasmWidget - > toggleViewAction ( ) ) ; <nl> - connect ( this , & GMainWindow : : EmulationStarting , disasmWidget , <nl> - & DisassemblerWidget : : OnEmulationStarting ) ; <nl> - connect ( this , & GMainWindow : : EmulationStopping , disasmWidget , <nl> - & DisassemblerWidget : : OnEmulationStopping ) ; <nl> - <nl> registersWidget = new RegistersWidget ( this ) ; <nl> addDockWidget ( Qt : : RightDockWidgetArea , registersWidget ) ; <nl> registersWidget - > hide ( ) ; <nl> void GMainWindow : : InitializeDebugWidgets ( ) { <nl> connect ( this , & GMainWindow : : EmulationStopping , registersWidget , <nl> & RegistersWidget : : OnEmulationStopping ) ; <nl> <nl> - callstackWidget = new CallstackWidget ( this ) ; <nl> - addDockWidget ( Qt : : RightDockWidgetArea , callstackWidget ) ; <nl> - callstackWidget - > hide ( ) ; <nl> - debug_menu - > addAction ( callstackWidget - > toggleViewAction ( ) ) ; <nl> - <nl> graphicsWidget = new GPUCommandStreamWidget ( this ) ; <nl> addDockWidget ( Qt : : RightDockWidgetArea , graphicsWidget ) ; <nl> graphicsWidget - > hide ( ) ; <nl> void GMainWindow : : ConnectWidgetEvents ( ) { <nl> void GMainWindow : : ConnectMenuEvents ( ) { <nl> / / File <nl> connect ( ui . action_Load_File , & QAction : : triggered , this , & GMainWindow : : OnMenuLoadFile ) ; <nl> - connect ( ui . action_Load_Symbol_Map , & QAction : : triggered , this , <nl> - & GMainWindow : : OnMenuLoadSymbolMap ) ; <nl> connect ( ui . action_Select_Game_List_Root , & QAction : : triggered , this , <nl> & GMainWindow : : OnMenuSelectGameListRoot ) ; <nl> connect ( ui . action_Exit , & QAction : : triggered , this , & QMainWindow : : close ) ; <nl> void GMainWindow : : BootGame ( const QString & filename ) { <nl> connect ( render_window , SIGNAL ( Closed ( ) ) , this , SLOT ( OnStopGame ( ) ) ) ; <nl> / / BlockingQueuedConnection is important here , it makes sure we ' ve finished refreshing our views <nl> / / before the CPU continues <nl> - connect ( emu_thread . get ( ) , SIGNAL ( DebugModeEntered ( ) ) , disasmWidget , SLOT ( OnDebugModeEntered ( ) ) , <nl> - Qt : : BlockingQueuedConnection ) ; <nl> connect ( emu_thread . get ( ) , SIGNAL ( DebugModeEntered ( ) ) , registersWidget , <nl> SLOT ( OnDebugModeEntered ( ) ) , Qt : : BlockingQueuedConnection ) ; <nl> - connect ( emu_thread . get ( ) , SIGNAL ( DebugModeEntered ( ) ) , callstackWidget , <nl> - SLOT ( OnDebugModeEntered ( ) ) , Qt : : BlockingQueuedConnection ) ; <nl> connect ( emu_thread . get ( ) , SIGNAL ( DebugModeEntered ( ) ) , waitTreeWidget , <nl> SLOT ( OnDebugModeEntered ( ) ) , Qt : : BlockingQueuedConnection ) ; <nl> - connect ( emu_thread . get ( ) , SIGNAL ( DebugModeLeft ( ) ) , disasmWidget , SLOT ( OnDebugModeLeft ( ) ) , <nl> - Qt : : BlockingQueuedConnection ) ; <nl> connect ( emu_thread . get ( ) , SIGNAL ( DebugModeLeft ( ) ) , registersWidget , SLOT ( OnDebugModeLeft ( ) ) , <nl> Qt : : BlockingQueuedConnection ) ; <nl> - connect ( emu_thread . get ( ) , SIGNAL ( DebugModeLeft ( ) ) , callstackWidget , SLOT ( OnDebugModeLeft ( ) ) , <nl> - Qt : : BlockingQueuedConnection ) ; <nl> connect ( emu_thread . get ( ) , SIGNAL ( DebugModeLeft ( ) ) , waitTreeWidget , SLOT ( OnDebugModeLeft ( ) ) , <nl> Qt : : BlockingQueuedConnection ) ; <nl> <nl> / / Update the GUI <nl> registersWidget - > OnDebugModeEntered ( ) ; <nl> - callstackWidget - > OnDebugModeEntered ( ) ; <nl> if ( ui . action_Single_Window_Mode - > isChecked ( ) ) { <nl> game_list - > hide ( ) ; <nl> } <nl> void GMainWindow : : OnMenuLoadFile ( ) { <nl> } <nl> } <nl> <nl> - void GMainWindow : : OnMenuLoadSymbolMap ( ) { <nl> - QString filename = QFileDialog : : getOpenFileName ( <nl> - this , tr ( " Load Symbol Map " ) , UISettings : : values . symbols_path , tr ( " Symbol Map ( * . * ) " ) ) ; <nl> - if ( ! filename . isEmpty ( ) ) { <nl> - UISettings : : values . symbols_path = QFileInfo ( filename ) . path ( ) ; <nl> - <nl> - LoadSymbolMap ( filename . toStdString ( ) ) ; <nl> - } <nl> - } <nl> - <nl> void GMainWindow : : OnMenuSelectGameListRoot ( ) { <nl> QString dir_path = QFileDialog : : getExistingDirectory ( this , tr ( " Select Directory " ) ) ; <nl> if ( ! dir_path . isEmpty ( ) ) { <nl> mmm a / src / citra_qt / main . h <nl> ppp b / src / citra_qt / main . h <nl> <nl> # include < QTimer > <nl> # include " ui_main . h " <nl> <nl> - class CallstackWidget ; <nl> class Config ; <nl> - class DisassemblerWidget ; <nl> class EmuThread ; <nl> class GameList ; <nl> class GImageInfo ; <nl> private slots : <nl> void OnGameListLoadFile ( QString game_path ) ; <nl> void OnGameListOpenSaveFolder ( u64 program_id ) ; <nl> void OnMenuLoadFile ( ) ; <nl> - void OnMenuLoadSymbolMap ( ) ; <nl> / / / Called whenever a user selects the " File - > Select Game List Root " menu item <nl> void OnMenuSelectGameListRoot ( ) ; <nl> void OnMenuRecentFile ( ) ; <nl> private slots : <nl> / / Debugger panes <nl> ProfilerWidget * profilerWidget ; <nl> MicroProfileDialog * microProfileDialog ; <nl> - DisassemblerWidget * disasmWidget ; <nl> RegistersWidget * registersWidget ; <nl> - CallstackWidget * callstackWidget ; <nl> GPUCommandStreamWidget * graphicsWidget ; <nl> GPUCommandListWidget * graphicsCommandsWidget ; <nl> GraphicsBreakPointsWidget * graphicsBreakpointsWidget ; <nl> mmm a / src / citra_qt / main . ui <nl> ppp b / src / citra_qt / main . ui <nl> <nl> < / property > <nl> < / widget > <nl> < addaction name = " action_Load_File " / > <nl> - < addaction name = " action_Load_Symbol_Map " / > <nl> < addaction name = " separator " / > <nl> < addaction name = " action_Select_Game_List_Root " / > <nl> < addaction name = " menu_recent_files " / > <nl> mmm a / src / common / CMakeLists . txt <nl> ppp b / src / common / CMakeLists . txt <nl> set ( SRCS <nl> param_package . cpp <nl> scm_rev . cpp <nl> string_util . cpp <nl> - symbols . cpp <nl> thread . cpp <nl> timer . cpp <nl> ) <nl> set ( HEADERS <nl> scope_exit . h <nl> string_util . h <nl> swap . h <nl> - symbols . h <nl> synchronized_wrapper . h <nl> thread . h <nl> thread_queue_list . h <nl> deleted file mode 100644 <nl> index c4d16af856b . . 00000000000 <nl> mmm a / src / common / symbols . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2014 Citra Emulator Project <nl> - / / Licensed under GPLv2 or any later version <nl> - / / Refer to the license . txt file included . <nl> - <nl> - # include " common / symbols . h " <nl> - <nl> - TSymbolsMap g_symbols ; <nl> - <nl> - namespace Symbols { <nl> - bool HasSymbol ( u32 address ) { <nl> - return g_symbols . find ( address ) ! = g_symbols . end ( ) ; <nl> - } <nl> - <nl> - void Add ( u32 address , const std : : string & name , u32 size , u32 type ) { <nl> - if ( ! HasSymbol ( address ) ) { <nl> - TSymbol symbol ; <nl> - symbol . address = address ; <nl> - symbol . name = name ; <nl> - symbol . size = size ; <nl> - symbol . type = type ; <nl> - <nl> - g_symbols . emplace ( address , symbol ) ; <nl> - } <nl> - } <nl> - <nl> - TSymbol GetSymbol ( u32 address ) { <nl> - const auto iter = g_symbols . find ( address ) ; <nl> - <nl> - if ( iter ! = g_symbols . end ( ) ) <nl> - return iter - > second ; <nl> - <nl> - return { } ; <nl> - } <nl> - <nl> - const std : : string GetName ( u32 address ) { <nl> - return GetSymbol ( address ) . name ; <nl> - } <nl> - <nl> - void Remove ( u32 address ) { <nl> - g_symbols . erase ( address ) ; <nl> - } <nl> - <nl> - void Clear ( ) { <nl> - g_symbols . clear ( ) ; <nl> - } <nl> - } <nl> deleted file mode 100644 <nl> index f5a48e05ac1 . . 00000000000 <nl> mmm a / src / common / symbols . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2014 Citra Emulator Project <nl> - / / Licensed under GPLv2 or any later version <nl> - / / Refer to the license . txt file included . <nl> - <nl> - # pragma once <nl> - <nl> - # include < map > <nl> - # include < string > <nl> - # include < utility > <nl> - # include " common / common_types . h " <nl> - <nl> - struct TSymbol { <nl> - u32 address = 0 ; <nl> - std : : string name ; <nl> - u32 size = 0 ; <nl> - u32 type = 0 ; <nl> - } ; <nl> - <nl> - typedef std : : map < u32 , TSymbol > TSymbolsMap ; <nl> - typedef std : : pair < u32 , TSymbol > TSymbolsPair ; <nl> - <nl> - namespace Symbols { <nl> - bool HasSymbol ( u32 address ) ; <nl> - <nl> - void Add ( u32 address , const std : : string & name , u32 size , u32 type ) ; <nl> - TSymbol GetSymbol ( u32 address ) ; <nl> - const std : : string GetName ( u32 address ) ; <nl> - void Remove ( u32 address ) ; <nl> - void Clear ( ) ; <nl> - } <nl> mmm a / src / core / CMakeLists . txt <nl> ppp b / src / core / CMakeLists . txt <nl> <nl> set ( SRCS <nl> - arm / disassembler / arm_disasm . cpp <nl> - arm / disassembler / load_symbol_map . cpp <nl> arm / dynarmic / arm_dynarmic . cpp <nl> arm / dynarmic / arm_dynarmic_cp15 . cpp <nl> arm / dyncom / arm_dyncom . cpp <nl> set ( SRCS <nl> <nl> set ( HEADERS <nl> arm / arm_interface . h <nl> - arm / disassembler / arm_disasm . h <nl> - arm / disassembler / load_symbol_map . h <nl> arm / dynarmic / arm_dynarmic . h <nl> arm / dynarmic / arm_dynarmic_cp15 . h <nl> arm / dyncom / arm_dyncom . h <nl> deleted file mode 100644 <nl> index 05d6ed1fb97 . . 00000000000 <nl> mmm a / src / core / arm / disassembler / arm_disasm . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2006 The Android Open Source Project <nl> - <nl> - # include < string > <nl> - # include < unordered_set > <nl> - # include " common / common_types . h " <nl> - # include " common / string_util . h " <nl> - # include " core / arm / disassembler / arm_disasm . h " <nl> - # include " core / arm / skyeye_common / armsupp . h " <nl> - <nl> - static const char * cond_names [ ] = { " eq " , " ne " , " cs " , " cc " , " mi " , " pl " , " vs " , " vc " , <nl> - " hi " , " ls " , " ge " , " lt " , " gt " , " le " , " " , " RESERVED " } ; <nl> - <nl> - static const char * opcode_names [ ] = { <nl> - " invalid " , " undefined " , " adc " , " add " , " and " , " b " , " bl " , " bic " , <nl> - " bkpt " , " blx " , " bx " , " cdp " , " clrex " , " clz " , " cmn " , " cmp " , <nl> - " eor " , " ldc " , " ldm " , " ldr " , " ldrb " , " ldrbt " , " ldrex " , " ldrexb " , <nl> - " ldrexd " , " ldrexh " , " ldrh " , " ldrsb " , " ldrsh " , " ldrt " , " mcr " , " mla " , <nl> - " mov " , " mrc " , " mrs " , " msr " , " mul " , " mvn " , " nop " , " orr " , <nl> - " pkh " , " pld " , " qadd16 " , " qadd8 " , " qasx " , " qsax " , " qsub16 " , " qsub8 " , <nl> - " rev " , " rev16 " , " revsh " , " rsb " , " rsc " , " sadd16 " , " sadd8 " , " sasx " , <nl> - " sbc " , " sel " , " sev " , " shadd16 " , " shadd8 " , " shasx " , " shsax " , " shsub16 " , <nl> - " shsub8 " , " smlad " , " smlal " , " smlald " , " smlsd " , " smlsld " , " smmla " , " smmls " , <nl> - " smmul " , " smuad " , " smull " , " smusd " , " ssat " , " ssat16 " , " ssax " , " ssub16 " , <nl> - " ssub8 " , " stc " , " stm " , " str " , " strb " , " strbt " , " strex " , " strexb " , <nl> - " strexd " , " strexh " , " strh " , " strt " , " sub " , " swi " , " swp " , " swpb " , <nl> - " sxtab " , " sxtab16 " , " sxtah " , " sxtb " , " sxtb16 " , " sxth " , " teq " , " tst " , <nl> - " uadd16 " , " uadd8 " , " uasx " , " uhadd16 " , " uhadd8 " , " uhasx " , " uhsax " , " uhsub16 " , <nl> - " uhsub8 " , " umlal " , " umull " , " uqadd16 " , " uqadd8 " , " uqasx " , " uqsax " , " uqsub16 " , <nl> - " uqsub8 " , " usad8 " , " usada8 " , " usat " , " usat16 " , " usax " , " usub16 " , " usub8 " , <nl> - " uxtab " , " uxtab16 " , " uxtah " , " uxtb " , " uxtb16 " , " uxth " , " wfe " , " wfi " , <nl> - " yield " , <nl> - <nl> - " undefined " , " adc " , " add " , " and " , " asr " , " b " , " bic " , " bkpt " , <nl> - " bl " , " blx " , " bx " , " cmn " , " cmp " , " eor " , " ldmia " , " ldr " , <nl> - " ldrb " , " ldrh " , " ldrsb " , " ldrsh " , " lsl " , " lsr " , " mov " , " mul " , <nl> - " mvn " , " neg " , " orr " , " pop " , " push " , " ror " , " sbc " , " stmia " , <nl> - " str " , " strb " , " strh " , " sub " , " swi " , " tst " , <nl> - <nl> - nullptr } ; <nl> - <nl> - / / Indexed by the shift type ( bits 6 - 5 ) <nl> - static const char * shift_names [ ] = { " LSL " , " LSR " , " ASR " , " ROR " } ; <nl> - <nl> - static const char * cond_to_str ( u32 cond ) { <nl> - return cond_names [ cond ] ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : Disassemble ( u32 addr , u32 insn ) { <nl> - Opcode opcode = Decode ( insn ) ; <nl> - switch ( opcode ) { <nl> - case OP_INVALID : <nl> - return " Invalid " ; <nl> - case OP_UNDEFINED : <nl> - return " Undefined " ; <nl> - case OP_ADC : <nl> - case OP_ADD : <nl> - case OP_AND : <nl> - case OP_BIC : <nl> - case OP_CMN : <nl> - case OP_CMP : <nl> - case OP_EOR : <nl> - case OP_MOV : <nl> - case OP_MVN : <nl> - case OP_ORR : <nl> - case OP_RSB : <nl> - case OP_RSC : <nl> - case OP_SBC : <nl> - case OP_SUB : <nl> - case OP_TEQ : <nl> - case OP_TST : <nl> - return DisassembleALU ( opcode , insn ) ; <nl> - case OP_B : <nl> - case OP_BL : <nl> - return DisassembleBranch ( addr , opcode , insn ) ; <nl> - case OP_BKPT : <nl> - return DisassembleBKPT ( insn ) ; <nl> - case OP_BLX : <nl> - / / not supported yet <nl> - break ; <nl> - case OP_BX : <nl> - return DisassembleBX ( insn ) ; <nl> - case OP_CDP : <nl> - return " cdp " ; <nl> - case OP_CLREX : <nl> - return " clrex " ; <nl> - case OP_CLZ : <nl> - return DisassembleCLZ ( insn ) ; <nl> - case OP_LDC : <nl> - return " ldc " ; <nl> - case OP_LDM : <nl> - case OP_STM : <nl> - return DisassembleMemblock ( opcode , insn ) ; <nl> - case OP_LDR : <nl> - case OP_LDRB : <nl> - case OP_LDRBT : <nl> - case OP_LDRT : <nl> - case OP_STR : <nl> - case OP_STRB : <nl> - case OP_STRBT : <nl> - case OP_STRT : <nl> - return DisassembleMem ( insn ) ; <nl> - case OP_LDREX : <nl> - case OP_LDREXB : <nl> - case OP_LDREXD : <nl> - case OP_LDREXH : <nl> - case OP_STREX : <nl> - case OP_STREXB : <nl> - case OP_STREXD : <nl> - case OP_STREXH : <nl> - return DisassembleREX ( opcode , insn ) ; <nl> - case OP_LDRH : <nl> - case OP_LDRSB : <nl> - case OP_LDRSH : <nl> - case OP_STRH : <nl> - return DisassembleMemHalf ( insn ) ; <nl> - case OP_MCR : <nl> - case OP_MRC : <nl> - return DisassembleMCR ( opcode , insn ) ; <nl> - case OP_MLA : <nl> - return DisassembleMLA ( opcode , insn ) ; <nl> - case OP_MRS : <nl> - return DisassembleMRS ( insn ) ; <nl> - case OP_MSR : <nl> - return DisassembleMSR ( insn ) ; <nl> - case OP_MUL : <nl> - return DisassembleMUL ( opcode , insn ) ; <nl> - case OP_NOP : <nl> - case OP_SEV : <nl> - case OP_WFE : <nl> - case OP_WFI : <nl> - case OP_YIELD : <nl> - return DisassembleNoOperands ( opcode , insn ) ; <nl> - case OP_PKH : <nl> - return DisassemblePKH ( insn ) ; <nl> - case OP_PLD : <nl> - return DisassemblePLD ( insn ) ; <nl> - case OP_QADD16 : <nl> - case OP_QADD8 : <nl> - case OP_QASX : <nl> - case OP_QSAX : <nl> - case OP_QSUB16 : <nl> - case OP_QSUB8 : <nl> - case OP_SADD16 : <nl> - case OP_SADD8 : <nl> - case OP_SASX : <nl> - case OP_SHADD16 : <nl> - case OP_SHADD8 : <nl> - case OP_SHASX : <nl> - case OP_SHSAX : <nl> - case OP_SHSUB16 : <nl> - case OP_SHSUB8 : <nl> - case OP_SSAX : <nl> - case OP_SSUB16 : <nl> - case OP_SSUB8 : <nl> - case OP_UADD16 : <nl> - case OP_UADD8 : <nl> - case OP_UASX : <nl> - case OP_UHADD16 : <nl> - case OP_UHADD8 : <nl> - case OP_UHASX : <nl> - case OP_UHSAX : <nl> - case OP_UHSUB16 : <nl> - case OP_UHSUB8 : <nl> - case OP_UQADD16 : <nl> - case OP_UQADD8 : <nl> - case OP_UQASX : <nl> - case OP_UQSAX : <nl> - case OP_UQSUB16 : <nl> - case OP_UQSUB8 : <nl> - case OP_USAX : <nl> - case OP_USUB16 : <nl> - case OP_USUB8 : <nl> - return DisassembleParallelAddSub ( opcode , insn ) ; <nl> - case OP_REV : <nl> - case OP_REV16 : <nl> - case OP_REVSH : <nl> - return DisassembleREV ( opcode , insn ) ; <nl> - case OP_SEL : <nl> - return DisassembleSEL ( insn ) ; <nl> - case OP_SMLAD : <nl> - case OP_SMLALD : <nl> - case OP_SMLSD : <nl> - case OP_SMLSLD : <nl> - case OP_SMMLA : <nl> - case OP_SMMLS : <nl> - case OP_SMMUL : <nl> - case OP_SMUAD : <nl> - case OP_SMUSD : <nl> - case OP_USAD8 : <nl> - case OP_USADA8 : <nl> - return DisassembleMediaMulDiv ( opcode , insn ) ; <nl> - case OP_SSAT : <nl> - case OP_SSAT16 : <nl> - case OP_USAT : <nl> - case OP_USAT16 : <nl> - return DisassembleSAT ( opcode , insn ) ; <nl> - case OP_STC : <nl> - return " stc " ; <nl> - case OP_SWI : <nl> - return DisassembleSWI ( insn ) ; <nl> - case OP_SWP : <nl> - case OP_SWPB : <nl> - return DisassembleSWP ( opcode , insn ) ; <nl> - case OP_SXTAB : <nl> - case OP_SXTAB16 : <nl> - case OP_SXTAH : <nl> - case OP_SXTB : <nl> - case OP_SXTB16 : <nl> - case OP_SXTH : <nl> - case OP_UXTAB : <nl> - case OP_UXTAB16 : <nl> - case OP_UXTAH : <nl> - case OP_UXTB : <nl> - case OP_UXTB16 : <nl> - case OP_UXTH : <nl> - return DisassembleXT ( opcode , insn ) ; <nl> - case OP_UMLAL : <nl> - case OP_UMULL : <nl> - case OP_SMLAL : <nl> - case OP_SMULL : <nl> - return DisassembleUMLAL ( opcode , insn ) ; <nl> - default : <nl> - return " Error " ; <nl> - } <nl> - return nullptr ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleALU ( Opcode opcode , u32 insn ) { <nl> - static const u8 kNoOperand1 = 1 ; <nl> - static const u8 kNoDest = 2 ; <nl> - static const u8 kNoSbit = 4 ; <nl> - <nl> - std : : string rn_str ; <nl> - std : : string rd_str ; <nl> - <nl> - u8 flags = 0 ; <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 is_immed = ( insn > > 25 ) & 0x1 ; <nl> - u8 bit_s = ( insn > > 20 ) & 1 ; <nl> - u8 rn = ( insn > > 16 ) & 0xf ; <nl> - u8 rd = ( insn > > 12 ) & 0xf ; <nl> - u8 immed = insn & 0xff ; <nl> - <nl> - const char * opname = opcode_names [ opcode ] ; <nl> - switch ( opcode ) { <nl> - case OP_CMN : <nl> - case OP_CMP : <nl> - case OP_TEQ : <nl> - case OP_TST : <nl> - flags = kNoDest | kNoSbit ; <nl> - break ; <nl> - case OP_MOV : <nl> - case OP_MVN : <nl> - flags = kNoOperand1 ; <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - <nl> - / / The " mov " instruction ignores the first operand ( rn ) . <nl> - rn_str [ 0 ] = 0 ; <nl> - if ( ( flags & kNoOperand1 ) = = 0 ) { <nl> - rn_str = Common : : StringFromFormat ( " r % d , " , rn ) ; <nl> - } <nl> - <nl> - / / The following instructions do not write the result register ( rd ) : <nl> - / / tst , teq , cmp , cmn . <nl> - rd_str [ 0 ] = 0 ; <nl> - if ( ( flags & kNoDest ) = = 0 ) { <nl> - rd_str = Common : : StringFromFormat ( " r % d , " , rd ) ; <nl> - } <nl> - <nl> - const char * sbit_str = " " ; <nl> - if ( bit_s & & ! ( flags & kNoSbit ) ) <nl> - sbit_str = " s " ; <nl> - <nl> - if ( is_immed ) { <nl> - return Common : : StringFromFormat ( " % s % s % s \ t % s % s # % u ; 0x % x " , opname , cond_to_str ( cond ) , <nl> - sbit_str , rd_str . c_str ( ) , rn_str . c_str ( ) , immed , immed ) ; <nl> - } <nl> - <nl> - u8 shift_is_reg = ( insn > > 4 ) & 1 ; <nl> - u8 rotate = ( insn > > 8 ) & 0xf ; <nl> - u8 rm = insn & 0xf ; <nl> - u8 shift_type = ( insn > > 5 ) & 0x3 ; <nl> - u8 rs = ( insn > > 8 ) & 0xf ; <nl> - u8 shift_amount = ( insn > > 7 ) & 0x1f ; <nl> - u32 rotated_val = immed ; <nl> - u8 rotate2 = rotate < < 1 ; <nl> - rotated_val = ( rotated_val > > rotate2 ) | ( rotated_val < < ( 32 - rotate2 ) ) ; <nl> - <nl> - if ( ! shift_is_reg & & shift_type = = 0 & & shift_amount = = 0 ) { <nl> - return Common : : StringFromFormat ( " % s % s % s \ t % s % sr % d " , opname , cond_to_str ( cond ) , sbit_str , <nl> - rd_str . c_str ( ) , rn_str . c_str ( ) , rm ) ; <nl> - } <nl> - <nl> - const char * shift_name = shift_names [ shift_type ] ; <nl> - if ( shift_is_reg ) { <nl> - return Common : : StringFromFormat ( " % s % s % s \ t % s % sr % d , % s r % d " , opname , cond_to_str ( cond ) , <nl> - sbit_str , rd_str . c_str ( ) , rn_str . c_str ( ) , rm , shift_name , <nl> - rs ) ; <nl> - } <nl> - if ( shift_amount = = 0 ) { <nl> - if ( shift_type = = 3 ) { <nl> - return Common : : StringFromFormat ( " % s % s % s \ t % s % sr % d , RRX " , opname , cond_to_str ( cond ) , <nl> - sbit_str , rd_str . c_str ( ) , rn_str . c_str ( ) , rm ) ; <nl> - } <nl> - shift_amount = 32 ; <nl> - } <nl> - return Common : : StringFromFormat ( " % s % s % s \ t % s % sr % d , % s # % u " , opname , cond_to_str ( cond ) , sbit_str , <nl> - rd_str . c_str ( ) , rn_str . c_str ( ) , rm , shift_name , shift_amount ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleBranch ( u32 addr , Opcode opcode , u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u32 offset = insn & 0xffffff ; <nl> - / / Sign - extend the 24 - bit offset <nl> - if ( ( offset > > 23 ) & 1 ) <nl> - offset | = 0xff000000 ; <nl> - <nl> - / / Pre - compute the left - shift and the prefetch offset <nl> - offset < < = 2 ; <nl> - offset + = 8 ; <nl> - addr + = offset ; <nl> - const char * opname = opcode_names [ opcode ] ; <nl> - return Common : : StringFromFormat ( " % s % s \ t0x % x " , opname , cond_to_str ( cond ) , addr ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleBX ( u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 rn = insn & 0xf ; <nl> - return Common : : StringFromFormat ( " bx % s \ tr % d " , cond_to_str ( cond ) , rn ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleBKPT ( u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u32 immed = ( ( ( insn > > 8 ) & 0xfff ) < < 4 ) | ( insn & 0xf ) ; <nl> - return Common : : StringFromFormat ( " bkpt % s \ t # % d " , cond_to_str ( cond ) , immed ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleCLZ ( u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 rd = ( insn > > 12 ) & 0xf ; <nl> - u8 rm = insn & 0xf ; <nl> - return Common : : StringFromFormat ( " clz % s \ tr % d , r % d " , cond_to_str ( cond ) , rd , rm ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleMediaMulDiv ( Opcode opcode , u32 insn ) { <nl> - u32 cond = BITS ( insn , 28 , 31 ) ; <nl> - u32 rd = BITS ( insn , 16 , 19 ) ; <nl> - u32 ra = BITS ( insn , 12 , 15 ) ; <nl> - u32 rm = BITS ( insn , 8 , 11 ) ; <nl> - u32 m = BIT ( insn , 5 ) ; <nl> - u32 rn = BITS ( insn , 0 , 3 ) ; <nl> - <nl> - std : : string cross = " " ; <nl> - if ( m ) { <nl> - if ( opcode = = OP_SMMLA | | opcode = = OP_SMMUL | | opcode = = OP_SMMLS ) <nl> - cross = " r " ; <nl> - else <nl> - cross = " x " ; <nl> - } <nl> - <nl> - std : : string ext_reg = " " ; <nl> - std : : unordered_set < Opcode , std : : hash < int > > with_ext_reg = { OP_SMLAD , OP_SMLSD , OP_SMMLA , <nl> - OP_SMMLS , OP_USADA8 } ; <nl> - if ( with_ext_reg . find ( opcode ) ! = with_ext_reg . end ( ) ) <nl> - ext_reg = Common : : StringFromFormat ( " , r % u " , ra ) ; <nl> - <nl> - std : : string rd_low = " " ; <nl> - if ( opcode = = OP_SMLALD | | opcode = = OP_SMLSLD ) <nl> - rd_low = Common : : StringFromFormat ( " r % u , " , ra ) ; <nl> - <nl> - return Common : : StringFromFormat ( " % s % s % s \ t % sr % u , r % u , r % u % s " , opcode_names [ opcode ] , <nl> - cross . c_str ( ) , cond_to_str ( cond ) , rd_low . c_str ( ) , rd , rn , rm , <nl> - ext_reg . c_str ( ) ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleMemblock ( Opcode opcode , u32 insn ) { <nl> - std : : string tmp_list ; <nl> - <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 write_back = ( insn > > 21 ) & 0x1 ; <nl> - u8 bit_s = ( insn > > 22 ) & 0x1 ; <nl> - u8 is_up = ( insn > > 23 ) & 0x1 ; <nl> - u8 is_pre = ( insn > > 24 ) & 0x1 ; <nl> - u8 rn = ( insn > > 16 ) & 0xf ; <nl> - u16 reg_list = insn & 0xffff ; <nl> - <nl> - const char * opname = opcode_names [ opcode ] ; <nl> - <nl> - const char * bang = " " ; <nl> - if ( write_back ) <nl> - bang = " ! " ; <nl> - <nl> - const char * carret = " " ; <nl> - if ( bit_s ) <nl> - carret = " ^ " ; <nl> - <nl> - const char * comma = " " ; <nl> - tmp_list [ 0 ] = 0 ; <nl> - for ( int ii = 0 ; ii < 16 ; + + ii ) { <nl> - if ( reg_list & ( 1 < < ii ) ) { <nl> - tmp_list + = Common : : StringFromFormat ( " % sr % d " , comma , ii ) ; <nl> - comma = " , " ; <nl> - } <nl> - } <nl> - <nl> - const char * addr_mode = " " ; <nl> - if ( is_pre ) { <nl> - if ( is_up ) { <nl> - addr_mode = " ib " ; <nl> - } else { <nl> - addr_mode = " db " ; <nl> - } <nl> - } else { <nl> - if ( is_up ) { <nl> - addr_mode = " ia " ; <nl> - } else { <nl> - addr_mode = " da " ; <nl> - } <nl> - } <nl> - <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d % s , { % s } % s " , opname , cond_to_str ( cond ) , addr_mode , <nl> - rn , bang , tmp_list . c_str ( ) , carret ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleMem ( u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 is_reg = ( insn > > 25 ) & 0x1 ; <nl> - u8 is_load = ( insn > > 20 ) & 0x1 ; <nl> - u8 write_back = ( insn > > 21 ) & 0x1 ; <nl> - u8 is_byte = ( insn > > 22 ) & 0x1 ; <nl> - u8 is_up = ( insn > > 23 ) & 0x1 ; <nl> - u8 is_pre = ( insn > > 24 ) & 0x1 ; <nl> - u8 rn = ( insn > > 16 ) & 0xf ; <nl> - u8 rd = ( insn > > 12 ) & 0xf ; <nl> - u16 offset = insn & 0xfff ; <nl> - <nl> - const char * opname = " ldr " ; <nl> - if ( ! is_load ) <nl> - opname = " str " ; <nl> - <nl> - const char * bang = " " ; <nl> - if ( write_back ) <nl> - bang = " ! " ; <nl> - <nl> - const char * minus = " " ; <nl> - if ( is_up = = 0 ) <nl> - minus = " - " ; <nl> - <nl> - const char * byte = " " ; <nl> - if ( is_byte ) <nl> - byte = " b " ; <nl> - <nl> - if ( is_reg = = 0 ) { <nl> - if ( is_pre ) { <nl> - if ( offset = = 0 ) { <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , [ r % d ] " , opname , cond_to_str ( cond ) , <nl> - byte , rd , rn ) ; <nl> - } else { <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , [ r % d , # % s % u ] % s " , opname , <nl> - cond_to_str ( cond ) , byte , rd , rn , minus , offset , <nl> - bang ) ; <nl> - } <nl> - } else { <nl> - const char * transfer = " " ; <nl> - if ( write_back ) <nl> - transfer = " t " ; <nl> - <nl> - return Common : : StringFromFormat ( " % s % s % s % s \ tr % d , [ r % d ] , # % s % u " , opname , <nl> - cond_to_str ( cond ) , byte , transfer , rd , rn , minus , <nl> - offset ) ; <nl> - } <nl> - } <nl> - <nl> - u8 rm = insn & 0xf ; <nl> - u8 shift_type = ( insn > > 5 ) & 0x3 ; <nl> - u8 shift_amount = ( insn > > 7 ) & 0x1f ; <nl> - <nl> - const char * shift_name = shift_names [ shift_type ] ; <nl> - <nl> - if ( is_pre ) { <nl> - if ( shift_amount = = 0 ) { <nl> - if ( shift_type = = 0 ) { <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , [ r % d , % sr % d ] % s " , opname , <nl> - cond_to_str ( cond ) , byte , rd , rn , minus , rm , bang ) ; <nl> - } <nl> - if ( shift_type = = 3 ) { <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , [ r % d , % sr % d , RRX ] % s " , opname , <nl> - cond_to_str ( cond ) , byte , rd , rn , minus , rm , bang ) ; <nl> - } <nl> - shift_amount = 32 ; <nl> - } <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , [ r % d , % sr % d , % s # % u ] % s " , opname , <nl> - cond_to_str ( cond ) , byte , rd , rn , minus , rm , shift_name , <nl> - shift_amount , bang ) ; <nl> - } <nl> - <nl> - const char * transfer = " " ; <nl> - if ( write_back ) <nl> - transfer = " t " ; <nl> - <nl> - if ( shift_amount = = 0 ) { <nl> - if ( shift_type = = 0 ) { <nl> - return Common : : StringFromFormat ( " % s % s % s % s \ tr % d , [ r % d ] , % sr % d " , opname , <nl> - cond_to_str ( cond ) , byte , transfer , rd , rn , minus , rm ) ; <nl> - } <nl> - if ( shift_type = = 3 ) { <nl> - return Common : : StringFromFormat ( " % s % s % s % s \ tr % d , [ r % d ] , % sr % d , RRX " , opname , <nl> - cond_to_str ( cond ) , byte , transfer , rd , rn , minus , rm ) ; <nl> - } <nl> - shift_amount = 32 ; <nl> - } <nl> - <nl> - return Common : : StringFromFormat ( " % s % s % s % s \ tr % d , [ r % d ] , % sr % d , % s # % u " , opname , <nl> - cond_to_str ( cond ) , byte , transfer , rd , rn , minus , rm , <nl> - shift_name , shift_amount ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleMemHalf ( u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 is_load = ( insn > > 20 ) & 0x1 ; <nl> - u8 write_back = ( insn > > 21 ) & 0x1 ; <nl> - u8 is_immed = ( insn > > 22 ) & 0x1 ; <nl> - u8 is_up = ( insn > > 23 ) & 0x1 ; <nl> - u8 is_pre = ( insn > > 24 ) & 0x1 ; <nl> - u8 rn = ( insn > > 16 ) & 0xf ; <nl> - u8 rd = ( insn > > 12 ) & 0xf ; <nl> - u8 bits_65 = ( insn > > 5 ) & 0x3 ; <nl> - u8 rm = insn & 0xf ; <nl> - u8 offset = ( ( ( insn > > 8 ) & 0xf ) < < 4 ) | ( insn & 0xf ) ; <nl> - <nl> - const char * opname = " ldr " ; <nl> - if ( is_load = = 0 ) <nl> - opname = " str " ; <nl> - <nl> - const char * width = " " ; <nl> - if ( bits_65 = = 1 ) <nl> - width = " h " ; <nl> - else if ( bits_65 = = 2 ) <nl> - width = " sb " ; <nl> - else <nl> - width = " sh " ; <nl> - <nl> - const char * bang = " " ; <nl> - if ( write_back ) <nl> - bang = " ! " ; <nl> - const char * minus = " " ; <nl> - if ( is_up = = 0 ) <nl> - minus = " - " ; <nl> - <nl> - if ( is_immed ) { <nl> - if ( is_pre ) { <nl> - if ( offset = = 0 ) { <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , [ r % d ] " , opname , cond_to_str ( cond ) , <nl> - width , rd , rn ) ; <nl> - } else { <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , [ r % d , # % s % u ] % s " , opname , <nl> - cond_to_str ( cond ) , width , rd , rn , minus , offset , <nl> - bang ) ; <nl> - } <nl> - } else { <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , [ r % d ] , # % s % u " , opname , cond_to_str ( cond ) , <nl> - width , rd , rn , minus , offset ) ; <nl> - } <nl> - } <nl> - <nl> - if ( is_pre ) { <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , [ r % d , % sr % d ] % s " , opname , cond_to_str ( cond ) , <nl> - width , rd , rn , minus , rm , bang ) ; <nl> - } else { <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , [ r % d ] , % sr % d " , opname , cond_to_str ( cond ) , <nl> - width , rd , rn , minus , rm ) ; <nl> - } <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleMCR ( Opcode opcode , u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 crn = ( insn > > 16 ) & 0xf ; <nl> - u8 crd = ( insn > > 12 ) & 0xf ; <nl> - u8 cpnum = ( insn > > 8 ) & 0xf ; <nl> - u8 opcode2 = ( insn > > 5 ) & 0x7 ; <nl> - u8 crm = insn & 0xf ; <nl> - <nl> - const char * opname = opcode_names [ opcode ] ; <nl> - return Common : : StringFromFormat ( " % s % s \ t % d , 0 , r % d , cr % d , cr % d , { % d } " , opname , cond_to_str ( cond ) , <nl> - cpnum , crd , crn , crm , opcode2 ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleMLA ( Opcode opcode , u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 rd = ( insn > > 16 ) & 0xf ; <nl> - u8 rn = ( insn > > 12 ) & 0xf ; <nl> - u8 rs = ( insn > > 8 ) & 0xf ; <nl> - u8 rm = insn & 0xf ; <nl> - u8 bit_s = ( insn > > 20 ) & 1 ; <nl> - <nl> - const char * opname = opcode_names [ opcode ] ; <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , r % d , r % d , r % d " , opname , cond_to_str ( cond ) , <nl> - bit_s ? " s " : " " , rd , rm , rs , rn ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleUMLAL ( Opcode opcode , u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 rdhi = ( insn > > 16 ) & 0xf ; <nl> - u8 rdlo = ( insn > > 12 ) & 0xf ; <nl> - u8 rs = ( insn > > 8 ) & 0xf ; <nl> - u8 rm = insn & 0xf ; <nl> - u8 bit_s = ( insn > > 20 ) & 1 ; <nl> - <nl> - const char * opname = opcode_names [ opcode ] ; <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , r % d , r % d , r % d " , opname , cond_to_str ( cond ) , <nl> - bit_s ? " s " : " " , rdlo , rdhi , rm , rs ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleMUL ( Opcode opcode , u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 rd = ( insn > > 16 ) & 0xf ; <nl> - u8 rs = ( insn > > 8 ) & 0xf ; <nl> - u8 rm = insn & 0xf ; <nl> - u8 bit_s = ( insn > > 20 ) & 1 ; <nl> - <nl> - const char * opname = opcode_names [ opcode ] ; <nl> - return Common : : StringFromFormat ( " % s % s % s \ tr % d , r % d , r % d " , opname , cond_to_str ( cond ) , <nl> - bit_s ? " s " : " " , rd , rm , rs ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleMRS ( u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 rd = ( insn > > 12 ) & 0xf ; <nl> - u8 ps = ( insn > > 22 ) & 1 ; <nl> - <nl> - return Common : : StringFromFormat ( " mrs % s \ tr % d , % s " , cond_to_str ( cond ) , rd , ps ? " spsr " : " cpsr " ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleMSR ( u32 insn ) { <nl> - char flags [ 8 ] ; <nl> - int flag_index = 0 ; <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 is_immed = ( insn > > 25 ) & 0x1 ; <nl> - u8 pd = ( insn > > 22 ) & 1 ; <nl> - u8 mask = ( insn > > 16 ) & 0xf ; <nl> - <nl> - if ( mask & 1 ) <nl> - flags [ flag_index + + ] = ' c ' ; <nl> - if ( mask & 2 ) <nl> - flags [ flag_index + + ] = ' x ' ; <nl> - if ( mask & 4 ) <nl> - flags [ flag_index + + ] = ' s ' ; <nl> - if ( mask & 8 ) <nl> - flags [ flag_index + + ] = ' f ' ; <nl> - flags [ flag_index ] = 0 ; <nl> - <nl> - if ( is_immed ) { <nl> - u32 immed = insn & 0xff ; <nl> - u8 rotate = ( insn > > 8 ) & 0xf ; <nl> - u8 rotate2 = rotate < < 1 ; <nl> - u32 rotated_val = ( immed > > rotate2 ) | ( immed < < ( 32 - rotate2 ) ) ; <nl> - return Common : : StringFromFormat ( " msr % s \ t % s_ % s , # 0x % x " , cond_to_str ( cond ) , <nl> - pd ? " spsr " : " cpsr " , flags , rotated_val ) ; <nl> - } <nl> - <nl> - u8 rm = insn & 0xf ; <nl> - <nl> - return Common : : StringFromFormat ( " msr % s \ t % s_ % s , r % d " , cond_to_str ( cond ) , pd ? " spsr " : " cpsr " , <nl> - flags , rm ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleNoOperands ( Opcode opcode , u32 insn ) { <nl> - u32 cond = BITS ( insn , 28 , 31 ) ; <nl> - return Common : : StringFromFormat ( " % s % s " , opcode_names [ opcode ] , cond_to_str ( cond ) ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleParallelAddSub ( Opcode opcode , u32 insn ) { <nl> - u32 cond = BITS ( insn , 28 , 31 ) ; <nl> - u32 rn = BITS ( insn , 16 , 19 ) ; <nl> - u32 rd = BITS ( insn , 12 , 15 ) ; <nl> - u32 rm = BITS ( insn , 0 , 3 ) ; <nl> - <nl> - return Common : : StringFromFormat ( " % s % s \ tr % u , r % u , r % u " , opcode_names [ opcode ] , cond_to_str ( cond ) , <nl> - rd , rn , rm ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassemblePKH ( u32 insn ) { <nl> - u32 cond = BITS ( insn , 28 , 31 ) ; <nl> - u32 rn = BITS ( insn , 16 , 19 ) ; <nl> - u32 rd = BITS ( insn , 12 , 15 ) ; <nl> - u32 imm5 = BITS ( insn , 7 , 11 ) ; <nl> - u32 tb = BIT ( insn , 6 ) ; <nl> - u32 rm = BITS ( insn , 0 , 3 ) ; <nl> - <nl> - std : : string suffix = tb ? " tb " : " bt " ; <nl> - std : : string shift = " " ; <nl> - <nl> - if ( tb & & imm5 = = 0 ) <nl> - imm5 = 32 ; <nl> - <nl> - if ( imm5 > 0 ) { <nl> - shift = tb ? " , ASR " : " , LSL " ; <nl> - shift + = " # " + std : : to_string ( imm5 ) ; <nl> - } <nl> - <nl> - return Common : : StringFromFormat ( " pkh % s % s \ tr % u , r % u , r % u % s " , suffix . c_str ( ) , cond_to_str ( cond ) , <nl> - rd , rn , rm , shift . c_str ( ) ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassemblePLD ( u32 insn ) { <nl> - u8 is_reg = ( insn > > 25 ) & 0x1 ; <nl> - u8 is_up = ( insn > > 23 ) & 0x1 ; <nl> - u8 rn = ( insn > > 16 ) & 0xf ; <nl> - <nl> - const char * minus = " " ; <nl> - if ( is_up = = 0 ) <nl> - minus = " - " ; <nl> - <nl> - if ( is_reg ) { <nl> - u8 rm = insn & 0xf ; <nl> - return Common : : StringFromFormat ( " pld \ t [ r % d , % sr % d ] " , rn , minus , rm ) ; <nl> - } <nl> - <nl> - u16 offset = insn & 0xfff ; <nl> - if ( offset = = 0 ) { <nl> - return Common : : StringFromFormat ( " pld \ t [ r % d ] " , rn ) ; <nl> - } else { <nl> - return Common : : StringFromFormat ( " pld \ t [ r % d , # % s % u ] " , rn , minus , offset ) ; <nl> - } <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleREV ( Opcode opcode , u32 insn ) { <nl> - u32 cond = BITS ( insn , 28 , 31 ) ; <nl> - u32 rd = BITS ( insn , 12 , 15 ) ; <nl> - u32 rm = BITS ( insn , 0 , 3 ) ; <nl> - <nl> - return Common : : StringFromFormat ( " % s % s \ tr % u , r % u " , opcode_names [ opcode ] , cond_to_str ( cond ) , rd , <nl> - rm ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleREX ( Opcode opcode , u32 insn ) { <nl> - u32 rn = BITS ( insn , 16 , 19 ) ; <nl> - u32 rd = BITS ( insn , 12 , 15 ) ; <nl> - u32 rt = BITS ( insn , 0 , 3 ) ; <nl> - u32 cond = BITS ( insn , 28 , 31 ) ; <nl> - <nl> - switch ( opcode ) { <nl> - case OP_STREX : <nl> - case OP_STREXB : <nl> - case OP_STREXH : <nl> - return Common : : StringFromFormat ( " % s % s \ tr % d , r % d , [ r % d ] " , opcode_names [ opcode ] , <nl> - cond_to_str ( cond ) , rd , rt , rn ) ; <nl> - case OP_STREXD : <nl> - return Common : : StringFromFormat ( " % s % s \ tr % d , r % d , r % d , [ r % d ] " , opcode_names [ opcode ] , <nl> - cond_to_str ( cond ) , rd , rt , rt + 1 , rn ) ; <nl> - <nl> - / / for LDREX instructions , rd corresponds to Rt from reference manual <nl> - case OP_LDREX : <nl> - case OP_LDREXB : <nl> - case OP_LDREXH : <nl> - return Common : : StringFromFormat ( " % s % s \ tr % d , [ r % d ] " , opcode_names [ opcode ] , cond_to_str ( cond ) , <nl> - rd , rn ) ; <nl> - case OP_LDREXD : <nl> - return Common : : StringFromFormat ( " % s % s \ tr % d , r % d , [ r % d ] " , opcode_names [ opcode ] , <nl> - cond_to_str ( cond ) , rd , rd + 1 , rn ) ; <nl> - default : <nl> - return opcode_names [ OP_UNDEFINED ] ; <nl> - } <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleSAT ( Opcode opcode , u32 insn ) { <nl> - u32 cond = BITS ( insn , 28 , 31 ) ; <nl> - u32 sat_imm = BITS ( insn , 16 , 20 ) ; <nl> - u32 rd = BITS ( insn , 12 , 15 ) ; <nl> - u32 imm5 = BITS ( insn , 7 , 11 ) ; <nl> - u32 sh = BIT ( insn , 6 ) ; <nl> - u32 rn = BITS ( insn , 0 , 3 ) ; <nl> - <nl> - std : : string shift_part = " " ; <nl> - bool opcode_has_shift = ( opcode = = OP_SSAT ) | | ( opcode = = OP_USAT ) ; <nl> - if ( opcode_has_shift & & ! ( sh = = 0 & & imm5 = = 0 ) ) { <nl> - if ( sh = = 0 ) <nl> - shift_part + = " , LSL # " ; <nl> - else <nl> - shift_part + = " , ASR # " ; <nl> - <nl> - if ( imm5 = = 0 ) <nl> - imm5 = 32 ; <nl> - shift_part + = std : : to_string ( imm5 ) ; <nl> - } <nl> - <nl> - if ( opcode = = OP_SSAT | | opcode = = OP_SSAT16 ) <nl> - sat_imm + + ; <nl> - <nl> - return Common : : StringFromFormat ( " % s % s \ tr % u , # % u , r % u % s " , opcode_names [ opcode ] , <nl> - cond_to_str ( cond ) , rd , sat_imm , rn , shift_part . c_str ( ) ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleSEL ( u32 insn ) { <nl> - u32 cond = BITS ( insn , 28 , 31 ) ; <nl> - u32 rn = BITS ( insn , 16 , 19 ) ; <nl> - u32 rd = BITS ( insn , 12 , 15 ) ; <nl> - u32 rm = BITS ( insn , 0 , 3 ) ; <nl> - <nl> - return Common : : StringFromFormat ( " % s % s \ tr % u , r % u , r % u " , opcode_names [ OP_SEL ] , cond_to_str ( cond ) , <nl> - rd , rn , rm ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleSWI ( u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u32 sysnum = insn & 0x00ffffff ; <nl> - <nl> - return Common : : StringFromFormat ( " swi % s 0x % x " , cond_to_str ( cond ) , sysnum ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleSWP ( Opcode opcode , u32 insn ) { <nl> - u8 cond = ( insn > > 28 ) & 0xf ; <nl> - u8 rn = ( insn > > 16 ) & 0xf ; <nl> - u8 rd = ( insn > > 12 ) & 0xf ; <nl> - u8 rm = insn & 0xf ; <nl> - <nl> - const char * opname = opcode_names [ opcode ] ; <nl> - return Common : : StringFromFormat ( " % s % s \ tr % d , r % d , [ r % d ] " , opname , cond_to_str ( cond ) , rd , rm , rn ) ; <nl> - } <nl> - <nl> - std : : string ARM_Disasm : : DisassembleXT ( Opcode opcode , u32 insn ) { <nl> - u32 cond = BITS ( insn , 28 , 31 ) ; <nl> - u32 rn = BITS ( insn , 16 , 19 ) ; <nl> - u32 rd = BITS ( insn , 12 , 15 ) ; <nl> - u32 rotate = BITS ( insn , 10 , 11 ) ; <nl> - u32 rm = BITS ( insn , 0 , 3 ) ; <nl> - <nl> - std : : string rn_part = " " ; <nl> - static std : : unordered_set < Opcode , std : : hash < int > > extend_with_add = { <nl> - OP_SXTAB , OP_SXTAB16 , OP_SXTAH , OP_UXTAB , OP_UXTAB16 , OP_UXTAH } ; <nl> - if ( extend_with_add . find ( opcode ) ! = extend_with_add . end ( ) ) <nl> - rn_part = " , r " + std : : to_string ( rn ) ; <nl> - <nl> - std : : string rotate_part = " " ; <nl> - if ( rotate ! = 0 ) <nl> - rotate_part = " , ROR # " + std : : to_string ( rotate < < 3 ) ; <nl> - <nl> - return Common : : StringFromFormat ( " % s % s \ tr % u % s , r % u % s " , opcode_names [ opcode ] , cond_to_str ( cond ) , <nl> - rd , rn_part . c_str ( ) , rm , rotate_part . c_str ( ) ) ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : Decode ( u32 insn ) { <nl> - u32 bits27_26 = ( insn > > 26 ) & 0x3 ; <nl> - switch ( bits27_26 ) { <nl> - case 0x0 : <nl> - return Decode00 ( insn ) ; <nl> - case 0x1 : <nl> - return Decode01 ( insn ) ; <nl> - case 0x2 : <nl> - return Decode10 ( insn ) ; <nl> - case 0x3 : <nl> - return Decode11 ( insn ) ; <nl> - } <nl> - return OP_INVALID ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : Decode00 ( u32 insn ) { <nl> - u8 bit25 = ( insn > > 25 ) & 0x1 ; <nl> - u8 bit4 = ( insn > > 4 ) & 0x1 ; <nl> - if ( bit25 = = 0 & & bit4 = = 1 ) { <nl> - if ( ( insn & 0x0ffffff0 ) = = 0x012fff10 ) { <nl> - / / Bx instruction <nl> - return OP_BX ; <nl> - } <nl> - if ( ( insn & 0x0ff000f0 ) = = 0x01600010 ) { <nl> - / / Clz instruction <nl> - return OP_CLZ ; <nl> - } <nl> - if ( ( insn & 0xfff000f0 ) = = 0xe1200070 ) { <nl> - / / Bkpt instruction <nl> - return OP_BKPT ; <nl> - } <nl> - u32 bits7_4 = ( insn > > 4 ) & 0xf ; <nl> - if ( bits7_4 = = 0x9 ) { <nl> - u32 bit24 = BIT ( insn , 24 ) ; <nl> - if ( bit24 ) { <nl> - return DecodeSyncPrimitive ( insn ) ; <nl> - } <nl> - / / One of the multiply instructions <nl> - return DecodeMUL ( insn ) ; <nl> - } <nl> - <nl> - u8 bit7 = ( insn > > 7 ) & 0x1 ; <nl> - if ( bit7 = = 1 ) { <nl> - / / One of the load / store halfword / byte instructions <nl> - return DecodeLDRH ( insn ) ; <nl> - } <nl> - } <nl> - <nl> - u32 op1 = BITS ( insn , 20 , 24 ) ; <nl> - if ( bit25 & & ( op1 = = 0x12 | | op1 = = 0x16 ) ) { <nl> - / / One of the MSR ( immediate ) and hints instructions <nl> - return DecodeMSRImmAndHints ( insn ) ; <nl> - } <nl> - <nl> - / / One of the data processing instructions <nl> - return DecodeALU ( insn ) ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : Decode01 ( u32 insn ) { <nl> - u8 is_reg = ( insn > > 25 ) & 0x1 ; <nl> - u8 bit4 = ( insn > > 4 ) & 0x1 ; <nl> - if ( is_reg = = 1 & & bit4 = = 1 ) <nl> - return DecodeMedia ( insn ) ; <nl> - u8 is_load = ( insn > > 20 ) & 0x1 ; <nl> - u8 is_byte = ( insn > > 22 ) & 0x1 ; <nl> - if ( ( insn & 0xfd70f000 ) = = 0xf550f000 ) { <nl> - / / Pre - load <nl> - return OP_PLD ; <nl> - } <nl> - if ( insn = = 0xf57ff01f ) { <nl> - / / Clear - Exclusive <nl> - return OP_CLREX ; <nl> - } <nl> - if ( is_load ) { <nl> - if ( is_byte ) { <nl> - / / Load byte <nl> - return OP_LDRB ; <nl> - } <nl> - / / Load word <nl> - return OP_LDR ; <nl> - } <nl> - if ( is_byte ) { <nl> - / / Store byte <nl> - return OP_STRB ; <nl> - } <nl> - / / Store word <nl> - return OP_STR ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : Decode10 ( u32 insn ) { <nl> - u8 bit25 = ( insn > > 25 ) & 0x1 ; <nl> - if ( bit25 = = 0 ) { <nl> - / / LDM / STM <nl> - u8 is_load = ( insn > > 20 ) & 0x1 ; <nl> - if ( is_load ) <nl> - return OP_LDM ; <nl> - return OP_STM ; <nl> - } <nl> - <nl> - / / Branch with link <nl> - if ( ( insn > > 24 ) & 1 ) <nl> - return OP_BL ; <nl> - <nl> - return OP_B ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : Decode11 ( u32 insn ) { <nl> - u8 bit25 = ( insn > > 25 ) & 0x1 ; <nl> - if ( bit25 = = 0 ) { <nl> - / / LDC , SDC <nl> - u8 is_load = ( insn > > 20 ) & 0x1 ; <nl> - if ( is_load ) { <nl> - / / LDC <nl> - return OP_LDC ; <nl> - } <nl> - / / STC <nl> - return OP_STC ; <nl> - } <nl> - <nl> - u8 bit24 = ( insn > > 24 ) & 0x1 ; <nl> - if ( bit24 = = 0x1 ) { <nl> - / / SWI <nl> - return OP_SWI ; <nl> - } <nl> - <nl> - u8 bit4 = ( insn > > 4 ) & 0x1 ; <nl> - u8 cpnum = ( insn > > 8 ) & 0xf ; <nl> - <nl> - if ( cpnum = = 15 ) { <nl> - / / Special case for coprocessor 15 <nl> - u8 opcode = ( insn > > 21 ) & 0x7 ; <nl> - if ( bit4 = = 0 | | opcode ! = 0 ) { <nl> - / / This is an unexpected bit pattern . Create an undefined <nl> - / / instruction in case this is ever executed . <nl> - return OP_UNDEFINED ; <nl> - } <nl> - <nl> - / / MRC , MCR <nl> - u8 is_mrc = ( insn > > 20 ) & 0x1 ; <nl> - if ( is_mrc ) <nl> - return OP_MRC ; <nl> - return OP_MCR ; <nl> - } <nl> - <nl> - if ( bit4 = = 0 ) { <nl> - / / CDP <nl> - return OP_CDP ; <nl> - } <nl> - / / MRC , MCR <nl> - u8 is_mrc = ( insn > > 20 ) & 0x1 ; <nl> - if ( is_mrc ) <nl> - return OP_MRC ; <nl> - return OP_MCR ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : DecodeSyncPrimitive ( u32 insn ) { <nl> - u32 op = BITS ( insn , 20 , 23 ) ; <nl> - u32 bit22 = BIT ( insn , 22 ) ; <nl> - switch ( op ) { <nl> - case 0x0 : <nl> - if ( bit22 ) <nl> - return OP_SWPB ; <nl> - return OP_SWP ; <nl> - case 0x8 : <nl> - return OP_STREX ; <nl> - case 0x9 : <nl> - return OP_LDREX ; <nl> - case 0xA : <nl> - return OP_STREXD ; <nl> - case 0xB : <nl> - return OP_LDREXD ; <nl> - case 0xC : <nl> - return OP_STREXB ; <nl> - case 0xD : <nl> - return OP_LDREXB ; <nl> - case 0xE : <nl> - return OP_STREXH ; <nl> - case 0xF : <nl> - return OP_LDREXH ; <nl> - default : <nl> - return OP_UNDEFINED ; <nl> - } <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : DecodeParallelAddSub ( u32 insn ) { <nl> - u32 op1 = BITS ( insn , 20 , 21 ) ; <nl> - u32 op2 = BITS ( insn , 5 , 7 ) ; <nl> - u32 is_unsigned = BIT ( insn , 22 ) ; <nl> - <nl> - if ( op1 = = 0x0 | | op2 = = 0x5 | | op2 = = 0x6 ) <nl> - return OP_UNDEFINED ; <nl> - <nl> - / / change op1 range from [ 1 , 3 ] to range [ 0 , 2 ] <nl> - op1 - - ; <nl> - <nl> - / / change op2 range from [ 0 , 4 ] U { 7 } to range [ 0 , 5 ] <nl> - if ( op2 = = 0x7 ) <nl> - op2 = 0x5 ; <nl> - <nl> - static std : : vector < Opcode > opcodes = { <nl> - / / op1 = 0 <nl> - OP_SADD16 , OP_UADD16 , OP_SASX , OP_UASX , OP_SSAX , OP_USAX , OP_SSUB16 , OP_USUB16 , OP_SADD8 , <nl> - OP_UADD8 , OP_SSUB8 , OP_USUB8 , <nl> - / / op1 = 1 <nl> - OP_QADD16 , OP_UQADD16 , OP_QASX , OP_UQASX , OP_QSAX , OP_UQSAX , OP_QSUB16 , OP_UQSUB16 , <nl> - OP_QADD8 , OP_UQADD8 , OP_QSUB8 , OP_UQSUB8 , <nl> - / / op1 = 2 <nl> - OP_SHADD16 , OP_UHADD16 , OP_SHASX , OP_UHASX , OP_SHSAX , OP_UHSAX , OP_SHSUB16 , OP_UHSUB16 , <nl> - OP_SHADD8 , OP_UHADD8 , OP_SHSUB8 , OP_UHSUB8 } ; <nl> - <nl> - u32 opcode_index = op1 * 12 + op2 * 2 + is_unsigned ; <nl> - return opcodes [ opcode_index ] ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : DecodePackingSaturationReversal ( u32 insn ) { <nl> - u32 op1 = BITS ( insn , 20 , 22 ) ; <nl> - u32 a = BITS ( insn , 16 , 19 ) ; <nl> - u32 op2 = BITS ( insn , 5 , 7 ) ; <nl> - <nl> - switch ( op1 ) { <nl> - case 0x0 : <nl> - if ( BIT ( op2 , 0 ) = = 0 ) <nl> - return OP_PKH ; <nl> - if ( op2 = = 0x3 & & a ! = 0xf ) <nl> - return OP_SXTAB16 ; <nl> - if ( op2 = = 0x3 & & a = = 0xf ) <nl> - return OP_SXTB16 ; <nl> - if ( op2 = = 0x5 ) <nl> - return OP_SEL ; <nl> - break ; <nl> - case 0x2 : <nl> - if ( BIT ( op2 , 0 ) = = 0 ) <nl> - return OP_SSAT ; <nl> - if ( op2 = = 0x1 ) <nl> - return OP_SSAT16 ; <nl> - if ( op2 = = 0x3 & & a ! = 0xf ) <nl> - return OP_SXTAB ; <nl> - if ( op2 = = 0x3 & & a = = 0xf ) <nl> - return OP_SXTB ; <nl> - break ; <nl> - case 0x3 : <nl> - if ( op2 = = 0x1 ) <nl> - return OP_REV ; <nl> - if ( BIT ( op2 , 0 ) = = 0 ) <nl> - return OP_SSAT ; <nl> - if ( op2 = = 0x3 & & a ! = 0xf ) <nl> - return OP_SXTAH ; <nl> - if ( op2 = = 0x3 & & a = = 0xf ) <nl> - return OP_SXTH ; <nl> - if ( op2 = = 0x5 ) <nl> - return OP_REV16 ; <nl> - break ; <nl> - case 0x4 : <nl> - if ( op2 = = 0x3 & & a ! = 0xf ) <nl> - return OP_UXTAB16 ; <nl> - if ( op2 = = 0x3 & & a = = 0xf ) <nl> - return OP_UXTB16 ; <nl> - break ; <nl> - case 0x6 : <nl> - if ( BIT ( op2 , 0 ) = = 0 ) <nl> - return OP_USAT ; <nl> - if ( op2 = = 0x1 ) <nl> - return OP_USAT16 ; <nl> - if ( op2 = = 0x3 & & a ! = 0xf ) <nl> - return OP_UXTAB ; <nl> - if ( op2 = = 0x3 & & a = = 0xf ) <nl> - return OP_UXTB ; <nl> - break ; <nl> - case 0x7 : <nl> - if ( BIT ( op2 , 0 ) = = 0 ) <nl> - return OP_USAT ; <nl> - if ( op2 = = 0x3 & & a ! = 0xf ) <nl> - return OP_UXTAH ; <nl> - if ( op2 = = 0x3 & & a = = 0xf ) <nl> - return OP_UXTH ; <nl> - if ( op2 = = 0x5 ) <nl> - return OP_REVSH ; <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - <nl> - return OP_UNDEFINED ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : DecodeMUL ( u32 insn ) { <nl> - u8 bit24 = ( insn > > 24 ) & 0x1 ; <nl> - if ( bit24 ! = 0 ) { <nl> - / / This is an unexpected bit pattern . Create an undefined <nl> - / / instruction in case this is ever executed . <nl> - return OP_UNDEFINED ; <nl> - } <nl> - u8 bit23 = ( insn > > 23 ) & 0x1 ; <nl> - u8 bit22_U = ( insn > > 22 ) & 0x1 ; <nl> - u8 bit21_A = ( insn > > 21 ) & 0x1 ; <nl> - if ( bit23 = = 0 ) { <nl> - / / 32 - bit multiply <nl> - if ( bit22_U ! = 0 ) { <nl> - / / This is an unexpected bit pattern . Create an undefined <nl> - / / instruction in case this is ever executed . <nl> - return OP_UNDEFINED ; <nl> - } <nl> - if ( bit21_A = = 0 ) <nl> - return OP_MUL ; <nl> - return OP_MLA ; <nl> - } <nl> - / / 64 - bit multiply <nl> - if ( bit22_U = = 0 ) { <nl> - / / Unsigned multiply long <nl> - if ( bit21_A = = 0 ) <nl> - return OP_UMULL ; <nl> - return OP_UMLAL ; <nl> - } <nl> - / / Signed multiply long <nl> - if ( bit21_A = = 0 ) <nl> - return OP_SMULL ; <nl> - return OP_SMLAL ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : DecodeMSRImmAndHints ( u32 insn ) { <nl> - u32 op = BIT ( insn , 22 ) ; <nl> - u32 op1 = BITS ( insn , 16 , 19 ) ; <nl> - u32 op2 = BITS ( insn , 0 , 7 ) ; <nl> - <nl> - if ( op = = 0 & & op1 = = 0 ) { <nl> - switch ( op2 ) { <nl> - case 0x0 : <nl> - return OP_NOP ; <nl> - case 0x1 : <nl> - return OP_YIELD ; <nl> - case 0x2 : <nl> - return OP_WFE ; <nl> - case 0x3 : <nl> - return OP_WFI ; <nl> - case 0x4 : <nl> - return OP_SEV ; <nl> - default : <nl> - return OP_UNDEFINED ; <nl> - } <nl> - } <nl> - <nl> - return OP_MSR ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : DecodeMediaMulDiv ( u32 insn ) { <nl> - u32 op1 = BITS ( insn , 20 , 22 ) ; <nl> - u32 op2_h = BITS ( insn , 6 , 7 ) ; <nl> - u32 a = BITS ( insn , 12 , 15 ) ; <nl> - <nl> - switch ( op1 ) { <nl> - case 0x0 : <nl> - if ( op2_h = = 0x0 ) { <nl> - if ( a ! = 0xf ) <nl> - return OP_SMLAD ; <nl> - else <nl> - return OP_SMUAD ; <nl> - } else if ( op2_h = = 0x1 ) { <nl> - if ( a ! = 0xf ) <nl> - return OP_SMLSD ; <nl> - else <nl> - return OP_SMUSD ; <nl> - } <nl> - break ; <nl> - case 0x4 : <nl> - if ( op2_h = = 0x0 ) <nl> - return OP_SMLALD ; <nl> - else if ( op2_h = = 0x1 ) <nl> - return OP_SMLSLD ; <nl> - break ; <nl> - case 0x5 : <nl> - if ( op2_h = = 0x0 ) { <nl> - if ( a ! = 0xf ) <nl> - return OP_SMMLA ; <nl> - else <nl> - return OP_SMMUL ; <nl> - } else if ( op2_h = = 0x3 ) { <nl> - return OP_SMMLS ; <nl> - } <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - <nl> - return OP_UNDEFINED ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : DecodeMedia ( u32 insn ) { <nl> - u32 op1 = BITS ( insn , 20 , 24 ) ; <nl> - u32 rd = BITS ( insn , 12 , 15 ) ; <nl> - u32 op2 = BITS ( insn , 5 , 7 ) ; <nl> - <nl> - switch ( BITS ( op1 , 3 , 4 ) ) { <nl> - case 0x0 : <nl> - / / unsigned and signed parallel addition and subtraction <nl> - return DecodeParallelAddSub ( insn ) ; <nl> - case 0x1 : <nl> - / / Packing , unpacking , saturation , and reversal <nl> - return DecodePackingSaturationReversal ( insn ) ; <nl> - case 0x2 : <nl> - / / Signed multiply , signed and unsigned divide <nl> - return DecodeMediaMulDiv ( insn ) ; <nl> - case 0x3 : <nl> - if ( op2 = = 0 & & rd = = 0xf ) <nl> - return OP_USAD8 ; <nl> - if ( op2 = = 0 & & rd ! = 0xf ) <nl> - return OP_USADA8 ; <nl> - break ; <nl> - default : <nl> - break ; <nl> - } <nl> - <nl> - return OP_UNDEFINED ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : DecodeLDRH ( u32 insn ) { <nl> - u8 is_load = ( insn > > 20 ) & 0x1 ; <nl> - u8 bits_65 = ( insn > > 5 ) & 0x3 ; <nl> - if ( is_load ) { <nl> - if ( bits_65 = = 0x1 ) { <nl> - / / Load unsigned halfword <nl> - return OP_LDRH ; <nl> - } else if ( bits_65 = = 0x2 ) { <nl> - / / Load signed byte <nl> - return OP_LDRSB ; <nl> - } <nl> - / / Signed halfword <nl> - if ( bits_65 ! = 0x3 ) { <nl> - / / This is an unexpected bit pattern . Create an undefined <nl> - / / instruction in case this is ever executed . <nl> - return OP_UNDEFINED ; <nl> - } <nl> - / / Load signed halfword <nl> - return OP_LDRSH ; <nl> - } <nl> - / / Store halfword <nl> - if ( bits_65 ! = 0x1 ) { <nl> - / / This is an unexpected bit pattern . Create an undefined <nl> - / / instruction in case this is ever executed . <nl> - return OP_UNDEFINED ; <nl> - } <nl> - / / Store halfword <nl> - return OP_STRH ; <nl> - } <nl> - <nl> - Opcode ARM_Disasm : : DecodeALU ( u32 insn ) { <nl> - u8 is_immed = ( insn > > 25 ) & 0x1 ; <nl> - u8 opcode = ( insn > > 21 ) & 0xf ; <nl> - u8 bit_s = ( insn > > 20 ) & 1 ; <nl> - u8 shift_is_reg = ( insn > > 4 ) & 1 ; <nl> - u8 bit7 = ( insn > > 7 ) & 1 ; <nl> - if ( ! is_immed & & shift_is_reg & & ( bit7 ! = 0 ) ) { <nl> - / / This is an unexpected bit pattern . Create an undefined <nl> - / / instruction in case this is ever executed . <nl> - return OP_UNDEFINED ; <nl> - } <nl> - switch ( opcode ) { <nl> - case 0x0 : <nl> - return OP_AND ; <nl> - case 0x1 : <nl> - return OP_EOR ; <nl> - case 0x2 : <nl> - return OP_SUB ; <nl> - case 0x3 : <nl> - return OP_RSB ; <nl> - case 0x4 : <nl> - return OP_ADD ; <nl> - case 0x5 : <nl> - return OP_ADC ; <nl> - case 0x6 : <nl> - return OP_SBC ; <nl> - case 0x7 : <nl> - return OP_RSC ; <nl> - case 0x8 : <nl> - if ( bit_s ) <nl> - return OP_TST ; <nl> - return OP_MRS ; <nl> - case 0x9 : <nl> - if ( bit_s ) <nl> - return OP_TEQ ; <nl> - return OP_MSR ; <nl> - case 0xa : <nl> - if ( bit_s ) <nl> - return OP_CMP ; <nl> - return OP_MRS ; <nl> - case 0xb : <nl> - if ( bit_s ) <nl> - return OP_CMN ; <nl> - return OP_MSR ; <nl> - case 0xc : <nl> - return OP_ORR ; <nl> - case 0xd : <nl> - return OP_MOV ; <nl> - case 0xe : <nl> - return OP_BIC ; <nl> - case 0xf : <nl> - return OP_MVN ; <nl> - } <nl> - / / Unreachable <nl> - return OP_INVALID ; <nl> - } <nl> deleted file mode 100644 <nl> index 300e228ed8d . . 00000000000 <nl> mmm a / src / core / arm / disassembler / arm_disasm . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2006 The Android Open Source Project <nl> - <nl> - # pragma once <nl> - <nl> - # include < string > <nl> - # include " common / common_types . h " <nl> - <nl> - / / Note : this list of opcodes must match the list used to initialize <nl> - / / the opflags [ ] array in opcode . cpp . <nl> - enum Opcode { <nl> - OP_INVALID , <nl> - OP_UNDEFINED , <nl> - OP_ADC , <nl> - OP_ADD , <nl> - OP_AND , <nl> - OP_B , <nl> - OP_BL , <nl> - OP_BIC , <nl> - OP_BKPT , <nl> - OP_BLX , <nl> - OP_BX , <nl> - OP_CDP , <nl> - OP_CLREX , <nl> - OP_CLZ , <nl> - OP_CMN , <nl> - OP_CMP , <nl> - OP_EOR , <nl> - OP_LDC , <nl> - OP_LDM , <nl> - OP_LDR , <nl> - OP_LDRB , <nl> - OP_LDRBT , <nl> - OP_LDREX , <nl> - OP_LDREXB , <nl> - OP_LDREXD , <nl> - OP_LDREXH , <nl> - OP_LDRH , <nl> - OP_LDRSB , <nl> - OP_LDRSH , <nl> - OP_LDRT , <nl> - OP_MCR , <nl> - OP_MLA , <nl> - OP_MOV , <nl> - OP_MRC , <nl> - OP_MRS , <nl> - OP_MSR , <nl> - OP_MUL , <nl> - OP_MVN , <nl> - OP_NOP , <nl> - OP_ORR , <nl> - OP_PKH , <nl> - OP_PLD , <nl> - OP_QADD16 , <nl> - OP_QADD8 , <nl> - OP_QASX , <nl> - OP_QSAX , <nl> - OP_QSUB16 , <nl> - OP_QSUB8 , <nl> - OP_REV , <nl> - OP_REV16 , <nl> - OP_REVSH , <nl> - OP_RSB , <nl> - OP_RSC , <nl> - OP_SADD16 , <nl> - OP_SADD8 , <nl> - OP_SASX , <nl> - OP_SBC , <nl> - OP_SEL , <nl> - OP_SEV , <nl> - OP_SHADD16 , <nl> - OP_SHADD8 , <nl> - OP_SHASX , <nl> - OP_SHSAX , <nl> - OP_SHSUB16 , <nl> - OP_SHSUB8 , <nl> - OP_SMLAD , <nl> - OP_SMLAL , <nl> - OP_SMLALD , <nl> - OP_SMLSD , <nl> - OP_SMLSLD , <nl> - OP_SMMLA , <nl> - OP_SMMLS , <nl> - OP_SMMUL , <nl> - OP_SMUAD , <nl> - OP_SMULL , <nl> - OP_SMUSD , <nl> - OP_SSAT , <nl> - OP_SSAT16 , <nl> - OP_SSAX , <nl> - OP_SSUB16 , <nl> - OP_SSUB8 , <nl> - OP_STC , <nl> - OP_STM , <nl> - OP_STR , <nl> - OP_STRB , <nl> - OP_STRBT , <nl> - OP_STREX , <nl> - OP_STREXB , <nl> - OP_STREXD , <nl> - OP_STREXH , <nl> - OP_STRH , <nl> - OP_STRT , <nl> - OP_SUB , <nl> - OP_SWI , <nl> - OP_SWP , <nl> - OP_SWPB , <nl> - OP_SXTAB , <nl> - OP_SXTAB16 , <nl> - OP_SXTAH , <nl> - OP_SXTB , <nl> - OP_SXTB16 , <nl> - OP_SXTH , <nl> - OP_TEQ , <nl> - OP_TST , <nl> - OP_UADD16 , <nl> - OP_UADD8 , <nl> - OP_UASX , <nl> - OP_UHADD16 , <nl> - OP_UHADD8 , <nl> - OP_UHASX , <nl> - OP_UHSAX , <nl> - OP_UHSUB16 , <nl> - OP_UHSUB8 , <nl> - OP_UMLAL , <nl> - OP_UMULL , <nl> - OP_UQADD16 , <nl> - OP_UQADD8 , <nl> - OP_UQASX , <nl> - OP_UQSAX , <nl> - OP_UQSUB16 , <nl> - OP_UQSUB8 , <nl> - OP_USAD8 , <nl> - OP_USADA8 , <nl> - OP_USAT , <nl> - OP_USAT16 , <nl> - OP_USAX , <nl> - OP_USUB16 , <nl> - OP_USUB8 , <nl> - OP_UXTAB , <nl> - OP_UXTAB16 , <nl> - OP_UXTAH , <nl> - OP_UXTB , <nl> - OP_UXTB16 , <nl> - OP_UXTH , <nl> - OP_WFE , <nl> - OP_WFI , <nl> - OP_YIELD , <nl> - <nl> - / / Define thumb opcodes <nl> - OP_THUMB_UNDEFINED , <nl> - OP_THUMB_ADC , <nl> - OP_THUMB_ADD , <nl> - OP_THUMB_AND , <nl> - OP_THUMB_ASR , <nl> - OP_THUMB_B , <nl> - OP_THUMB_BIC , <nl> - OP_THUMB_BKPT , <nl> - OP_THUMB_BL , <nl> - OP_THUMB_BLX , <nl> - OP_THUMB_BX , <nl> - OP_THUMB_CMN , <nl> - OP_THUMB_CMP , <nl> - OP_THUMB_EOR , <nl> - OP_THUMB_LDMIA , <nl> - OP_THUMB_LDR , <nl> - OP_THUMB_LDRB , <nl> - OP_THUMB_LDRH , <nl> - OP_THUMB_LDRSB , <nl> - OP_THUMB_LDRSH , <nl> - OP_THUMB_LSL , <nl> - OP_THUMB_LSR , <nl> - OP_THUMB_MOV , <nl> - OP_THUMB_MUL , <nl> - OP_THUMB_MVN , <nl> - OP_THUMB_NEG , <nl> - OP_THUMB_ORR , <nl> - OP_THUMB_POP , <nl> - OP_THUMB_PUSH , <nl> - OP_THUMB_ROR , <nl> - OP_THUMB_SBC , <nl> - OP_THUMB_STMIA , <nl> - OP_THUMB_STR , <nl> - OP_THUMB_STRB , <nl> - OP_THUMB_STRH , <nl> - OP_THUMB_SUB , <nl> - OP_THUMB_SWI , <nl> - OP_THUMB_TST , <nl> - <nl> - OP_END / / must be last <nl> - } ; <nl> - <nl> - class ARM_Disasm { <nl> - public : <nl> - static std : : string Disassemble ( u32 addr , u32 insn ) ; <nl> - static Opcode Decode ( u32 insn ) ; <nl> - <nl> - private : <nl> - static Opcode Decode00 ( u32 insn ) ; <nl> - static Opcode Decode01 ( u32 insn ) ; <nl> - static Opcode Decode10 ( u32 insn ) ; <nl> - static Opcode Decode11 ( u32 insn ) ; <nl> - static Opcode DecodeSyncPrimitive ( u32 insn ) ; <nl> - static Opcode DecodeParallelAddSub ( u32 insn ) ; <nl> - static Opcode DecodePackingSaturationReversal ( u32 insn ) ; <nl> - static Opcode DecodeMUL ( u32 insn ) ; <nl> - static Opcode DecodeMSRImmAndHints ( u32 insn ) ; <nl> - static Opcode DecodeMediaMulDiv ( u32 insn ) ; <nl> - static Opcode DecodeMedia ( u32 insn ) ; <nl> - static Opcode DecodeLDRH ( u32 insn ) ; <nl> - static Opcode DecodeALU ( u32 insn ) ; <nl> - <nl> - static std : : string DisassembleALU ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleBranch ( u32 addr , Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleBX ( u32 insn ) ; <nl> - static std : : string DisassembleBKPT ( u32 insn ) ; <nl> - static std : : string DisassembleCLZ ( u32 insn ) ; <nl> - static std : : string DisassembleMediaMulDiv ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleMemblock ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleMem ( u32 insn ) ; <nl> - static std : : string DisassembleMemHalf ( u32 insn ) ; <nl> - static std : : string DisassembleMCR ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleMLA ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleUMLAL ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleMUL ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleMRS ( u32 insn ) ; <nl> - static std : : string DisassembleMSR ( u32 insn ) ; <nl> - static std : : string DisassembleNoOperands ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleParallelAddSub ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassemblePKH ( u32 insn ) ; <nl> - static std : : string DisassemblePLD ( u32 insn ) ; <nl> - static std : : string DisassembleREV ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleREX ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleSAT ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleSEL ( u32 insn ) ; <nl> - static std : : string DisassembleSWI ( u32 insn ) ; <nl> - static std : : string DisassembleSWP ( Opcode opcode , u32 insn ) ; <nl> - static std : : string DisassembleXT ( Opcode opcode , u32 insn ) ; <nl> - } ; <nl> deleted file mode 100644 <nl> index 6863c103a00 . . 00000000000 <nl> mmm a / src / core / arm / disassembler / load_symbol_map . cpp <nl> ppp / dev / null <nl> <nl> - / / Copyright 2014 Citra Emulator Project <nl> - / / Licensed under GPLv2 or any later version <nl> - / / Refer to the license . txt file included . <nl> - <nl> - # include < sstream > <nl> - # include < string > <nl> - # include < vector > <nl> - # include " common / file_util . h " <nl> - # include " common / symbols . h " <nl> - # include " core / arm / disassembler / load_symbol_map . h " <nl> - <nl> - / * <nl> - * Loads a symbol map file for use with the disassembler <nl> - * @ param filename String filename path of symbol map file <nl> - * / <nl> - void LoadSymbolMap ( std : : string filename ) { <nl> - std : : ifstream infile ( filename ) ; <nl> - <nl> - std : : string address_str , function_name , line ; <nl> - u32 size ; <nl> - <nl> - while ( std : : getline ( infile , line ) ) { <nl> - std : : istringstream iss ( line ) ; <nl> - if ( ! ( iss > > address_str > > size > > function_name ) ) { <nl> - break ; / / Error parsing <nl> - } <nl> - u32 address = std : : stoul ( address_str , nullptr , 16 ) ; <nl> - <nl> - Symbols : : Add ( address , function_name , size , 2 ) ; <nl> - } <nl> - } <nl> deleted file mode 100644 <nl> index d28c551c3b8 . . 00000000000 <nl> mmm a / src / core / arm / disassembler / load_symbol_map . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2014 Citra Emulator Project <nl> - / / Licensed under GPLv2 or any later version <nl> - / / Refer to the license . txt file included . <nl> - <nl> - # pragma once <nl> - <nl> - # include < string > <nl> - <nl> - / * <nl> - * Loads a symbol map file for use with the disassembler <nl> - * @ param filename String filename path of symbol map file <nl> - * / <nl> - void LoadSymbolMap ( std : : string filename ) ; <nl> mmm a / src / core / arm / dyncom / arm_dyncom_dec . cpp <nl> ppp b / src / core / arm / dyncom / arm_dyncom_dec . cpp <nl> const InstructionSetEncodingItem arm_exclusion_code [ ] = { <nl> } ; <nl> / / clang - format on <nl> <nl> - ARMDecodeStatus DecodeARMInstruction ( u32 instr , s32 * idx ) { <nl> + ARMDecodeStatus DecodeARMInstruction ( u32 instr , int * idx ) { <nl> int n = 0 ; <nl> int base = 0 ; <nl> int instr_slots = sizeof ( arm_instruction ) / sizeof ( InstructionSetEncodingItem ) ; <nl> mmm a / src / core / arm / dyncom / arm_dyncom_dec . h <nl> ppp b / src / core / arm / dyncom / arm_dyncom_dec . h <nl> <nl> <nl> enum class ARMDecodeStatus { SUCCESS , FAILURE } ; <nl> <nl> - ARMDecodeStatus DecodeARMInstruction ( u32 instr , s32 * idx ) ; <nl> + ARMDecodeStatus DecodeARMInstruction ( u32 instr , int * idx ) ; <nl> <nl> struct InstructionSetEncodingItem { <nl> const char * name ; <nl> mmm a / src / core / arm / dyncom / arm_dyncom_interpreter . cpp <nl> ppp b / src / core / arm / dyncom / arm_dyncom_interpreter . cpp <nl> <nl> # define CITRA_IGNORE_EXIT ( x ) <nl> <nl> # include < algorithm > <nl> + # include < cinttypes > <nl> # include < cstdio > <nl> # include " common / common_types . h " <nl> # include " common / logging / log . h " <nl> # include " common / microprofile . h " <nl> - # include " core / arm / disassembler / arm_disasm . h " <nl> # include " core / arm / dyncom / arm_dyncom_dec . h " <nl> # include " core / arm / dyncom / arm_dyncom_interpreter . h " <nl> # include " core / arm / dyncom / arm_dyncom_run . h " <nl> MICROPROFILE_DEFINE ( DynCom_Decode , " DynCom " , " Decode " , MP_RGB ( 255 , 64 , 64 ) ) ; <nl> <nl> static unsigned int InterpreterTranslateInstruction ( const ARMul_State * cpu , const u32 phys_addr , <nl> ARM_INST_PTR & inst_base ) { <nl> - unsigned int inst_size = 4 ; <nl> - unsigned int inst = Memory : : Read32 ( phys_addr & 0xFFFFFFFC ) ; <nl> + u32 inst_size = 4 ; <nl> + u32 inst = Memory : : Read32 ( phys_addr & 0xFFFFFFFC ) ; <nl> <nl> / / If we are in Thumb mode , we ' ll translate one Thumb instruction to the corresponding ARM <nl> / / instruction <nl> static unsigned int InterpreterTranslateInstruction ( const ARMul_State * cpu , cons <nl> <nl> int idx ; <nl> if ( DecodeARMInstruction ( inst , & idx ) = = ARMDecodeStatus : : FAILURE ) { <nl> - std : : string disasm = ARM_Disasm : : Disassemble ( phys_addr , inst ) ; <nl> - LOG_ERROR ( Core_ARM11 , " Decode failure . \ tPC : [ 0x % x ] \ tInstruction : % s [ % x ] " , phys_addr , <nl> - disasm . c_str ( ) , inst ) ; <nl> - LOG_ERROR ( Core_ARM11 , " cpsr = 0x % x , cpu - > TFlag = % d , r15 = 0x % x " , cpu - > Cpsr , cpu - > TFlag , <nl> - cpu - > Reg [ 15 ] ) ; <nl> + LOG_ERROR ( Core_ARM11 , " Decode failure . \ tPC : [ 0x % 08 " PRIX32 " ] \ tInstruction : % 08 " PRIX32 , <nl> + phys_addr , inst ) ; <nl> + LOG_ERROR ( Core_ARM11 , " cpsr = 0x % " PRIX32 " , cpu - > TFlag = % d , r15 = 0x % 08 " PRIX32 , cpu - > Cpsr , <nl> + cpu - > TFlag , cpu - > Reg [ 15 ] ) ; <nl> CITRA_IGNORE_EXIT ( - 1 ) ; <nl> } <nl> inst_base = arm_instruction_trans [ idx ] ( inst , idx ) ; <nl> mmm a / src / core / hle / svc . cpp <nl> ppp b / src / core / hle / svc . cpp <nl> <nl> / / Licensed under GPLv2 or any later version <nl> / / Refer to the license . txt file included . <nl> <nl> + # include < cinttypes > <nl> # include < map > <nl> # include " common / logging / log . h " <nl> # include " common / microprofile . h " <nl> # include " common / scope_exit . h " <nl> # include " common / string_util . h " <nl> - # include " common / symbols . h " <nl> # include " core / arm / arm_interface . h " <nl> # include " core / core_timing . h " <nl> # include " core / hle / function_wrappers . h " <nl> static ResultCode CreateThread ( Kernel : : Handle * out_handle , s32 priority , u32 ent <nl> u32 stack_top , s32 processor_id ) { <nl> using Kernel : : Thread ; <nl> <nl> - std : : string name ; <nl> - if ( Symbols : : HasSymbol ( entry_point ) ) { <nl> - TSymbol symbol = Symbols : : GetSymbol ( entry_point ) ; <nl> - name = symbol . name ; <nl> - } else { <nl> - name = Common : : StringFromFormat ( " unknown - % 08x " , entry_point ) ; <nl> - } <nl> + std : : string name = Common : : StringFromFormat ( " unknown - % 08 " PRIX32 , entry_point ) ; <nl> <nl> if ( priority > THREADPRIO_LOWEST ) { <nl> return ResultCode ( ErrorDescription : : OutOfRange , ErrorModule : : OS , <nl> mmm a / src / core / loader / elf . cpp <nl> ppp b / src / core / loader / elf . cpp <nl> <nl> # include " common / common_types . h " <nl> # include " common / file_util . h " <nl> # include " common / logging / log . h " <nl> - # include " common / symbols . h " <nl> # include " core / hle / kernel / process . h " <nl> # include " core / hle / kernel / resource_limit . h " <nl> # include " core / loader / elf . h " <nl> class ElfReader { <nl> return ( u32 ) ( header - > e_flags ) ; <nl> } <nl> SharedPtr < CodeSet > LoadInto ( u32 vaddr ) ; <nl> - bool LoadSymbols ( ) ; <nl> <nl> int GetNumSegments ( ) const { <nl> return ( int ) ( header - > e_phnum ) ; <nl> ElfReader : : ElfReader ( void * ptr ) { <nl> sections = ( Elf32_Shdr * ) ( base + header - > e_shoff ) ; <nl> <nl> entryPoint = header - > e_entry ; <nl> - <nl> - LoadSymbols ( ) ; <nl> } <nl> <nl> const char * ElfReader : : GetSectionName ( int section ) const { <nl> SectionID ElfReader : : GetSectionByName ( const char * name , int firstSection ) const <nl> return - 1 ; <nl> } <nl> <nl> - bool ElfReader : : LoadSymbols ( ) { <nl> - bool hasSymbols = false ; <nl> - SectionID sec = GetSectionByName ( " . symtab " ) ; <nl> - if ( sec ! = - 1 ) { <nl> - int stringSection = sections [ sec ] . sh_link ; <nl> - const char * stringBase = reinterpret_cast < const char * > ( GetSectionDataPtr ( stringSection ) ) ; <nl> - <nl> - / / We have a symbol table ! <nl> - const Elf32_Sym * symtab = reinterpret_cast < const Elf32_Sym * > ( GetSectionDataPtr ( sec ) ) ; <nl> - unsigned int numSymbols = sections [ sec ] . sh_size / sizeof ( Elf32_Sym ) ; <nl> - for ( unsigned sym = 0 ; sym < numSymbols ; sym + + ) { <nl> - int size = symtab [ sym ] . st_size ; <nl> - if ( size = = 0 ) <nl> - continue ; <nl> - <nl> - int type = symtab [ sym ] . st_info & 0xF ; <nl> - <nl> - const char * name = stringBase + symtab [ sym ] . st_name ; <nl> - <nl> - Symbols : : Add ( symtab [ sym ] . st_value , name , size , type ) ; <nl> - <nl> - hasSymbols = true ; <nl> - } <nl> - } <nl> - <nl> - return hasSymbols ; <nl> - } <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Loader namespace <nl> <nl>
Merge pull request from yuriks / remove - disassembler
yuzu-emu/yuzu
7325413cd8b4f02719ca0f87c8a70d4713333a98
2017-05-08T20:02:53Z
mmm a / src / hydrogen - instructions . cc <nl> ppp b / src / hydrogen - instructions . cc <nl> void HValue : : UpdateRepresentation ( Representation new_rep , <nl> const char * reason ) { <nl> Representation r = representation ( ) ; <nl> if ( new_rep . is_more_general_than ( r ) ) { <nl> - if ( CheckFlag ( kCannotBeTagged ) & & r . IsTagged ( ) ) return ; <nl> + if ( CheckFlag ( kCannotBeTagged ) & & new_rep . IsTagged ( ) ) return ; <nl> if ( FLAG_trace_representation ) { <nl> PrintF ( " Changing # % d % s representation % s - > % s based on % s \ n " , <nl> id ( ) , Mnemonic ( ) , r . Mnemonic ( ) , new_rep . Mnemonic ( ) , reason ) ; <nl> mmm a / src / hydrogen - instructions . h <nl> ppp b / src / hydrogen - instructions . h <nl> class HValue : public ZoneObject { <nl> Representation representation ( ) const { return representation_ ; } <nl> void ChangeRepresentation ( Representation r ) { <nl> ASSERT ( CheckFlag ( kFlexibleRepresentation ) ) ; <nl> + ASSERT ( ! CheckFlag ( kCannotBeTagged ) | | ! r . IsTagged ( ) ) ; <nl> RepresentationChanged ( r ) ; <nl> representation_ = r ; <nl> - if ( r . IsTagged ( ) | | <nl> - ( r . IsDouble ( ) & & CheckFlag ( kCannotBeTagged ) ) ) { <nl> + if ( r . IsTagged ( ) ) { <nl> / / Tagged is the bottom of the lattice , don ' t go any further . <nl> ClearFlag ( kFlexibleRepresentation ) ; <nl> } <nl> mmm a / src / hydrogen . cc <nl> ppp b / src / hydrogen . cc <nl> void HGraph : : RestoreActualValues ( ) { <nl> } <nl> <nl> <nl> - void HOptimizedGraphBuilder : : AddPhi ( HPhi * instr ) { <nl> - ASSERT ( current_block ( ) ! = NULL ) ; <nl> - current_block ( ) - > AddPhi ( instr ) ; <nl> - } <nl> - <nl> - <nl> void HOptimizedGraphBuilder : : PushAndAdd ( HInstruction * instr ) { <nl> Push ( instr ) ; <nl> AddInstruction ( instr ) ; <nl> mmm a / src / hydrogen . h <nl> ppp b / src / hydrogen . h <nl> class HOptimizedGraphBuilder : public HGraphBuilder , public AstVisitor { <nl> / / Visit a list of expressions from left to right , each in a value context . <nl> void VisitExpressions ( ZoneList < Expression * > * exprs ) ; <nl> <nl> - void AddPhi ( HPhi * phi ) ; <nl> - <nl> void PushAndAdd ( HInstruction * instr ) ; <nl> <nl> / / Remove the arguments from the bailout environment and emit instructions <nl>
Fix ugly typo in HValue : : UpdateRepresentation .
v8/v8
bd90e71b011f40b3e810b5ca83b80c31fa70345a
2013-06-24T14:34:07Z
mmm a / torch / csrc / jit / passes / python_print . cpp <nl> ppp b / torch / csrc / jit / passes / python_print . cpp <nl> struct PythonPrintImpl { <nl> class TaggedStringStream { <nl> public : <nl> TaggedStringStream ( const SourceRangeStack * srs ) : srs_ ( srs ) { } <nl> - TaggedStringStream ( TaggedStringStream & & rhs ) = default ; <nl> <nl> TaggedStringStream & operator < < ( const std : : string & s ) { <nl> / / This prevents having redundant entries at the same offset , <nl>
Delete move constructor from TaggedStringStream ( )
pytorch/pytorch
df81cb22b82c193847683e5683fa1001697bf6ea
2019-10-24T22:52:01Z
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 = " 18603319321a6c1b158800bcc60035ee01549516 " <nl> - LLVM_SHA256 = " 346e1e684cc5ceac862f0748fbf24c40f20788f74538896529b926324d3f253a " <nl> + LLVM_COMMIT = " 55db6ec1cc20d32ad179e0059aafcc545125fca6 " <nl> + LLVM_SHA256 = " 7d3718556d602583412354031dfb1d5c7e387cba15a008c39385be5bc38e34a3 " <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>
Integrate LLVM at llvm / llvm - project @ 55db6ec1cc20
tensorflow/tensorflow
9f073da45248c604600a3c68147ac6ff78da244b
2020-12-04T01:04:33Z
mmm a / docs / en / operations / system_tables . md <nl> ppp b / docs / en / operations / system_tables . md <nl> The ` system . columns ` table contains the following columns ( the column type is sh <nl> - ` is_in_primary_key ` ( UInt8 ) — Flag that indicates whether the column is in the primary key expression . <nl> - ` is_in_sampling_key ` ( UInt8 ) — Flag that indicates whether the column is in the sampling key expression . <nl> <nl> + # # system . contributors { # system_contributors } <nl> + <nl> + Contains information about contributors . Arbitrary selection . <nl> + <nl> + Columns : <nl> + <nl> + - ` name ` ( String ) — Contributor name . <nl> + <nl> + * * Пример * * <nl> + <nl> + ` ` ` sql <nl> + SELECT * FROM system . contributors LIMIT 10 <nl> + ` ` ` <nl> + <nl> + ` ` ` text <nl> + ┌ ─ name ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ <nl> + │ Olga Khvostikova │ <nl> + │ Max Vetrov │ <nl> + │ LiuYangkuan │ <nl> + │ svladykin │ <nl> + │ zamulla │ <nl> + │ Šimon Podlipský │ <nl> + │ BayoNet │ <nl> + │ Ilya Khomutov │ <nl> + │ Amy Krishnevsky │ <nl> + │ Loud_Scream │ <nl> + └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> + ` ` ` <nl> + <nl> + To find out yourself in the table , use a query : <nl> + <nl> + ` ` ` sql <nl> + SELECT * FROM system . contributors WHERE name = ' Olga Khvostikova ' <nl> + ` ` ` <nl> + ` ` ` text <nl> + ┌ ─ name ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ <nl> + │ Olga Khvostikova │ <nl> + └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> + ` ` ` <nl> + <nl> # # system . databases <nl> <nl> This table contains a single String column called ' name ' – the name of a database . <nl> mmm a / docs / ru / operations / system_tables . md <nl> ppp b / docs / ru / operations / system_tables . md <nl> user String — имя пользователя , которого использ <nl> - ` is_in_primary_key ` ( UInt8 ) — флаг , показывающий включение столбца в первичный ключ . <nl> - ` is_in_sampling_key ` ( UInt8 ) — флаг , показывающий включение столбца в ключ выборки . <nl> <nl> + # # system . contributors { # system_contributors } <nl> + <nl> + Содержит информацию о контрибьютерах . Выборка произвольная . <nl> + <nl> + Столбцы : <nl> + <nl> + - ` name ` ( String ) — Имя контрибьютера . <nl> + <nl> + * * Пример * * <nl> + <nl> + ` ` ` sql <nl> + SELECT * FROM system . contributors LIMIT 10 <nl> + ` ` ` <nl> + ` ` ` text <nl> + ┌ ─ name ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ <nl> + │ Olga Khvostikova │ <nl> + │ Max Vetrov │ <nl> + │ LiuYangkuan │ <nl> + │ svladykin │ <nl> + │ zamulla │ <nl> + │ Šimon Podlipský │ <nl> + │ BayoNet │ <nl> + │ Ilya Khomutov │ <nl> + │ Amy Krishnevsky │ <nl> + │ Loud_Scream │ <nl> + └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> + ` ` ` <nl> + <nl> + Чтобы найти себя в таблице , выполните запрос : <nl> + <nl> + ` ` ` sql <nl> + SELECT * FROM system . contributors WHERE name = ' Olga Khvostikova ' <nl> + ` ` ` <nl> + ` ` ` text <nl> + ┌ ─ name ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ <nl> + │ Olga Khvostikova │ <nl> + └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ <nl> + ` ` ` <nl> + <nl> # # system . databases <nl> <nl> Таблица содержит один столбец name типа String - имя базы данных . <nl>
docs ( system_tables ) : Added info about system . contributors
ClickHouse/ClickHouse
4be887a80317b243f6d54c41379bcfbb03818589
2019-09-19T09:16:10Z
mmm a / swoole_process . c <nl> ppp b / swoole_process . c <nl> static PHP_METHOD ( swoole_process , wait ) <nl> <nl> static PHP_METHOD ( swoole_process , useQueue ) <nl> { <nl> - long msgkey = - 1 ; <nl> + long msgkey = 0 ; <nl> long mode = 2 ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " | ll " , & msgkey , & mode ) = = FAILURE ) <nl> static PHP_METHOD ( swoole_process , useQueue ) <nl> <nl> swWorker * process = swoole_get_object ( getThis ( ) ) ; <nl> <nl> - if ( msgkey < 0 ) <nl> + if ( msgkey < = 0 ) <nl> { <nl> # if PHP_MAJOR_VERSION = = 7 <nl> - msgkey = ftok ( execute_data - > func - > op_array . filename - > val , 0 ) ; <nl> + msgkey = ftok ( execute_data - > func - > op_array . filename - > val , 0 ) ; <nl> # else <nl> - msgkey = ftok ( EG ( active_op_array ) - > filename , 0 ) ; <nl> + msgkey = ftok ( EG ( active_op_array ) - > filename , 0 ) ; <nl> # endif <nl> } <nl> <nl>
Fixed
swoole/swoole-src
4784c1481ab1aaf61fd6106c28d877792ace50db
2015-09-01T01:57:49Z
mmm a / modules / gdnative / gdnative . cpp <nl> ppp b / modules / gdnative / gdnative . cpp <nl> <nl> # include " project_settings . h " <nl> <nl> # include " scene / main / scene_tree . h " <nl> - # include " scene / resources / scene_format_text . h " <nl> <nl> - # if defined ( TOOLS_ENABLED ) & & defined ( DEBUG_METHODS_ENABLED ) <nl> - # include " api_generator . h " <nl> - # endif <nl> + const String init_symbol = " godot_gdnative_init " ; <nl> + const String terminate_symbol = " godot_gdnative_terminate " ; <nl> <nl> - # ifdef TOOLS_ENABLED <nl> - # include " editor / editor_node . h " <nl> - # endif <nl> + String GDNativeLibrary : : platform_names [ NUM_PLATFORMS ] = { <nl> + " X11_32bit " , <nl> + " X11_64bit " , <nl> + " Windows_32bit " , <nl> + " Windows_64bit " , <nl> + " OSX " , <nl> <nl> - Error NativeLibrary : : initialize ( NativeLibrary * & p_native_lib , const StringName p_path ) { <nl> + " Android " , <nl> + " iOS " , <nl> <nl> - if ( GDNativeScriptLanguage : : get_singleton ( ) - > initialized_libraries . has ( p_path ) ) { <nl> - p_native_lib = GDNativeScriptLanguage : : get_singleton ( ) - > initialized_libraries [ p_path ] ; <nl> - return OK ; <nl> - } <nl> - <nl> - NativeLibrary * lib = memnew ( NativeLibrary ) ; <nl> - lib - > path = p_path ; <nl> - <nl> - p_native_lib = lib ; <nl> - <nl> - / / Open the file <nl> - <nl> - Error error ; <nl> - error = OS : : get_singleton ( ) - > open_dynamic_library ( p_path , lib - > handle ) ; <nl> - if ( error ) return error ; <nl> - ERR_FAIL_COND_V ( ! lib - > handle , ERR_BUG ) ; <nl> - <nl> - / / Get the method <nl> - <nl> - void * library_init ; <nl> - error = OS : : get_singleton ( ) - > get_dynamic_library_symbol_handle ( lib - > handle , GDNativeScriptLanguage : : get_init_symbol_name ( ) , library_init ) ; <nl> - if ( error ) return error ; <nl> - ERR_FAIL_COND_V ( ! library_init , ERR_BUG ) ; <nl> - <nl> - void ( * library_init_fpointer ) ( godot_native_init_options * ) = ( void ( * ) ( godot_native_init_options * ) ) library_init ; <nl> - <nl> - godot_native_init_options options ; <nl> - <nl> - options . in_editor = SceneTree : : get_singleton ( ) - > is_editor_hint ( ) ; <nl> - options . core_api_hash = ClassDB : : get_api_hash ( ClassDB : : API_CORE ) ; <nl> - options . editor_api_hash = ClassDB : : get_api_hash ( ClassDB : : API_EDITOR ) ; <nl> - options . no_api_hash = ClassDB : : get_api_hash ( ClassDB : : API_NONE ) ; <nl> - <nl> - library_init_fpointer ( & options ) ; / / Catch errors ? <nl> - <nl> - GDNativeScriptLanguage : : get_singleton ( ) - > initialized_libraries [ p_path ] = lib ; <nl> - <nl> - return OK ; <nl> - } <nl> - <nl> - Error NativeLibrary : : terminate ( NativeLibrary * & p_native_lib ) { <nl> - <nl> - if ( ! GDNativeScriptLanguage : : get_singleton ( ) - > initialized_libraries . has ( p_native_lib - > path ) ) { <nl> - OS : : get_singleton ( ) - > close_dynamic_library ( p_native_lib - > handle ) ; <nl> - p_native_lib - > handle = 0 ; <nl> - return OK ; <nl> - } <nl> - <nl> - Error error = OK ; <nl> - void * library_terminate ; <nl> - error = OS : : get_singleton ( ) - > get_dynamic_library_symbol_handle ( p_native_lib - > handle , GDNativeScriptLanguage : : get_terminate_symbol_name ( ) , library_terminate ) ; <nl> - if ( ! error ) { <nl> - <nl> - void ( * library_terminate_pointer ) ( godot_native_terminate_options * ) = ( void ( * ) ( godot_native_terminate_options * ) ) library_terminate ; <nl> - <nl> - godot_native_terminate_options options ; <nl> - options . in_editor = SceneTree : : get_singleton ( ) - > is_editor_hint ( ) ; <nl> - <nl> - library_terminate_pointer ( & options ) ; <nl> - } <nl> - <nl> - GDNativeScriptLanguage : : get_singleton ( ) - > initialized_libraries . erase ( p_native_lib - > path ) ; <nl> - <nl> - OS : : get_singleton ( ) - > close_dynamic_library ( p_native_lib - > handle ) ; <nl> - p_native_lib - > handle = 0 ; <nl> - <nl> - return OK ; <nl> - } <nl> - <nl> - / / Script <nl> - # ifdef TOOLS_ENABLED <nl> - <nl> - void GDNativeScript : : _update_placeholder ( PlaceHolderScriptInstance * p_placeholder ) { <nl> - ERR_FAIL_COND ( ! script_data ) ; <nl> - <nl> - List < PropertyInfo > pinfo ; <nl> - Map < StringName , Variant > values ; <nl> - <nl> - for ( Map < StringName , GDNativeScriptData : : Property > : : Element * E = script_data - > properties . front ( ) ; E ; E = E - > next ( ) ) { <nl> - PropertyInfo p = E - > get ( ) . info ; <nl> - p . name = String ( E - > key ( ) ) ; <nl> - pinfo . push_back ( p ) ; <nl> - values [ p . name ] = E - > get ( ) . default_value ; <nl> - } <nl> - <nl> - p_placeholder - > update ( pinfo , values ) ; <nl> - } <nl> - <nl> - void GDNativeScript : : _placeholder_erased ( PlaceHolderScriptInstance * p_placeholder ) { <nl> - <nl> - placeholders . erase ( p_placeholder ) ; <nl> - } <nl> - <nl> - # endif <nl> - <nl> - bool GDNativeScript : : can_instance ( ) const { <nl> - # ifdef TOOLS_ENABLED <nl> - return script_data | | ( ! is_tool ( ) & & ! ScriptServer : : is_scripting_enabled ( ) ) ; <nl> - # else <nl> - / / allow defaultlibrary without editor features <nl> - if ( ! library . is_valid ( ) ) { <nl> - String path = GLOBAL_GET ( " gdnative / default_gdnativelibrary " ) ; <nl> - <nl> - RES lib = ResourceLoader : : load ( path ) ; <nl> - <nl> - if ( lib . is_valid ( ) & & lib - > cast_to < GDNativeLibrary > ( ) ) { <nl> - return true ; <nl> - } <nl> - } <nl> - <nl> - return script_data ; <nl> - # endif <nl> - / / return script_data | | ( ! tool & & ! ScriptServer : : is_scripting_enabled ( ) ) ; <nl> - / / change to true enable in editor stuff . <nl> - } <nl> - <nl> - Ref < Script > GDNativeScript : : get_base_script ( ) const { <nl> - Ref < GDNativeScript > base_script ; <nl> - base_script - > library = library ; <nl> - base_script - > script_data = script_data ; <nl> - base_script - > script_name = script_data - > base ; <nl> - return base_script ; <nl> - } <nl> - <nl> - StringName GDNativeScript : : get_instance_base_type ( ) const { <nl> - return script_data - > base_native_type ; <nl> - } <nl> - <nl> - ScriptInstance * GDNativeScript : : instance_create ( Object * p_this ) { <nl> - <nl> - # ifdef TOOLS_ENABLED <nl> - <nl> - / / find a good way to initialize stuff in the editor <nl> - if ( ! ScriptServer : : is_scripting_enabled ( ) & & ! is_tool ( ) ) { <nl> - / / placeholder , for nodes . But for tools we want the real thing <nl> - <nl> - PlaceHolderScriptInstance * sins = memnew ( PlaceHolderScriptInstance ( GDNativeScriptLanguage : : singleton , Ref < Script > ( ( Script * ) this ) , p_this ) ) ; <nl> - placeholders . insert ( sins ) ; <nl> - <nl> - if ( ! library . is_valid ( ) ) <nl> - return sins ; <nl> - <nl> - if ( ! library - > native_library ) { <nl> - Error err = library - > _initialize ( ) ; <nl> - if ( err ! = OK ) { <nl> - return sins ; <nl> - } <nl> - } <nl> - <nl> - if ( ! script_data ) { <nl> - script_data = library - > get_script_data ( script_name ) ; <nl> - } <nl> - if ( script_data & & script_data - > create_func . create_func ) { <nl> - script_data - > create_func . create_func ( ( godot_object * ) p_this , script_data - > create_func . method_data ) ; <nl> - } <nl> - <nl> - _update_placeholder ( sins ) ; <nl> - <nl> - return sins ; <nl> - } <nl> - <nl> - # endif <nl> - <nl> - if ( ! library . is_valid ( ) ) { <nl> - String path = GLOBAL_GET ( " gdnative / default_gdnativelibrary " ) ; <nl> - <nl> - RES lib = ResourceLoader : : load ( path ) ; <nl> - <nl> - if ( lib . is_valid ( ) & & lib - > cast_to < GDNativeLibrary > ( ) ) { <nl> - set_library ( lib ) ; <nl> - } <nl> - } <nl> - <nl> - GDNativeInstance * new_instance = memnew ( GDNativeInstance ) ; <nl> - <nl> - new_instance - > owner = p_this ; <nl> - new_instance - > script = Ref < GDNativeScript > ( this ) ; <nl> - <nl> - # ifndef TOOLS_ENABLED <nl> - if ( ! ScriptServer : : is_scripting_enabled ( ) ) { <nl> - new_instance - > userdata = 0 ; <nl> - } else { <nl> - new_instance - > userdata = script_data - > create_func . create_func ( ( godot_object * ) p_this , script_data - > create_func . method_data ) ; <nl> - } <nl> - # else <nl> - new_instance - > userdata = script_data - > create_func . create_func ( ( godot_object * ) p_this , script_data - > create_func . method_data ) ; <nl> - # endif <nl> - <nl> - instances . insert ( p_this ) ; <nl> - return new_instance ; <nl> - } <nl> - <nl> - bool GDNativeScript : : instance_has ( const Object * p_this ) const { <nl> - return instances . has ( ( Object * ) p_this ) ; / / TODO <nl> - } <nl> - <nl> - bool GDNativeScript : : has_source_code ( ) const { <nl> - return false ; <nl> - } <nl> - <nl> - String GDNativeScript : : get_source_code ( ) const { <nl> - return " " ; <nl> - } <nl> - <nl> - Error GDNativeScript : : reload ( bool p_keep_state ) { <nl> - return FAILED ; <nl> - } <nl> - <nl> - bool GDNativeScript : : has_method ( const StringName & p_method ) const { <nl> - if ( ! script_data ) <nl> - return false ; <nl> - GDNativeScriptData * data = script_data ; <nl> - <nl> - while ( data ) { <nl> - if ( data - > methods . has ( p_method ) ) <nl> - return true ; <nl> - <nl> - data = data - > base_data ; <nl> - } <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - MethodInfo GDNativeScript : : get_method_info ( const StringName & p_method ) const { <nl> - if ( ! script_data ) <nl> - return MethodInfo ( ) ; <nl> - GDNativeScriptData * data = script_data ; <nl> - <nl> - while ( data ) { <nl> - if ( data - > methods . has ( p_method ) ) <nl> - return data - > methods [ p_method ] . info ; <nl> - <nl> - data = data - > base_data ; <nl> - } <nl> - <nl> - ERR_FAIL_COND_V ( ! script_data - > methods . has ( p_method ) , MethodInfo ( ) ) ; <nl> - return MethodInfo ( ) ; <nl> - } <nl> - <nl> - void GDNativeScript : : get_script_method_list ( List < MethodInfo > * p_list ) const { <nl> - if ( ! script_data ) return ; <nl> - <nl> - Set < MethodInfo > methods ; <nl> - GDNativeScriptData * data = script_data ; <nl> - <nl> - while ( data ) { <nl> - for ( Map < StringName , GDNativeScriptData : : Method > : : Element * E = data - > methods . front ( ) ; E ; E = E - > next ( ) ) { <nl> - methods . insert ( E - > get ( ) . info ) ; <nl> - } <nl> - data = data - > base_data ; <nl> - } <nl> - <nl> - for ( Set < MethodInfo > : : Element * E = methods . front ( ) ; E ; E = E - > next ( ) ) { <nl> - p_list - > push_back ( E - > get ( ) ) ; <nl> - } <nl> - } <nl> - <nl> - void GDNativeScript : : get_script_property_list ( List < PropertyInfo > * p_list ) const { <nl> - if ( ! script_data ) return ; <nl> - <nl> - Set < PropertyInfo > properties ; <nl> - GDNativeScriptData * data = script_data ; <nl> - <nl> - while ( data ) { <nl> - for ( Map < StringName , GDNativeScriptData : : Property > : : Element * E = data - > properties . front ( ) ; E ; E = E - > next ( ) ) { <nl> - properties . insert ( E - > get ( ) . info ) ; <nl> - } <nl> - data = data - > base_data ; <nl> - } <nl> - <nl> - for ( Set < PropertyInfo > : : Element * E = properties . front ( ) ; E ; E = E - > next ( ) ) { <nl> - p_list - > push_back ( E - > get ( ) ) ; <nl> - } <nl> - } <nl> - <nl> - bool GDNativeScript : : get_property_default_value ( const StringName & p_property , Variant & r_value ) const { <nl> - if ( ! script_data ) return false ; <nl> - <nl> - GDNativeScriptData * data = script_data ; <nl> - <nl> - while ( data ) { <nl> - if ( data - > properties . has ( p_property ) ) { <nl> - r_value = data - > properties [ p_property ] . default_value ; <nl> - return true ; <nl> - } <nl> - <nl> - data = data - > base_data ; <nl> - } <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - bool GDNativeScript : : is_tool ( ) const { <nl> - ERR_FAIL_COND_V ( ! script_data , false ) ; <nl> - return script_data - > is_tool ; <nl> - } <nl> - <nl> - String GDNativeScript : : get_node_type ( ) const { <nl> - return " " ; / / ? <nl> - } <nl> - <nl> - ScriptLanguage * GDNativeScript : : get_language ( ) const { <nl> - return GDNativeScriptLanguage : : singleton ; <nl> - } <nl> - <nl> - bool GDNativeScript : : has_script_signal ( const StringName & p_signal ) const { <nl> - if ( ! script_data ) <nl> - return false ; <nl> - <nl> - GDNativeScriptData * data = script_data ; <nl> - <nl> - while ( data ) { <nl> - if ( data - > signals_ . has ( p_signal ) ) { <nl> - return true ; <nl> - } <nl> - <nl> - data = data - > base_data ; <nl> - } <nl> - <nl> - return false ; <nl> - } <nl> - <nl> - void GDNativeScript : : get_script_signal_list ( List < MethodInfo > * r_signals ) const { <nl> - if ( ! script_data ) <nl> - return ; <nl> - <nl> - Set < MethodInfo > signals_ ; <nl> - GDNativeScriptData * data = script_data ; <nl> - <nl> - while ( data ) { <nl> - <nl> - for ( Map < StringName , GDNativeScriptData : : Signal > : : Element * S = data - > signals_ . front ( ) ; S ; S = S - > next ( ) ) { <nl> - signals_ . insert ( S - > get ( ) . signal ) ; <nl> - } <nl> - <nl> - data = data - > base_data ; <nl> - } <nl> - <nl> - for ( Set < MethodInfo > : : Element * E = signals_ . front ( ) ; E ; E = E - > next ( ) ) { <nl> - r_signals - > push_back ( E - > get ( ) ) ; <nl> - } <nl> - } <nl> - <nl> - Variant GDNativeScript : : _new ( const Variant * * p_args , int p_argcount , Variant : : CallError & r_error ) { <nl> - <nl> - / * STEP 1 , CREATE * / <nl> - <nl> - if ( ! library . is_valid ( ) | | ( ( String ) script_name ) . empty ( ) | | ! script_data ) { <nl> - r_error . error = Variant : : CallError : : CALL_ERROR_INVALID_METHOD ; <nl> - return Variant ( ) ; <nl> - } <nl> - <nl> - r_error . error = Variant : : CallError : : CALL_OK ; <nl> - REF ref ; <nl> - Object * owner = NULL ; <nl> - <nl> - GDNativeScriptData * _baseptr = script_data ; <nl> - while ( _baseptr - > base_data ) { <nl> - _baseptr = _baseptr - > base_data ; <nl> - } <nl> - <nl> - if ( ! ( _baseptr - > base_native_type = = " " ) ) { <nl> - owner = ClassDB : : instance ( _baseptr - > base_native_type ) ; <nl> - } else { <nl> - owner = memnew ( Reference ) ; / / by default , no base means use reference <nl> - } <nl> - <nl> - Reference * r = owner - > cast_to < Reference > ( ) ; <nl> - if ( r ) { <nl> - ref = REF ( r ) ; <nl> - } <nl> - <nl> - / / GDScript does it like this : _create_instance ( p_args , p_argcount , owner , r ! = NULL , r_error ) ; <nl> - / / @ Todo support varargs for constructors . <nl> - GDNativeInstance * instance = ( GDNativeInstance * ) instance_create ( owner ) ; <nl> - <nl> - owner - > set_script_instance ( instance ) ; <nl> - if ( ! instance ) { <nl> - if ( ref . is_null ( ) ) { <nl> - memdelete ( owner ) ; / / no owner , sorry <nl> - } <nl> - return Variant ( ) ; <nl> - } <nl> - <nl> - if ( ref . is_valid ( ) ) { <nl> - return ref ; <nl> - } else { <nl> - return owner ; <nl> - } <nl> - } <nl> - <nl> - Ref < GDNativeLibrary > GDNativeScript : : get_library ( ) const { <nl> - return library ; <nl> - } <nl> - <nl> - void GDNativeScript : : set_library ( Ref < GDNativeLibrary > p_library ) { <nl> - library = p_library ; <nl> - <nl> - # ifdef TOOLS_ENABLED <nl> - if ( ! ScriptServer : : is_scripting_enabled ( ) ) <nl> - return ; <nl> - # endif <nl> - if ( library . is_valid ( ) ) { <nl> - Error initalize_status = library - > _initialize ( ) ; <nl> - ERR_FAIL_COND ( initalize_status ! = OK ) ; <nl> - if ( script_name ) { <nl> - script_data = library - > native_library - > scripts [ script_name ] ; <nl> - ERR_FAIL_COND ( ! script_data ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - StringName GDNativeScript : : get_script_name ( ) const { <nl> - return script_name ; <nl> - } <nl> - <nl> - void GDNativeScript : : set_script_name ( StringName p_script_name ) { <nl> - script_name = p_script_name ; <nl> - <nl> - if ( library . is_valid ( ) ) { <nl> - # ifdef TOOLS_ENABLED <nl> - if ( ! library - > native_library ) { <nl> - library - > _initialize ( ) ; <nl> - } <nl> - # endif <nl> - if ( library - > native_library ) { <nl> - script_data = library - > get_script_data ( script_name ) ; <nl> - ERR_FAIL_COND ( ! script_data ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - void GDNativeScript : : _bind_methods ( ) { <nl> - ClassDB : : bind_method ( D_METHOD ( " get_library : GDNativeLibrary " ) , & GDNativeScript : : get_library ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " set_library " , " library : GDNativeLibrary " ) , & GDNativeScript : : set_library ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " get_script_name " ) , & GDNativeScript : : get_script_name ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " set_script_name " , " script_name " ) , & GDNativeScript : : set_script_name ) ; <nl> - <nl> - ClassDB : : bind_vararg_method ( METHOD_FLAGS_DEFAULT , " new " , & GDNativeScript : : _new , MethodInfo ( Variant : : OBJECT , " new " ) ) ; <nl> - <nl> - ADD_PROPERTYNZ ( PropertyInfo ( Variant : : OBJECT , " library " , PROPERTY_HINT_RESOURCE_TYPE , " GDNativeLibrary " ) , " set_library " , " get_library " ) ; <nl> - ADD_PROPERTYNZ ( PropertyInfo ( Variant : : STRING , " script_name " ) , " set_script_name " , " get_script_name " ) ; <nl> - } <nl> - <nl> - GDNativeScript : : GDNativeScript ( ) { <nl> - script_data = NULL ; <nl> - GDNativeScriptLanguage : : get_singleton ( ) - > script_list . insert ( this ) ; <nl> - } <nl> - <nl> - GDNativeScript : : ~ GDNativeScript ( ) { <nl> - / / hmm <nl> - GDNativeScriptLanguage : : get_singleton ( ) - > script_list . erase ( this ) ; <nl> - } <nl> - <nl> - / / Library <nl> - <nl> - GDNativeLibrary * GDNativeLibrary : : currently_initialized_library = NULL ; <nl> - <nl> - GDNativeLibrary * GDNativeLibrary : : get_currently_initialized_library ( ) { <nl> - return currently_initialized_library ; <nl> - } <nl> - <nl> - static const char * _dl_platforms_info [ ] = { <nl> - " | unix | so | Unix " , <nl> - " unix | x11 | so | X11 " , <nl> - " unix | server | so | Server " , <nl> - " unix | android | so | Android " , <nl> - " unix | haiku | so | Haiku " , / / Right ? <nl> - " | mac | dylib | Mac " , <nl> - " mac | ios | dylib | iOS " , <nl> - " mac | osx | dylib | OSX " , <nl> - " | html5 | js | HTML5 " , <nl> - " | windows | dll | Windows " , <nl> - " windows | uwp | dll | UWP " , <nl> - NULL / / Finishing condition <nl> + " WebAssembly " <nl> } ; <nl> + String GDNativeLibrary : : platform_lib_ext [ NUM_PLATFORMS ] = { <nl> + " so " , <nl> + " so " , <nl> + " dll " , <nl> + " dll " , <nl> + " dylib " , <nl> <nl> - void GDNativeLibrary : : set_platform_file ( StringName p_platform , String p_file ) { <nl> - if ( p_file . empty ( ) ) { <nl> - platform_files . erase ( p_platform ) ; <nl> - } else { <nl> - platform_files [ p_platform ] = p_file ; <nl> - } <nl> - } <nl> - <nl> - String GDNativeLibrary : : get_platform_file ( StringName p_platform ) const { <nl> - if ( platform_files . has ( p_platform ) ) { <nl> - return platform_files [ p_platform ] ; <nl> - } else { <nl> - return " " ; <nl> - } <nl> - } <nl> - <nl> - Error GDNativeLibrary : : _initialize ( ) { <nl> - _THREAD_SAFE_METHOD_ <nl> - <nl> - / / Get the file <nl> - <nl> - const String platform_name = OS : : get_singleton ( ) - > get_name ( ) ; <nl> - String platform_file ( " " ) ; <nl> - char * * platform_info = ( char * * ) _dl_platforms_info ; <nl> - <nl> - if ( platform_files . has ( platform_name . to_lower ( ) ) ) { <nl> - platform_file = platform_files [ platform_name . to_lower ( ) ] ; <nl> - } <nl> - <nl> - while ( * platform_info ) { <nl> - String platform_info_string ( * platform_info ) ; <nl> - <nl> - if ( platform_name = = platform_info_string . get_slicec ( ' | ' , 3 ) ) { <nl> - String platform_key = platform_info_string . get_slicec ( ' | ' , 1 ) ; <nl> - String fallback_platform_key = platform_info_string . get_slicec ( ' | ' , 0 ) ; <nl> - <nl> - if ( platform_files . has ( platform_key ) ) { <nl> - platform_file = platform_files [ platform_key ] ; <nl> - } else if ( ! fallback_platform_key . empty ( ) & & platform_files . has ( fallback_platform_key ) ) { <nl> - platform_file = platform_files [ fallback_platform_key ] ; <nl> - } else { <nl> - return ERR_UNAVAILABLE ; <nl> - } <nl> - } <nl> - platform_info + + ; <nl> - } <nl> - ERR_FAIL_COND_V ( platform_file = = " " , ERR_DOES_NOT_EXIST ) ; <nl> - <nl> - StringName path = ProjectSettings : : get_singleton ( ) - > globalize_path ( platform_file ) ; <nl> - <nl> - GDNativeLibrary : : currently_initialized_library = this ; <nl> - <nl> - Error ret = NativeLibrary : : initialize ( native_library , path ) ; <nl> - native_library - > dllib = this ; <nl> - <nl> - GDNativeLibrary : : currently_initialized_library = NULL ; <nl> + " so " , <nl> + " dylib " , <nl> <nl> - return ret ; <nl> - } <nl> - <nl> - Error GDNativeLibrary : : _terminate ( ) { <nl> - ERR_FAIL_COND_V ( ! native_library , ERR_BUG ) ; <nl> - ERR_FAIL_COND_V ( ! native_library - > handle , ERR_BUG ) ; <nl> - <nl> - / / de - init stuff <nl> - <nl> - for ( Map < StringName , GDNativeScriptData * > : : Element * E = native_library - > scripts . front ( ) ; E ; E = E - > next ( ) ) { <nl> - for ( Map < StringName , GDNativeScriptData : : Method > : : Element * M = E - > get ( ) - > methods . front ( ) ; M ; M = M - > next ( ) ) { <nl> - if ( M - > get ( ) . method . free_func ) { <nl> - M - > get ( ) . method . free_func ( M - > get ( ) . method . method_data ) ; <nl> - } <nl> - } <nl> - if ( E - > get ( ) - > create_func . free_func ) { <nl> - E - > get ( ) - > create_func . free_func ( E - > get ( ) - > create_func . method_data ) ; <nl> - } <nl> - if ( E - > get ( ) - > destroy_func . free_func ) { <nl> - E - > get ( ) - > destroy_func . free_func ( E - > get ( ) - > destroy_func . method_data ) ; <nl> - } <nl> - <nl> - for ( Set < GDNativeScript * > : : Element * S = GDNativeScriptLanguage : : get_singleton ( ) - > script_list . front ( ) ; S ; S = S - > next ( ) ) { <nl> - if ( S - > get ( ) - > script_data = = E - > get ( ) ) { <nl> - S - > get ( ) - > script_data = NULL ; <nl> - } <nl> - } <nl> - <nl> - memdelete ( E - > get ( ) ) ; <nl> - } <nl> - <nl> - Error ret = NativeLibrary : : terminate ( native_library ) ; <nl> - native_library - > scripts . clear ( ) ; <nl> - <nl> - return ret ; <nl> - } <nl> - <nl> - void GDNativeLibrary : : _register_script ( const StringName p_name , const StringName p_base , godot_instance_create_func p_instance_func , godot_instance_destroy_func p_destroy_func ) { <nl> - ERR_FAIL_COND ( ! native_library ) ; <nl> - ERR_FAIL_COND ( native_library - > scripts . has ( p_name ) ) ; <nl> - <nl> - GDNativeScriptData * s = memnew ( GDNativeScriptData ) ; <nl> - s - > base = p_base ; <nl> - s - > create_func = p_instance_func ; <nl> - s - > destroy_func = p_destroy_func ; <nl> - Map < StringName , GDNativeScriptData * > : : Element * E = native_library - > scripts . find ( p_base ) ; <nl> - if ( E ) { <nl> - s - > base_data = E - > get ( ) ; <nl> - s - > base_native_type = s - > base_data - > base_native_type ; <nl> - } else { <nl> - if ( ! ClassDB : : class_exists ( p_base ) ) { <nl> - memdelete ( s ) ; <nl> - ERR_EXPLAIN ( " Invalid base for registered type ' " + p_name + " ' " ) ; <nl> - ERR_FAIL ( ) ; <nl> - } <nl> - s - > base_native_type = p_base ; <nl> - } <nl> - <nl> - native_library - > scripts . insert ( p_name , s ) ; <nl> - } <nl> - <nl> - void GDNativeLibrary : : _register_tool_script ( const StringName p_name , const StringName p_base , godot_instance_create_func p_instance_func , godot_instance_destroy_func p_destroy_func ) { <nl> - ERR_FAIL_COND ( ! native_library ) ; <nl> - ERR_FAIL_COND ( native_library - > scripts . has ( p_name ) ) ; <nl> - <nl> - GDNativeScriptData * s = memnew ( GDNativeScriptData ) ; <nl> - s - > base = p_base ; <nl> - s - > create_func = p_instance_func ; <nl> - s - > destroy_func = p_destroy_func ; <nl> - s - > is_tool = true ; <nl> - Map < StringName , GDNativeScriptData * > : : Element * E = native_library - > scripts . find ( p_base ) ; <nl> - if ( E ) { <nl> - s - > base_data = E - > get ( ) ; <nl> - s - > base_native_type = s - > base_data - > base_native_type ; <nl> - } else { <nl> - if ( ! ClassDB : : class_exists ( p_base ) ) { <nl> - memdelete ( s ) ; <nl> - ERR_EXPLAIN ( " Invalid base for registered type ' " + p_name + " ' " ) ; <nl> - ERR_FAIL ( ) ; <nl> - } <nl> - s - > base_native_type = p_base ; <nl> - } <nl> - <nl> - native_library - > scripts . insert ( p_name , s ) ; <nl> - } <nl> - <nl> - void GDNativeLibrary : : _register_script_method ( const StringName p_name , const StringName p_method , godot_method_attributes p_attr , godot_instance_method p_func , MethodInfo p_info ) { <nl> - ERR_FAIL_COND ( ! native_library ) ; <nl> - ERR_FAIL_COND ( ! native_library - > scripts . has ( p_name ) ) ; <nl> - <nl> - p_info . name = p_method ; <nl> - GDNativeScriptData : : Method method ; <nl> - <nl> - method = GDNativeScriptData : : Method ( p_func , p_info , p_attr . rpc_type ) ; <nl> - <nl> - native_library - > scripts [ p_name ] - > methods . insert ( p_method , method ) ; <nl> - } <nl> - <nl> - void GDNativeLibrary : : _register_script_property ( const StringName p_name , const String p_path , godot_property_attributes * p_attr , godot_property_set_func p_setter , godot_property_get_func p_getter ) { <nl> - ERR_FAIL_COND ( ! native_library ) ; <nl> - ERR_FAIL_COND ( ! native_library - > scripts . has ( p_name ) ) ; <nl> - <nl> - GDNativeScriptData : : Property p ; <nl> - <nl> - PropertyInfo pi ; <nl> - pi . name = p_path ; <nl> - <nl> - if ( p_attr ! = NULL ) { <nl> - pi = PropertyInfo ( ( Variant : : Type ) p_attr - > type , p_path , ( PropertyHint ) p_attr - > hint , * ( String * ) & p_attr - > hint_string , p_attr - > usage ) ; <nl> + " wasm " <nl> + } ; <nl> <nl> - p = GDNativeScriptData : : Property ( p_setter , p_getter , pi , * ( Variant * ) & p_attr - > default_value , p_attr - > rset_type ) ; <nl> - } <nl> + / / TODO ( karroffel ) : make this actually do something lol . <nl> + GDNativeLibrary : : Platform GDNativeLibrary : : current_platform = X11_64BIT ; <nl> <nl> - native_library - > scripts [ p_name ] - > properties . insert ( p_path , p ) ; <nl> + GDNativeLibrary : : GDNativeLibrary ( ) <nl> + : library_paths ( ) { <nl> } <nl> <nl> - void GDNativeLibrary : : _register_script_signal ( const StringName p_name , const godot_signal * p_signal ) { <nl> - ERR_FAIL_COND ( ! native_library ) ; <nl> - ERR_FAIL_COND ( ! native_library - > scripts . has ( p_name ) ) ; <nl> - ERR_FAIL_COND ( ! p_signal ) ; <nl> - <nl> - GDNativeScriptData : : Signal signal ; <nl> - <nl> - signal . signal . name = * ( String * ) & p_signal - > name ; <nl> - <nl> - { <nl> - List < PropertyInfo > arguments ; <nl> - for ( int i = 0 ; i < p_signal - > num_args ; i + + ) { <nl> - PropertyInfo info ; <nl> - godot_signal_argument attrib = p_signal - > args [ i ] ; <nl> - <nl> - String * name = ( String * ) & attrib . name ; <nl> - info . name = * name ; <nl> - info . type = ( Variant : : Type ) attrib . type ; <nl> - info . hint = ( PropertyHint ) attrib . hint ; <nl> - info . hint_string = * ( String * ) & attrib . hint_string ; <nl> - info . usage = attrib . usage ; <nl> - <nl> - arguments . push_back ( info ) ; <nl> - } <nl> - <nl> - signal . signal . arguments = arguments ; <nl> - } <nl> - <nl> - { <nl> - Vector < Variant > default_arguments ; <nl> - for ( int i = 0 ; i < p_signal - > num_default_args ; i + + ) { <nl> - Variant * v ; <nl> - godot_signal_argument attrib = p_signal - > args [ i ] ; <nl> - <nl> - v = ( Variant * ) & attrib . default_value ; <nl> - <nl> - default_arguments . push_back ( * v ) ; <nl> - } <nl> - <nl> - signal . signal . default_arguments = default_arguments ; <nl> - } <nl> - <nl> - native_library - > scripts [ p_name ] - > signals_ . insert ( * ( String * ) & p_signal - > name , signal ) ; <nl> + GDNativeLibrary : : ~ GDNativeLibrary ( ) { <nl> } <nl> <nl> - GDNativeScriptData * GDNativeLibrary : : get_script_data ( const StringName p_name ) { <nl> - ERR_FAIL_COND_V ( ! native_library , NULL ) ; <nl> - <nl> - ERR_FAIL_COND_V ( ! native_library - > scripts . has ( p_name ) , NULL ) ; <nl> - <nl> - return native_library - > scripts [ p_name ] ; <nl> + void GDNativeLibrary : : _bind_methods ( ) { <nl> + ClassDB : : bind_method ( D_METHOD ( " set_library_path " , " platform " , " path " ) , & GDNativeLibrary : : set_library_path ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_library_path " , " platform " ) , & GDNativeLibrary : : get_library_path ) ; <nl> } <nl> <nl> bool GDNativeLibrary : : _set ( const StringName & p_name , const Variant & p_value ) { <nl> String name = p_name ; <nl> if ( name . begins_with ( " platform / " ) ) { <nl> - set_platform_file ( name . get_slice ( " / " , 1 ) , p_value ) ; <nl> + set_library_path ( name . get_slice ( " / " , 1 ) , p_value ) ; <nl> return true ; <nl> } <nl> return false ; <nl> bool GDNativeLibrary : : _set ( const StringName & p_name , const Variant & p_value ) { <nl> bool GDNativeLibrary : : _get ( const StringName & p_name , Variant & r_ret ) const { <nl> String name = p_name ; <nl> if ( name . begins_with ( " platform / " ) ) { <nl> - r_ret = get_platform_file ( name . get_slice ( " / " , 1 ) ) ; <nl> + r_ret = get_library_path ( name . get_slice ( " / " , 1 ) ) ; <nl> return true ; <nl> } <nl> return false ; <nl> } <nl> <nl> void GDNativeLibrary : : _get_property_list ( List < PropertyInfo > * p_list ) const { <nl> - char * * platform_info = ( char * * ) _dl_platforms_info ; <nl> - <nl> - Set < String > registered_platform_names ; <nl> - { <nl> - List < StringName > ep ; <nl> - / / ep . push_back ( " X11 " ) ; <nl> - / / EditorImportExport : : get_singleton ( ) - > get_export_platforms ( & ep ) ; <nl> - <nl> - / / @ Todo <nl> - / / get export platforms with the new export system somehow . <nl> - for ( List < StringName > : : Element * E = ep . front ( ) ; E ; E = E - > next ( ) ) { <nl> - registered_platform_names . insert ( String ( E - > get ( ) ) . to_lower ( ) ) ; <nl> - } <nl> - } <nl> - <nl> - while ( * platform_info ) { <nl> - String platform_info_string ( * platform_info ) ; <nl> - String fallback_platform_key = platform_info_string . get_slicec ( ' | ' , 0 ) ; <nl> - String platform_key = platform_info_string . get_slicec ( ' | ' , 1 ) ; <nl> - String platform_extension = platform_info_string . get_slicec ( ' | ' , 2 ) ; <nl> - String platform_name = platform_info_string . get_slicec ( ' | ' , 3 ) ; <nl> - <nl> - registered_platform_names . erase ( platform_name ) ; <nl> - <nl> - if ( fallback_platform_key . empty ( ) ) { <nl> - p_list - > push_back ( PropertyInfo ( Variant : : STRING , " platform / " + platform_key , PROPERTY_HINT_FILE , " * . " + platform_extension ) ) ; <nl> - <nl> - } else { <nl> - if ( platform_files . has ( platform_key ) ) { <nl> - p_list - > push_back ( PropertyInfo ( Variant : : STRING , " platform / " + platform_key , PROPERTY_HINT_FILE , " * . " + platform_extension , PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CHECKABLE | PROPERTY_USAGE_CHECKED ) ) ; <nl> - } else { <nl> - p_list - > push_back ( PropertyInfo ( Variant : : STRING , " platform / " + platform_key , PROPERTY_HINT_FILE , " * . " + platform_extension , PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CHECKABLE ) ) ; <nl> - } <nl> - } <nl> - platform_info + + ; <nl> - } <nl> - <nl> - while ( registered_platform_names . size ( ) ) { <nl> - const String platform_name = registered_platform_names . front ( ) - > get ( ) ; <nl> - registered_platform_names . erase ( platform_name ) ; <nl> - p_list - > push_back ( PropertyInfo ( Variant : : STRING , " platform / " + platform_name . to_lower ( ) , PROPERTY_HINT_FILE , " * " ) ) ; <nl> - } <nl> - } <nl> - <nl> - void GDNativeLibrary : : _notification ( int what ) { <nl> - / / TODO <nl> - } <nl> - <nl> - void GDNativeLibrary : : _bind_methods ( ) { <nl> - ClassDB : : bind_method ( D_METHOD ( " set_platform_file " , " platform " , " file " ) , & GDNativeLibrary : : set_platform_file ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " get_platform_file " , " platform " ) , & GDNativeLibrary : : get_platform_file ) ; <nl> - } <nl> - <nl> - GDNativeLibrary : : GDNativeLibrary ( ) { <nl> - native_library = NULL ; <nl> - } <nl> - <nl> - GDNativeLibrary : : ~ GDNativeLibrary ( ) { <nl> - <nl> - if ( ! native_library ) { <nl> - return ; <nl> - } <nl> - <nl> - if ( native_library - > handle ) { <nl> - _terminate ( ) ; <nl> + for ( int i = 0 ; i < NUM_PLATFORMS ; i + + ) { <nl> + p_list - > push_back ( PropertyInfo ( Variant : : STRING , <nl> + " platform / " + platform_names [ i ] , <nl> + PROPERTY_HINT_FILE , <nl> + " * . " + platform_lib_ext [ i ] ) ) ; <nl> } <nl> } <nl> <nl> - / / Instance <nl> - <nl> - bool GDNativeInstance : : set ( const StringName & p_name , const Variant & p_value ) { <nl> - if ( ! script - > script_data ) <nl> - return false ; <nl> - if ( script - > script_data - > properties . has ( p_name ) ) { <nl> - script - > script_data - > properties [ p_name ] . setter . set_func ( ( godot_object * ) owner , script - > script_data - > properties [ p_name ] . setter . method_data , userdata , * ( godot_variant * ) & p_value ) ; <nl> - return true ; <nl> + void GDNativeLibrary : : set_library_path ( StringName p_platform , String p_path ) { <nl> + int i ; <nl> + for ( i = 0 ; i < = NUM_PLATFORMS ; i + + ) { <nl> + if ( i = = NUM_PLATFORMS ) break ; <nl> + if ( platform_names [ i ] = = p_platform ) { <nl> + break ; <nl> + } <nl> } <nl> <nl> - Map < StringName , GDNativeScriptData : : Method > : : Element * E = script - > script_data - > methods . find ( " _set " ) ; <nl> - if ( E ) { <nl> - Variant name = p_name ; <nl> - const Variant * args [ 2 ] = { & name , & p_value } ; <nl> - <nl> - E - > get ( ) . method . method ( ( godot_object * ) owner , E - > get ( ) . method . method_data , userdata , 2 , ( godot_variant * * ) args ) ; <nl> - return true ; <nl> + if ( i = = NUM_PLATFORMS ) { <nl> + ERR_EXPLAIN ( String ( " No such platform : " ) + p_platform ) ; <nl> + ERR_FAIL ( ) ; <nl> } <nl> <nl> - return false ; <nl> + library_paths [ i ] = p_path ; <nl> } <nl> <nl> - bool GDNativeInstance : : get ( const StringName & p_name , Variant & r_ret ) const { <nl> - if ( ! script - > script_data ) <nl> - return false ; <nl> - if ( script - > script_data - > properties . has ( p_name ) ) { <nl> - godot_variant value = script - > script_data - > properties [ p_name ] . getter . get_func ( ( godot_object * ) owner , script - > script_data - > properties [ p_name ] . getter . method_data , userdata ) ; <nl> - r_ret = * ( Variant * ) & value ; <nl> - godot_variant_destroy ( & value ) ; <nl> - return true ; <nl> - } <nl> - <nl> - Map < StringName , GDNativeScriptData : : Method > : : Element * E = script - > script_data - > methods . find ( " _get " ) ; <nl> - if ( E ) { <nl> - Variant name = p_name ; <nl> - const Variant * args [ 1 ] = { & name } ; <nl> - <nl> - godot_variant result = E - > get ( ) . method . method ( ( godot_object * ) owner , E - > get ( ) . method . method_data , userdata , 1 , ( godot_variant * * ) args ) ; <nl> - if ( ( ( Variant * ) & result ) - > get_type ( ) ! = Variant : : NIL ) { <nl> - r_ret = * ( Variant * ) & result ; <nl> - godot_variant_destroy ( & result ) ; <nl> - return true ; <nl> + String GDNativeLibrary : : get_library_path ( StringName p_platform ) const { <nl> + int i ; <nl> + for ( i = 0 ; i < = NUM_PLATFORMS ; i + + ) { <nl> + if ( i = = NUM_PLATFORMS ) break ; <nl> + if ( platform_names [ i ] = = p_platform ) { <nl> + break ; <nl> } <nl> - godot_variant_destroy ( & result ) ; <nl> } <nl> <nl> - return false ; <nl> - } <nl> - <nl> - void GDNativeInstance : : get_property_list ( List < PropertyInfo > * p_properties ) const { <nl> - script - > get_script_property_list ( p_properties ) ; <nl> - / / TODO : dynamic properties <nl> - <nl> - Map < StringName , GDNativeScriptData : : Method > : : Element * E = script - > script_data - > methods . find ( " _get_property_list " ) ; <nl> - if ( E ) { <nl> - godot_variant result = E - > get ( ) . method . method ( ( godot_object * ) owner , E - > get ( ) . method . method_data , userdata , 0 , NULL ) ; <nl> - Variant ret = * ( Variant * ) & result ; <nl> - godot_variant_destroy ( & result ) ; <nl> - <nl> - if ( ret . get_type ( ) ! = Variant : : ARRAY ) { <nl> - ERR_EXPLAIN ( " Wrong type for _get_property_list , must be an array of dictionaries . " ) ; <nl> - ERR_FAIL ( ) ; <nl> - } <nl> - <nl> - Array arr = ret ; <nl> - for ( int i = 0 ; i < arr . size ( ) ; i + + ) { <nl> - Dictionary d = arr [ i ] ; <nl> - ERR_CONTINUE ( ! d . has ( " name " ) ) <nl> - ERR_CONTINUE ( ! d . has ( " type " ) ) <nl> - <nl> - PropertyInfo pinfo ; <nl> - <nl> - pinfo . type = Variant : : Type ( d [ " type " ] . operator int ( ) ) ; <nl> - ERR_CONTINUE ( pinfo . type < 0 | | pinfo . type > = Variant : : VARIANT_MAX ) ; <nl> - <nl> - pinfo . name = d [ " name " ] ; <nl> - ERR_CONTINUE ( pinfo . name = = " " ) ; <nl> - <nl> - if ( d . has ( " hint " ) ) { <nl> - pinfo . hint = PropertyHint ( d [ " hint " ] . operator int ( ) ) ; <nl> - } <nl> - if ( d . has ( " hint_string " ) ) { <nl> - pinfo . hint_string = d [ " hint_string " ] ; <nl> - } <nl> - if ( d . has ( " usage " ) ) { <nl> - pinfo . usage = d [ " usage " ] ; <nl> - } <nl> - <nl> - p_properties - > push_back ( pinfo ) ; <nl> - } <nl> + if ( i = = NUM_PLATFORMS ) { <nl> + ERR_EXPLAIN ( String ( " No such platform : " ) + p_platform ) ; <nl> + ERR_FAIL_V ( " " ) ; <nl> } <nl> - } <nl> <nl> - Variant : : Type GDNativeInstance : : get_property_type ( const StringName & p_name , bool * r_is_valid ) const { <nl> - if ( script - > script_data - > properties . has ( p_name ) ) { <nl> - * r_is_valid = true ; <nl> - return script - > script_data - > properties [ p_name ] . info . type ; <nl> - } <nl> - * r_is_valid = false ; <nl> - return Variant : : NIL ; <nl> + return library_paths [ i ] ; <nl> } <nl> <nl> - void GDNativeInstance : : get_method_list ( List < MethodInfo > * p_list ) const { <nl> - script - > get_script_method_list ( p_list ) ; <nl> + String GDNativeLibrary : : get_active_library_path ( ) const { <nl> + return library_paths [ GDNativeLibrary : : current_platform ] ; <nl> } <nl> <nl> - bool GDNativeInstance : : has_method ( const StringName & p_method ) const { <nl> - return script - > has_method ( p_method ) ; <nl> + GDNative : : GDNative ( ) { <nl> + initialized = false ; <nl> + native_handle = NULL ; <nl> } <nl> <nl> - Variant GDNativeInstance : : call ( const StringName & p_method , const Variant * * p_args , int p_argcount , Variant : : CallError & r_error ) { <nl> - / / TODO : validated methods & errors <nl> - <nl> - GDNativeScriptData * data_ptr = script - > script_data ; <nl> - while ( data_ptr ) { <nl> - Map < StringName , GDNativeScriptData : : Method > : : Element * E = data_ptr - > methods . find ( p_method ) ; <nl> - if ( E ) { <nl> - godot_variant result = E - > get ( ) . method . method ( ( godot_object * ) owner , E - > get ( ) . method . method_data , userdata , p_argcount , ( godot_variant * * ) p_args ) ; <nl> - return * ( Variant * ) & result ; <nl> - } <nl> - data_ptr = data_ptr - > base_data ; <nl> - } <nl> - r_error . error = Variant : : CallError : : CALL_ERROR_INVALID_METHOD ; <nl> - return Variant ( ) ; <nl> + GDNative : : ~ GDNative ( ) { <nl> + / / TODO ( karroffel ) : implement ALL the things ! <nl> } <nl> <nl> - void GDNativeInstance : : call_multilevel ( const StringName & p_method , const Variant * * p_args , int p_argcount ) { <nl> - / / TODO : validated methods & errors <nl> + extern " C " void _api_anchor ( ) ; <nl> <nl> - GDNativeScriptData * data_ptr = script - > script_data ; <nl> - while ( data_ptr ) { <nl> - Map < StringName , GDNativeScriptData : : Method > : : Element * E = data_ptr - > methods . find ( p_method ) ; <nl> - if ( E ) { <nl> - E - > get ( ) . method . method ( ( godot_object * ) owner , E - > get ( ) . method . method_data , userdata , p_argcount , ( godot_variant * * ) p_args ) ; <nl> - } <nl> - data_ptr = data_ptr - > base_data ; <nl> - } <nl> + void GDNative : : _compile_dummy_for_api ( ) { <nl> + _api_anchor ( ) ; <nl> } <nl> <nl> - void GDNativeInstance : : _ml_call_reversed ( GDNativeScriptData * data_ptr , const StringName & p_method , const Variant * * p_args , int p_argcount ) { <nl> - / / TODO : validated methods & errors <nl> + void GDNative : : _bind_methods ( ) { <nl> + ClassDB : : bind_method ( D_METHOD ( " set_library " , " library : GDNativeLibrary " ) , & GDNative : : set_library ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_library : GDNativeLibrary " ) , & GDNative : : get_library ) ; <nl> <nl> - if ( data_ptr - > base_data ) <nl> - _ml_call_reversed ( data_ptr - > base_data , p_method , p_args , p_argcount ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " initialize " ) , & GDNative : : initialize ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " terminate " ) , & GDNative : : terminate ) ; <nl> <nl> - / / Variant : : CallError ce ; <nl> + / / TODO ( karroffel ) : get_native_ ( raw_ ) call_types binding ? <nl> <nl> - Map < StringName , GDNativeScriptData : : Method > : : Element * E = data_ptr - > methods . find ( p_method ) ; <nl> - if ( E ) { <nl> - E - > get ( ) . method . method ( ( godot_object * ) owner , E - > get ( ) . method . method_data , userdata , p_argcount , ( godot_variant * * ) p_args ) ; <nl> - } <nl> - } <nl> - <nl> - void GDNativeInstance : : call_multilevel_reversed ( const StringName & p_method , const Variant * * p_args , int p_argcount ) { <nl> - if ( script . ptr ( ) & & script - > script_data ) { <nl> - _ml_call_reversed ( script - > script_data , p_method , p_args , p_argcount ) ; <nl> - } <nl> - } <nl> + / / TODO ( karroffel ) : make this a varargs function ? <nl> + ClassDB : : bind_method ( D_METHOD ( " call_native : Variant " , " procedure_name " , " arguments : Array " ) , & GDNative : : call_native ) ; <nl> <nl> - void GDNativeInstance : : notification ( int p_notification ) { <nl> - Variant value = p_notification ; <nl> - const Variant * args [ 1 ] = { & value } ; <nl> - call_multilevel ( GDNativeScriptLanguage : : singleton - > strings . _notification , args , 1 ) ; <nl> + ADD_PROPERTYNZ ( PropertyInfo ( Variant : : OBJECT , " library " , PROPERTY_HINT_RESOURCE_TYPE , " GDNativeLibrary " ) , " set_library " , " get_library " ) ; <nl> } <nl> <nl> - Ref < Script > GDNativeInstance : : get_script ( ) const { <nl> - return script ; <nl> + void GDNative : : set_library ( Ref < GDNativeLibrary > p_library ) { <nl> + library = p_library ; <nl> } <nl> <nl> - ScriptLanguage * GDNativeInstance : : get_language ( ) { <nl> - return GDNativeScriptLanguage : : singleton ; <nl> + Ref < GDNativeLibrary > GDNative : : get_library ( ) { <nl> + return library ; <nl> } <nl> <nl> - ScriptInstance : : RPCMode GDNativeInstance : : get_rpc_mode ( const StringName & p_method ) const { <nl> - GDNativeScriptData : : Method m = script - > script_data - > methods [ p_method ] ; <nl> - switch ( m . rpc_mode ) { <nl> - case GODOT_METHOD_RPC_MODE_DISABLED : <nl> - return RPC_MODE_DISABLED ; <nl> - case GODOT_METHOD_RPC_MODE_REMOTE : <nl> - return RPC_MODE_REMOTE ; <nl> - case GODOT_METHOD_RPC_MODE_SYNC : <nl> - return RPC_MODE_SYNC ; <nl> - case GODOT_METHOD_RPC_MODE_MASTER : <nl> - return RPC_MODE_MASTER ; <nl> - case GODOT_METHOD_RPC_MODE_SLAVE : <nl> - return RPC_MODE_SLAVE ; <nl> - default : <nl> - return RPC_MODE_DISABLED ; <nl> + bool GDNative : : initialize ( ) { <nl> + if ( library . is_null ( ) ) { <nl> + ERR_PRINT ( " No library set , can ' t initialize GDNative object " ) ; <nl> + return false ; <nl> } <nl> - } <nl> <nl> - ScriptInstance : : RPCMode GDNativeInstance : : get_rset_mode ( const StringName & p_variable ) const { <nl> - GDNativeScriptData : : Property p = script - > script_data - > properties [ p_variable ] ; <nl> - switch ( p . rset_mode ) { <nl> - case GODOT_METHOD_RPC_MODE_DISABLED : <nl> - return RPC_MODE_DISABLED ; <nl> - case GODOT_METHOD_RPC_MODE_REMOTE : <nl> - return RPC_MODE_REMOTE ; <nl> - case GODOT_METHOD_RPC_MODE_SYNC : <nl> - return RPC_MODE_SYNC ; <nl> - case GODOT_METHOD_RPC_MODE_MASTER : <nl> - return RPC_MODE_MASTER ; <nl> - case GODOT_METHOD_RPC_MODE_SLAVE : <nl> - return RPC_MODE_SLAVE ; <nl> - default : <nl> - return RPC_MODE_DISABLED ; <nl> + String lib_path = library - > get_active_library_path ( ) ; <nl> + if ( lib_path . empty ( ) ) { <nl> + ERR_PRINT ( " No library set for this platform " ) ; <nl> + return false ; <nl> } <nl> - } <nl> <nl> - GDNativeInstance : : GDNativeInstance ( ) { <nl> - owner = NULL ; <nl> - userdata = NULL ; <nl> - } <nl> - <nl> - GDNativeInstance : : ~ GDNativeInstance ( ) { <nl> - if ( script . is_valid ( ) ) { <nl> - if ( owner ) { <nl> - script - > instances . erase ( owner ) ; <nl> - } <nl> - if ( ! script - > script_data ) <nl> - return ; <nl> - script - > script_data - > destroy_func . destroy_func ( ( godot_object * ) owner , script - > script_data - > destroy_func . method_data , userdata ) ; <nl> - if ( script - > script_data - > destroy_func . free_func ) <nl> - script - > script_data - > destroy_func . free_func ( script - > script_data - > destroy_func . method_data ) ; <nl> - if ( script - > script_data - > create_func . free_func ) <nl> - script - > script_data - > create_func . free_func ( script - > script_data - > create_func . method_data ) ; <nl> + String path = ProjectSettings : : get_singleton ( ) - > globalize_path ( lib_path ) ; <nl> + Error err = OS : : get_singleton ( ) - > open_dynamic_library ( path , native_handle ) ; <nl> + if ( err ! = OK ) { <nl> + return false ; <nl> } <nl> - } <nl> - <nl> - / / Language <nl> - <nl> - GDNativeScriptLanguage * GDNativeScriptLanguage : : singleton = NULL ; <nl> - <nl> - String GDNativeScriptLanguage : : get_name ( ) const { <nl> - return " Native " ; <nl> - } <nl> - <nl> - void _add_reload_node ( ) { <nl> - # ifdef TOOLS_ENABLED <nl> - GDNativeReloadNode * rn = memnew ( GDNativeReloadNode ) ; <nl> - EditorNode : : get_singleton ( ) - > add_child ( rn ) ; <nl> - # endif <nl> - } <nl> - <nl> - void GDNativeScriptLanguage : : init ( ) { <nl> - / / TODO : Expose globals <nl> - GLOBAL_DEF ( " gdnative / default_gdnativelibrary " , " " ) ; <nl> - PropertyInfo prop_info ( Variant : : STRING , " gdnative / default_gdnativelibrary " , PROPERTY_HINT_FILE , " tres , res , dllib " ) ; <nl> - ProjectSettings : : get_singleton ( ) - > set_custom_property_info ( " gdnative / default_gdnativelibrary " , prop_info ) ; <nl> - <nl> - / / generate bindings <nl> - # if defined ( TOOLS_ENABLED ) & & defined ( DEBUG_METHODS_ENABLED ) <nl> - <nl> - List < String > args = OS : : get_singleton ( ) - > get_cmdline_args ( ) ; <nl> <nl> - List < String > : : Element * E = args . find ( " - - gdnative - generate - json - api " ) ; <nl> + void * library_init ; <nl> + err = OS : : get_singleton ( ) - > get_dynamic_library_symbol_handle ( <nl> + native_handle , <nl> + init_symbol , <nl> + library_init ) ; <nl> <nl> - if ( E & & E - > next ( ) ) { <nl> - if ( generate_c_api ( E - > next ( ) - > get ( ) ) ! = OK ) { <nl> - ERR_PRINT ( " Failed to generate C API \ n " ) ; <nl> - } <nl> + if ( err | | ! library_init ) { <nl> + return false ; <nl> } <nl> - # endif <nl> <nl> - # ifdef TOOLS_ENABLED <nl> - / / if ( SceneTree : : get_singleton ( ) - > is_editor_hint ( ) ) { <nl> - EditorNode : : add_init_callback ( & _add_reload_node ) ; <nl> - / / } <nl> - # endif <nl> - } <nl> - <nl> - String GDNativeScriptLanguage : : get_type ( ) const { <nl> - return " Native " ; <nl> - } <nl> - <nl> - String GDNativeScriptLanguage : : get_extension ( ) const { <nl> - return " gdn " ; <nl> - } <nl> - <nl> - Error GDNativeScriptLanguage : : execute_file ( const String & p_path ) { <nl> - return OK ; / / ? ? <nl> - } <nl> - <nl> - void GDNativeScriptLanguage : : finish ( ) { <nl> - / / cleanup is for noobs <nl> - } <nl> - <nl> - / / scons doesn ' t want to link in the api source so we need to call a dummy function to cause it to link <nl> - extern " C " void _api_anchor ( ) ; <nl> - <nl> - void GDNativeScriptLanguage : : _compile_dummy_for_the_api ( ) { <nl> - _api_anchor ( ) ; <nl> - } <nl> + godot_gdnative_init_fn library_init_fpointer ; <nl> + library_init_fpointer = ( godot_gdnative_init_fn ) library_init ; <nl> <nl> - Ref < Script > GDNativeScriptLanguage : : get_template ( const String & p_class_name , const String & p_base_class_name ) const { <nl> - GDNativeScript * src = memnew ( GDNativeScript ) ; <nl> - src - > set_script_name ( p_class_name ) ; <nl> - return Ref < GDNativeScript > ( src ) ; <nl> - } <nl> + godot_gdnative_init_options options ; <nl> <nl> - bool GDNativeScriptLanguage : : validate ( const String & p_script , int & r_line_error , int & r_col_error , String & r_test_error , const String & p_path , List < String > * r_functions ) const { <nl> - return false ; / / TODO <nl> - } <nl> + options . in_editor = SceneTree : : get_singleton ( ) - > is_editor_hint ( ) ; <nl> + options . core_api_hash = ClassDB : : get_api_hash ( ClassDB : : API_CORE ) ; <nl> + options . editor_api_hash = ClassDB : : get_api_hash ( ClassDB : : API_EDITOR ) ; <nl> + options . no_api_hash = ClassDB : : get_api_hash ( ClassDB : : API_NONE ) ; <nl> <nl> - Script * GDNativeScriptLanguage : : create_script ( ) const { <nl> - GDNativeScript * scr = memnew ( GDNativeScript ) ; <nl> - return scr ; <nl> - } <nl> + library_init_fpointer ( & options ) ; <nl> <nl> - bool GDNativeScriptLanguage : : has_named_classes ( ) const { <nl> return true ; <nl> } <nl> <nl> - int GDNativeScriptLanguage : : find_function ( const String & p_function , const String & p_code ) const { <nl> - return - 1 ; / / No source code ! <nl> - } <nl> - <nl> - String GDNativeScriptLanguage : : make_function ( const String & p_class , const String & p_name , const PoolStringArray & p_args ) const { <nl> - return " " ; / / No source code ! <nl> - } <nl> - <nl> - void GDNativeScriptLanguage : : add_global_constant ( const StringName & p_variable , const Variant & p_value ) { <nl> - / / TODO TODO TODO <nl> - } <nl> - <nl> - / / TODO : Any debugging ? ( research ) <nl> - String GDNativeScriptLanguage : : debug_get_error ( ) const { <nl> - return " " ; <nl> - } <nl> - <nl> - int GDNativeScriptLanguage : : debug_get_stack_level_count ( ) const { <nl> - return 1 ; / / ? <nl> - } <nl> - <nl> - int GDNativeScriptLanguage : : debug_get_stack_level_line ( int p_level ) const { <nl> - return - 1 ; <nl> - } <nl> - <nl> - String GDNativeScriptLanguage : : debug_get_stack_level_function ( int p_level ) const { <nl> - return " [ native code ] " ; / / ? <nl> - } <nl> - <nl> - String GDNativeScriptLanguage : : debug_get_stack_level_source ( int p_level ) const { <nl> - return " " ; <nl> - } <nl> - <nl> - void GDNativeScriptLanguage : : debug_get_stack_level_members ( int p_level , List < String > * p_members , List < Variant > * p_values , int p_max_subitems , int p_max_depth ) { } <nl> + bool GDNative : : terminate ( ) { <nl> <nl> - void GDNativeScriptLanguage : : debug_get_globals ( List < String > * p_locals , List < Variant > * p_values , int p_max_subitems , int p_max_depth ) { } <nl> - <nl> - String GDNativeScriptLanguage : : debug_parse_stack_level_expression ( int p_level , const String & p_expression , int p_max_subitems , int p_max_depth ) { <nl> - return " " ; / / ? ? <nl> - } <nl> - <nl> - void GDNativeScriptLanguage : : reload_all_scripts ( ) { <nl> - / / @ Todo <nl> - } <nl> + if ( native_handle = = NULL ) { <nl> + ERR_PRINT ( " No valid library handle , can ' t terminate GDNative object " ) ; <nl> + return false ; <nl> + } <nl> <nl> - void GDNativeScriptLanguage : : reload_tool_script ( const Ref < Script > & p_script , bool p_soft_reload ) { <nl> - / / @ Todo <nl> - OS : : get_singleton ( ) - > print ( " reload tool scripts \ n " ) ; <nl> - } <nl> + Error error = OK ; <nl> + void * library_terminate ; <nl> + error = OS : : get_singleton ( ) - > get_dynamic_library_symbol_handle ( <nl> + native_handle , <nl> + terminate_symbol , <nl> + library_terminate ) ; <nl> + if ( error ) { <nl> + OS : : get_singleton ( ) - > close_dynamic_library ( native_handle ) ; <nl> + native_handle = NULL ; <nl> + return true ; <nl> + } <nl> <nl> - void GDNativeScriptLanguage : : get_recognized_extensions ( List < String > * p_extensions ) const { <nl> - p_extensions - > push_back ( " gdn " ) ; / / Container file format <nl> - } <nl> + godot_gdnative_terminate_fn library_terminate_pointer ; <nl> + library_terminate_pointer = ( godot_gdnative_terminate_fn ) library_terminate ; <nl> <nl> - void GDNativeScriptLanguage : : get_public_functions ( List < MethodInfo > * p_functions ) const { <nl> - } <nl> + / / TODO ( karroffel ) : remove this ? Should be part of NativeScript , not <nl> + / / GDNative IMO <nl> + godot_gdnative_terminate_options options ; <nl> + options . in_editor = SceneTree : : get_singleton ( ) - > is_editor_hint ( ) ; <nl> <nl> - void GDNativeScriptLanguage : : get_public_constants ( List < Pair < String , Variant > > * p_constants ) const { <nl> - } <nl> + library_terminate_pointer ( & options ) ; <nl> <nl> - / / TODO : all profilling <nl> - void GDNativeScriptLanguage : : profiling_start ( ) { <nl> - } <nl> + / / GDNativeScriptLanguage : : get_singleton ( ) - > initialized_libraries . erase ( p_native_lib - > path ) ; <nl> <nl> - void GDNativeScriptLanguage : : profiling_stop ( ) { <nl> - } <nl> + OS : : get_singleton ( ) - > close_dynamic_library ( native_handle ) ; <nl> + native_handle = NULL ; <nl> <nl> - int GDNativeScriptLanguage : : profiling_get_accumulated_data ( ProfilingInfo * p_info_arr , int p_info_max ) { <nl> - return 0 ; <nl> + return false ; <nl> } <nl> <nl> - int GDNativeScriptLanguage : : profiling_get_frame_data ( ProfilingInfo * p_info_arr , int p_info_max ) { <nl> - return 0 ; <nl> + void GDNativeCallRegistry : : register_native_call_type ( StringName p_call_type , native_call_cb p_callback ) { <nl> + native_calls . insert ( p_call_type , p_callback ) ; <nl> } <nl> <nl> - void GDNativeScriptLanguage : : frame ( ) { <nl> + void GDNativeCallRegistry : : register_native_raw_call_type ( StringName p_raw_call_type , native_raw_call_cb p_callback ) { <nl> + native_raw_calls . insert ( p_raw_call_type , p_callback ) ; <nl> } <nl> <nl> - String GDNativeScriptLanguage : : get_init_symbol_name ( ) { <nl> - return " godot_native_init " ; / / TODO : Maybe make some internal function which would do the actual stuff <nl> - } <nl> + Vector < StringName > GDNativeCallRegistry : : get_native_call_types ( ) { <nl> + Vector < StringName > call_types ; <nl> + call_types . resize ( native_calls . size ( ) ) ; <nl> <nl> - String GDNativeScriptLanguage : : get_terminate_symbol_name ( ) { <nl> - return " godot_native_terminate " ; <nl> - } <nl> + size_t idx = 0 ; <nl> + for ( Map < StringName , native_call_cb > : : Element * E = native_calls . front ( ) ; E ; E = E - > next ( ) , idx + + ) { <nl> + call_types [ idx ] = E - > key ( ) ; <nl> + } <nl> <nl> - GDNativeScriptLanguage : : GDNativeScriptLanguage ( ) { <nl> - ERR_FAIL_COND ( singleton ) ; <nl> - strings . _notification = StringName ( " _notification " ) ; <nl> - singleton = this ; <nl> - initialized_libraries = Map < StringName , NativeLibrary * > ( ) ; <nl> + return call_types ; <nl> } <nl> <nl> - GDNativeScriptLanguage : : ~ GDNativeScriptLanguage ( ) { <nl> - singleton = NULL ; <nl> - } <nl> + Vector < StringName > GDNativeCallRegistry : : get_native_raw_call_types ( ) { <nl> + Vector < StringName > call_types ; <nl> + call_types . resize ( native_raw_calls . size ( ) ) ; <nl> <nl> - / / DLReloadNode <nl> + size_t idx = 0 ; <nl> + for ( Map < StringName , native_raw_call_cb > : : Element * E = native_raw_calls . front ( ) ; E ; E = E - > next ( ) , idx + + ) { <nl> + call_types [ idx ] = E - > key ( ) ; <nl> + } <nl> <nl> - void GDNativeReloadNode : : _bind_methods ( ) { <nl> - ClassDB : : bind_method ( " _notification " , & GDNativeReloadNode : : _notification ) ; <nl> + return call_types ; <nl> } <nl> <nl> - void GDNativeReloadNode : : _notification ( int p_what ) { <nl> - # ifdef TOOLS_ENABLED <nl> - <nl> - switch ( p_what ) { <nl> - case MainLoop : : NOTIFICATION_WM_FOCUS_IN : { <nl> - <nl> - Set < NativeLibrary * > libs_to_reload ; <nl> - <nl> - for ( Map < StringName , NativeLibrary * > : : Element * L = GDNativeScriptLanguage : : get_singleton ( ) - > initialized_libraries . front ( ) ; L ; L = L - > next ( ) ) { <nl> - / / check if file got modified at all <nl> - / / @ Todo <nl> - <nl> - libs_to_reload . insert ( L - > get ( ) ) ; <nl> - } <nl> - <nl> - for ( Set < NativeLibrary * > : : Element * L = libs_to_reload . front ( ) ; L ; L = L - > next ( ) ) { <nl> - <nl> - GDNativeLibrary * lib = L - > get ( ) - > dllib ; <nl> - <nl> - lib - > _terminate ( ) ; <nl> - lib - > _initialize ( ) ; <nl> - <nl> - / / update placeholders ( if any ) <nl> - <nl> - Set < GDNativeScript * > scripts ; <nl> - <nl> - for ( Set < GDNativeScript * > : : Element * S = GDNativeScriptLanguage : : get_singleton ( ) - > script_list . front ( ) ; S ; S = S - > next ( ) ) { <nl> + Variant GDNative : : call_native ( StringName p_native_call_type , StringName p_procedure_name , Array p_arguments ) { <nl> <nl> - if ( lib - > native_library - > scripts . has ( S - > get ( ) - > get_script_name ( ) ) ) { <nl> - GDNativeScript * script = S - > get ( ) ; <nl> - script - > script_data = lib - > get_script_data ( script - > get_script_name ( ) ) ; <nl> - scripts . insert ( script ) ; <nl> - } <nl> - } <nl> - <nl> - for ( Set < GDNativeScript * > : : Element * S = scripts . front ( ) ; S ; S = S - > next ( ) ) { <nl> - GDNativeScript * script = S - > get ( ) ; <nl> - if ( script - > placeholders . size ( ) = = 0 ) <nl> - continue ; <nl> - <nl> - for ( Set < PlaceHolderScriptInstance * > : : Element * P = script - > placeholders . front ( ) ; P ; P = P - > next ( ) ) { <nl> - PlaceHolderScriptInstance * p = P - > get ( ) ; <nl> - script - > _update_placeholder ( p ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - } break ; <nl> - default : { <nl> - } ; <nl> + Map < StringName , native_call_cb > : : Element * E = GDNativeCallRegistry : : singleton - > native_calls . find ( p_native_call_type ) ; <nl> + if ( ! E ) { <nl> + ERR_PRINT ( ( String ( " No handler for native call type \ " " + p_native_call_type ) + " \ " found " ) . utf8 ( ) . get_data ( ) ) ; <nl> + return Variant ( ) ; <nl> } <nl> - # endif <nl> - } <nl> - <nl> - / / Resource loader / saver <nl> - <nl> - RES ResourceFormatLoaderGDNativeScript : : load ( const String & p_path , const String & p_original_path , Error * r_error ) { <nl> - ResourceFormatLoaderText rsflt ; <nl> - return rsflt . load ( p_path , p_original_path , r_error ) ; <nl> - } <nl> <nl> - void ResourceFormatLoaderGDNativeScript : : get_recognized_extensions ( List < String > * p_extensions ) const { <nl> - p_extensions - > push_back ( " gdn " ) ; <nl> - } <nl> - bool ResourceFormatLoaderGDNativeScript : : handles_type ( const String & p_type ) const { <nl> - return ( p_type = = " Script " | | p_type = = " Native " ) ; <nl> - } <nl> - String ResourceFormatLoaderGDNativeScript : : get_resource_type ( const String & p_path ) const { <nl> - String el = p_path . get_extension ( ) . to_lower ( ) ; <nl> - if ( el = = " gdn " ) <nl> - return " Native " ; <nl> - return " " ; <nl> - } <nl> + String procedure_name = p_procedure_name ; <nl> + godot_variant result = E - > get ( ) ( native_handle , ( godot_string * ) & procedure_name , ( godot_array * ) & p_arguments ) ; <nl> <nl> - Error ResourceFormatSaverGDNativeScript : : save ( const String & p_path , const RES & p_resource , uint32_t p_flags ) { <nl> - ResourceFormatSaverText rfst ; <nl> - return rfst . save ( p_path , p_resource , p_flags ) ; <nl> + return * ( Variant * ) & result ; <nl> } <nl> <nl> - bool ResourceFormatSaverGDNativeScript : : recognize ( const RES & p_resource ) const { <nl> - return p_resource - > cast_to < GDNativeScript > ( ) ! = NULL ; <nl> - } <nl> + void GDNative : : call_native_raw ( StringName p_raw_call_type , StringName p_procedure_name , void * data , int num_args , void * * args , void * r_return ) { <nl> <nl> - void ResourceFormatSaverGDNativeScript : : get_recognized_extensions ( const RES & p_resource , List < String > * p_extensions ) const { <nl> - if ( p_resource - > cast_to < GDNativeScript > ( ) ) { <nl> - p_extensions - > push_back ( " gdn " ) ; <nl> + Map < StringName , native_raw_call_cb > : : Element * E = GDNativeCallRegistry : : singleton - > native_raw_calls . find ( p_raw_call_type ) ; <nl> + if ( ! E ) { <nl> + ERR_PRINT ( ( String ( " No handler for native raw call type \ " " + p_raw_call_type ) + " \ " found " ) . utf8 ( ) . get_data ( ) ) ; <nl> + return ; <nl> } <nl> + <nl> + String procedure_name = p_procedure_name ; <nl> + E - > get ( ) ( native_handle , ( godot_string * ) & procedure_name , data , num_args , args , r_return ) ; <nl> } <nl> mmm a / modules / gdnative / gdnative . h <nl> ppp b / modules / gdnative / gdnative . h <nl> <nl> # include " io / resource_saver . h " <nl> # include " os / thread_safe . h " <nl> # include " resource . h " <nl> - # include " scene / main / node . h " <nl> - # include " script_language . h " <nl> - # include " self_list . h " <nl> <nl> - # include " godot . h " <nl> + # include " godot / gdnative . h " <nl> <nl> - struct GDNativeScriptData ; <nl> - class GDNativeLibrary ; <nl> - <nl> - struct NativeLibrary { <nl> - StringName path ; <nl> - void * handle ; <nl> - <nl> - GDNativeLibrary * dllib ; <nl> - <nl> - Map < StringName , GDNativeScriptData * > scripts ; <nl> - <nl> - static Error initialize ( NativeLibrary * & p_native_lib , const StringName p_path ) ; <nl> - static Error terminate ( NativeLibrary * & p_native_lib ) ; <nl> - } ; <nl> - <nl> - struct GDNativeScriptData { <nl> - / * typedef void * ( InstanceFunc ) ( godot_object * instance ) ; <nl> - typedef void ( DestroyFunc ) ( godot_object * instance , void * userdata ) ; <nl> - typedef godot_variant ( MethodFunc ) ( godot_object * instance , void * userdata , void * method_data , int arg_count , godot_variant * * args ) ; <nl> - typedef void ( MethodDataFreeFunc ) ( void * method_data ) ; <nl> - typedef void ( SetterFunc ) ( godot_object * instance , void * userdata , godot_variant value ) ; <nl> - typedef godot_variant ( GetterFunc ) ( godot_object * instance , void * userdata ) ; * / <nl> - <nl> - struct Method { <nl> - godot_instance_method method ; <nl> - MethodInfo info ; <nl> - int rpc_mode ; <nl> - <nl> - Method ( ) { <nl> - } <nl> - Method ( godot_instance_method p_method , MethodInfo p_info , int p_rpc_mode ) { <nl> - method = p_method ; <nl> - info = p_info ; <nl> - rpc_mode = p_rpc_mode ; <nl> - } <nl> - } ; <nl> - struct Property { <nl> - godot_property_set_func setter ; <nl> - godot_property_get_func getter ; <nl> - PropertyInfo info ; <nl> - Variant default_value ; <nl> - int rset_mode ; <nl> - <nl> - Property ( ) { <nl> - } <nl> - Property ( godot_property_set_func p_setter , godot_property_get_func p_getter ) { <nl> - setter = p_setter ; <nl> - getter = p_getter ; <nl> - } <nl> - Property ( godot_property_set_func p_setter , godot_property_get_func p_getter , PropertyInfo p_info , Variant p_default_value , int p_rset_mode ) { <nl> - setter = p_setter ; <nl> - getter = p_getter ; <nl> - info = p_info ; <nl> - default_value = p_default_value ; <nl> - rset_mode = p_rset_mode ; <nl> - } <nl> - } ; <nl> - <nl> - struct Signal { <nl> - MethodInfo signal ; <nl> - } ; <nl> - <nl> - Map < StringName , Method > methods ; <nl> - Map < StringName , Property > properties ; <nl> - Map < StringName , Signal > signals_ ; / / QtCreator doesn ' t like the name signals <nl> - StringName base ; <nl> - StringName base_native_type ; <nl> - GDNativeScriptData * base_data ; <nl> - godot_instance_create_func create_func ; <nl> - godot_instance_destroy_func destroy_func ; <nl> - <nl> - bool is_tool ; <nl> - <nl> - GDNativeScriptData ( ) { <nl> - base = StringName ( ) ; <nl> - base_data = NULL ; <nl> - is_tool = false ; <nl> - } <nl> - GDNativeScriptData ( StringName p_base , godot_instance_create_func p_instance , godot_instance_destroy_func p_free ) { <nl> - base = p_base ; <nl> - base_data = NULL ; <nl> - create_func = p_instance ; <nl> - destroy_func = p_free ; <nl> - is_tool = false ; <nl> - } <nl> - } ; <nl> - <nl> - class GDNativeScript : public Script { <nl> - GDCLASS ( GDNativeScript , Script ) ; <nl> - <nl> - Ref < GDNativeLibrary > library ; <nl> - StringName script_name ; <nl> - StringName base_native_type ; <nl> - Set < Object * > instances ; <nl> - GDNativeScriptData * script_data ; <nl> - <nl> - # ifdef TOOLS_ENABLED <nl> - Set < PlaceHolderScriptInstance * > placeholders ; <nl> - void _update_placeholder ( PlaceHolderScriptInstance * p_placeholder ) ; <nl> - virtual void _placeholder_erased ( PlaceHolderScriptInstance * p_placeholder ) ; <nl> - # endif <nl> - <nl> - friend class GDNativeInstance ; <nl> - friend class GDNativeScriptLanguage ; <nl> - friend class GDNativeReloadNode ; <nl> - friend class GDNativeLibrary ; <nl> - <nl> - protected : <nl> - static void _bind_methods ( ) ; <nl> - <nl> - public : <nl> - virtual bool can_instance ( ) const ; <nl> - <nl> - virtual Ref < Script > get_base_script ( ) const ; / / for script inheritance <nl> - <nl> - virtual StringName get_instance_base_type ( ) const ; / / this may not work in all scripts , will return empty if so <nl> - virtual ScriptInstance * instance_create ( Object * p_this ) ; <nl> - virtual bool instance_has ( const Object * p_this ) const ; <nl> - <nl> - virtual bool has_source_code ( ) const ; <nl> - virtual String get_source_code ( ) const ; <nl> - virtual void set_source_code ( const String & p_code ) { } <nl> - virtual Error reload ( bool p_keep_state = false ) ; <nl> - <nl> - virtual bool has_method ( const StringName & p_method ) const ; <nl> - virtual MethodInfo get_method_info ( const StringName & p_method ) const ; <nl> - <nl> - virtual bool is_tool ( ) const ; <nl> - <nl> - virtual String get_node_type ( ) const ; <nl> + class GDNativeLibrary : public Resource { <nl> + GDCLASS ( GDNativeLibrary , Resource ) <nl> <nl> - virtual ScriptLanguage * get_language ( ) const ; <nl> + enum Platform { <nl> + X11_32BIT , <nl> + X11_64BIT , <nl> + WINDOWS_32BIT , <nl> + WINDOWS_64BIT , <nl> + / / NOTE ( karroffel ) : I heard OSX 32 bit is dead , so 64 only <nl> + OSX , <nl> <nl> - virtual bool has_script_signal ( const StringName & p_signal ) const ; <nl> - virtual void get_script_signal_list ( List < MethodInfo > * r_signals ) const ; <nl> + / / TODO ( karroffel ) : all different android versions and archs <nl> + ANDROID , <nl> <nl> - virtual bool get_property_default_value ( const StringName & p_property , Variant & r_value ) const ; <nl> + / / TODO ( karroffe ) : all different iOS versions and archs <nl> + IOS , <nl> <nl> - virtual void update_exports ( ) { } / / editor tool <nl> - virtual void get_script_method_list ( List < MethodInfo > * p_list ) const ; <nl> - virtual void get_script_property_list ( List < PropertyInfo > * p_list ) const ; <nl> + / / TODO ( karroffel ) : figure out how to deal with web stuff at all . . . <nl> + WASM , <nl> <nl> - Variant _new ( const Variant * * p_args , int p_argcount , Variant : : CallError & r_error ) ; <nl> + / / TODO ( karroffel ) : does UWP have different libs ? ? <nl> + / / UWP , <nl> <nl> - Ref < GDNativeLibrary > get_library ( ) const ; <nl> - void set_library ( Ref < GDNativeLibrary > p_library ) ; <nl> + NUM_PLATFORMS <nl> <nl> - StringName get_script_name ( ) const ; <nl> - void set_script_name ( StringName p_script_name ) ; <nl> + } ; <nl> <nl> - GDNativeScript ( ) ; <nl> - ~ GDNativeScript ( ) ; <nl> - } ; <nl> + static String platform_names [ NUM_PLATFORMS ] ; <nl> + static String platform_lib_ext [ NUM_PLATFORMS ] ; <nl> <nl> - class GDNativeLibrary : public Resource { <nl> - _THREAD_SAFE_CLASS_ <nl> + / / TODO ( karroffel ) : make this actually do something lol . <nl> + static Platform current_platform ; <nl> <nl> - GDCLASS ( GDNativeLibrary , Resource ) ; <nl> - OBJ_SAVE_TYPE ( GDNativeLibrary ) ; <nl> - <nl> - Map < StringName , String > platform_files ; <nl> - NativeLibrary * native_library ; <nl> - static GDNativeLibrary * currently_initialized_library ; <nl> + String library_paths [ NUM_PLATFORMS ] ; <nl> <nl> protected : <nl> - friend class GDNativeScript ; <nl> - friend struct NativeLibrary ; <nl> - friend class GDNativeReloadNode ; <nl> - <nl> - GDNativeScriptData * get_script_data ( const StringName p_name ) ; <nl> - <nl> bool _set ( const StringName & p_name , const Variant & p_value ) ; <nl> bool _get ( const StringName & p_name , Variant & r_ret ) const ; <nl> void _get_property_list ( List < PropertyInfo > * p_list ) const ; <nl> - void _notification ( int p_what ) ; <nl> - static void _bind_methods ( ) ; <nl> <nl> public : <nl> - Error _initialize ( ) ; <nl> - Error _terminate ( ) ; <nl> - <nl> - static GDNativeLibrary * get_currently_initialized_library ( ) ; <nl> - <nl> - void _register_script ( const StringName p_name , const StringName p_base , godot_instance_create_func p_instance_func , godot_instance_destroy_func p_destroy_func ) ; <nl> - void _register_tool_script ( const StringName p_name , const StringName p_base , godot_instance_create_func p_instance_func , godot_instance_destroy_func p_destroy_func ) ; <nl> - void _register_script_method ( const StringName p_name , const StringName p_method , godot_method_attributes p_attr , godot_instance_method p_func , MethodInfo p_info ) ; <nl> - void _register_script_property ( const StringName p_name , const String p_path , godot_property_attributes * p_attr , godot_property_set_func p_setter , godot_property_get_func p_getter ) ; <nl> - void _register_script_signal ( const StringName p_name , const godot_signal * p_signal ) ; <nl> - <nl> - void set_platform_file ( StringName p_platform , String p_file ) ; <nl> - String get_platform_file ( StringName p_platform ) const ; <nl> - <nl> GDNativeLibrary ( ) ; <nl> ~ GDNativeLibrary ( ) ; <nl> - } ; <nl> - <nl> - class GDNativeInstance : public ScriptInstance { <nl> - friend class GDNativeScript ; <nl> <nl> - Object * owner ; <nl> - Ref < GDNativeScript > script ; <nl> - void * userdata ; <nl> - <nl> - void _ml_call_reversed ( GDNativeScriptData * data_ptr , const StringName & p_method , const Variant * * p_args , int p_argcount ) ; <nl> - <nl> - public : <nl> - _FORCE_INLINE_ Object * get_owner ( ) { return owner ; } <nl> - <nl> - _FORCE_INLINE_ void * get_userdata ( ) { return userdata ; } <nl> - <nl> - virtual bool set ( const StringName & p_name , const Variant & p_value ) ; <nl> - virtual bool get ( const StringName & p_name , Variant & r_ret ) const ; <nl> - virtual void get_property_list ( List < PropertyInfo > * p_properties ) const ; <nl> - virtual Variant : : Type get_property_type ( const StringName & p_name , bool * r_is_valid = NULL ) const ; <nl> - <nl> - virtual void get_method_list ( List < MethodInfo > * p_list ) const ; <nl> - virtual bool has_method ( const StringName & p_method ) const ; <nl> - virtual Variant call ( const StringName & p_method , const Variant * * p_args , int p_argcount , Variant : : CallError & r_error ) ; <nl> - virtual void call_multilevel ( const StringName & p_method , const Variant * * p_args , int p_argcount ) ; <nl> - virtual void call_multilevel_reversed ( const StringName & p_method , const Variant * * p_args , int p_argcount ) ; <nl> - <nl> - Variant debug_get_member_by_index ( int p_idx ) const { return Variant ( ) ; } <nl> - <nl> - virtual void notification ( int p_notification ) ; <nl> - <nl> - virtual Ref < Script > get_script ( ) const ; <nl> - <nl> - virtual ScriptLanguage * get_language ( ) ; <nl> - <nl> - void set_path ( const String & p_path ) ; <nl> - <nl> - void reload_members ( ) ; <nl> + static void _bind_methods ( ) ; <nl> <nl> - virtual RPCMode get_rpc_mode ( const StringName & p_method ) const ; <nl> - virtual RPCMode get_rset_mode ( const StringName & p_variable ) const ; <nl> + void set_library_path ( StringName p_platform , String p_path ) ; <nl> + String get_library_path ( StringName p_platform ) const ; <nl> <nl> - GDNativeInstance ( ) ; <nl> - ~ GDNativeInstance ( ) ; <nl> + String get_active_library_path ( ) const ; <nl> } ; <nl> <nl> - class GDNativeReloadNode ; <nl> + typedef godot_variant ( * native_call_cb ) ( void * , godot_string * , godot_array * ) ; <nl> + typedef void ( * native_raw_call_cb ) ( void * , godot_string * , void * , int , void * * , void * ) ; <nl> <nl> - class GDNativeScriptLanguage : public ScriptLanguage { <nl> - friend class GDNativeScript ; <nl> - friend class GDNativeInstance ; <nl> - friend class GDNativeReloadNode ; <nl> - friend class GDNativeLibrary ; <nl> + struct GDNativeCallRegistry { <nl> + static GDNativeCallRegistry * singleton ; <nl> <nl> - static GDNativeScriptLanguage * singleton ; <nl> + inline GDNativeCallRegistry * get_singleton ( ) { <nl> + return singleton ; <nl> + } <nl> <nl> - Variant * _global_array ; / / @ Unused necessary ? <nl> - Vector < Variant > global_array ; / / @ Unused necessary ? <nl> - Map < StringName , int > globals ; / / @ Unused necessary ? <nl> + inline GDNativeCallRegistry ( ) <nl> + : native_calls ( ) , <nl> + native_raw_calls ( ) { } <nl> <nl> - / / @ Unused necessary ? <nl> - void _add_global ( const StringName & p_name , const Variant & p_value ) ; <nl> + Map < StringName , native_call_cb > native_calls ; <nl> + Map < StringName , native_raw_call_cb > native_raw_calls ; <nl> <nl> - Mutex * lock ; <nl> + void register_native_call_type ( StringName p_call_type , native_call_cb p_callback ) ; <nl> + void register_native_raw_call_type ( StringName p_raw_call_type , native_raw_call_cb p_callback ) ; <nl> <nl> - Set < GDNativeScript * > script_list ; <nl> + Vector < StringName > get_native_call_types ( ) ; <nl> + Vector < StringName > get_native_raw_call_types ( ) ; <nl> + } ; <nl> <nl> - bool profiling ; <nl> - uint64_t script_frame_time ; <nl> + class GDNative : public Reference { <nl> + GDCLASS ( GDNative , Reference ) <nl> <nl> - struct { <nl> + Ref < GDNativeLibrary > library ; <nl> + bool initialized ; <nl> <nl> - StringName _notification ; <nl> + / / TODO ( karroffel ) : different platforms ? WASM ? ? ? ? <nl> + void * native_handle ; <nl> <nl> - } strings ; <nl> + void _compile_dummy_for_api ( ) ; <nl> <nl> public : <nl> - Map < StringName , NativeLibrary * > initialized_libraries ; <nl> - <nl> - _FORCE_INLINE_ static GDNativeScriptLanguage * get_singleton ( ) { return singleton ; } <nl> - <nl> - virtual String get_name ( ) const ; <nl> - <nl> - / * LANGUAGE FUNCTIONS * / <nl> - virtual void init ( ) ; <nl> - virtual String get_type ( ) const ; <nl> - virtual String get_extension ( ) const ; <nl> - virtual Error execute_file ( const String & p_path ) ; <nl> - virtual void finish ( ) ; <nl> - <nl> - / * EDITOR FUNCTIONS * / <nl> - <nl> - virtual void get_reserved_words ( List < String > * p_words ) const { } ; <nl> - virtual void get_comment_delimiters ( List < String > * p_delimiters ) const { } ; <nl> - virtual void get_string_delimiters ( List < String > * p_delimiters ) const { } ; <nl> - virtual Ref < Script > get_template ( const String & p_class_name , const String & p_base_class_name ) const ; <nl> - virtual bool validate ( const String & p_script , int & r_line_error , int & r_col_error , String & r_test_error , const String & p_path = " " , List < String > * r_functions = NULL ) const ; <nl> - virtual Script * create_script ( ) const ; <nl> - virtual bool has_named_classes ( ) const ; <nl> - virtual int find_function ( const String & p_function , const String & p_code ) const ; <nl> - virtual String make_function ( const String & p_class , const String & p_name , const PoolStringArray & p_args ) const ; <nl> - virtual Error open_in_external_editor ( const Ref < Script > & p_script , int p_line , int p_col ) { return ERR_UNAVAILABLE ; } <nl> - virtual Error complete_code ( const String & p_code , const String & p_base_path , Object * p_owner , List < String > * r_options , String & r_call_hint ) { return ERR_UNAVAILABLE ; } <nl> - <nl> - virtual Error lookup_code ( const String & p_code , const String & p_symbol , const String & p_base_path , Object * p_owner , LookupResult & r_result ) { return ERR_UNAVAILABLE ; } <nl> + GDNative ( ) ; <nl> + ~ GDNative ( ) ; <nl> <nl> - virtual void auto_indent_code ( String & p_code , int p_from_line , int p_to_line ) const { } ; <nl> - virtual void add_global_constant ( const StringName & p_variable , const Variant & p_value ) ; <nl> - <nl> - / * MULTITHREAD FUNCTIONS * / <nl> - <nl> - / / some VMs need to be notified of thread creation / exiting to allocate a stack <nl> - virtual void thread_enter ( ) { } <nl> - virtual void thread_exit ( ) { } <nl> - <nl> - / * DEBUGGER FUNCTIONS * / <nl> - <nl> - virtual String debug_get_error ( ) const ; <nl> - virtual int debug_get_stack_level_count ( ) const ; <nl> - virtual int debug_get_stack_level_line ( int p_level ) const ; <nl> - virtual String debug_get_stack_level_function ( int p_level ) const ; <nl> - virtual String debug_get_stack_level_source ( int p_level ) const ; <nl> - virtual void debug_get_stack_level_locals ( int p_level , List < String > * p_locals , List < Variant > * p_values , int p_max_subitems = - 1 , int p_max_depth = - 1 ) { } ; <nl> - virtual void debug_get_stack_level_members ( int p_level , List < String > * p_members , List < Variant > * p_values , int p_max_subitems = - 1 , int p_max_depth = - 1 ) ; <nl> - virtual void debug_get_globals ( List < String > * p_locals , List < Variant > * p_values , int p_max_subitems = - 1 , int p_max_depth = - 1 ) ; <nl> - virtual String debug_parse_stack_level_expression ( int p_level , const String & p_expression , int p_max_subitems = - 1 , int p_max_depth = - 1 ) ; <nl> - <nl> - virtual Vector < StackInfo > debug_get_current_stack_info ( ) { return Vector < StackInfo > ( ) ; } <nl> - <nl> - virtual void reload_all_scripts ( ) ; <nl> - virtual void reload_tool_script ( const Ref < Script > & p_script , bool p_soft_reload ) ; <nl> - / * LOADER FUNCTIONS * / <nl> - <nl> - virtual void get_recognized_extensions ( List < String > * p_extensions ) const ; <nl> - virtual void get_public_functions ( List < MethodInfo > * p_functions ) const ; <nl> - virtual void get_public_constants ( List < Pair < String , Variant > > * p_constants ) const ; <nl> - <nl> - / * PROFILLER FUNCTIONS * / <nl> - <nl> - virtual void profiling_start ( ) ; <nl> - virtual void profiling_stop ( ) ; <nl> - <nl> - virtual int profiling_get_accumulated_data ( ProfilingInfo * p_info_arr , int p_info_max ) ; <nl> - virtual int profiling_get_frame_data ( ProfilingInfo * p_info_arr , int p_info_max ) ; <nl> - <nl> - virtual void frame ( ) ; <nl> - <nl> - static String get_init_symbol_name ( ) ; <nl> - static String get_terminate_symbol_name ( ) ; <nl> - <nl> - / * HACKER FUNCTIONS * / <nl> - void _compile_dummy_for_the_api ( ) ; <nl> + static void _bind_methods ( ) ; <nl> <nl> - GDNativeScriptLanguage ( ) ; <nl> - ~ GDNativeScriptLanguage ( ) ; <nl> - } ; <nl> + void set_library ( Ref < GDNativeLibrary > p_library ) ; <nl> + Ref < GDNativeLibrary > get_library ( ) ; <nl> <nl> - class GDNativeReloadNode : public Node { <nl> - GDCLASS ( GDNativeReloadNode , Node ) <nl> - public : <nl> - static void _bind_methods ( ) ; <nl> - void _notification ( int p_what ) ; <nl> - } ; <nl> + bool is_initialized ( ) ; <nl> <nl> - class ResourceFormatLoaderGDNativeScript : public ResourceFormatLoader { <nl> - public : <nl> - virtual RES load ( const String & p_path , const String & p_original_path = " " , Error * r_error = NULL ) ; <nl> - virtual void get_recognized_extensions ( List < String > * p_extensions ) const ; <nl> - virtual bool handles_type ( const String & p_type ) const ; <nl> - virtual String get_resource_type ( const String & p_path ) const ; <nl> - } ; <nl> + bool initialize ( ) ; <nl> + bool terminate ( ) ; <nl> <nl> - class ResourceFormatSaverGDNativeScript : public ResourceFormatSaver { <nl> - virtual Error save ( const String & p_path , const RES & p_resource , uint32_t p_flags = 0 ) ; <nl> - virtual bool recognize ( const RES & p_resource ) const ; <nl> - virtual void get_recognized_extensions ( const RES & p_resource , List < String > * p_extensions ) const ; <nl> + Variant call_native ( StringName p_call_type , StringName p_procedure_name , Array p_arguments = Array ( ) ) ; <nl> + void call_native_raw ( StringName p_raw_call_type , StringName p_procedure_name , void * data , int num_args , void * * args , void * r_return ) ; <nl> } ; <nl> <nl> # endif / / GDNATIVE_H <nl> similarity index 99 % <nl> rename from modules / gdnative / godot / godot_array . cpp <nl> rename to modules / gdnative / godot / array . cpp <nl> mmm a / modules / gdnative / godot / godot_array . cpp <nl> ppp b / modules / gdnative / godot / array . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_array . cpp * / <nl> + / * array . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_array . h " <nl> + # include " array . h " <nl> <nl> # include " core / array . h " <nl> # include " core / os / memory . h " <nl> similarity index 95 % <nl> rename from modules / gdnative / godot / godot_array . h <nl> rename to modules / gdnative / godot / array . h <nl> mmm a / modules / gdnative / godot / godot_array . h <nl> ppp b / modules / gdnative / godot / array . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_array . h * / <nl> + / * array . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_ARRAY_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED <nl> - typedef struct godot_array { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + # define GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_ARRAY_SIZE ] ; <nl> } godot_array ; <nl> # endif <nl> <nl> - # include " godot_pool_arrays . h " <nl> - # include " godot_variant . h " <nl> + # include " pool_arrays . h " <nl> + # include " variant . h " <nl> <nl> - # include " . . / godot . h " <nl> + # include " gdnative . h " <nl> <nl> void GDAPI godot_array_new ( godot_array * r_dest ) ; <nl> void GDAPI godot_array_new_copy ( godot_array * r_dest , const godot_array * p_src ) ; <nl> similarity index 99 % <nl> rename from modules / gdnative / godot / godot_basis . cpp <nl> rename to modules / gdnative / godot / basis . cpp <nl> mmm a / modules / gdnative / godot / godot_basis . cpp <nl> ppp b / modules / gdnative / godot / basis . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_basis . cpp * / <nl> + / * basis . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_basis . h " <nl> + # include " basis . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / math / matrix3 . h " <nl> similarity index 96 % <nl> rename from modules / gdnative / godot / godot_basis . h <nl> rename to modules / gdnative / godot / basis . h <nl> mmm a / modules / gdnative / godot / godot_basis . h <nl> ppp b / modules / gdnative / godot / basis . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_basis . h * / <nl> + / * basis . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_BASIS_SIZE 36 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED <nl> - typedef struct godot_basis { <nl> - uint8_t _dont_touch_that [ 36 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_BASIS_SIZE ] ; <nl> } godot_basis ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_vector3 . h " <nl> + # include " gdnative . h " <nl> + # include " quat . h " <nl> + # include " vector3 . h " <nl> <nl> void GDAPI godot_basis_new_with_rows ( godot_basis * r_dest , const godot_vector3 * p_x_axis , const godot_vector3 * p_y_axis , const godot_vector3 * p_z_axis ) ; <nl> void GDAPI godot_basis_new_with_axis_and_angle ( godot_basis * r_dest , const godot_vector3 * p_axis , const godot_real p_phi ) ; <nl> similarity index 98 % <nl> rename from modules / gdnative / godot / godot_color . cpp <nl> rename to modules / gdnative / godot / color . cpp <nl> mmm a / modules / gdnative / godot / godot_color . cpp <nl> ppp b / modules / gdnative / godot / color . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_color . cpp * / <nl> + / * color . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_color . h " <nl> + # include " color . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / color . h " <nl> similarity index 95 % <nl> rename from modules / gdnative / godot / godot_color . h <nl> rename to modules / gdnative / godot / color . h <nl> mmm a / modules / gdnative / godot / godot_color . h <nl> ppp b / modules / gdnative / godot / color . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_color . h * / <nl> + / * color . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_COLOR_SIZE 16 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED <nl> - typedef struct godot_color { <nl> - uint8_t _dont_touch_that [ 16 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_COLOR_SIZE ] ; <nl> } godot_color ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_string . h " <nl> + # include " gdnative . h " <nl> + # include " string . h " <nl> <nl> void GDAPI godot_color_new_rgba ( godot_color * r_dest , const godot_real p_r , const godot_real p_g , const godot_real p_b , const godot_real p_a ) ; <nl> void GDAPI godot_color_new_rgb ( godot_color * r_dest , const godot_real p_r , const godot_real p_g , const godot_real p_b ) ; <nl> similarity index 98 % <nl> rename from modules / gdnative / godot / godot_dictionary . cpp <nl> rename to modules / gdnative / godot / dictionary . cpp <nl> mmm a / modules / gdnative / godot / godot_dictionary . cpp <nl> ppp b / modules / gdnative / godot / dictionary . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_dictionary . cpp * / <nl> + / * dictionary . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_dictionary . h " <nl> + # include " dictionary . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / dictionary . h " <nl> similarity index 94 % <nl> rename from modules / gdnative / godot / godot_dictionary . h <nl> rename to modules / gdnative / godot / dictionary . h <nl> mmm a / modules / gdnative / godot / godot_dictionary . h <nl> ppp b / modules / gdnative / godot / dictionary . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_dictionary . h * / <nl> + / * dictionary . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_DICTIONARY_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED <nl> - typedef struct godot_dictionary { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_DICTIONARY_SIZE ] ; <nl> } godot_dictionary ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_array . h " <nl> - # include " godot_variant . h " <nl> + # include " array . h " <nl> + # include " gdnative . h " <nl> + # include " variant . h " <nl> <nl> void GDAPI godot_dictionary_new ( godot_dictionary * r_dest ) ; <nl> void GDAPI godot_dictionary_new_copy ( godot_dictionary * r_dest , const godot_dictionary * p_src ) ; <nl> similarity index 70 % <nl> rename from modules / gdnative / godot . cpp <nl> rename to modules / gdnative / godot / gdnative . cpp <nl> mmm a / modules / gdnative / godot . cpp <nl> ppp b / modules / gdnative / godot / gdnative . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot . cpp * / <nl> + / * gdnative . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot . h " <nl> + # include " gdnative . h " <nl> <nl> # include " class_db . h " <nl> # include " error_macros . h " <nl> void _api_anchor ( ) { <nl> _variant_api_anchor ( ) ; <nl> } <nl> <nl> - extern " C + + " { <nl> - template < class a , class b > <nl> - _FORCE_INLINE_ a memcast ( b v ) { <nl> - return * ( ( a * ) & v ) ; <nl> - } <nl> - } <nl> - <nl> void GDAPI godot_object_destroy ( godot_object * p_o ) { <nl> memdelete ( ( Object * ) p_o ) ; <nl> } <nl> void GDAPI godot_method_bind_varcall ( godot_method_bind * p_method_bind ) <nl> } <nl> * / <nl> <nl> - / / Script API <nl> - <nl> - void GDAPI godot_script_register_class ( const char * p_name , const char * p_base , godot_instance_create_func p_create_func , godot_instance_destroy_func p_destroy_func ) { <nl> - GDNativeLibrary * library = GDNativeLibrary : : get_currently_initialized_library ( ) ; <nl> - if ( ! library ) { <nl> - ERR_EXPLAIN ( " Attempt to register script after initializing library ! " ) ; <nl> - ERR_FAIL ( ) ; <nl> - } <nl> - library - > _register_script ( p_name , p_base , p_create_func , p_destroy_func ) ; <nl> - } <nl> - <nl> - void GDAPI godot_script_register_tool_class ( const char * p_name , const char * p_base , godot_instance_create_func p_create_func , godot_instance_destroy_func p_destroy_func ) { <nl> - GDNativeLibrary * library = GDNativeLibrary : : get_currently_initialized_library ( ) ; <nl> - if ( ! library ) { <nl> - ERR_EXPLAIN ( " Attempt to register script after initializing library ! " ) ; <nl> - ERR_FAIL ( ) ; <nl> - } <nl> - library - > _register_tool_script ( p_name , p_base , p_create_func , p_destroy_func ) ; <nl> - } <nl> - <nl> - void GDAPI godot_script_register_method ( const char * p_name , const char * p_function_name , godot_method_attributes p_attr , godot_instance_method p_method ) { <nl> - GDNativeLibrary * library = GDNativeLibrary : : get_currently_initialized_library ( ) ; <nl> - if ( ! library ) { <nl> - ERR_EXPLAIN ( " Attempt to register script after initializing library ! " ) ; <nl> - ERR_FAIL ( ) ; <nl> - } <nl> - library - > _register_script_method ( p_name , p_function_name , p_attr , p_method , MethodInfo ( ) ) ; <nl> - } <nl> - <nl> - void GDAPI godot_script_register_property ( const char * p_name , const char * p_path , godot_property_attributes * p_attr , godot_property_set_func p_set_func , godot_property_get_func p_get_func ) { <nl> - GDNativeLibrary * library = GDNativeLibrary : : get_currently_initialized_library ( ) ; <nl> - if ( ! library ) { <nl> - ERR_EXPLAIN ( " Attempt to register script after initializing library ! " ) ; <nl> - ERR_FAIL ( ) ; <nl> - } <nl> - <nl> - library - > _register_script_property ( p_name , p_path , p_attr , p_set_func , p_get_func ) ; <nl> - } <nl> - <nl> - void GDAPI godot_script_register_signal ( const char * p_name , const godot_signal * p_signal ) { <nl> - GDNativeLibrary * library = GDNativeLibrary : : get_currently_initialized_library ( ) ; <nl> - if ( ! library ) { <nl> - ERR_EXPLAIN ( " Attempt to register script after initializing library ! " ) ; <nl> - ERR_FAIL ( ) ; <nl> - } <nl> - <nl> - library - > _register_script_signal ( p_name , p_signal ) ; <nl> - } <nl> - <nl> - void GDAPI * godot_native_get_userdata ( godot_object * p_instance ) { <nl> - Object * instance = ( Object * ) p_instance ; <nl> - if ( ! instance ) <nl> - return NULL ; <nl> - if ( instance - > get_script_instance ( ) & & instance - > get_script_instance ( ) - > get_language ( ) = = GDNativeScriptLanguage : : get_singleton ( ) ) { <nl> - return ( ( GDNativeInstance * ) instance - > get_script_instance ( ) ) - > get_userdata ( ) ; <nl> - } <nl> - return NULL ; <nl> - } <nl> - <nl> godot_class_constructor GDAPI godot_get_class_constructor ( const char * p_classname ) { <nl> ClassDB : : ClassInfo * class_info = ClassDB : : classes . getptr ( StringName ( p_classname ) ) ; <nl> if ( class_info ) <nl> new file mode 100644 <nl> index 00000000000 . . 4b79706b52e <nl> mmm / dev / null <nl> ppp b / modules / gdnative / godot / gdnative . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * gdnative . h * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * This file is part of : * / <nl> + / * GODOT ENGINE * / <nl> + / * http : / / www . godotengine . org * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * Copyright ( c ) 2007 - 2017 Juan Linietsky , Ariel Manzur . * / <nl> + / * Copyright ( c ) 2014 - 2017 Godot Engine contributors ( cf . AUTHORS . md ) * / <nl> + / * * / <nl> + / * Permission is hereby granted , free of charge , to any person obtaining * / <nl> + / * a copy of this software and associated documentation files ( the * / <nl> + / * " Software " ) , to deal in the Software without restriction , including * / <nl> + / * without limitation the rights to use , copy , modify , merge , publish , * / <nl> + / * distribute , sublicense , and / or sell copies of the Software , and to * / <nl> + / * permit persons to whom the Software is furnished to do so , subject to * / <nl> + / * the following conditions : * / <nl> + / * * / <nl> + / * The above copyright notice and this permission notice shall be * / <nl> + / * included in all copies or substantial portions of the Software . * / <nl> + / * * / <nl> + / * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , * / <nl> + / * EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * / <nl> + / * MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . * / <nl> + / * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * / <nl> + / * CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF CONTRACT , * / <nl> + / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> + / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + # ifndef GODOT_GDNATIVE_H <nl> + # define GODOT_GDNATIVE_H <nl> + <nl> + # ifdef __cplusplus <nl> + extern " C " { <nl> + # endif <nl> + <nl> + # ifdef GDAPI_BUILT_IN <nl> + # define GDAPI_EXPORT <nl> + # endif <nl> + <nl> + # ifdef _WIN32 <nl> + # if defined ( GDAPI_EXPORT ) <nl> + # define GDCALLINGCONV <nl> + # define GDAPI __declspec ( dllexport ) GDCALLINGCONV <nl> + # else <nl> + # define GDCALLINGCONV <nl> + # define GDAPI __declspec ( dllimport ) GDCALLINGCONV <nl> + # endif <nl> + # elif defined ( __APPLE__ ) <nl> + # include " TargetConditionals . h " <nl> + # if TARGET_OS_IPHONE <nl> + # define GDCALLINGCONV <nl> + # define GDAPI <nl> + # elif TARGET_OS_MAC <nl> + # define GDCALLINGCONV __attribute__ ( ( sysv_abi ) ) <nl> + # define GDAPI GDCALLINGCONV <nl> + # endif <nl> + # else <nl> + # define GDCALLINGCONV __attribute__ ( ( sysv_abi ) ) <nl> + # define GDAPI GDCALLINGCONV <nl> + # endif <nl> + <nl> + / / This is for libraries * using * the header , NOT GODOT EXPOSING STUFF ! ! <nl> + # ifdef _WIN32 <nl> + # define GDN_EXPORT __declspec ( dllexport ) <nl> + # else <nl> + # define GDN_EXPORT <nl> + # endif <nl> + <nl> + # include < stdbool . h > <nl> + # include < stdint . h > <nl> + <nl> + # define GODOT_API_VERSION 1 <nl> + <nl> + / / / / / / Error <nl> + <nl> + typedef enum { <nl> + GODOT_OK , <nl> + GODOT_FAILED , / / / < Generic fail error <nl> + GODOT_ERR_UNAVAILABLE , / / / < What is requested is unsupported / unavailable <nl> + GODOT_ERR_UNCONFIGURED , / / / < The object being used hasnt been properly set up yet <nl> + GODOT_ERR_UNAUTHORIZED , / / / < Missing credentials for requested resource <nl> + GODOT_ERR_PARAMETER_RANGE_ERROR , / / / < Parameter given out of range ( 5 ) <nl> + GODOT_ERR_OUT_OF_MEMORY , / / / < Out of memory <nl> + GODOT_ERR_FILE_NOT_FOUND , <nl> + GODOT_ERR_FILE_BAD_DRIVE , <nl> + GODOT_ERR_FILE_BAD_PATH , <nl> + GODOT_ERR_FILE_NO_PERMISSION , / / ( 10 ) <nl> + GODOT_ERR_FILE_ALREADY_IN_USE , <nl> + GODOT_ERR_FILE_CANT_OPEN , <nl> + GODOT_ERR_FILE_CANT_WRITE , <nl> + GODOT_ERR_FILE_CANT_READ , <nl> + GODOT_ERR_FILE_UNRECOGNIZED , / / ( 15 ) <nl> + GODOT_ERR_FILE_CORRUPT , <nl> + GODOT_ERR_FILE_MISSING_DEPENDENCIES , <nl> + GODOT_ERR_FILE_EOF , <nl> + GODOT_ERR_CANT_OPEN , / / / < Can ' t open a resource / socket / file <nl> + GODOT_ERR_CANT_CREATE , / / ( 20 ) <nl> + GODOT_ERR_QUERY_FAILED , <nl> + GODOT_ERR_ALREADY_IN_USE , <nl> + GODOT_ERR_LOCKED , / / / < resource is locked <nl> + GODOT_ERR_TIMEOUT , <nl> + GODOT_ERR_CANT_CONNECT , / / ( 25 ) <nl> + GODOT_ERR_CANT_RESOLVE , <nl> + GODOT_ERR_CONNECTION_ERROR , <nl> + GODOT_ERR_CANT_AQUIRE_RESOURCE , <nl> + GODOT_ERR_CANT_FORK , <nl> + GODOT_ERR_INVALID_DATA , / / / < Data passed is invalid ( 30 ) <nl> + GODOT_ERR_INVALID_PARAMETER , / / / < Parameter passed is invalid <nl> + GODOT_ERR_ALREADY_EXISTS , / / / < When adding , item already exists <nl> + GODOT_ERR_DOES_NOT_EXIST , / / / < When retrieving / erasing , it item does not exist <nl> + GODOT_ERR_DATABASE_CANT_READ , / / / < database is full <nl> + GODOT_ERR_DATABASE_CANT_WRITE , / / / < database is full ( 35 ) <nl> + GODOT_ERR_COMPILATION_FAILED , <nl> + GODOT_ERR_METHOD_NOT_FOUND , <nl> + GODOT_ERR_LINK_FAILED , <nl> + GODOT_ERR_SCRIPT_FAILED , <nl> + GODOT_ERR_CYCLIC_LINK , / / ( 40 ) <nl> + GODOT_ERR_INVALID_DECLARATION , <nl> + GODOT_ERR_DUPLICATE_SYMBOL , <nl> + GODOT_ERR_PARSE_ERROR , <nl> + GODOT_ERR_BUSY , <nl> + GODOT_ERR_SKIP , / / ( 45 ) <nl> + GODOT_ERR_HELP , / / / < user requested help ! ! <nl> + GODOT_ERR_BUG , / / / < a bug in the software certainly happened , due to a double check failing or unexpected behavior . <nl> + GODOT_ERR_PRINTER_ON_FIRE , / / / the parallel port printer is engulfed in flames <nl> + GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD , / / / < shit happens , has never been used , though <nl> + GODOT_ERR_WTF = GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD / / / < short version of the above <nl> + } godot_error ; <nl> + <nl> + / / / / / / bool <nl> + <nl> + typedef bool godot_bool ; <nl> + <nl> + # define GODOT_TRUE 1 <nl> + # define GODOT_FALSE 0 <nl> + <nl> + / / / / / / / int <nl> + <nl> + typedef int godot_int ; <nl> + <nl> + / / / / / / / real <nl> + <nl> + typedef float godot_real ; <nl> + <nl> + / / / / / / / Object ( forward declared ) <nl> + typedef void godot_object ; <nl> + <nl> + / / / / / / / Brute force forward declarations for the rest <nl> + / * <nl> + typedef struct godot_variant godot_variant ; <nl> + typedef struct godot_string godot_string ; <nl> + typedef struct godot_vector2 godot_vector2 ; <nl> + typedef struct godot_rect2 godot_rect2 ; <nl> + typedef struct godot_vector3 godot_vector3 ; <nl> + typedef struct godot_transform2d godot_transform2d ; <nl> + typedef struct godot_plane godot_plane ; <nl> + typedef struct godot_quat godot_quat ; <nl> + typedef struct godot_rect3 godot_rect3 ; <nl> + typedef struct godot_basis godot_basis ; <nl> + typedef struct godot_transform godot_transform ; <nl> + typedef struct godot_color godot_color ; <nl> + typedef struct godot_node_path godot_node_path ; <nl> + typedef struct godot_rid godot_rid ; <nl> + typedef struct godot_dictionary godot_dictionary ; <nl> + typedef struct godot_array godot_array ; <nl> + typedef struct godot_pool_byte_array godot_pool_byte_array ; <nl> + typedef struct godot_pool_int_array godot_pool_int_array ; <nl> + typedef struct godot_pool_real_array godot_pool_real_array ; <nl> + typedef struct godot_pool_string_array godot_pool_string_array ; <nl> + typedef struct godot_pool_vector2_array godot_pool_vector2_array ; <nl> + typedef struct godot_pool_vector3_array godot_pool_vector3_array ; <nl> + typedef struct godot_pool_color_array godot_pool_color_array ; <nl> + * / <nl> + / / / / / / / String <nl> + <nl> + # include " string . h " <nl> + <nl> + / / / / / / Vector2 <nl> + <nl> + # include " vector2 . h " <nl> + <nl> + / / / / / / Rect2 <nl> + <nl> + # include " rect2 . h " <nl> + <nl> + / / / / / / Vector3 <nl> + <nl> + # include " vector3 . h " <nl> + <nl> + / / / / / / Transform2D <nl> + <nl> + # include " transform2d . h " <nl> + <nl> + / / / / / / / Plane <nl> + <nl> + # include " plane . h " <nl> + <nl> + / / / / / / / Quat <nl> + <nl> + # include " quat . h " <nl> + <nl> + / / / / / / / Rect3 <nl> + <nl> + # include " rect3 . h " <nl> + <nl> + / / / / / / / Basis <nl> + <nl> + # include " basis . h " <nl> + <nl> + / / / / / / / Transform <nl> + <nl> + # include " transform . h " <nl> + <nl> + / / / / / / / Color <nl> + <nl> + # include " color . h " <nl> + <nl> + / / / / / / / NodePath <nl> + <nl> + # include " node_path . h " <nl> + <nl> + / / / / / / / RID <nl> + <nl> + # include " rid . h " <nl> + <nl> + / / / / / / / Dictionary <nl> + <nl> + # include " dictionary . h " <nl> + <nl> + / / / / / / / Array <nl> + <nl> + # include " array . h " <nl> + <nl> + / / single API file for Pool * Array <nl> + # include " pool_arrays . h " <nl> + <nl> + void GDAPI godot_object_destroy ( godot_object * p_o ) ; <nl> + <nl> + / / / / / / Variant <nl> + <nl> + # include " variant . h " <nl> + <nl> + / / / / / / Singleton API <nl> + <nl> + godot_object GDAPI * godot_global_get_singleton ( char * p_name ) ; / / result shouldn ' t be freed <nl> + <nl> + / / / / / / MethodBind API <nl> + <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ 1 ] ; / / TODO <nl> + } godot_method_bind ; <nl> + <nl> + godot_method_bind GDAPI * godot_method_bind_get_method ( const char * p_classname , const char * p_methodname ) ; <nl> + void GDAPI godot_method_bind_ptrcall ( godot_method_bind * p_method_bind , godot_object * p_instance , const void * * p_args , void * p_ret ) ; <nl> + godot_variant GDAPI godot_method_bind_call ( godot_method_bind * p_method_bind , godot_object * p_instance , const godot_variant * * p_args , const int p_arg_count , godot_variant_call_error * p_call_error ) ; <nl> + / / / / / / Script API <nl> + <nl> + typedef struct { <nl> + godot_bool in_editor ; <nl> + uint64_t core_api_hash ; <nl> + uint64_t editor_api_hash ; <nl> + uint64_t no_api_hash ; <nl> + } godot_gdnative_init_options ; <nl> + <nl> + typedef struct { <nl> + godot_bool in_editor ; <nl> + } godot_gdnative_terminate_options ; <nl> + <nl> + / / Calling convention ? <nl> + typedef godot_object * ( * godot_class_constructor ) ( ) ; <nl> + <nl> + godot_class_constructor GDAPI godot_get_class_constructor ( const char * p_classname ) ; <nl> + <nl> + godot_dictionary GDAPI godot_get_global_constants ( ) ; <nl> + <nl> + / / / / / / GDNative procedure types <nl> + typedef void ( * godot_gdnative_init_fn ) ( godot_gdnative_init_options * ) ; <nl> + typedef void ( * godot_gdnative_terminate_fn ) ( godot_gdnative_terminate_options * ) ; <nl> + typedef godot_variant ( * godot_gdnative_procedure_fn ) ( void * , godot_array * ) ; <nl> + <nl> + / / / / / / System Functions <nl> + <nl> + / / using these will help Godot track how much memory is in use in debug mode <nl> + void GDAPI * godot_alloc ( int p_bytes ) ; <nl> + void GDAPI * godot_realloc ( void * p_ptr , int p_bytes ) ; <nl> + void GDAPI godot_free ( void * p_ptr ) ; <nl> + <nl> + / / print using Godot ' s error handler list <nl> + void GDAPI godot_print_error ( const char * p_description , const char * p_function , const char * p_file , int p_line ) ; <nl> + void GDAPI godot_print_warning ( const char * p_description , const char * p_function , const char * p_file , int p_line ) ; <nl> + void GDAPI godot_print ( const godot_string * p_message ) ; <nl> + <nl> + # ifdef __cplusplus <nl> + } <nl> + # endif <nl> + <nl> + # endif / / GODOT_C_H <nl> new file mode 100644 <nl> index 00000000000 . . 27920124f9a <nl> mmm / dev / null <nl> ppp b / modules / gdnative / godot / icon . png . import <nl> <nl> + [ remap ] <nl> + <nl> + importer = " texture " <nl> + type = " StreamTexture " <nl> + path = " res : / / . import / icon . png - aa47d037a37fb38b3b7e7828e4eec407 . stex " <nl> + <nl> + [ params ] <nl> + <nl> + compress / mode = 0 <nl> + compress / lossy_quality = 0 . 7 <nl> + compress / hdr_mode = 0 <nl> + compress / normal_map = 0 <nl> + flags / repeat = 0 <nl> + flags / filter = true <nl> + flags / mipmaps = false <nl> + flags / anisotropic = false <nl> + flags / srgb = 2 <nl> + process / fix_alpha_border = true <nl> + process / premult_alpha = false <nl> + process / HDR_as_SRGB = false <nl> + stream = false <nl> + size_limit = 0 <nl> + detect_3d = true <nl> similarity index 98 % <nl> rename from modules / gdnative / godot / godot_node_path . cpp <nl> rename to modules / gdnative / godot / node_path . cpp <nl> mmm a / modules / gdnative / godot / godot_node_path . cpp <nl> ppp b / modules / gdnative / godot / node_path . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_node_path . cpp * / <nl> + / * node_path . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_node_path . h " <nl> + # include " node_path . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / path_db . h " <nl> similarity index 94 % <nl> rename from modules / gdnative / godot / godot_node_path . h <nl> rename to modules / gdnative / godot / node_path . h <nl> mmm a / modules / gdnative / godot / godot_node_path . h <nl> ppp b / modules / gdnative / godot / node_path . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_node_path . h * / <nl> + / * node_path . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_NODE_PATH_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED <nl> - typedef struct godot_node_path { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_NODE_PATH_SIZE ] ; <nl> } godot_node_path ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_string . h " <nl> + # include " gdnative . h " <nl> + # include " string . h " <nl> <nl> void GDAPI godot_node_path_new ( godot_node_path * r_dest , const godot_string * p_from ) ; <nl> void GDAPI godot_node_path_new_copy ( godot_node_path * r_dest , const godot_node_path * p_src ) ; <nl> similarity index 98 % <nl> rename from modules / gdnative / godot / godot_plane . cpp <nl> rename to modules / gdnative / godot / plane . cpp <nl> mmm a / modules / gdnative / godot / godot_plane . cpp <nl> ppp b / modules / gdnative / godot / plane . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_plane . cpp * / <nl> + / * plane . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_plane . h " <nl> + # include " plane . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / math / plane . h " <nl> similarity index 95 % <nl> rename from modules / gdnative / godot / godot_plane . h <nl> rename to modules / gdnative / godot / plane . h <nl> mmm a / modules / gdnative / godot / godot_plane . h <nl> ppp b / modules / gdnative / godot / plane . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_plane . h * / <nl> + / * plane . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_PLANE_SIZE 16 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED <nl> - typedef struct godot_plane { <nl> - uint8_t _dont_touch_that [ 16 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_PLANE_SIZE ] ; <nl> } godot_plane ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_vector3 . h " <nl> + # include " gdnative . h " <nl> + # include " vector3 . h " <nl> <nl> void GDAPI godot_plane_new_with_reals ( godot_plane * r_dest , const godot_real p_a , const godot_real p_b , const godot_real p_c , const godot_real p_d ) ; <nl> void GDAPI godot_plane_new_with_vectors ( godot_plane * r_dest , const godot_vector3 * p_v1 , const godot_vector3 * p_v2 , const godot_vector3 * p_v3 ) ; <nl> similarity index 99 % <nl> rename from modules / gdnative / godot / godot_pool_arrays . cpp <nl> rename to modules / gdnative / godot / pool_arrays . cpp <nl> mmm a / modules / gdnative / godot / godot_pool_arrays . cpp <nl> ppp b / modules / gdnative / godot / pool_arrays . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_pool_arrays . cpp * / <nl> + / * pool_arrays . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_pool_arrays . h " <nl> + # include " pool_arrays . h " <nl> <nl> # include " array . h " <nl> + # include " core / variant . h " <nl> # include " dvector . h " <nl> - # include " variant . h " <nl> + <nl> + # include " core / color . h " <nl> + # include " core / math / math_2d . h " <nl> + # include " core / math / vector3 . h " <nl> <nl> # ifdef __cplusplus <nl> extern " C " { <nl> similarity index 90 % <nl> rename from modules / gdnative / godot / godot_pool_arrays . h <nl> rename to modules / gdnative / godot / pool_arrays . h <nl> mmm a / modules / gdnative / godot / godot_pool_arrays . h <nl> ppp b / modules / gdnative / godot / pool_arrays . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_pool_arrays . h * / <nl> + / * pool_arrays . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> / / / / / / / PoolByteArray <nl> <nl> + # define GODOT_POOL_BYTE_ARRAY_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED <nl> - typedef struct godot_pool_byte_array { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + # define GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_POOL_BYTE_ARRAY_SIZE ] ; <nl> } godot_pool_byte_array ; <nl> # endif <nl> <nl> / / / / / / / PoolIntArray <nl> <nl> + # define GODOT_POOL_INT_ARRAY_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED <nl> - typedef struct godot_pool_int_array { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + # define GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_POOL_INT_ARRAY_SIZE ] ; <nl> } godot_pool_int_array ; <nl> # endif <nl> <nl> / / / / / / / PoolRealArray <nl> <nl> + # define GODOT_POOL_REAL_ARRAY_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED <nl> - typedef struct godot_pool_real_array { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + # define GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_POOL_REAL_ARRAY_SIZE ] ; <nl> } godot_pool_real_array ; <nl> # endif <nl> <nl> / / / / / / / PoolStringArray <nl> <nl> + # define GODOT_POOL_STRING_ARRAY_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED <nl> - typedef struct godot_pool_string_array { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + # define GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_POOL_STRING_ARRAY_SIZE ] ; <nl> } godot_pool_string_array ; <nl> # endif <nl> <nl> / / / / / / / PoolVector2Array <nl> <nl> + # define GODOT_POOL_VECTOR2_ARRAY_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED <nl> - typedef struct godot_pool_vector2_array { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + # define GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_POOL_VECTOR2_ARRAY_SIZE ] ; <nl> } godot_pool_vector2_array ; <nl> # endif <nl> <nl> / / / / / / / PoolVector3Array <nl> <nl> + # define GODOT_POOL_VECTOR3_ARRAY_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED <nl> - typedef struct godot_pool_vector3_array { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + # define GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_POOL_VECTOR3_ARRAY_SIZE ] ; <nl> } godot_pool_vector3_array ; <nl> # endif <nl> <nl> / / / / / / / PoolColorArray <nl> <nl> + # define GODOT_POOL_COLOR_ARRAY_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED <nl> - typedef struct godot_pool_color_array { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + # define GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_POOL_COLOR_ARRAY_SIZE ] ; <nl> } godot_pool_color_array ; <nl> # endif <nl> <nl> - # include " godot_array . h " <nl> - # include " godot_color . h " <nl> - # include " godot_vector2 . h " <nl> - # include " godot_vector3 . h " <nl> + # include " array . h " <nl> + # include " color . h " <nl> + # include " vector2 . h " <nl> + # include " vector3 . h " <nl> <nl> - # include " . . / godot . h " <nl> + # include " gdnative . h " <nl> <nl> / / byte <nl> <nl> similarity index 98 % <nl> rename from modules / gdnative / godot / godot_quat . cpp <nl> rename to modules / gdnative / godot / quat . cpp <nl> mmm a / modules / gdnative / godot / godot_quat . cpp <nl> ppp b / modules / gdnative / godot / quat . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_quat . cpp * / <nl> + / * quat . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_quat . h " <nl> + # include " quat . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / math / quat . h " <nl> similarity index 95 % <nl> rename from modules / gdnative / godot / godot_quat . h <nl> rename to modules / gdnative / godot / quat . h <nl> mmm a / modules / gdnative / godot / godot_quat . h <nl> ppp b / modules / gdnative / godot / quat . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_quat . h * / <nl> + / * quat . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_QUAT_SIZE 16 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED <nl> - typedef struct godot_quat { <nl> - uint8_t _dont_touch_that [ 16 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_QUAT_SIZE ] ; <nl> } godot_quat ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_vector3 . h " <nl> + # include " gdnative . h " <nl> + # include " vector3 . h " <nl> <nl> void GDAPI godot_quat_new ( godot_quat * r_dest , const godot_real p_x , const godot_real p_y , const godot_real p_z , const godot_real p_w ) ; <nl> void GDAPI godot_quat_new_with_axis_angle ( godot_quat * r_dest , const godot_vector3 * p_axis , const godot_real p_angle ) ; <nl> similarity index 98 % <nl> rename from modules / gdnative / godot / godot_rect2 . cpp <nl> rename to modules / gdnative / godot / rect2 . cpp <nl> mmm a / modules / gdnative / godot / godot_rect2 . cpp <nl> ppp b / modules / gdnative / godot / rect2 . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_rect2 . cpp * / <nl> + / * rect2 . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_rect2 . h " <nl> + # include " rect2 . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / math / math_2d . h " <nl> similarity index 97 % <nl> rename from modules / gdnative / godot / godot_rect2 . h <nl> rename to modules / gdnative / godot / rect2 . h <nl> mmm a / modules / gdnative / godot / godot_rect2 . h <nl> ppp b / modules / gdnative / godot / rect2 . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_rect2 . h * / <nl> + / * rect2 . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> typedef struct godot_rect2 { <nl> } godot_rect2 ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_vector2 . h " <nl> + # include " gdnative . h " <nl> + # include " vector2 . h " <nl> <nl> void GDAPI godot_rect2_new_with_position_and_size ( godot_rect2 * r_dest , const godot_vector2 * p_pos , const godot_vector2 * p_size ) ; <nl> void GDAPI godot_rect2_new ( godot_rect2 * r_dest , const godot_real p_x , const godot_real p_y , const godot_real p_width , const godot_real p_height ) ; <nl> similarity index 98 % <nl> rename from modules / gdnative / godot / godot_rect3 . cpp <nl> rename to modules / gdnative / godot / rect3 . cpp <nl> mmm a / modules / gdnative / godot / godot_rect3 . cpp <nl> ppp b / modules / gdnative / godot / rect3 . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_rect3 . cpp * / <nl> + / * rect3 . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_rect3 . h " <nl> + # include " rect3 . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / math / rect3 . h " <nl> similarity index 95 % <nl> rename from modules / gdnative / godot / godot_rect3 . h <nl> rename to modules / gdnative / godot / rect3 . h <nl> mmm a / modules / gdnative / godot / godot_rect3 . h <nl> ppp b / modules / gdnative / godot / rect3 . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_rect3 . h * / <nl> + / * rect3 . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_RECT3_SIZE 24 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED <nl> - typedef struct godot_rect3 { <nl> - uint8_t _dont_touch_that [ 24 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_RECT3_SIZE ] ; <nl> } godot_rect3 ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_plane . h " <nl> - # include " godot_vector3 . h " <nl> + # include " gdnative . h " <nl> + # include " plane . h " <nl> + # include " vector3 . h " <nl> <nl> void GDAPI godot_rect3_new ( godot_rect3 * r_dest , const godot_vector3 * p_pos , const godot_vector3 * p_size ) ; <nl> <nl> similarity index 97 % <nl> rename from modules / gdnative / godot / godot_rid . cpp <nl> rename to modules / gdnative / godot / rid . cpp <nl> mmm a / modules / gdnative / godot / godot_rid . cpp <nl> ppp b / modules / gdnative / godot / rid . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_rid . cpp * / <nl> + / * rid . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_rid . h " <nl> + # include " rid . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / resource . h " <nl> similarity index 94 % <nl> rename from modules / gdnative / godot / godot_rid . h <nl> rename to modules / gdnative / godot / rid . h <nl> mmm a / modules / gdnative / godot / godot_rid . h <nl> ppp b / modules / gdnative / godot / rid . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_rid . h * / <nl> + / * rid . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_RID_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_RID_TYPE_DEFINED <nl> - typedef struct godot_rid { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_RID_SIZE ] ; <nl> } godot_rid ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> + # include " gdnative . h " <nl> <nl> void GDAPI godot_rid_new ( godot_rid * r_dest ) ; <nl> <nl> similarity index 98 % <nl> rename from modules / gdnative / godot / godot_string . cpp <nl> rename to modules / gdnative / godot / string . cpp <nl> mmm a / modules / gdnative / godot / godot_string . cpp <nl> ppp b / modules / gdnative / godot / string . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_string . cpp * / <nl> + / * string . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_string . h " <nl> + # include " string . h " <nl> <nl> # include " string_db . h " <nl> # include " ustring . h " <nl> similarity index 94 % <nl> rename from modules / gdnative / godot / godot_string . h <nl> rename to modules / gdnative / godot / string . h <nl> mmm a / modules / gdnative / godot / godot_string . h <nl> ppp b / modules / gdnative / godot / string . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_string . h * / <nl> + / * string . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> # include < stdint . h > <nl> # include < wchar . h > <nl> <nl> + # define GODOT_STRING_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED <nl> - typedef struct godot_string { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + # define GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_STRING_SIZE ] ; <nl> } godot_string ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> + # include " gdnative . h " <nl> <nl> void GDAPI godot_string_new ( godot_string * r_dest ) ; <nl> void GDAPI godot_string_new_copy ( godot_string * r_dest , const godot_string * p_src ) ; <nl> similarity index 98 % <nl> rename from modules / gdnative / godot / godot_transform . cpp <nl> rename to modules / gdnative / godot / transform . cpp <nl> mmm a / modules / gdnative / godot / godot_transform . cpp <nl> ppp b / modules / gdnative / godot / transform . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_transform . cpp * / <nl> + / * transform . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_transform . h " <nl> + # include " transform . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / math / transform . h " <nl> similarity index 95 % <nl> rename from modules / gdnative / godot / godot_transform . h <nl> rename to modules / gdnative / godot / transform . h <nl> mmm a / modules / gdnative / godot / godot_transform . h <nl> ppp b / modules / gdnative / godot / transform . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_transform . h * / <nl> + / * transform . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_TRANSFORM_SIZE 48 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED <nl> - typedef struct godot_transform { <nl> - uint8_t _dont_touch_that [ 48 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_TRANSFORM_SIZE ] ; <nl> } godot_transform ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_basis . h " <nl> - # include " godot_variant . h " <nl> - # include " godot_vector3 . h " <nl> + # include " basis . h " <nl> + # include " gdnative . h " <nl> + # include " variant . h " <nl> + # include " vector3 . h " <nl> <nl> void GDAPI godot_transform_new_with_axis_origin ( godot_transform * r_dest , const godot_vector3 * p_x_axis , const godot_vector3 * p_y_axis , const godot_vector3 * p_z_axis , const godot_vector3 * p_origin ) ; <nl> void GDAPI godot_transform_new ( godot_transform * r_dest , const godot_basis * p_basis , const godot_vector3 * p_origin ) ; <nl> similarity index 98 % <nl> rename from modules / gdnative / godot / godot_transform2d . cpp <nl> rename to modules / gdnative / godot / transform2d . cpp <nl> mmm a / modules / gdnative / godot / godot_transform2d . cpp <nl> ppp b / modules / gdnative / godot / transform2d . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_transform2d . cpp * / <nl> + / * transform2d . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_transform2d . h " <nl> + # include " transform2d . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / math / math_2d . h " <nl> similarity index 95 % <nl> rename from modules / gdnative / godot / godot_transform2d . h <nl> rename to modules / gdnative / godot / transform2d . h <nl> mmm a / modules / gdnative / godot / godot_transform2d . h <nl> ppp b / modules / gdnative / godot / transform2d . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_transform2d . h * / <nl> + / * transform2d . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_TRANSFORM2D_SIZE 24 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED <nl> - typedef struct godot_transform2d { <nl> - uint8_t _dont_touch_that [ 24 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_TRANSFORM2D_SIZE ] ; <nl> } godot_transform2d ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_variant . h " <nl> - # include " godot_vector2 . h " <nl> + # include " gdnative . h " <nl> + # include " variant . h " <nl> + # include " vector2 . h " <nl> <nl> void GDAPI godot_transform2d_new ( godot_transform2d * r_dest , const godot_real p_rot , const godot_vector2 * p_pos ) ; <nl> void GDAPI godot_transform2d_new_axis_origin ( godot_transform2d * r_dest , const godot_vector2 * p_x_axis , const godot_vector2 * p_y_axis , const godot_vector2 * p_origin ) ; <nl> similarity index 99 % <nl> rename from modules / gdnative / godot / godot_variant . cpp <nl> rename to modules / gdnative / godot / variant . cpp <nl> mmm a / modules / gdnative / godot / godot_variant . cpp <nl> ppp b / modules / gdnative / godot / variant . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_variant . cpp * / <nl> + / * variant . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_variant . h " <nl> + # include " variant . h " <nl> # include " core / variant . h " <nl> <nl> # ifdef __cplusplus <nl> similarity index 93 % <nl> rename from modules / gdnative / godot / godot_variant . h <nl> rename to modules / gdnative / godot / variant . h <nl> mmm a / modules / gdnative / godot / godot_variant . h <nl> ppp b / modules / gdnative / godot / variant . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_variant . h * / <nl> + / * variant . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_VARIANT_SIZE 24 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED <nl> - typedef struct godot_variant { <nl> - uint8_t _dont_touch_that [ 24 ] ; <nl> + # define GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_VARIANT_SIZE ] ; <nl> } godot_variant ; <nl> # endif <nl> <nl> typedef struct godot_variant_call_error { <nl> godot_variant_type expected ; <nl> } godot_variant_call_error ; <nl> <nl> - # include " godot_array . h " <nl> - # include " godot_basis . h " <nl> - # include " godot_color . h " <nl> - # include " godot_dictionary . h " <nl> - # include " godot_node_path . h " <nl> - # include " godot_plane . h " <nl> - # include " godot_pool_arrays . h " <nl> - # include " godot_quat . h " <nl> - # include " godot_rect2 . h " <nl> - # include " godot_rect3 . h " <nl> - # include " godot_rid . h " <nl> - # include " godot_string . h " <nl> - # include " godot_transform . h " <nl> - # include " godot_transform2d . h " <nl> - # include " godot_variant . h " <nl> - # include " godot_vector2 . h " <nl> - # include " godot_vector3 . h " <nl> - <nl> - # include " . . / godot . h " <nl> + # include " array . h " <nl> + # include " basis . h " <nl> + # include " color . h " <nl> + # include " dictionary . h " <nl> + # include " node_path . h " <nl> + # include " plane . h " <nl> + # include " pool_arrays . h " <nl> + # include " quat . h " <nl> + # include " rect2 . h " <nl> + # include " rect3 . h " <nl> + # include " rid . h " <nl> + # include " string . h " <nl> + # include " transform . h " <nl> + # include " transform2d . h " <nl> + # include " variant . h " <nl> + # include " vector2 . h " <nl> + # include " vector3 . h " <nl> + <nl> + # include " gdnative . h " <nl> <nl> godot_variant_type GDAPI godot_variant_get_type ( const godot_variant * p_v ) ; <nl> <nl> similarity index 99 % <nl> rename from modules / gdnative / godot / godot_vector2 . cpp <nl> rename to modules / gdnative / godot / vector2 . cpp <nl> mmm a / modules / gdnative / godot / godot_vector2 . cpp <nl> ppp b / modules / gdnative / godot / vector2 . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_vector2 . cpp * / <nl> + / * vector2 . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_vector2 . h " <nl> + # include " vector2 . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / math / math_2d . h " <nl> similarity index 97 % <nl> rename from modules / gdnative / godot / godot_vector2 . h <nl> rename to modules / gdnative / godot / vector2 . h <nl> mmm a / modules / gdnative / godot / godot_vector2 . h <nl> ppp b / modules / gdnative / godot / vector2 . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_vector2 . h * / <nl> + / * vector2 . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_VECTOR2_SIZE 8 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED <nl> - typedef struct godot_vector2 { <nl> - uint8_t _dont_touch_that [ 8 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_VECTOR2_SIZE ] ; <nl> } godot_vector2 ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> + # include " gdnative . h " <nl> <nl> void GDAPI godot_vector2_new ( godot_vector2 * r_dest , const godot_real p_x , const godot_real p_y ) ; <nl> <nl> similarity index 99 % <nl> rename from modules / gdnative / godot / godot_vector3 . cpp <nl> rename to modules / gdnative / godot / vector3 . cpp <nl> mmm a / modules / gdnative / godot / godot_vector3 . cpp <nl> ppp b / modules / gdnative / godot / vector3 . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_vector3 . cpp * / <nl> + / * vector3 . cpp * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # include " godot_vector3 . h " <nl> + # include " vector3 . h " <nl> # include " core / variant . h " <nl> <nl> # include " core / vector . h " <nl> similarity index 96 % <nl> rename from modules / gdnative / godot / godot_vector3 . h <nl> rename to modules / gdnative / godot / vector3 . h <nl> mmm a / modules / gdnative / godot / godot_vector3 . h <nl> ppp b / modules / gdnative / godot / vector3 . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * godot_vector3 . h * / <nl> + / * vector3 . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> extern " C " { <nl> <nl> # include < stdint . h > <nl> <nl> + # define GODOT_VECTOR3_SIZE 12 <nl> + <nl> # ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED <nl> # define GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED <nl> - typedef struct godot_vector3 { <nl> - uint8_t _dont_touch_that [ 12 ] ; <nl> + typedef struct { <nl> + uint8_t _dont_touch_that [ GODOT_VECTOR3_SIZE ] ; <nl> } godot_vector3 ; <nl> # endif <nl> <nl> - # include " . . / godot . h " <nl> - # include " godot_basis . h " <nl> + # include " basis . h " <nl> + # include " gdnative . h " <nl> <nl> typedef enum { <nl> GODOT_VECTOR3_AXIS_X , <nl> mmm a / modules / gdnative / register_types . cpp <nl> ppp b / modules / gdnative / register_types . cpp <nl> <nl> # include " io / resource_loader . h " <nl> # include " io / resource_saver . h " <nl> <nl> - GDNativeScriptLanguage * script_language_gdn = NULL ; <nl> - ResourceFormatLoaderGDNativeScript * resource_loader_gdn = NULL ; <nl> - ResourceFormatSaverGDNativeScript * resource_saver_gdn = NULL ; <nl> - / / ResourceFormatLoaderDLLibrary * resource_loader_dllib = NULL ; <nl> + # include " core / os / os . h " <nl> <nl> - void register_gdnative_types ( ) { <nl> + godot_variant cb_standard_varcall ( void * handle , godot_string * p_procedure , godot_array * p_args ) { <nl> + if ( handle = = NULL ) { <nl> + ERR_PRINT ( " No valid library handle , can ' t call standard varcall procedure " ) ; <nl> + godot_variant ret ; <nl> + godot_variant_new_nil ( & ret ) ; <nl> + return ret ; <nl> + } <nl> <nl> - ClassDB : : register_class < GDNativeLibrary > ( ) ; <nl> - ClassDB : : register_class < GDNativeScript > ( ) ; <nl> + void * library_proc ; <nl> + Error err = OS : : get_singleton ( ) - > get_dynamic_library_symbol_handle ( <nl> + handle , <nl> + * ( String * ) p_procedure , <nl> + library_proc ) ; <nl> + if ( err ! = OK ) { <nl> + ERR_PRINT ( ( String ( " GDNative procedure \ " " + * ( String * ) p_procedure ) + " \ " does not exists and can ' t be called " ) . utf8 ( ) . get_data ( ) ) ; <nl> + godot_variant ret ; <nl> + godot_variant_new_nil ( & ret ) ; <nl> + return ret ; <nl> + } <nl> + <nl> + godot_gdnative_procedure_fn proc ; <nl> + proc = ( godot_gdnative_procedure_fn ) library_proc ; <nl> <nl> - script_language_gdn = memnew ( GDNativeScriptLanguage ) ; <nl> - ScriptServer : : register_language ( script_language_gdn ) ; <nl> - resource_loader_gdn = memnew ( ResourceFormatLoaderGDNativeScript ) ; <nl> - ResourceLoader : : add_resource_format_loader ( resource_loader_gdn ) ; <nl> - resource_saver_gdn = memnew ( ResourceFormatSaverGDNativeScript ) ; <nl> - ResourceSaver : : add_resource_format_saver ( resource_saver_gdn ) ; <nl> + return proc ( NULL , p_args ) ; <nl> } <nl> <nl> - void unregister_gdnative_types ( ) { <nl> + GDNativeCallRegistry * GDNativeCallRegistry : : singleton ; <nl> <nl> - ScriptServer : : unregister_language ( script_language_gdn ) ; <nl> + void register_gdnative_types ( ) { <nl> <nl> - if ( script_language_gdn ) <nl> - memdelete ( script_language_gdn ) ; <nl> + ClassDB : : register_class < GDNativeLibrary > ( ) ; <nl> + ClassDB : : register_class < GDNative > ( ) ; <nl> + <nl> + GDNativeCallRegistry : : singleton = memnew ( GDNativeCallRegistry ) ; <nl> <nl> - if ( resource_loader_gdn ) <nl> - memdelete ( resource_loader_gdn ) ; <nl> + GDNativeCallRegistry : : singleton - > register_native_call_type ( " standard_varcall " , cb_standard_varcall ) ; <nl> + } <nl> <nl> - if ( resource_saver_gdn ) <nl> - memdelete ( resource_saver_gdn ) ; <nl> + void unregister_gdnative_types ( ) { <nl> + memdelete ( GDNativeCallRegistry : : singleton ) ; <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . e980e40e8ec <nl> mmm / dev / null <nl> ppp b / modules / nativescript / SCsub <nl> <nl> + # ! / usr / bin / env python <nl> + <nl> + Import ( ' env ' ) <nl> + <nl> + mod_env = env . Clone ( ) <nl> + mod_env . add_source_files ( env . modules_sources , " * . cpp " ) <nl> + mod_env . Append ( CPPPATH = ' # modules / gdnative ' ) <nl> + mod_env . Append ( CPPFLAGS = [ ' - DGDAPI_BUILT_IN ' ] ) <nl> + <nl> + Export ( ' mod_env ' ) <nl> similarity index 100 % <nl> rename from modules / gdnative / api_generator . cpp <nl> rename to modules / nativescript / api_generator . cpp <nl> similarity index 100 % <nl> rename from modules / gdnative / api_generator . h <nl> rename to modules / nativescript / api_generator . h <nl> new file mode 100644 <nl> index 00000000000 . . 9f57b9bb740 <nl> mmm / dev / null <nl> ppp b / modules / nativescript / config . py <nl> <nl> + <nl> + <nl> + def can_build ( platform ) : <nl> + return True <nl> + <nl> + <nl> + def configure ( env ) : <nl> + env . use_ptrcall = True <nl> new file mode 100644 <nl> index 00000000000 . . 7da6d14d184 <nl> mmm / dev / null <nl> ppp b / modules / nativescript / godot_nativescript . cpp <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * godot_nativescript . cpp * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * This file is part of : * / <nl> + / * GODOT ENGINE * / <nl> + / * http : / / www . godotengine . org * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * Copyright ( c ) 2007 - 2017 Juan Linietsky , Ariel Manzur . * / <nl> + / * Copyright ( c ) 2014 - 2017 Godot Engine contributors ( cf . AUTHORS . md ) * / <nl> + / * * / <nl> + / * Permission is hereby granted , free of charge , to any person obtaining * / <nl> + / * a copy of this software and associated documentation files ( the * / <nl> + / * " Software " ) , to deal in the Software without restriction , including * / <nl> + / * without limitation the rights to use , copy , modify , merge , publish , * / <nl> + / * distribute , sublicense , and / or sell copies of the Software , and to * / <nl> + / * permit persons to whom the Software is furnished to do so , subject to * / <nl> + / * the following conditions : * / <nl> + / * * / <nl> + / * The above copyright notice and this permission notice shall be * / <nl> + / * included in all copies or substantial portions of the Software . * / <nl> + / * * / <nl> + / * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , * / <nl> + / * EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * / <nl> + / * MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . * / <nl> + / * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * / <nl> + / * CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF CONTRACT , * / <nl> + / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> + / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + # include " godot_nativescript . h " <nl> + <nl> + # include " nativescript . h " <nl> + <nl> + # include " class_db . h " <nl> + # include " error_macros . h " <nl> + # include " gdnative . h " <nl> + # include " global_constants . h " <nl> + # include " project_settings . h " <nl> + # include " variant . h " <nl> + <nl> + # ifdef __cplusplus <nl> + extern " C " { <nl> + # endif <nl> + <nl> + extern " C " void _native_script_hook ( ) { <nl> + } <nl> + <nl> + # define NSL NativeScriptLanguage : : get_singleton ( ) <nl> + <nl> + / / Script API <nl> + <nl> + void GDAPI godot_nativescript_register_class ( void * p_gdnative_handle , const char * p_name , const char * p_base , godot_instance_create_func p_create_func , godot_instance_destroy_func p_destroy_func ) { <nl> + <nl> + String * s = ( String * ) p_gdnative_handle ; <nl> + <nl> + Map < StringName , NativeScriptDesc > * classes = & NSL - > library_classes [ * s ] ; <nl> + <nl> + NativeScriptDesc desc ; <nl> + <nl> + desc . create_func = p_create_func ; <nl> + desc . destroy_func = p_destroy_func ; <nl> + desc . is_tool = false ; <nl> + <nl> + desc . base = p_base ; <nl> + <nl> + if ( classes - > has ( p_base ) ) { <nl> + desc . base_data = & ( * classes ) [ p_base ] ; <nl> + desc . base_native_type = desc . base_data - > base_native_type ; <nl> + } else { <nl> + desc . base_data = NULL ; <nl> + desc . base_native_type = p_base ; <nl> + } <nl> + <nl> + classes - > insert ( p_name , desc ) ; <nl> + } <nl> + <nl> + void GDAPI godot_nativescript_register_tool_class ( void * p_gdnative_handle , const char * p_name , const char * p_base , godot_instance_create_func p_create_func , godot_instance_destroy_func p_destroy_func ) { <nl> + <nl> + String * s = ( String * ) p_gdnative_handle ; <nl> + <nl> + Map < StringName , NativeScriptDesc > * classes = & NSL - > library_classes [ * s ] ; <nl> + <nl> + NativeScriptDesc desc ; <nl> + <nl> + desc . create_func = p_create_func ; <nl> + desc . destroy_func = p_destroy_func ; <nl> + desc . is_tool = true ; <nl> + desc . base = p_base ; <nl> + <nl> + if ( classes - > has ( p_base ) ) { <nl> + desc . base_data = & ( * classes ) [ p_base ] ; <nl> + desc . base_native_type = desc . base_data - > base_native_type ; <nl> + } else { <nl> + desc . base_data = NULL ; <nl> + desc . base_native_type = p_base ; <nl> + } <nl> + <nl> + classes - > insert ( p_name , desc ) ; <nl> + } <nl> + <nl> + void GDAPI godot_nativescript_register_method ( void * p_gdnative_handle , const char * p_name , const char * p_function_name , godot_method_attributes p_attr , godot_instance_method p_method ) { <nl> + <nl> + String * s = ( String * ) p_gdnative_handle ; <nl> + <nl> + Map < StringName , NativeScriptDesc > : : Element * E = NSL - > library_classes [ * s ] . find ( p_name ) ; <nl> + <nl> + if ( ! E ) { <nl> + ERR_EXPLAIN ( " Attempt to register method on non - existant class ! " ) ; <nl> + ERR_FAIL ( ) ; <nl> + } <nl> + <nl> + NativeScriptDesc : : Method method ; <nl> + method . method = p_method ; <nl> + method . rpc_mode = p_attr . rpc_type ; <nl> + method . info = MethodInfo ( p_function_name ) ; <nl> + <nl> + E - > get ( ) . methods . insert ( p_function_name , method ) ; <nl> + } <nl> + <nl> + void GDAPI godot_nativescript_register_property ( void * p_gdnative_handle , const char * p_name , const char * p_path , godot_property_attributes * p_attr , godot_property_set_func p_set_func , godot_property_get_func p_get_func ) { <nl> + <nl> + String * s = ( String * ) p_gdnative_handle ; <nl> + <nl> + Map < StringName , NativeScriptDesc > : : Element * E = NSL - > library_classes [ * s ] . find ( p_name ) ; <nl> + <nl> + if ( ! E ) { <nl> + ERR_EXPLAIN ( " Attempt to register method on non - existant class ! " ) ; <nl> + ERR_FAIL ( ) ; <nl> + } <nl> + <nl> + NativeScriptDesc : : Property property ; <nl> + property . default_value = * ( Variant * ) & p_attr - > default_value ; <nl> + property . getter = p_get_func ; <nl> + property . rset_mode = p_attr - > rset_type ; <nl> + property . setter = p_set_func ; <nl> + property . info = PropertyInfo ( ( Variant : : Type ) p_attr - > type , <nl> + p_path , <nl> + ( PropertyHint ) p_attr - > hint , <nl> + * ( String * ) & p_attr - > hint_string , <nl> + ( PropertyUsageFlags ) p_attr - > usage ) ; <nl> + <nl> + E - > get ( ) . properties . insert ( p_path , property ) ; <nl> + } <nl> + <nl> + void GDAPI godot_nativescript_register_signal ( void * p_gdnative_handle , const char * p_name , const godot_signal * p_signal ) { <nl> + <nl> + String * s = ( String * ) p_gdnative_handle ; <nl> + <nl> + Map < StringName , NativeScriptDesc > : : Element * E = NSL - > library_classes [ * s ] . find ( p_name ) ; <nl> + <nl> + if ( ! E ) { <nl> + ERR_EXPLAIN ( " Attempt to register method on non - existant class ! " ) ; <nl> + ERR_FAIL ( ) ; <nl> + } <nl> + <nl> + List < PropertyInfo > args ; <nl> + Vector < Variant > default_args ; <nl> + <nl> + for ( int i = 0 ; i < p_signal - > num_args ; i + + ) { <nl> + PropertyInfo info ; <nl> + <nl> + godot_signal_argument arg = p_signal - > args [ i ] ; <nl> + <nl> + info . hint = ( PropertyHint ) arg . hint ; <nl> + info . hint_string = * ( String * ) & arg . hint_string ; <nl> + info . name = * ( String * ) & arg . name ; <nl> + info . type = ( Variant : : Type ) arg . type ; <nl> + info . usage = ( PropertyUsageFlags ) arg . usage ; <nl> + <nl> + args . push_back ( info ) ; <nl> + } <nl> + <nl> + for ( int i = 0 ; i < p_signal - > num_default_args ; i + + ) { <nl> + Variant * v ; <nl> + godot_signal_argument attrib = p_signal - > args [ i ] ; <nl> + <nl> + v = ( Variant * ) & attrib . default_value ; <nl> + <nl> + default_args . push_back ( * v ) ; <nl> + } <nl> + <nl> + MethodInfo method_info ; <nl> + method_info . name = * ( String * ) & p_signal - > name ; <nl> + method_info . arguments = args ; <nl> + method_info . default_arguments = default_args ; <nl> + <nl> + NativeScriptDesc : : Signal signal ; <nl> + signal . signal = method_info ; <nl> + <nl> + E - > get ( ) . signals_ . insert ( * ( String * ) & p_signal - > name , signal ) ; <nl> + } <nl> + <nl> + void GDAPI * godot_nativescript_get_userdata ( godot_object * p_instance ) { <nl> + Object * instance = ( Object * ) p_instance ; <nl> + if ( ! instance ) <nl> + return NULL ; <nl> + if ( instance - > get_script_instance ( ) & & instance - > get_script_instance ( ) - > get_language ( ) = = NativeScriptLanguage : : get_singleton ( ) ) { <nl> + / / return ( ( NativeScriptInstance * ) instance - > get_script_instance ( ) ) - > get_userdata ( ) ; <nl> + } <nl> + return NULL ; <nl> + } <nl> + <nl> + # ifdef __cplusplus <nl> + } <nl> + # endif <nl> similarity index 52 % <nl> rename from modules / gdnative / godot . h <nl> rename to modules / nativescript / godot_nativescript . h <nl> mmm a / modules / gdnative / godot . h <nl> ppp b / modules / nativescript / godot_nativescript . h <nl> <nl> / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - # ifndef GODOT_C_H <nl> - # define GODOT_C_H <nl> + # ifndef GODOT_NATIVESCRIPT_H <nl> + # define GODOT_NATIVESCRIPT_H <nl> + <nl> + # include < godot / gdnative . h > <nl> <nl> # ifdef __cplusplus <nl> extern " C " { <nl> extern " C " { <nl> # include < stdbool . h > <nl> # include < stdint . h > <nl> <nl> - # define GODOT_API_VERSION 1 <nl> - <nl> - / / / / / / Error <nl> - <nl> - typedef enum godot_error { <nl> - GODOT_OK , <nl> - GODOT_FAILED , / / / < Generic fail error <nl> - GODOT_ERR_UNAVAILABLE , / / / < What is requested is unsupported / unavailable <nl> - GODOT_ERR_UNCONFIGURED , / / / < The object being used hasnt been properly set up yet <nl> - GODOT_ERR_UNAUTHORIZED , / / / < Missing credentials for requested resource <nl> - GODOT_ERR_PARAMETER_RANGE_ERROR , / / / < Parameter given out of range ( 5 ) <nl> - GODOT_ERR_OUT_OF_MEMORY , / / / < Out of memory <nl> - GODOT_ERR_FILE_NOT_FOUND , <nl> - GODOT_ERR_FILE_BAD_DRIVE , <nl> - GODOT_ERR_FILE_BAD_PATH , <nl> - GODOT_ERR_FILE_NO_PERMISSION , / / ( 10 ) <nl> - GODOT_ERR_FILE_ALREADY_IN_USE , <nl> - GODOT_ERR_FILE_CANT_OPEN , <nl> - GODOT_ERR_FILE_CANT_WRITE , <nl> - GODOT_ERR_FILE_CANT_READ , <nl> - GODOT_ERR_FILE_UNRECOGNIZED , / / ( 15 ) <nl> - GODOT_ERR_FILE_CORRUPT , <nl> - GODOT_ERR_FILE_MISSING_DEPENDENCIES , <nl> - GODOT_ERR_FILE_EOF , <nl> - GODOT_ERR_CANT_OPEN , / / / < Can ' t open a resource / socket / file <nl> - GODOT_ERR_CANT_CREATE , / / ( 20 ) <nl> - GODOT_ERR_QUERY_FAILED , <nl> - GODOT_ERR_ALREADY_IN_USE , <nl> - GODOT_ERR_LOCKED , / / / < resource is locked <nl> - GODOT_ERR_TIMEOUT , <nl> - GODOT_ERR_CANT_CONNECT , / / ( 25 ) <nl> - GODOT_ERR_CANT_RESOLVE , <nl> - GODOT_ERR_CONNECTION_ERROR , <nl> - GODOT_ERR_CANT_AQUIRE_RESOURCE , <nl> - GODOT_ERR_CANT_FORK , <nl> - GODOT_ERR_INVALID_DATA , / / / < Data passed is invalid ( 30 ) <nl> - GODOT_ERR_INVALID_PARAMETER , / / / < Parameter passed is invalid <nl> - GODOT_ERR_ALREADY_EXISTS , / / / < When adding , item already exists <nl> - GODOT_ERR_DOES_NOT_EXIST , / / / < When retrieving / erasing , it item does not exist <nl> - GODOT_ERR_DATABASE_CANT_READ , / / / < database is full <nl> - GODOT_ERR_DATABASE_CANT_WRITE , / / / < database is full ( 35 ) <nl> - GODOT_ERR_COMPILATION_FAILED , <nl> - GODOT_ERR_METHOD_NOT_FOUND , <nl> - GODOT_ERR_LINK_FAILED , <nl> - GODOT_ERR_SCRIPT_FAILED , <nl> - GODOT_ERR_CYCLIC_LINK , / / ( 40 ) <nl> - GODOT_ERR_INVALID_DECLARATION , <nl> - GODOT_ERR_DUPLICATE_SYMBOL , <nl> - GODOT_ERR_PARSE_ERROR , <nl> - GODOT_ERR_BUSY , <nl> - GODOT_ERR_SKIP , / / ( 45 ) <nl> - GODOT_ERR_HELP , / / / < user requested help ! ! <nl> - GODOT_ERR_BUG , / / / < a bug in the software certainly happened , due to a double check failing or unexpected behavior . <nl> - GODOT_ERR_PRINTER_ON_FIRE , / / / the parallel port printer is engulfed in flames <nl> - GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD , / / / < shit happens , has never been used , though <nl> - GODOT_ERR_WTF = GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD / / / < short version of the above <nl> - } godot_error ; <nl> - <nl> - / / / / / / bool <nl> - <nl> - typedef bool godot_bool ; <nl> - <nl> - # define GODOT_TRUE 1 <nl> - # define GODOT_FALSE 0 <nl> - <nl> - / / / / / / / int <nl> - <nl> - typedef int godot_int ; <nl> - <nl> - / / / / / / / real <nl> - <nl> - typedef float godot_real ; <nl> - <nl> - / / / / / / / Object ( forward declared ) <nl> - typedef void godot_object ; <nl> - <nl> - / / / / / / / Brute force forward declarations for the rest <nl> - typedef struct godot_variant godot_variant ; <nl> - typedef struct godot_string godot_string ; <nl> - typedef struct godot_vector2 godot_vector2 ; <nl> - typedef struct godot_rect2 godot_rect2 ; <nl> - typedef struct godot_vector3 godot_vector3 ; <nl> - typedef struct godot_transform2d godot_transform2d ; <nl> - typedef struct godot_plane godot_plane ; <nl> - typedef struct godot_quat godot_quat ; <nl> - typedef struct godot_rect3 godot_rect3 ; <nl> - typedef struct godot_basis godot_basis ; <nl> - typedef struct godot_transform godot_transform ; <nl> - typedef struct godot_color godot_color ; <nl> - typedef struct godot_node_path godot_node_path ; <nl> - typedef struct godot_rid godot_rid ; <nl> - typedef struct godot_dictionary godot_dictionary ; <nl> - typedef struct godot_array godot_array ; <nl> - typedef struct godot_pool_byte_array godot_pool_byte_array ; <nl> - typedef struct godot_pool_int_array godot_pool_int_array ; <nl> - typedef struct godot_pool_real_array godot_pool_real_array ; <nl> - typedef struct godot_pool_string_array godot_pool_string_array ; <nl> - typedef struct godot_pool_vector2_array godot_pool_vector2_array ; <nl> - typedef struct godot_pool_vector3_array godot_pool_vector3_array ; <nl> - typedef struct godot_pool_color_array godot_pool_color_array ; <nl> - <nl> - / / / / / / / String <nl> - <nl> - # include " godot / godot_string . h " <nl> - <nl> - / / / / / / Vector2 <nl> - <nl> - # include " godot / godot_vector2 . h " <nl> - <nl> - / / / / / / Rect2 <nl> - <nl> - # include " godot / godot_rect2 . h " <nl> - <nl> - / / / / / / Vector3 <nl> - <nl> - # include " godot / godot_vector3 . h " <nl> - <nl> - / / / / / / Transform2D <nl> - <nl> - # include " godot / godot_transform2d . h " <nl> - <nl> - / / / / / / / Plane <nl> - <nl> - # include " godot / godot_plane . h " <nl> - <nl> - / / / / / / / Quat <nl> - <nl> - # include " godot / godot_quat . h " <nl> - <nl> - / / / / / / / Rect3 <nl> - <nl> - # include " godot / godot_rect3 . h " <nl> - <nl> - / / / / / / / Basis <nl> - <nl> - # include " godot / godot_basis . h " <nl> - <nl> - / / / / / / / Transform <nl> - <nl> - # include " godot / godot_transform . h " <nl> - <nl> - / / / / / / / Color <nl> - <nl> - # include " godot / godot_color . h " <nl> - <nl> - / / / / / / / NodePath <nl> - <nl> - # include " godot / godot_node_path . h " <nl> - <nl> - / / / / / / / RID <nl> - <nl> - # include " godot / godot_rid . h " <nl> - <nl> - / / / / / / / Dictionary <nl> - <nl> - # include " godot / godot_dictionary . h " <nl> - <nl> - / / / / / / / Array <nl> - <nl> - # include " godot / godot_array . h " <nl> - <nl> - / / single API file for Pool * Array <nl> - # include " godot / godot_pool_arrays . h " <nl> - <nl> - void GDAPI godot_object_destroy ( godot_object * p_o ) ; <nl> - <nl> - / / / / / / Variant <nl> - <nl> - # include " godot / godot_variant . h " <nl> - <nl> - / / / / / / Singleton API <nl> - <nl> - godot_object GDAPI * godot_global_get_singleton ( char * p_name ) ; / / result shouldn ' t be freed <nl> - <nl> - / / / / / / MethodBind API <nl> - <nl> - typedef struct godot_method_bind { <nl> - uint8_t _dont_touch_that [ 1 ] ; / / TODO <nl> - } godot_method_bind ; <nl> - <nl> - godot_method_bind GDAPI * godot_method_bind_get_method ( const char * p_classname , const char * p_methodname ) ; <nl> - void GDAPI godot_method_bind_ptrcall ( godot_method_bind * p_method_bind , godot_object * p_instance , const void * * p_args , void * p_ret ) ; <nl> - godot_variant GDAPI godot_method_bind_call ( godot_method_bind * p_method_bind , godot_object * p_instance , const godot_variant * * p_args , const int p_arg_count , godot_variant_call_error * p_call_error ) ; <nl> - / / / / / / Script API <nl> - <nl> - typedef struct godot_native_init_options { <nl> - godot_bool in_editor ; <nl> - uint64_t core_api_hash ; <nl> - uint64_t editor_api_hash ; <nl> - uint64_t no_api_hash ; <nl> - } godot_native_init_options ; <nl> - <nl> - typedef struct godot_native_terminate_options { <nl> - godot_bool in_editor ; <nl> - } godot_native_terminate_options ; <nl> - <nl> - typedef enum godot_method_rpc_mode { <nl> + typedef enum { <nl> GODOT_METHOD_RPC_MODE_DISABLED , <nl> GODOT_METHOD_RPC_MODE_REMOTE , <nl> GODOT_METHOD_RPC_MODE_SYNC , <nl> typedef enum godot_method_rpc_mode { <nl> GODOT_METHOD_RPC_MODE_SLAVE , <nl> } godot_method_rpc_mode ; <nl> <nl> - typedef struct godot_method_attributes { <nl> - godot_method_rpc_mode rpc_type ; <nl> - } godot_method_attributes ; <nl> - <nl> - typedef enum godot_property_hint { <nl> + typedef enum { <nl> GODOT_PROPERTY_HINT_NONE , / / / < no hint provided . <nl> GODOT_PROPERTY_HINT_RANGE , / / / < hint_text = " min , max , step , slider ; / / slider is optional " <nl> GODOT_PROPERTY_HINT_EXP_RANGE , / / / < hint_text = " min , max , step " , exponential edit <nl> typedef enum godot_property_hint { <nl> GODOT_PROPERTY_HINT_MAX , <nl> } godot_property_hint ; <nl> <nl> - typedef enum godot_property_usage_flags { <nl> + typedef enum { <nl> <nl> GODOT_PROPERTY_USAGE_STORAGE = 1 , <nl> GODOT_PROPERTY_USAGE_EDITOR = 2 , <nl> typedef enum godot_property_usage_flags { <nl> GODOT_PROPERTY_USAGE_NOEDITOR = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_NETWORK , <nl> } godot_property_usage_flags ; <nl> <nl> - typedef struct godot_property_attributes { <nl> + typedef struct { <nl> godot_method_rpc_mode rset_type ; <nl> <nl> godot_int type ; <nl> typedef struct godot_property_attributes { <nl> godot_variant default_value ; <nl> } godot_property_attributes ; <nl> <nl> - typedef struct godot_instance_create_func { <nl> + typedef struct { <nl> / / instance pointer , method_data - return user data <nl> GDCALLINGCONV void * ( * create_func ) ( godot_object * , void * ) ; <nl> void * method_data ; <nl> GDCALLINGCONV void ( * free_func ) ( void * ) ; <nl> } godot_instance_create_func ; <nl> <nl> - typedef struct godot_instance_destroy_func { <nl> + typedef struct { <nl> / / instance pointer , method data , user data <nl> GDCALLINGCONV void ( * destroy_func ) ( godot_object * , void * , void * ) ; <nl> void * method_data ; <nl> GDCALLINGCONV void ( * free_func ) ( void * ) ; <nl> } godot_instance_destroy_func ; <nl> <nl> - void GDAPI godot_script_register_class ( const char * p_name , const char * p_base , godot_instance_create_func p_create_func , godot_instance_destroy_func p_destroy_func ) ; <nl> + void GDAPI godot_nativescript_register_class ( void * p_gdnative_handle , const char * p_name , const char * p_base , godot_instance_create_func p_create_func , godot_instance_destroy_func p_destroy_func ) ; <nl> <nl> - void GDAPI godot_script_register_tool_class ( const char * p_name , const char * p_base , godot_instance_create_func p_create_func , godot_instance_destroy_func p_destroy_func ) ; <nl> + void GDAPI godot_nativescript_register_tool_class ( void * p_gdnative_handle , const char * p_name , const char * p_base , godot_instance_create_func p_create_func , godot_instance_destroy_func p_destroy_func ) ; <nl> + <nl> + typedef struct { <nl> + godot_method_rpc_mode rpc_type ; <nl> + } godot_method_attributes ; <nl> <nl> - typedef struct godot_instance_method { <nl> + typedef struct { <nl> / / instance pointer , method data , user data , num args , args - return result as varaint <nl> GDCALLINGCONV godot_variant ( * method ) ( godot_object * , void * , void * , int , godot_variant * * ) ; <nl> void * method_data ; <nl> GDCALLINGCONV void ( * free_func ) ( void * ) ; <nl> } godot_instance_method ; <nl> <nl> - void GDAPI godot_script_register_method ( const char * p_name , const char * p_function_name , godot_method_attributes p_attr , godot_instance_method p_method ) ; <nl> + void GDAPI godot_nativescript_register_method ( void * p_gdnative_handle , const char * p_name , const char * p_function_name , godot_method_attributes p_attr , godot_instance_method p_method ) ; <nl> <nl> - typedef struct godot_property_set_func { <nl> + typedef struct { <nl> / / instance pointer , method data , user data , value <nl> - GDCALLINGCONV void ( * set_func ) ( godot_object * , void * , void * , godot_variant ) ; <nl> + GDCALLINGCONV void ( * set_func ) ( godot_object * , void * , void * , godot_variant * ) ; <nl> void * method_data ; <nl> GDCALLINGCONV void ( * free_func ) ( void * ) ; <nl> } godot_property_set_func ; <nl> <nl> - typedef struct godot_property_get_func { <nl> + typedef struct { <nl> / / instance pointer , method data , user data , value <nl> GDCALLINGCONV godot_variant ( * get_func ) ( godot_object * , void * , void * ) ; <nl> void * method_data ; <nl> GDCALLINGCONV void ( * free_func ) ( void * ) ; <nl> } godot_property_get_func ; <nl> <nl> - void GDAPI godot_script_register_property ( const char * p_name , const char * p_path , godot_property_attributes * p_attr , godot_property_set_func p_set_func , godot_property_get_func p_get_func ) ; <nl> + void GDAPI godot_nativescript_register_property ( void * p_gdnative_handle , const char * p_name , const char * p_path , godot_property_attributes * p_attr , godot_property_set_func p_set_func , godot_property_get_func p_get_func ) ; <nl> <nl> - typedef struct godot_signal_argument { <nl> + typedef struct { <nl> godot_string name ; <nl> godot_int type ; <nl> godot_property_hint hint ; <nl> typedef struct godot_signal_argument { <nl> godot_variant default_value ; <nl> } godot_signal_argument ; <nl> <nl> - typedef struct godot_signal { <nl> + typedef struct { <nl> godot_string name ; <nl> int num_args ; <nl> godot_signal_argument * args ; <nl> typedef struct godot_signal { <nl> godot_variant * default_args ; <nl> } godot_signal ; <nl> <nl> - void GDAPI godot_script_register_signal ( const char * p_name , const godot_signal * p_signal ) ; <nl> - <nl> - void GDAPI * godot_native_get_userdata ( godot_object * p_instance ) ; <nl> - <nl> - / / Calling convention ? <nl> - typedef godot_object * ( * godot_class_constructor ) ( ) ; <nl> - <nl> - godot_class_constructor GDAPI godot_get_class_constructor ( const char * p_classname ) ; <nl> + void GDAPI godot_nativescript_register_signal ( void * p_gdnative_handle , const char * p_name , const godot_signal * p_signal ) ; <nl> <nl> - godot_dictionary GDAPI godot_get_global_constants ( ) ; <nl> - <nl> - / / / / / / System Functions <nl> - <nl> - / / using these will help Godot track how much memory is in use in debug mode <nl> - void GDAPI * godot_alloc ( int p_bytes ) ; <nl> - void GDAPI * godot_realloc ( void * p_ptr , int p_bytes ) ; <nl> - void GDAPI godot_free ( void * p_ptr ) ; <nl> - <nl> - / / print using Godot ' s error handler list <nl> - void GDAPI godot_print_error ( const char * p_description , const char * p_function , const char * p_file , int p_line ) ; <nl> - void GDAPI godot_print_warning ( const char * p_description , const char * p_function , const char * p_file , int p_line ) ; <nl> - void GDAPI godot_print ( const godot_string * p_message ) ; <nl> + void GDAPI * godot_nativescript_get_userdata ( godot_object * p_instance ) ; <nl> <nl> # ifdef __cplusplus <nl> } <nl> # endif <nl> <nl> - # endif / / GODOT_C_H <nl> + # endif <nl> new file mode 100644 <nl> index 00000000000 . . 661ae5371d8 <nl> mmm / dev / null <nl> ppp b / modules / nativescript / nativescript . cpp <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * nativescript . cpp * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * This file is part of : * / <nl> + / * GODOT ENGINE * / <nl> + / * http : / / www . godotengine . org * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * Copyright ( c ) 2007 - 2017 Juan Linietsky , Ariel Manzur . * / <nl> + / * Copyright ( c ) 2014 - 2017 Godot Engine contributors ( cf . AUTHORS . md ) * / <nl> + / * * / <nl> + / * Permission is hereby granted , free of charge , to any person obtaining * / <nl> + / * a copy of this software and associated documentation files ( the * / <nl> + / * " Software " ) , to deal in the Software without restriction , including * / <nl> + / * without limitation the rights to use , copy , modify , merge , publish , * / <nl> + / * distribute , sublicense , and / or sell copies of the Software , and to * / <nl> + / * permit persons to whom the Software is furnished to do so , subject to * / <nl> + / * the following conditions : * / <nl> + / * * / <nl> + / * The above copyright notice and this permission notice shall be * / <nl> + / * included in all copies or substantial portions of the Software . * / <nl> + / * * / <nl> + / * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , * / <nl> + / * EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * / <nl> + / * MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . * / <nl> + / * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * / <nl> + / * CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF CONTRACT , * / <nl> + / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> + / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + # include " nativescript . h " <nl> + <nl> + # include " modules / gdnative / godot / gdnative . h " <nl> + <nl> + # include " global_constants . h " <nl> + # include " io / file_access_encrypted . h " <nl> + # include " os / file_access . h " <nl> + # include " os / os . h " <nl> + # include " project_settings . h " <nl> + <nl> + # include " scene / main / scene_tree . h " <nl> + # include " scene / resources / scene_format_text . h " <nl> + <nl> + # if defined ( TOOLS_ENABLED ) & & defined ( DEBUG_METHODS_ENABLED ) <nl> + # include " api_generator . h " <nl> + # endif <nl> + <nl> + # ifdef TOOLS_ENABLED <nl> + # include " editor / editor_node . h " <nl> + # endif <nl> + <nl> + / / / / / / Script stuff <nl> + <nl> + void NativeScript : : _bind_methods ( ) { <nl> + ClassDB : : bind_method ( D_METHOD ( " set_class_name " , " class_name : String " ) , & NativeScript : : set_class_name ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_class_name : String " ) , & NativeScript : : get_class_name ) ; <nl> + <nl> + ClassDB : : bind_method ( D_METHOD ( " set_library " , " library : GDNativeLibrary " ) , & NativeScript : : set_library ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_library : GDNativeLibrary " ) , & NativeScript : : get_library ) ; <nl> + <nl> + ADD_PROPERTYNZ ( PropertyInfo ( Variant : : STRING , " class_name " ) , " set_class_name " , " get_class_name " ) ; <nl> + ADD_PROPERTYNZ ( PropertyInfo ( Variant : : OBJECT , " library " , PROPERTY_HINT_RESOURCE_TYPE , " GDNativeLibrary " ) , " set_library " , " get_library " ) ; <nl> + } <nl> + <nl> + # define NSL NativeScriptLanguage : : get_singleton ( ) <nl> + <nl> + # ifdef TOOLS_ENABLED <nl> + <nl> + void NativeScript : : _update_placeholder ( PlaceHolderScriptInstance * p_placeholder ) { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + ERR_FAIL_COND ( ! script_data ) ; <nl> + <nl> + List < PropertyInfo > info ; <nl> + Map < StringName , Variant > values ; <nl> + <nl> + for ( Map < StringName , NativeScriptDesc : : Property > : : Element * E = script_data - > properties . front ( ) ; E ; E = E - > next ( ) ) { <nl> + PropertyInfo p = E - > get ( ) . info ; <nl> + p . name = String ( E - > key ( ) ) ; <nl> + <nl> + info . push_back ( p ) ; <nl> + values [ p . name ] = E - > get ( ) . default_value ; <nl> + } <nl> + <nl> + p_placeholder - > update ( info , values ) ; <nl> + } <nl> + <nl> + void NativeScript : : _placeholder_erased ( PlaceHolderScriptInstance * p_placeholder ) { <nl> + placeholders . erase ( p_placeholder ) ; <nl> + } <nl> + <nl> + # endif <nl> + <nl> + void NativeScript : : set_class_name ( String p_class_name ) { <nl> + class_name = p_class_name ; <nl> + } <nl> + <nl> + String NativeScript : : get_class_name ( ) const { <nl> + return class_name ; <nl> + } <nl> + <nl> + void NativeScript : : set_library ( Ref < GDNativeLibrary > p_library ) { <nl> + if ( ! library . is_null ( ) ) { <nl> + WARN_PRINT ( " library on NativeScript already set . Do nothing . " ) ; <nl> + return ; <nl> + } <nl> + library = p_library ; <nl> + <nl> + / / See if this library was " registered " already . <nl> + <nl> + lib_path = library - > get_active_library_path ( ) ; <nl> + Map < String , Ref < GDNative > > : : Element * E = NSL - > library_gdnatives . find ( lib_path ) ; <nl> + <nl> + if ( ! E ) { <nl> + Ref < GDNative > gdn ; <nl> + gdn . instance ( ) ; <nl> + gdn - > set_library ( library ) ; <nl> + <nl> + / / TODO ( karroffel ) : check the return value ? <nl> + gdn - > initialize ( ) ; <nl> + <nl> + NSL - > library_gdnatives . insert ( lib_path , gdn ) ; <nl> + <nl> + NSL - > library_classes . insert ( lib_path , Map < StringName , NativeScriptDesc > ( ) ) ; <nl> + <nl> + if ( ! NSL - > library_script_users . has ( lib_path ) ) <nl> + NSL - > library_script_users . insert ( lib_path , Set < NativeScript * > ( ) ) ; <nl> + <nl> + NSL - > library_script_users [ lib_path ] . insert ( this ) ; <nl> + <nl> + void * args [ 1 ] = { <nl> + ( void * ) & lib_path <nl> + } ; <nl> + <nl> + / / here the library registers all the classes and stuff . <nl> + gdn - > call_native_raw ( NSL - > _init_call_type , <nl> + NSL - > _init_call_name , <nl> + NULL , <nl> + 1 , <nl> + args , <nl> + NULL ) ; <nl> + } else { <nl> + / / already initialized . Nice . <nl> + } <nl> + } <nl> + <nl> + Ref < GDNativeLibrary > NativeScript : : get_library ( ) const { <nl> + return library ; <nl> + } <nl> + <nl> + bool NativeScript : : can_instance ( ) const { <nl> + <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + # ifdef TOOLS_ENABLED <nl> + <nl> + return script_data | | ( ! is_tool ( ) & & ! ScriptServer : : is_scripting_enabled ( ) ) ; <nl> + # else <nl> + return script_data ; <nl> + # endif <nl> + } <nl> + <nl> + / / TODO ( karroffel ) : implement this <nl> + Ref < Script > NativeScript : : get_base_script ( ) const { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + if ( ! script_data ) <nl> + return Ref < Script > ( ) ; <nl> + <nl> + Ref < NativeScript > ns = Ref < NativeScript > ( NSL - > create_script ( ) ) ; <nl> + ns - > set_class_name ( script_data - > base ) ; <nl> + ns - > set_library ( get_library ( ) ) ; <nl> + return ns ; <nl> + } <nl> + <nl> + StringName NativeScript : : get_instance_base_type ( ) const { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + if ( ! script_data ) <nl> + return " " ; <nl> + <nl> + return script_data - > base_native_type ; <nl> + } <nl> + <nl> + ScriptInstance * NativeScript : : instance_create ( Object * p_this ) { <nl> + <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + if ( ! script_data ) { <nl> + return NULL ; <nl> + } <nl> + <nl> + # ifdef TOOLS_ENABLED <nl> + if ( ! ScriptServer : : is_scripting_enabled ( ) & & ! is_tool ( ) ) { <nl> + / / placeholder for nodes . For tools we want the rool thing . <nl> + <nl> + PlaceHolderScriptInstance * sins = memnew ( PlaceHolderScriptInstance ( NSL , Ref < Script > ( this ) , p_this ) ) ; <nl> + placeholders . insert ( sins ) ; <nl> + <nl> + if ( script_data - > create_func . create_func ) { <nl> + script_data - > create_func . create_func ( <nl> + ( godot_object * ) p_this , <nl> + script_data - > create_func . method_data ) ; <nl> + } <nl> + <nl> + _update_placeholder ( sins ) ; <nl> + <nl> + return sins ; <nl> + } <nl> + # endif <nl> + <nl> + NativeScriptInstance * nsi = memnew ( NativeScriptInstance ) ; <nl> + <nl> + nsi - > owner = p_this ; <nl> + nsi - > script = Ref < NativeScript > ( this ) ; <nl> + <nl> + # ifndef TOOLS_ENABLED <nl> + if ( ! ScriptServer : : is_scripting_enabled ( ) ) { <nl> + nsi - > userdata = NULL ; <nl> + } else { <nl> + nsi - > userdata = script_data - > create_func . create_func ( ( godot_object * ) p_this , script_data - > create_func . method_data ) ; <nl> + } <nl> + # else <nl> + nsi - > userdata = script_data - > create_func . create_func ( ( godot_object * ) p_this , script_data - > create_func . method_data ) ; <nl> + # endif <nl> + <nl> + instance_owners . insert ( p_this ) ; <nl> + return nsi ; <nl> + } <nl> + <nl> + bool NativeScript : : instance_has ( const Object * p_this ) const { <nl> + return instance_owners . has ( ( Object * ) p_this ) ; <nl> + } <nl> + <nl> + bool NativeScript : : has_source_code ( ) const { <nl> + return false ; <nl> + } <nl> + <nl> + String NativeScript : : get_source_code ( ) const { <nl> + return " " ; <nl> + } <nl> + <nl> + void NativeScript : : set_source_code ( const String & p_code ) { <nl> + } <nl> + <nl> + Error NativeScript : : reload ( bool p_keep_state ) { <nl> + return FAILED ; <nl> + } <nl> + <nl> + bool NativeScript : : has_method ( const StringName & p_method ) const { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + while ( script_data ) { <nl> + if ( script_data - > methods . has ( p_method ) ) <nl> + return true ; <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + MethodInfo NativeScript : : get_method_info ( const StringName & p_method ) const { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + if ( ! script_data ) <nl> + return MethodInfo ( ) ; <nl> + <nl> + while ( script_data ) { <nl> + Map < StringName , NativeScriptDesc : : Method > : : Element * M = script_data - > methods . find ( p_method ) ; <nl> + <nl> + if ( M ) <nl> + return M - > get ( ) . info ; <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + return MethodInfo ( ) ; <nl> + } <nl> + <nl> + bool NativeScript : : is_tool ( ) const { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + if ( script_data ) <nl> + return script_data - > is_tool ; <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + String NativeScript : : get_node_type ( ) const { <nl> + return " " ; / / NOTE ( karroffel ) : uhm ? <nl> + } <nl> + <nl> + ScriptLanguage * NativeScript : : get_language ( ) const { <nl> + return NativeScriptLanguage : : get_singleton ( ) ; <nl> + } <nl> + <nl> + bool NativeScript : : has_script_signal ( const StringName & p_signal ) const { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + if ( ! script_data ) <nl> + return false ; <nl> + return script_data - > signals_ . has ( p_signal ) ; <nl> + } <nl> + <nl> + void NativeScript : : get_script_signal_list ( List < MethodInfo > * r_signals ) const { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + if ( ! script_data ) <nl> + return ; <nl> + <nl> + Set < MethodInfo > signals_ ; <nl> + <nl> + while ( script_data ) { <nl> + <nl> + for ( Map < StringName , NativeScriptDesc : : Signal > : : Element * S = script_data - > signals_ . front ( ) ; S ; S = S - > next ( ) ) { <nl> + signals_ . insert ( S - > get ( ) . signal ) ; <nl> + } <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + <nl> + for ( Set < MethodInfo > : : Element * E = signals_ . front ( ) ; E ; E = E - > next ( ) ) { <nl> + r_signals - > push_back ( E - > get ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + bool NativeScript : : get_property_default_value ( const StringName & p_property , Variant & r_value ) const { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + if ( ! script_data ) <nl> + return false ; <nl> + <nl> + Map < StringName , NativeScriptDesc : : Property > : : Element * P = script_data - > properties . find ( p_property ) ; <nl> + <nl> + if ( ! P ) <nl> + return false ; <nl> + <nl> + r_value = P - > get ( ) . default_value ; <nl> + return true ; <nl> + } <nl> + <nl> + void NativeScript : : update_exports ( ) { <nl> + } <nl> + <nl> + void NativeScript : : get_script_method_list ( List < MethodInfo > * p_list ) const { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + if ( ! script_data ) <nl> + return ; <nl> + <nl> + Set < MethodInfo > methods ; <nl> + <nl> + while ( script_data ) { <nl> + <nl> + for ( Map < StringName , NativeScriptDesc : : Method > : : Element * E = script_data - > methods . front ( ) ; E ; E = E - > next ( ) ) { <nl> + methods . insert ( E - > get ( ) . info ) ; <nl> + } <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + <nl> + for ( Set < MethodInfo > : : Element * E = methods . front ( ) ; E ; E = E - > next ( ) ) { <nl> + p_list - > push_back ( E - > get ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + void NativeScript : : get_script_property_list ( List < PropertyInfo > * p_list ) const { <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + if ( ! script_data ) <nl> + return ; <nl> + <nl> + Set < PropertyInfo > properties ; <nl> + <nl> + while ( script_data ) { <nl> + <nl> + for ( Map < StringName , NativeScriptDesc : : Property > : : Element * E = script_data - > properties . front ( ) ; E ; E = E - > next ( ) ) { <nl> + properties . insert ( E - > get ( ) . info ) ; <nl> + } <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + <nl> + for ( Set < PropertyInfo > : : Element * E = properties . front ( ) ; E ; E = E - > next ( ) ) { <nl> + p_list - > push_back ( E - > get ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + Variant NativeScript : : _new ( const Variant * * p_args , int p_argcount , Variant : : CallError & r_error ) { <nl> + <nl> + if ( lib_path . empty ( ) | | class_name . empty ( ) | | library . is_null ( ) ) { <nl> + r_error . error = Variant : : CallError : : CALL_ERROR_INSTANCE_IS_NULL ; <nl> + return Variant ( ) ; <nl> + } <nl> + <nl> + NativeScriptDesc * script_data = get_script_desc ( ) ; <nl> + <nl> + if ( ! script_data ) { <nl> + r_error . error = Variant : : CallError : : CALL_ERROR_INSTANCE_IS_NULL ; <nl> + return Variant ( ) ; <nl> + } <nl> + <nl> + r_error . error = Variant : : CallError : : CALL_OK ; <nl> + <nl> + REF ref ; <nl> + Object * owner = NULL ; <nl> + <nl> + if ( ! ( script_data - > base_native_type = = " " ) ) { <nl> + owner = ClassDB : : instance ( script_data - > base_native_type ) ; <nl> + } else { <nl> + owner = memnew ( Reference ) ; <nl> + } <nl> + <nl> + Reference * r = owner - > cast_to < Reference > ( ) ; <nl> + if ( r ) { <nl> + ref = REF ( r ) ; <nl> + } <nl> + <nl> + / / GDScript does it like this : _create_instance ( p_args , p_argcount , owner , r ! = NULL , r_error ) ; <nl> + / / TODO ( karroffel ) : support varargs for constructors . <nl> + <nl> + NativeScriptInstance * instance = ( NativeScriptInstance * ) instance_create ( owner ) ; <nl> + <nl> + owner - > set_script_instance ( instance ) ; <nl> + <nl> + if ( ! instance ) { <nl> + if ( ref . is_null ( ) ) { <nl> + memdelete ( owner ) ; / / no owner , sorry <nl> + } <nl> + return Variant ( ) ; <nl> + } <nl> + <nl> + if ( ref . is_valid ( ) ) { <nl> + return ref ; <nl> + } else { <nl> + return owner ; <nl> + } <nl> + } <nl> + <nl> + / / TODO ( karroffel ) : implement this <nl> + NativeScript : : NativeScript ( ) { <nl> + library = Ref < GDNative > ( ) ; <nl> + lib_path = " " ; <nl> + class_name = " " ; <nl> + } <nl> + <nl> + / / TODO ( karroffel ) : implement this <nl> + NativeScript : : ~ NativeScript ( ) { <nl> + NSL - > library_script_users [ lib_path ] . erase ( this ) ; <nl> + } <nl> + <nl> + / / / / / / ScriptInstance stuff <nl> + <nl> + # define GET_SCRIPT_DESC ( ) script - > get_script_desc ( ) <nl> + <nl> + void NativeScriptInstance : : _ml_call_reversed ( NativeScriptDesc * script_data , const StringName & p_method , const Variant * * p_args , int p_argcount ) { <nl> + if ( script_data - > base_data ) { <nl> + _ml_call_reversed ( script_data - > base_data , p_method , p_args , p_argcount ) ; <nl> + } <nl> + <nl> + Map < StringName , NativeScriptDesc : : Method > : : Element * E = script_data - > methods . find ( p_method ) ; <nl> + if ( E ) { <nl> + godot_variant res = E - > get ( ) . method . method ( ( godot_object * ) owner , E - > get ( ) . method . method_data , userdata , p_argcount , ( godot_variant * * ) p_args ) ; <nl> + godot_variant_destroy ( & res ) ; <nl> + } <nl> + } <nl> + <nl> + bool NativeScriptInstance : : set ( const StringName & p_name , const Variant & p_value ) { <nl> + NativeScriptDesc * script_data = GET_SCRIPT_DESC ( ) ; <nl> + <nl> + while ( script_data ) { <nl> + Map < StringName , NativeScriptDesc : : Property > : : Element * P = script_data - > properties . find ( p_name ) ; <nl> + if ( P ) { <nl> + P - > get ( ) . setter . set_func ( ( godot_object * ) owner , <nl> + P - > get ( ) . setter . method_data , <nl> + userdata , <nl> + ( godot_variant * ) & p_value ) ; <nl> + return true ; <nl> + } <nl> + <nl> + Map < StringName , NativeScriptDesc : : Method > : : Element * E = script_data - > methods . find ( " _set " ) ; <nl> + if ( E ) { <nl> + Variant name = p_name ; <nl> + const Variant * args [ 2 ] = { & name , & p_value } ; <nl> + <nl> + E - > get ( ) . method . method ( ( godot_object * ) owner , <nl> + E - > get ( ) . method . method_data , <nl> + userdata , <nl> + 2 , <nl> + ( godot_variant * * ) args ) ; <nl> + return true ; <nl> + } <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + return false ; <nl> + } <nl> + bool NativeScriptInstance : : get ( const StringName & p_name , Variant & r_ret ) const { <nl> + NativeScriptDesc * script_data = GET_SCRIPT_DESC ( ) ; <nl> + <nl> + while ( script_data ) { <nl> + Map < StringName , NativeScriptDesc : : Property > : : Element * P = script_data - > properties . find ( p_name ) ; <nl> + if ( P ) { <nl> + godot_variant value ; <nl> + value = P - > get ( ) . getter . get_func ( ( godot_object * ) owner , <nl> + P - > get ( ) . setter . method_data , <nl> + userdata ) ; <nl> + r_ret = * ( Variant * ) & value ; <nl> + godot_variant_destroy ( & value ) ; <nl> + return true ; <nl> + } <nl> + <nl> + Map < StringName , NativeScriptDesc : : Method > : : Element * E = script_data - > methods . find ( " _get " ) ; <nl> + if ( E ) { <nl> + Variant name = p_name ; <nl> + const Variant * args [ 1 ] = { & name } ; <nl> + <nl> + godot_variant result ; <nl> + result = E - > get ( ) . method . method ( ( godot_object * ) owner , <nl> + E - > get ( ) . method . method_data , <nl> + userdata , <nl> + 1 , <nl> + ( godot_variant * * ) args ) ; <nl> + r_ret = * ( Variant * ) & result ; <nl> + godot_variant_destroy ( & result ) ; <nl> + if ( r_ret . get_type ( ) = = Variant : : NIL ) { <nl> + return false ; <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + void NativeScriptInstance : : get_property_list ( List < PropertyInfo > * p_properties ) const { <nl> + <nl> + NativeScriptDesc * script_data = GET_SCRIPT_DESC ( ) ; <nl> + <nl> + while ( script_data ) { <nl> + <nl> + Map < StringName , NativeScriptDesc : : Method > : : Element * E = script_data - > methods . find ( " _get_property_list " ) ; <nl> + if ( E ) { <nl> + <nl> + godot_variant result ; <nl> + result = E - > get ( ) . method . method ( ( godot_object * ) owner , <nl> + E - > get ( ) . method . method_data , <nl> + userdata , <nl> + 0 , <nl> + NULL ) ; <nl> + Variant res = * ( Variant * ) & result ; <nl> + godot_variant_destroy ( & result ) ; <nl> + <nl> + if ( res . get_type ( ) ! = Variant : : ARRAY ) { <nl> + ERR_EXPLAIN ( " _get_property_list must return an array of dictionaries " ) ; <nl> + ERR_FAIL ( ) ; <nl> + } <nl> + <nl> + Array arr = res ; <nl> + for ( int i = 0 ; i < arr . size ( ) ; i + + ) { <nl> + Dictionary d = arr [ i ] ; <nl> + <nl> + ERR_CONTINUE ( ! d . has ( " name " ) ) ; <nl> + ERR_CONTINUE ( ! d . has ( " type " ) ) ; <nl> + <nl> + PropertyInfo info ; <nl> + <nl> + info . type = Variant : : Type ( d [ " type " ] . operator int64_t ( ) ) ; <nl> + ERR_CONTINUE ( info . type < 0 | | info . type > = Variant : : VARIANT_MAX ) ; <nl> + <nl> + info . name = d [ " name " ] ; <nl> + ERR_CONTINUE ( info . name = = " " ) ; <nl> + <nl> + if ( d . has ( " hint " ) ) { <nl> + info . hint = PropertyHint ( d [ " hint " ] . operator int64_t ( ) ) ; <nl> + } <nl> + <nl> + if ( d . has ( " hint_string " ) ) { <nl> + info . hint_string = d [ " hint_string " ] ; <nl> + } <nl> + <nl> + if ( d . has ( " usage " ) ) { <nl> + info . usage = d [ " usage " ] ; <nl> + } <nl> + <nl> + p_properties - > push_back ( info ) ; <nl> + } <nl> + } <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + return ; <nl> + } <nl> + <nl> + Variant : : Type NativeScriptInstance : : get_property_type ( const StringName & p_name , bool * r_is_valid ) const { <nl> + <nl> + NativeScriptDesc * script_data = GET_SCRIPT_DESC ( ) ; <nl> + <nl> + while ( script_data ) { <nl> + <nl> + Map < StringName , NativeScriptDesc : : Property > : : Element * P = script_data - > properties . find ( p_name ) ; <nl> + if ( P ) { <nl> + * r_is_valid = true ; <nl> + return P - > get ( ) . info . type ; <nl> + } <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + return Variant : : NIL ; <nl> + } <nl> + <nl> + void NativeScriptInstance : : get_method_list ( List < MethodInfo > * p_list ) const { <nl> + script - > get_method_list ( p_list ) ; <nl> + } <nl> + <nl> + bool NativeScriptInstance : : has_method ( const StringName & p_method ) const { <nl> + return script - > has_method ( p_method ) ; <nl> + } <nl> + <nl> + Variant NativeScriptInstance : : call ( const StringName & p_method , const Variant * * p_args , int p_argcount , Variant : : CallError & r_error ) { <nl> + <nl> + NativeScriptDesc * script_data = GET_SCRIPT_DESC ( ) ; <nl> + <nl> + while ( script_data ) { <nl> + Map < StringName , NativeScriptDesc : : Method > : : Element * E = script_data - > methods . find ( p_method ) ; <nl> + if ( E ) { <nl> + godot_variant result ; <nl> + result = E - > get ( ) . method . method ( ( godot_object * ) owner , <nl> + E - > get ( ) . method . method_data , <nl> + userdata , <nl> + p_argcount , <nl> + ( godot_variant * * ) p_args ) ; <nl> + Variant res = * ( Variant * ) & result ; <nl> + godot_variant_destroy ( & result ) ; <nl> + r_error . error = Variant : : CallError : : CALL_OK ; <nl> + return res ; <nl> + } <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + <nl> + r_error . error = Variant : : CallError : : CALL_ERROR_INVALID_METHOD ; <nl> + return Variant ( ) ; <nl> + } <nl> + <nl> + void NativeScriptInstance : : notification ( int p_notification ) { <nl> + Variant value = p_notification ; <nl> + const Variant * args [ 1 ] = { & value } ; <nl> + call_multilevel ( " _notification " , args , 1 ) ; <nl> + } <nl> + <nl> + Ref < Script > NativeScriptInstance : : get_script ( ) const { <nl> + return script ; <nl> + } <nl> + <nl> + NativeScriptInstance : : RPCMode NativeScriptInstance : : get_rpc_mode ( const StringName & p_method ) const { <nl> + <nl> + NativeScriptDesc * script_data = GET_SCRIPT_DESC ( ) ; <nl> + <nl> + while ( script_data ) { <nl> + <nl> + Map < StringName , NativeScriptDesc : : Method > : : Element * E = script_data - > methods . find ( p_method ) ; <nl> + if ( E ) { <nl> + switch ( E - > get ( ) . rpc_mode ) { <nl> + case GODOT_METHOD_RPC_MODE_DISABLED : <nl> + return RPC_MODE_DISABLED ; <nl> + case GODOT_METHOD_RPC_MODE_REMOTE : <nl> + return RPC_MODE_REMOTE ; <nl> + case GODOT_METHOD_RPC_MODE_SYNC : <nl> + return RPC_MODE_SYNC ; <nl> + case GODOT_METHOD_RPC_MODE_MASTER : <nl> + return RPC_MODE_MASTER ; <nl> + case GODOT_METHOD_RPC_MODE_SLAVE : <nl> + return RPC_MODE_SLAVE ; <nl> + default : <nl> + return RPC_MODE_DISABLED ; <nl> + } <nl> + } <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + <nl> + return RPC_MODE_DISABLED ; <nl> + } <nl> + <nl> + / / TODO ( karroffel ) : implement this <nl> + NativeScriptInstance : : RPCMode NativeScriptInstance : : get_rset_mode ( const StringName & p_variable ) const { <nl> + <nl> + NativeScriptDesc * script_data = GET_SCRIPT_DESC ( ) ; <nl> + <nl> + while ( script_data ) { <nl> + <nl> + Map < StringName , NativeScriptDesc : : Property > : : Element * E = script_data - > properties . find ( p_variable ) ; <nl> + if ( E ) { <nl> + switch ( E - > get ( ) . rset_mode ) { <nl> + case GODOT_METHOD_RPC_MODE_DISABLED : <nl> + return RPC_MODE_DISABLED ; <nl> + case GODOT_METHOD_RPC_MODE_REMOTE : <nl> + return RPC_MODE_REMOTE ; <nl> + case GODOT_METHOD_RPC_MODE_SYNC : <nl> + return RPC_MODE_SYNC ; <nl> + case GODOT_METHOD_RPC_MODE_MASTER : <nl> + return RPC_MODE_MASTER ; <nl> + case GODOT_METHOD_RPC_MODE_SLAVE : <nl> + return RPC_MODE_SLAVE ; <nl> + default : <nl> + return RPC_MODE_DISABLED ; <nl> + } <nl> + } <nl> + <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + <nl> + return RPC_MODE_DISABLED ; <nl> + } <nl> + <nl> + ScriptLanguage * NativeScriptInstance : : get_language ( ) { <nl> + return NativeScriptLanguage : : get_singleton ( ) ; <nl> + } <nl> + <nl> + void NativeScriptInstance : : call_multilevel ( const StringName & p_method , const Variant * * p_args , int p_argcount ) { <nl> + NativeScriptDesc * script_data = GET_SCRIPT_DESC ( ) ; <nl> + <nl> + while ( script_data ) { <nl> + Map < StringName , NativeScriptDesc : : Method > : : Element * E = script_data - > methods . find ( p_method ) ; <nl> + if ( E ) { <nl> + godot_variant res = E - > get ( ) . method . method ( ( godot_object * ) owner , <nl> + E - > get ( ) . method . method_data , <nl> + userdata , <nl> + p_argcount , <nl> + ( godot_variant * * ) p_args ) ; <nl> + godot_variant_destroy ( & res ) ; <nl> + } <nl> + script_data = script_data - > base_data ; <nl> + } <nl> + } <nl> + <nl> + void NativeScriptInstance : : call_multilevel_reversed ( const StringName & p_method , const Variant * * p_args , int p_argcount ) { <nl> + NativeScriptDesc * script_data = GET_SCRIPT_DESC ( ) ; <nl> + <nl> + if ( script_data ) { <nl> + _ml_call_reversed ( script_data , p_method , p_args , p_argcount ) ; <nl> + } <nl> + } <nl> + <nl> + NativeScriptInstance : : ~ NativeScriptInstance ( ) { <nl> + <nl> + NativeScriptDesc * script_data = GET_SCRIPT_DESC ( ) ; <nl> + <nl> + if ( ! script_data ) <nl> + return ; <nl> + <nl> + script_data - > destroy_func . destroy_func ( ( godot_object * ) owner , script_data - > destroy_func . method_data , userdata ) ; <nl> + <nl> + if ( owner ) { <nl> + script - > instance_owners . erase ( owner ) ; <nl> + } <nl> + } <nl> + <nl> + / / / / / / ScriptingLanguage stuff <nl> + <nl> + NativeScriptLanguage * NativeScriptLanguage : : singleton ; <nl> + <nl> + extern " C " void _native_script_hook ( ) ; <nl> + void NativeScriptLanguage : : _hacky_api_anchor ( ) { <nl> + _native_script_hook ( ) ; <nl> + } <nl> + <nl> + void NativeScriptLanguage : : _unload_stuff ( ) { <nl> + for ( Map < String , Map < StringName , NativeScriptDesc > > : : Element * L = library_classes . front ( ) ; L ; L = L - > next ( ) ) { <nl> + for ( Map < StringName , NativeScriptDesc > : : Element * C = L - > get ( ) . front ( ) ; C ; C = C - > next ( ) ) { <nl> + <nl> + / / free property stuff first <nl> + for ( Map < StringName , NativeScriptDesc : : Property > : : Element * P = C - > get ( ) . properties . front ( ) ; P ; P = P - > next ( ) ) { <nl> + if ( P - > get ( ) . getter . free_func ) <nl> + P - > get ( ) . getter . free_func ( P - > get ( ) . getter . method_data ) ; <nl> + <nl> + if ( P - > get ( ) . setter . free_func ) <nl> + P - > get ( ) . setter . free_func ( P - > get ( ) . setter . method_data ) ; <nl> + } <nl> + <nl> + / / free method stuff <nl> + for ( Map < StringName , NativeScriptDesc : : Method > : : Element * M = C - > get ( ) . methods . front ( ) ; M ; M = M - > next ( ) ) { <nl> + if ( M - > get ( ) . method . free_func ) <nl> + M - > get ( ) . method . free_func ( M - > get ( ) . method . method_data ) ; <nl> + } <nl> + <nl> + / / free constructor / destructor <nl> + if ( C - > get ( ) . create_func . free_func ) <nl> + C - > get ( ) . create_func . free_func ( C - > get ( ) . create_func . method_data ) ; <nl> + <nl> + if ( C - > get ( ) . destroy_func . free_func ) <nl> + C - > get ( ) . destroy_func . free_func ( C - > get ( ) . destroy_func . method_data ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + NativeScriptLanguage : : NativeScriptLanguage ( ) { <nl> + NativeScriptLanguage : : singleton = this ; <nl> + } <nl> + <nl> + / / TODO ( karroffel ) : implement this <nl> + NativeScriptLanguage : : ~ NativeScriptLanguage ( ) { <nl> + _unload_stuff ( ) ; <nl> + <nl> + for ( Map < String , Ref < GDNative > > : : Element * L = NSL - > library_gdnatives . front ( ) ; L ; L = L - > next ( ) ) { <nl> + <nl> + L - > get ( ) - > terminate ( ) ; <nl> + NSL - > library_classes . clear ( ) ; <nl> + NSL - > library_gdnatives . clear ( ) ; <nl> + NSL - > library_script_users . clear ( ) ; <nl> + } <nl> + } <nl> + <nl> + String NativeScriptLanguage : : get_name ( ) const { <nl> + return " NativeScript " ; <nl> + } <nl> + <nl> + void _add_reload_node ( ) { <nl> + # ifdef TOOLS_ENABLED <nl> + NativeReloadNode * rn = memnew ( NativeReloadNode ) ; <nl> + EditorNode : : get_singleton ( ) - > add_child ( rn ) ; <nl> + # endif <nl> + } <nl> + <nl> + / / TODO ( karroffel ) : implement this <nl> + void NativeScriptLanguage : : init ( ) { <nl> + <nl> + # if defined ( TOOLS_ENABLED ) & & defined ( DEBUG_METHODS_ENABLED ) <nl> + <nl> + List < String > args = OS : : get_singleton ( ) - > get_cmdline_args ( ) ; <nl> + <nl> + List < String > : : Element * E = args . find ( " - - gdnative - generate - json - api " ) ; <nl> + <nl> + if ( E & & E - > next ( ) ) { <nl> + if ( generate_c_api ( E - > next ( ) - > get ( ) ) ! = OK ) { <nl> + ERR_PRINT ( " Failed to generate C API \ n " ) ; <nl> + } <nl> + } <nl> + # endif <nl> + <nl> + # ifdef TOOLS_ENABLED <nl> + EditorNode : : add_init_callback ( & _add_reload_node ) ; <nl> + # endif <nl> + } <nl> + String NativeScriptLanguage : : get_type ( ) const { <nl> + return " NativeScript " ; <nl> + } <nl> + String NativeScriptLanguage : : get_extension ( ) const { <nl> + return " gdns " ; <nl> + } <nl> + Error NativeScriptLanguage : : execute_file ( const String & p_path ) { <nl> + return OK ; / / Qué ? <nl> + } <nl> + void NativeScriptLanguage : : finish ( ) { <nl> + _unload_stuff ( ) ; <nl> + } <nl> + void NativeScriptLanguage : : get_reserved_words ( List < String > * p_words ) const { <nl> + } <nl> + void NativeScriptLanguage : : get_comment_delimiters ( List < String > * p_delimiters ) const { <nl> + } <nl> + void NativeScriptLanguage : : get_string_delimiters ( List < String > * p_delimiters ) const { <nl> + } <nl> + <nl> + / / TODO ( karroffel ) : implement this <nl> + Ref < Script > NativeScriptLanguage : : get_template ( const String & p_class_name , const String & p_base_class_name ) const { <nl> + NativeScript * s = memnew ( NativeScript ) ; <nl> + s - > set_class_name ( p_class_name ) ; <nl> + / / TODO ( karroffel ) : use p_base_class_name <nl> + return Ref < NativeScript > ( s ) ; <nl> + } <nl> + bool NativeScriptLanguage : : validate ( const String & p_script , int & r_line_error , int & r_col_error , String & r_test_error , const String & p_path , List < String > * r_functions ) const { <nl> + return false ; <nl> + } <nl> + <nl> + Script * NativeScriptLanguage : : create_script ( ) const { <nl> + NativeScript * script = memnew ( NativeScript ) ; <nl> + return script ; <nl> + } <nl> + bool NativeScriptLanguage : : has_named_classes ( ) const { <nl> + return true ; <nl> + } <nl> + int NativeScriptLanguage : : find_function ( const String & p_function , const String & p_code ) const { <nl> + return - 1 ; <nl> + } <nl> + String NativeScriptLanguage : : make_function ( const String & p_class , const String & p_name , const PoolStringArray & p_args ) const { <nl> + return " " ; <nl> + } <nl> + void NativeScriptLanguage : : auto_indent_code ( String & p_code , int p_from_line , int p_to_line ) const { <nl> + } <nl> + void NativeScriptLanguage : : add_global_constant ( const StringName & p_variable , const Variant & p_value ) { <nl> + } <nl> + <nl> + / / Debugging stuff here . Not used for now . <nl> + String NativeScriptLanguage : : debug_get_error ( ) const { <nl> + return " " ; <nl> + } <nl> + int NativeScriptLanguage : : debug_get_stack_level_count ( ) const { <nl> + return - 1 ; <nl> + } <nl> + int NativeScriptLanguage : : debug_get_stack_level_line ( int p_level ) const { <nl> + return - 1 ; <nl> + } <nl> + String NativeScriptLanguage : : debug_get_stack_level_function ( int p_level ) const { <nl> + return " " ; <nl> + } <nl> + String NativeScriptLanguage : : debug_get_stack_level_source ( int p_level ) const { <nl> + return " " ; <nl> + } <nl> + void NativeScriptLanguage : : debug_get_stack_level_locals ( int p_level , List < String > * p_locals , List < Variant > * p_values , int p_max_subitems , int p_max_depth ) { <nl> + } <nl> + void NativeScriptLanguage : : debug_get_stack_level_members ( int p_level , List < String > * p_members , List < Variant > * p_values , int p_max_subitems , int p_max_depth ) { <nl> + } <nl> + void NativeScriptLanguage : : debug_get_globals ( List < String > * p_locals , List < Variant > * p_values , int p_max_subitems , int p_max_depth ) { <nl> + } <nl> + String NativeScriptLanguage : : debug_parse_stack_level_expression ( int p_level , const String & p_expression , int p_max_subitems , int p_max_depth ) { <nl> + return " " ; <nl> + } <nl> + / / Debugging stuff end . <nl> + <nl> + void NativeScriptLanguage : : reload_all_scripts ( ) { <nl> + } <nl> + <nl> + void NativeScriptLanguage : : reload_tool_script ( const Ref < Script > & p_script , bool p_soft_reload ) { <nl> + } <nl> + void NativeScriptLanguage : : get_recognized_extensions ( List < String > * p_extensions ) const { <nl> + p_extensions - > push_back ( " gdns " ) ; <nl> + } <nl> + <nl> + void NativeScriptLanguage : : get_public_functions ( List < MethodInfo > * p_functions ) const { <nl> + } <nl> + <nl> + void NativeScriptLanguage : : get_public_constants ( List < Pair < String , Variant > > * p_constants ) const { <nl> + } <nl> + <nl> + void NativeScriptLanguage : : profiling_start ( ) { <nl> + } <nl> + <nl> + void NativeScriptLanguage : : profiling_stop ( ) { <nl> + } <nl> + <nl> + int NativeScriptLanguage : : profiling_get_accumulated_data ( ProfilingInfo * p_info_arr , int p_info_max ) { <nl> + return - 1 ; <nl> + } <nl> + <nl> + int NativeScriptLanguage : : profiling_get_frame_data ( ProfilingInfo * p_info_arr , int p_info_max ) { <nl> + return - 1 ; <nl> + } <nl> + <nl> + void NativeReloadNode : : _bind_methods ( ) { <nl> + ClassDB : : bind_method ( D_METHOD ( " _notification " ) , & NativeReloadNode : : _notification ) ; <nl> + } <nl> + <nl> + void NativeReloadNode : : _notification ( int p_what ) { <nl> + # ifdef TOOLS_ENABLED <nl> + <nl> + switch ( p_what ) { <nl> + case MainLoop : : NOTIFICATION_WM_FOCUS_OUT : { <nl> + <nl> + print_line ( " unload " ) ; <nl> + <nl> + NSL - > _unload_stuff ( ) ; <nl> + for ( Map < String , Ref < GDNative > > : : Element * L = NSL - > library_gdnatives . front ( ) ; L ; L = L - > next ( ) ) { <nl> + <nl> + L - > get ( ) - > terminate ( ) ; <nl> + NSL - > library_classes . erase ( L - > key ( ) ) ; <nl> + } <nl> + <nl> + } break ; <nl> + <nl> + case MainLoop : : NOTIFICATION_WM_FOCUS_IN : { <nl> + <nl> + print_line ( " load " ) ; <nl> + <nl> + Set < StringName > libs_to_remove ; <nl> + <nl> + for ( Map < String , Ref < GDNative > > : : Element * L = NSL - > library_gdnatives . front ( ) ; L ; L = L - > next ( ) ) { <nl> + <nl> + if ( ! L - > get ( ) - > initialize ( ) ) { <nl> + libs_to_remove . insert ( L - > key ( ) ) ; <nl> + continue ; <nl> + } <nl> + <nl> + NSL - > library_classes . insert ( L - > key ( ) , Map < StringName , NativeScriptDesc > ( ) ) ; <nl> + <nl> + void * args [ 1 ] = { <nl> + ( void * ) & L - > key ( ) <nl> + } ; <nl> + <nl> + / / here the library registers all the classes and stuff . <nl> + L - > get ( ) - > call_native_raw ( NSL - > _init_call_type , <nl> + NSL - > _init_call_name , <nl> + NULL , <nl> + 1 , <nl> + args , <nl> + NULL ) ; <nl> + <nl> + for ( Map < String , Set < NativeScript * > > : : Element * U = NSL - > library_script_users . front ( ) ; U ; U = U - > next ( ) ) { <nl> + for ( Set < NativeScript * > : : Element * S = U - > get ( ) . front ( ) ; S ; S = S - > next ( ) ) { <nl> + NativeScript * script = S - > get ( ) ; <nl> + <nl> + if ( script - > placeholders . size ( ) = = 0 ) <nl> + continue ; <nl> + <nl> + for ( Set < PlaceHolderScriptInstance * > : : Element * P = script - > placeholders . front ( ) ; P ; P = P - > next ( ) ) { <nl> + script - > _update_placeholder ( P - > get ( ) ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + for ( Set < StringName > : : Element * R = libs_to_remove . front ( ) ; R ; R = R - > next ( ) ) { <nl> + NSL - > library_gdnatives . erase ( R - > get ( ) ) ; <nl> + } <nl> + <nl> + / * <nl> + for ( Set < NativeLibrary * > : : Element * L = libs_to_reload . front ( ) ; L ; L = L - > next ( ) ) { <nl> + <nl> + GDNativeLibrary * lib = L - > get ( ) - > dllib ; <nl> + <nl> + lib - > _terminate ( ) ; <nl> + lib - > _initialize ( ) ; <nl> + <nl> + / / update placeholders ( if any ) <nl> + <nl> + Set < GDNativeScript * > scripts ; <nl> + <nl> + for ( Set < GDNativeScript * > : : Element * S = GDNativeScriptLanguage : : get_singleton ( ) - > script_list . front ( ) ; S ; S = S - > next ( ) ) { <nl> + <nl> + if ( lib - > native_library - > scripts . has ( S - > get ( ) - > get_script_name ( ) ) ) { <nl> + GDNativeScript * script = S - > get ( ) ; <nl> + script - > script_data = lib - > get_script_data ( script - > get_script_name ( ) ) ; <nl> + scripts . insert ( script ) ; <nl> + } <nl> + } <nl> + <nl> + for ( Set < GDNativeScript * > : : Element * S = scripts . front ( ) ; S ; S = S - > next ( ) ) { <nl> + GDNativeScript * script = S - > get ( ) ; <nl> + if ( script - > placeholders . size ( ) = = 0 ) <nl> + continue ; <nl> + <nl> + for ( Set < PlaceHolderScriptInstance * > : : Element * P = script - > placeholders . front ( ) ; P ; P = P - > next ( ) ) { <nl> + PlaceHolderScriptInstance * p = P - > get ( ) ; <nl> + script - > _update_placeholder ( p ) ; <nl> + } <nl> + } <nl> + } <nl> + * / <nl> + <nl> + } break ; <nl> + default : { <nl> + } ; <nl> + } <nl> + # endif <nl> + } <nl> + <nl> + RES ResourceFormatLoaderNativeScript : : load ( const String & p_path , const String & p_original_path , Error * r_error ) { <nl> + ResourceFormatLoaderText rsflt ; <nl> + return rsflt . load ( p_path , p_original_path , r_error ) ; <nl> + } <nl> + <nl> + void ResourceFormatLoaderNativeScript : : get_recognized_extensions ( List < String > * p_extensions ) const { <nl> + p_extensions - > push_back ( " gdns " ) ; <nl> + } <nl> + <nl> + bool ResourceFormatLoaderNativeScript : : handles_type ( const String & p_type ) const { <nl> + return ( p_type = = " Script " | | p_type = = " NativeScript " ) ; <nl> + } <nl> + <nl> + String ResourceFormatLoaderNativeScript : : get_resource_type ( const String & p_path ) const { <nl> + String el = p_path . get_extension ( ) . to_lower ( ) ; <nl> + if ( el = = " gdns " ) <nl> + return " NativeScript " ; <nl> + return " " ; <nl> + } <nl> + <nl> + Error ResourceFormatSaverNativeScript : : save ( const String & p_path , const RES & p_resource , uint32_t p_flags ) { <nl> + ResourceFormatSaverText rfst ; <nl> + return rfst . save ( p_path , p_resource , p_flags ) ; <nl> + } <nl> + <nl> + bool ResourceFormatSaverNativeScript : : recognize ( const RES & p_resource ) const { <nl> + return p_resource - > cast_to < NativeScript > ( ) ! = NULL ; <nl> + } <nl> + <nl> + void ResourceFormatSaverNativeScript : : get_recognized_extensions ( const RES & p_resource , List < String > * p_extensions ) const { <nl> + if ( p_resource - > cast_to < NativeScript > ( ) ) { <nl> + p_extensions - > push_back ( " gdns " ) ; <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 0578ffb680a <nl> mmm / dev / null <nl> ppp b / modules / nativescript / nativescript . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * nativescript . h * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * This file is part of : * / <nl> + / * GODOT ENGINE * / <nl> + / * http : / / www . godotengine . org * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * Copyright ( c ) 2007 - 2017 Juan Linietsky , Ariel Manzur . * / <nl> + / * Copyright ( c ) 2014 - 2017 Godot Engine contributors ( cf . AUTHORS . md ) * / <nl> + / * * / <nl> + / * Permission is hereby granted , free of charge , to any person obtaining * / <nl> + / * a copy of this software and associated documentation files ( the * / <nl> + / * " Software " ) , to deal in the Software without restriction , including * / <nl> + / * without limitation the rights to use , copy , modify , merge , publish , * / <nl> + / * distribute , sublicense , and / or sell copies of the Software , and to * / <nl> + / * permit persons to whom the Software is furnished to do so , subject to * / <nl> + / * the following conditions : * / <nl> + / * * / <nl> + / * The above copyright notice and this permission notice shall be * / <nl> + / * included in all copies or substantial portions of the Software . * / <nl> + / * * / <nl> + / * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , * / <nl> + / * EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * / <nl> + / * MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . * / <nl> + / * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * / <nl> + / * CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF CONTRACT , * / <nl> + / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> + / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + # ifndef NATIVE_SCRIPT_H <nl> + # define NATIVE_SCRIPT_H <nl> + <nl> + # include " io / resource_loader . h " <nl> + # include " io / resource_saver . h " <nl> + # include " os / thread_safe . h " <nl> + # include " resource . h " <nl> + # include " scene / main / node . h " <nl> + # include " script_language . h " <nl> + # include " self_list . h " <nl> + <nl> + # include " godot_nativescript . h " <nl> + # include " modules / gdnative / gdnative . h " <nl> + <nl> + struct NativeScriptDesc { <nl> + <nl> + struct Method { <nl> + godot_instance_method method ; <nl> + MethodInfo info ; <nl> + int rpc_mode ; <nl> + } ; <nl> + struct Property { <nl> + godot_property_set_func setter ; <nl> + godot_property_get_func getter ; <nl> + PropertyInfo info ; <nl> + Variant default_value ; <nl> + int rset_mode ; <nl> + } ; <nl> + <nl> + struct Signal { <nl> + MethodInfo signal ; <nl> + } ; <nl> + <nl> + Map < StringName , Method > methods ; <nl> + Map < StringName , Property > properties ; <nl> + Map < StringName , Signal > signals_ ; / / QtCreator doesn ' t like the name signals <nl> + StringName base ; <nl> + StringName base_native_type ; <nl> + NativeScriptDesc * base_data ; <nl> + godot_instance_create_func create_func ; <nl> + godot_instance_destroy_func destroy_func ; <nl> + <nl> + bool is_tool ; <nl> + <nl> + inline NativeScriptDesc ( ) <nl> + : methods ( ) , <nl> + properties ( ) , <nl> + signals_ ( ) , <nl> + base ( ) , <nl> + base_native_type ( ) { <nl> + zeromem ( & create_func , sizeof ( godot_instance_create_func ) ) ; <nl> + zeromem ( & destroy_func , sizeof ( godot_instance_destroy_func ) ) ; <nl> + } <nl> + } ; <nl> + <nl> + class NativeScript : public Script { <nl> + GDCLASS ( NativeScript , Script ) <nl> + <nl> + # ifdef TOOLS_ENABLED <nl> + Set < PlaceHolderScriptInstance * > placeholders ; <nl> + void _update_placeholder ( PlaceHolderScriptInstance * p_placeholder ) ; <nl> + virtual void _placeholder_erased ( PlaceHolderScriptInstance * p_placeholder ) ; <nl> + # endif <nl> + <nl> + friend class NativeScriptInstance ; <nl> + friend class NativeScriptLanguage ; <nl> + friend class NativeReloadNode ; <nl> + friend class GDNativeLibrary ; <nl> + <nl> + Ref < GDNativeLibrary > library ; <nl> + <nl> + String lib_path ; <nl> + <nl> + String class_name ; <nl> + <nl> + Set < Object * > instance_owners ; <nl> + <nl> + protected : <nl> + static void _bind_methods ( ) ; <nl> + <nl> + public : <nl> + inline NativeScriptDesc * get_script_desc ( ) const ; <nl> + <nl> + void set_class_name ( String p_class_name ) ; <nl> + String get_class_name ( ) const ; <nl> + <nl> + void set_library ( Ref < GDNativeLibrary > library ) ; <nl> + Ref < GDNativeLibrary > get_library ( ) const ; <nl> + <nl> + virtual bool can_instance ( ) const ; <nl> + <nl> + virtual Ref < Script > get_base_script ( ) const ; / / for script inheritance <nl> + <nl> + virtual StringName get_instance_base_type ( ) const ; / / this may not work in all scripts , will return empty if so <nl> + virtual ScriptInstance * instance_create ( Object * p_this ) ; <nl> + virtual bool instance_has ( const Object * p_this ) const ; <nl> + <nl> + virtual bool has_source_code ( ) const ; <nl> + virtual String get_source_code ( ) const ; <nl> + virtual void set_source_code ( const String & p_code ) ; <nl> + virtual Error reload ( bool p_keep_state = false ) ; <nl> + <nl> + virtual bool has_method ( const StringName & p_method ) const ; <nl> + virtual MethodInfo get_method_info ( const StringName & p_method ) const ; <nl> + <nl> + virtual bool is_tool ( ) const ; <nl> + <nl> + virtual String get_node_type ( ) const ; <nl> + <nl> + virtual ScriptLanguage * get_language ( ) const ; <nl> + <nl> + virtual bool has_script_signal ( const StringName & p_signal ) const ; <nl> + virtual void get_script_signal_list ( List < MethodInfo > * r_signals ) const ; <nl> + <nl> + virtual bool get_property_default_value ( const StringName & p_property , Variant & r_value ) const ; <nl> + <nl> + virtual void update_exports ( ) ; / / editor tool <nl> + virtual void get_script_method_list ( List < MethodInfo > * p_list ) const ; <nl> + virtual void get_script_property_list ( List < PropertyInfo > * p_list ) const ; <nl> + <nl> + Variant _new ( const Variant * * p_args , int p_argcount , Variant : : CallError & r_error ) ; <nl> + <nl> + NativeScript ( ) ; <nl> + ~ NativeScript ( ) ; <nl> + } ; <nl> + <nl> + class NativeScriptInstance : public ScriptInstance { <nl> + <nl> + friend class NativeScript ; <nl> + <nl> + Object * owner ; <nl> + Ref < NativeScript > script ; <nl> + <nl> + void * userdata ; <nl> + <nl> + void _ml_call_reversed ( NativeScriptDesc * script_data , const StringName & p_method , const Variant * * p_args , int p_argcount ) ; <nl> + <nl> + public : <nl> + virtual bool set ( const StringName & p_name , const Variant & p_value ) ; <nl> + virtual bool get ( const StringName & p_name , Variant & r_ret ) const ; <nl> + virtual void get_property_list ( List < PropertyInfo > * p_properties ) const ; <nl> + virtual Variant : : Type get_property_type ( const StringName & p_name , bool * r_is_valid ) const ; <nl> + virtual void get_method_list ( List < MethodInfo > * p_list ) const ; <nl> + virtual bool has_method ( const StringName & p_method ) const ; <nl> + virtual Variant call ( const StringName & p_method , const Variant * * p_args , int p_argcount , Variant : : CallError & r_error ) ; <nl> + virtual void notification ( int p_notification ) ; <nl> + virtual Ref < Script > get_script ( ) const ; <nl> + virtual RPCMode get_rpc_mode ( const StringName & p_method ) const ; <nl> + virtual RPCMode get_rset_mode ( const StringName & p_variable ) const ; <nl> + virtual ScriptLanguage * get_language ( ) ; <nl> + <nl> + virtual void call_multilevel ( const StringName & p_method , const Variant * * p_args , int p_argcount ) ; <nl> + virtual void call_multilevel_reversed ( const StringName & p_method , const Variant * * p_args , int p_argcount ) ; <nl> + <nl> + ~ NativeScriptInstance ( ) ; <nl> + } ; <nl> + <nl> + class NativeReloadNode ; <nl> + <nl> + class NativeScriptLanguage : public ScriptLanguage { <nl> + <nl> + friend class NativeScript ; <nl> + friend class NativeScriptInstance ; <nl> + friend class NativeReloadNode ; <nl> + <nl> + private : <nl> + static NativeScriptLanguage * singleton ; <nl> + <nl> + void _unload_stuff ( ) ; <nl> + <nl> + public : <nl> + Map < String , Map < StringName , NativeScriptDesc > > library_classes ; <nl> + Map < String , Ref < GDNative > > library_gdnatives ; <nl> + <nl> + Map < String , Set < NativeScript * > > library_script_users ; <nl> + <nl> + const StringName _init_call_type = " nativescript_init " ; <nl> + const StringName _init_call_name = " godot_nativescript_init " ; <nl> + <nl> + NativeScriptLanguage ( ) ; <nl> + ~ NativeScriptLanguage ( ) ; <nl> + <nl> + inline static NativeScriptLanguage * get_singleton ( ) { <nl> + return singleton ; <nl> + } <nl> + <nl> + void _hacky_api_anchor ( ) ; <nl> + <nl> + virtual String get_name ( ) const ; <nl> + virtual void init ( ) ; <nl> + virtual String get_type ( ) const ; <nl> + virtual String get_extension ( ) const ; <nl> + virtual Error execute_file ( const String & p_path ) ; <nl> + virtual void finish ( ) ; <nl> + virtual void get_reserved_words ( List < String > * p_words ) const ; <nl> + virtual void get_comment_delimiters ( List < String > * p_delimiters ) const ; <nl> + virtual void get_string_delimiters ( List < String > * p_delimiters ) const ; <nl> + virtual Ref < Script > get_template ( const String & p_class_name , const String & p_base_class_name ) const ; <nl> + virtual bool validate ( const String & p_script , int & r_line_error , int & r_col_error , String & r_test_error , const String & p_path , List < String > * r_functions ) const ; <nl> + virtual Script * create_script ( ) const ; <nl> + virtual bool has_named_classes ( ) const ; <nl> + virtual int find_function ( const String & p_function , const String & p_code ) const ; <nl> + virtual String make_function ( const String & p_class , const String & p_name , const PoolStringArray & p_args ) const ; <nl> + virtual void auto_indent_code ( String & p_code , int p_from_line , int p_to_line ) const ; <nl> + virtual void add_global_constant ( const StringName & p_variable , const Variant & p_value ) ; <nl> + virtual String debug_get_error ( ) const ; <nl> + virtual int debug_get_stack_level_count ( ) const ; <nl> + virtual int debug_get_stack_level_line ( int p_level ) const ; <nl> + virtual String debug_get_stack_level_function ( int p_level ) const ; <nl> + virtual String debug_get_stack_level_source ( int p_level ) const ; <nl> + virtual void debug_get_stack_level_locals ( int p_level , List < String > * p_locals , List < Variant > * p_values , int p_max_subitems , int p_max_depth ) ; <nl> + virtual void debug_get_stack_level_members ( int p_level , List < String > * p_members , List < Variant > * p_values , int p_max_subitems , int p_max_depth ) ; <nl> + virtual void debug_get_globals ( List < String > * p_locals , List < Variant > * p_values , int p_max_subitems , int p_max_depth ) ; <nl> + virtual String debug_parse_stack_level_expression ( int p_level , const String & p_expression , int p_max_subitems , int p_max_depth ) ; <nl> + virtual void reload_all_scripts ( ) ; <nl> + virtual void reload_tool_script ( const Ref < Script > & p_script , bool p_soft_reload ) ; <nl> + virtual void get_recognized_extensions ( List < String > * p_extensions ) const ; <nl> + virtual void get_public_functions ( List < MethodInfo > * p_functions ) const ; <nl> + virtual void get_public_constants ( List < Pair < String , Variant > > * p_constants ) const ; <nl> + virtual void profiling_start ( ) ; <nl> + virtual void profiling_stop ( ) ; <nl> + virtual int profiling_get_accumulated_data ( ProfilingInfo * p_info_arr , int p_info_max ) ; <nl> + virtual int profiling_get_frame_data ( ProfilingInfo * p_info_arr , int p_info_max ) ; <nl> + } ; <nl> + <nl> + inline NativeScriptDesc * NativeScript : : get_script_desc ( ) const { <nl> + Map < StringName , NativeScriptDesc > : : Element * E = NativeScriptLanguage : : singleton - > library_classes [ lib_path ] . find ( class_name ) ; <nl> + return E ? & E - > get ( ) : NULL ; <nl> + } <nl> + <nl> + class NativeReloadNode : public Node { <nl> + GDCLASS ( NativeReloadNode , Node ) <nl> + public : <nl> + static void _bind_methods ( ) ; <nl> + void _notification ( int p_what ) ; <nl> + } ; <nl> + <nl> + class ResourceFormatLoaderNativeScript : public ResourceFormatLoader { <nl> + public : <nl> + virtual RES load ( const String & p_path , const String & p_original_path = " " , Error * r_error = NULL ) ; <nl> + virtual void get_recognized_extensions ( List < String > * p_extensions ) const ; <nl> + virtual bool handles_type ( const String & p_type ) const ; <nl> + virtual String get_resource_type ( const String & p_path ) const ; <nl> + } ; <nl> + <nl> + class ResourceFormatSaverNativeScript : public ResourceFormatSaver { <nl> + virtual Error save ( const String & p_path , const RES & p_resource , uint32_t p_flags = 0 ) ; <nl> + virtual bool recognize ( const RES & p_resource ) const ; <nl> + virtual void get_recognized_extensions ( const RES & p_resource , List < String > * p_extensions ) const ; <nl> + } ; <nl> + <nl> + # endif / / GDNATIVE_H <nl> new file mode 100644 <nl> index 00000000000 . . 6c88b04a56c <nl> mmm / dev / null <nl> ppp b / modules / nativescript / register_types . cpp <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * register_types . cpp * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * This file is part of : * / <nl> + / * GODOT ENGINE * / <nl> + / * http : / / www . godotengine . org * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * Copyright ( c ) 2007 - 2017 Juan Linietsky , Ariel Manzur . * / <nl> + / * Copyright ( c ) 2014 - 2017 Godot Engine contributors ( cf . AUTHORS . md ) * / <nl> + / * * / <nl> + / * Permission is hereby granted , free of charge , to any person obtaining * / <nl> + / * a copy of this software and associated documentation files ( the * / <nl> + / * " Software " ) , to deal in the Software without restriction , including * / <nl> + / * without limitation the rights to use , copy , modify , merge , publish , * / <nl> + / * distribute , sublicense , and / or sell copies of the Software , and to * / <nl> + / * permit persons to whom the Software is furnished to do so , subject to * / <nl> + / * the following conditions : * / <nl> + / * * / <nl> + / * The above copyright notice and this permission notice shall be * / <nl> + / * included in all copies or substantial portions of the Software . * / <nl> + / * * / <nl> + / * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , * / <nl> + / * EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * / <nl> + / * MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . * / <nl> + / * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * / <nl> + / * CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF CONTRACT , * / <nl> + / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> + / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + # include " register_types . h " <nl> + <nl> + # include " io / resource_loader . h " <nl> + # include " io / resource_saver . h " <nl> + <nl> + # include " nativescript . h " <nl> + <nl> + # include " core / os / os . h " <nl> + <nl> + NativeScriptLanguage * native_script_language ; <nl> + <nl> + typedef void ( * native_script_init_fn ) ( void * ) ; <nl> + <nl> + void init_call_cb ( void * p_handle , godot_string * p_proc_name , void * p_data , int p_num_args , void * * args , void * r_ret ) { <nl> + if ( p_handle = = NULL ) { <nl> + ERR_PRINT ( " No valid library handle , can ' t call nativescript init procedure " ) ; <nl> + return ; <nl> + } <nl> + <nl> + void * library_proc ; <nl> + Error err = OS : : get_singleton ( ) - > get_dynamic_library_symbol_handle ( <nl> + p_handle , <nl> + * ( String * ) p_proc_name , <nl> + library_proc ) ; <nl> + if ( err ! = OK ) { <nl> + ERR_PRINT ( ( String ( " GDNative procedure \ " " + * ( String * ) p_proc_name ) + " \ " does not exists and can ' t be called " ) . utf8 ( ) . get_data ( ) ) ; <nl> + return ; <nl> + } <nl> + <nl> + native_script_init_fn fn = ( native_script_init_fn ) library_proc ; <nl> + <nl> + fn ( args [ 0 ] ) ; <nl> + } <nl> + <nl> + ResourceFormatLoaderNativeScript * resource_loader_gdns = NULL ; <nl> + ResourceFormatSaverNativeScript * resource_saver_gdns = NULL ; <nl> + <nl> + void register_nativescript_types ( ) { <nl> + native_script_language = memnew ( NativeScriptLanguage ) ; <nl> + <nl> + ClassDB : : register_class < NativeScript > ( ) ; <nl> + <nl> + ScriptServer : : register_language ( native_script_language ) ; <nl> + <nl> + GDNativeCallRegistry : : singleton - > register_native_raw_call_type ( native_script_language - > _init_call_type , init_call_cb ) ; <nl> + <nl> + resource_saver_gdns = memnew ( ResourceFormatSaverNativeScript ) ; <nl> + ResourceSaver : : add_resource_format_saver ( resource_saver_gdns ) ; <nl> + <nl> + resource_loader_gdns = memnew ( ResourceFormatLoaderNativeScript ) ; <nl> + ResourceLoader : : add_resource_format_loader ( resource_loader_gdns ) ; <nl> + } <nl> + <nl> + void unregister_nativescript_types ( ) { <nl> + <nl> + memdelete ( resource_loader_gdns ) ; <nl> + <nl> + memdelete ( resource_saver_gdns ) ; <nl> + <nl> + if ( native_script_language ) { <nl> + ScriptServer : : unregister_language ( native_script_language ) ; <nl> + memdelete ( native_script_language ) ; <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 319da9c42f1 <nl> mmm / dev / null <nl> ppp b / modules / nativescript / register_types . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * register_types . h * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * This file is part of : * / <nl> + / * GODOT ENGINE * / <nl> + / * http : / / www . godotengine . org * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * Copyright ( c ) 2007 - 2017 Juan Linietsky , Ariel Manzur . * / <nl> + / * Copyright ( c ) 2014 - 2017 Godot Engine contributors ( cf . AUTHORS . md ) * / <nl> + / * * / <nl> + / * Permission is hereby granted , free of charge , to any person obtaining * / <nl> + / * a copy of this software and associated documentation files ( the * / <nl> + / * " Software " ) , to deal in the Software without restriction , including * / <nl> + / * without limitation the rights to use , copy , modify , merge , publish , * / <nl> + / * distribute , sublicense , and / or sell copies of the Software , and to * / <nl> + / * permit persons to whom the Software is furnished to do so , subject to * / <nl> + / * the following conditions : * / <nl> + / * * / <nl> + / * The above copyright notice and this permission notice shall be * / <nl> + / * included in all copies or substantial portions of the Software . * / <nl> + / * * / <nl> + / * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , * / <nl> + / * EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * / <nl> + / * MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . * / <nl> + / * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * / <nl> + / * CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF CONTRACT , * / <nl> + / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> + / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + void register_nativescript_types ( ) ; <nl> + void unregister_nativescript_types ( ) ; <nl>
Merge pull request from karroffel / gdnative - rewrite
godotengine/godot
b31973b64de038a1d2dfaa1fcea0c72ee5ce012b
2017-07-24T02:51:34Z
mmm a / tests / tests / ActionsTest / ActionsTest . cpp <nl> ppp b / tests / tests / ActionsTest / ActionsTest . cpp <nl> void ActionCallFuncND : : onEnter ( ) <nl> centerSprites ( 1 ) ; <nl> <nl> CCFiniteTimeAction * action = CCSequence : : actions ( CCMoveBy : : actionWithDuration ( 2 . 0f , ccp ( 200 , 0 ) ) , <nl> - / / CCCallFuncND : : actionWithTarget ( m_grossini , callfuncND_selector ( ActionCallFuncND : : removeFromParentAndCleanup ) , ( void * ) true ) , <nl> + CCCallFuncND : : actionWithTarget ( this , callfuncND_selector ( ActionCallFuncND : : removeFromParentAndCleanup ) , ( void * ) true ) , <nl> NULL ) ; <nl> <nl> m_grossini - > runAction ( action ) ; <nl> std : : string ActionCallFuncND : : subtitle ( ) <nl> return " CallFuncND + removeFromParentAndCleanup . Grossini dissapears in 2s " ; <nl> } <nl> <nl> + void ActionCallFuncND : : removeFromParentAndCleanup ( CCNode * pSender , void * data ) <nl> + { <nl> + bool bCleanUp = ( bool ) data ; <nl> + m_grossini - > removeFromParentAndCleanup ( bCleanUp ) ; <nl> + } <nl> + <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> / / <nl> / / ActionSpawn <nl> mmm a / tests / tests / ActionsTest / ActionsTest . h <nl> ppp b / tests / tests / ActionsTest / ActionsTest . h <nl> class ActionCallFuncND : public ActionsDemo <nl> virtual void onEnter ( ) ; <nl> virtual std : : string title ( ) ; <nl> virtual std : : string subtitle ( ) ; <nl> + void removeFromParentAndCleanup ( CCNode * pSender , void * data ) ; <nl> } ; <nl> <nl> class ActionFollow : public ActionsDemo <nl>
Merge pull request from dumganhar / gles20
cocos2d/cocos2d-x
91b4d52c31eb6b4558dcbde48be9b3baab46dd7c
2012-04-13T03:56:05Z
mmm a / stdlib / public / SwiftShims / UnicodeShims . h <nl> ppp b / stdlib / public / SwiftShims / UnicodeShims . h <nl> typedef enum __swift_stdlib_UBreakIteratorType { <nl> } __swift_stdlib_UBreakIteratorType ; <nl> <nl> typedef struct __swift_stdlib_UBreakIterator __swift_stdlib_UBreakIterator ; <nl> + typedef struct __swift_stdlib_UText __swift_stdlib_UText ; <nl> typedef struct __swift_stdlib_UNormalizer2 __swift_stdlib_UNormalizer2 ; <nl> typedef __swift_int8_t __swift_stdlib_UBool ; <nl> typedef __swift_int32_t __swift_stdlib_UChar32 ; <nl> __swift_stdlib_ubrk_open ( __swift_stdlib_UBreakIteratorType type , <nl> __swift_int32_t textLength , <nl> __swift_stdlib_UErrorCode * status ) ; <nl> <nl> + SWIFT_RUNTIME_STDLIB_INTERFACE <nl> + void __swift_stdlib_ubrk_setUText ( __swift_stdlib_UBreakIterator * bi , <nl> + __swift_stdlib_UText * text , <nl> + __swift_stdlib_UErrorCode * status ) ; <nl> + <nl> SWIFT_RUNTIME_STDLIB_INTERFACE <nl> void __swift_stdlib_ubrk_setText ( __swift_stdlib_UBreakIterator * bi , <nl> const __swift_stdlib_UChar * text , <nl> __swift_int32_t textLength , <nl> __swift_stdlib_UErrorCode * status ) ; <nl> <nl> + SWIFT_RUNTIME_STDLIB_INTERFACE <nl> + __swift_stdlib_UText * <nl> + __swift_stdlib_utext_openUTF8 ( __swift_stdlib_UText * _Nullable , const char * , <nl> + __swift_int64_t , __swift_stdlib_UErrorCode * ) ; <nl> + <nl> + SWIFT_RUNTIME_STDLIB_INTERFACE <nl> + __swift_stdlib_UText * <nl> + __swift_stdlib_utext_openUChars ( __swift_stdlib_UText * _Nullable , <nl> + const __swift_stdlib_UChar * , <nl> + __swift_int64_t , __swift_stdlib_UErrorCode * ) ; <nl> + <nl> SWIFT_RUNTIME_STDLIB_INTERFACE <nl> __swift_int32_t __swift_stdlib_ubrk_preceding ( __swift_stdlib_UBreakIterator * bi , <nl> __swift_int32_t offset ) ; <nl> mmm a / stdlib / public / core / BidirectionalCollection . swift <nl> ppp b / stdlib / public / core / BidirectionalCollection . swift <nl> extension BidirectionalCollection { <nl> <nl> @ inlinable / / protocol - only <nl> public func index ( _ i : Index , offsetBy n : Int ) - > Index { <nl> + return _index ( i , offsetBy : n ) <nl> + } <nl> + <nl> + @ inlinable / / protocol - only <nl> + internal func _index ( _ i : Index , offsetBy n : Int ) - > Index { <nl> if n > = 0 { <nl> return _advanceForward ( i , by : n ) <nl> } <nl> extension BidirectionalCollection { <nl> @ inlinable / / protocol - only <nl> public func index ( <nl> _ i : Index , offsetBy n : Int , limitedBy limit : Index <nl> + ) - > Index ? { <nl> + return _index ( i , offsetBy : n , limitedBy : limit ) <nl> + } <nl> + <nl> + @ inlinable / / protocol - only <nl> + internal func _index ( <nl> + _ i : Index , offsetBy n : Int , limitedBy limit : Index <nl> ) - > Index ? { <nl> if n > = 0 { <nl> return _advanceForward ( i , by : n , limitedBy : limit ) <nl> extension BidirectionalCollection { <nl> <nl> @ inlinable / / protocol - only <nl> public func distance ( from start : Index , to end : Index ) - > Int { <nl> + return _distance ( from : start , to : end ) <nl> + } <nl> + <nl> + @ inlinable / / protocol - only <nl> + internal func _distance ( from start : Index , to end : Index ) - > Int { <nl> var start = start <nl> var count = 0 <nl> <nl> mmm a / stdlib / public / stubs / UnicodeNormalization . cpp <nl> ppp b / stdlib / public / stubs / UnicodeNormalization . cpp <nl> extern " C " { <nl> <nl> / / Types <nl> typedef struct UBreakIterator UBreakIterator ; <nl> + typedef struct UText UText ; <nl> typedef struct UBreakIterator UNormalizer2 ; <nl> typedef enum UBreakIteratorType { } UBreakIteratorType ; <nl> typedef enum UErrorCode { } UErrorCode ; <nl> UBreakIterator * ubrk_open ( UBreakIteratorType , const char * , const UChar * , <nl> int32_t ubrk_preceding ( UBreakIterator * , int32_t ) ; <nl> int32_t ubrk_following ( UBreakIterator * , int32_t ) ; <nl> void ubrk_setText ( UBreakIterator * , const UChar * , int32_t , UErrorCode * ) ; <nl> + void ubrk_setUText ( UBreakIterator * , UText * , UErrorCode * ) ; <nl> + <nl> + UText * utext_openUTF8 ( UText * , const char * , int64_t , UErrorCode * ) ; <nl> + UText * utext_openUChars ( UText * , const UChar * , int64_t , UErrorCode * ) ; <nl> <nl> / / Comparison , normalization , and character property APIs <nl> int32_t unorm2_spanQuickCheckYes ( const UNormalizer2 * , const UChar * , int32_t , <nl> void swift : : __swift_stdlib_ubrk_setText ( <nl> textLength , ptr_cast < UErrorCode > ( status ) ) ; <nl> } <nl> <nl> + void swift : : __swift_stdlib_ubrk_setUText ( <nl> + swift : : __swift_stdlib_UBreakIterator * bi , __swift_stdlib_UText * text , <nl> + __swift_stdlib_UErrorCode * status ) { <nl> + return ubrk_setUText ( ptr_cast < UBreakIterator > ( bi ) , ptr_cast < UText > ( text ) , <nl> + ptr_cast < UErrorCode > ( status ) ) ; <nl> + } <nl> + <nl> + SWIFT_RUNTIME_STDLIB_INTERFACE swift : : __swift_stdlib_UText * <nl> + swift : : __swift_stdlib_utext_openUTF8 ( __swift_stdlib_UText * ut , <nl> + const char * s , int64_t len , <nl> + __swift_stdlib_UErrorCode * status ) { <nl> + return ptr_cast < __swift_stdlib_UText > ( <nl> + utext_openUTF8 ( ptr_cast < UText > ( ut ) , s , len , <nl> + ptr_cast < UErrorCode > ( status ) ) ) ; <nl> + } <nl> + <nl> + SWIFT_RUNTIME_STDLIB_INTERFACE swift : : __swift_stdlib_UText * <nl> + swift : : __swift_stdlib_utext_openUChars ( __swift_stdlib_UText * ut , <nl> + const __swift_stdlib_UChar * s , <nl> + int64_t len , <nl> + __swift_stdlib_UErrorCode * status ) { <nl> + return ptr_cast < __swift_stdlib_UText > ( <nl> + utext_openUChars ( ptr_cast < UText > ( ut ) , ptr_cast < UChar > ( s ) , len , <nl> + ptr_cast < UErrorCode > ( status ) ) ) ; <nl> + } <nl> + <nl> swift : : __swift_stdlib_UBool swift : : __swift_stdlib_unorm2_hasBoundaryBefore ( <nl> const __swift_stdlib_UNormalizer2 * ptr , __swift_stdlib_UChar32 char32 ) { <nl> return unorm2_hasBoundaryBefore ( ptr_cast < UNormalizer2 > ( ptr ) , char32 ) ; <nl>
Merge pull request from milseman / nfc
apple/swift
88fb1246431c6e8e5e23555b597d673205f81863
2018-07-10T22:10:22Z
mmm a / src / rdb_protocol / protocol . cc <nl> ppp b / src / rdb_protocol / protocol . cc <nl> class apply_sindex_change_visitor_t : public boost : : static_visitor < > { <nl> : sindexes_ ( sindexes ) , txn_ ( txn ) , interruptor_ ( interruptor ) { } <nl> void operator ( ) ( const rdb_modification_report_t & mod_report ) const { <nl> rdb_update_sindexes ( * sindexes_ , & mod_report , txn_ ) ; <nl> - coro_t : : yield ( ) ; <nl> } <nl> <nl> void operator ( ) ( const rdb_erase_range_report_t & erase_range_report ) const { <nl> rdb_erase_range_sindexes ( * sindexes_ , & erase_range_report , txn_ , interruptor_ ) ; <nl> - coro_t : : yield ( ) ; <nl> } <nl> <nl> private : <nl>
These yields were not necessary
rethinkdb/rethinkdb
6e3346be78af2e01c6c0a4c20c2f09911963a63e
2013-10-31T21:39:10Z
mmm a / trunk / src / app / srs_app_http_static . cpp <nl> ppp b / trunk / src / app / srs_app_http_static . cpp <nl> srs_error_t SrsVodStream : : serve_flv_stream ( ISrsHttpResponseWriter * w , ISrsHttpMe <nl> / / write http header for ts . <nl> w - > header ( ) - > set_content_length ( ( int ) ( sizeof ( flv_header ) + sh_size + left ) ) ; <nl> w - > header ( ) - > set_content_type ( " video / x - flv " ) ; <nl> + w - > write_header ( SRS_CONSTS_HTTP_OK ) ; <nl> <nl> / / write flv header and sequence header . <nl> if ( ( err = w - > write ( flv_header , sizeof ( flv_header ) ) ) ! = srs_success ) { <nl> srs_error_t SrsVodStream : : serve_mp4_stream ( ISrsHttpResponseWriter * w , ISrsHttpMe <nl> / / write http header for ts . <nl> w - > header ( ) - > set_content_length ( left ) ; <nl> w - > header ( ) - > set_content_type ( " video / mp4 " ) ; <nl> - <nl> - / / status code 206 to make dash . as happy . <nl> w - > write_header ( SRS_CONSTS_HTTP_PartialContent ) ; <nl> <nl> / / response the content range header . <nl> mmm a / trunk / src / app / srs_app_http_stream . cpp <nl> ppp b / trunk / src / app / srs_app_http_stream . cpp <nl> srs_error_t SrsLiveStream : : do_serve_http ( ISrsHttpResponseWriter * w , ISrsHttpMess <nl> return srs_error_new ( ERROR_HTTP_LIVE_STREAM_EXT , " invalid pattern = % s " , entry - > pattern . c_str ( ) ) ; <nl> } <nl> SrsAutoFree ( ISrsBufferEncoder , enc ) ; <nl> + <nl> + / / Enter chunked mode , because we didn ' t set the content - length . <nl> + w - > write_header ( SRS_CONSTS_HTTP_OK ) ; <nl> <nl> / / create consumer of souce , ignore gop cache , use the audio gop cache . <nl> SrsConsumer * consumer = NULL ; <nl> mmm a / trunk / src / protocol / srs_http_stack . cpp <nl> ppp b / trunk / src / protocol / srs_http_stack . cpp <nl> srs_error_t SrsHttpFileServer : : serve_file ( ISrsHttpResponseWriter * w , ISrsHttpMes <nl> w - > header ( ) - > set_content_type ( _mime [ ext ] ) ; <nl> } <nl> } <nl> + <nl> + / / Enter chunked mode , because we didn ' t set the content - length . <nl> + w - > write_header ( SRS_CONSTS_HTTP_OK ) ; <nl> <nl> / / write body . <nl> int64_t left = length ; <nl> mmm a / trunk / src / protocol / srs_http_stack . hpp <nl> ppp b / trunk / src / protocol / srs_http_stack . hpp <nl> class SrsHttpHeader <nl> <nl> / / A ResponseWriter interface is used by an HTTP handler to <nl> / / construct an HTTP response . <nl> - / / Usage 1 , response with specified length content : <nl> + / / Usage 0 , response with a message once : <nl> + / / ISrsHttpResponseWriter * w ; / / create or get response . <nl> + / / std : : string msg = " Hello , HTTP ! " ; <nl> + / / w - > write ( ( char * ) msg . data ( ) , ( int ) msg . length ( ) ) ; <nl> + / / Usage 1 , response with specified length content , same to # 0 : <nl> / / ISrsHttpResponseWriter * w ; / / create or get response . <nl> / / std : : string msg = " Hello , HTTP ! " ; <nl> / / w - > header ( ) - > set_content_type ( " text / plain ; charset = utf - 8 " ) ; <nl> mmm a / trunk / src / service / srs_service_http_conn . cpp <nl> ppp b / trunk / src / service / srs_service_http_conn . cpp <nl> srs_error_t SrsHttpResponseWriter : : write ( char * data , int size ) <nl> <nl> / / write the header data in memory . <nl> if ( ! header_wrote ) { <nl> + if ( hdr - > content_type ( ) . empty ( ) ) { <nl> + hdr - > set_content_type ( " text / plain ; charset = utf - 8 " ) ; <nl> + } <nl> + hdr - > set_content_length ( size ) ; <nl> write_header ( SRS_CONSTS_HTTP_OK ) ; <nl> } <nl> <nl> mmm a / trunk / src / utest / srs_utest_http . cpp <nl> ppp b / trunk / src / utest / srs_utest_http . cpp <nl> string mock_http_response ( int status , string content ) <nl> return ss . str ( ) ; <nl> } <nl> <nl> + class MockFileReaderFactory : public ISrsFileReaderFactory <nl> + { <nl> + public : <nl> + string bytes ; <nl> + MockFileReaderFactory ( string data ) { <nl> + bytes = data ; <nl> + } <nl> + virtual ~ MockFileReaderFactory ( ) { <nl> + } <nl> + virtual SrsFileReader * create_file_reader ( ) { <nl> + return new MockSrsFileReader ( ( const char * ) bytes . data ( ) , ( int ) bytes . length ( ) ) ; <nl> + } <nl> + } ; <nl> + <nl> + class MockHttpHandler : public ISrsHttpHandler <nl> + { <nl> + public : <nl> + string bytes ; <nl> + MockHttpHandler ( string data ) { <nl> + bytes = data ; <nl> + } <nl> + virtual ~ MockHttpHandler ( ) { <nl> + } <nl> + virtual srs_error_t serve_http ( ISrsHttpResponseWriter * w , ISrsHttpMessage * / * r * / ) { <nl> + return w - > write ( ( char * ) bytes . data ( ) , ( int ) bytes . length ( ) ) ; <nl> + } <nl> + } ; <nl> + <nl> + bool _mock_srs_path_always_exists ( std : : string / * path * / ) <nl> + { <nl> + return true ; <nl> + } <nl> + <nl> + bool _mock_srs_path_not_exists ( std : : string / * path * / ) <nl> + { <nl> + return false ; <nl> + } <nl> + <nl> + # define __MOCK_HTTP_EXPECT_STREQ ( status , text , w ) \ <nl> + EXPECT_STREQ ( mock_http_response ( status , text ) . c_str ( ) , HELPER_BUFFER2STR ( & w . io . out_buffer ) . c_str ( ) ) <nl> + <nl> VOID TEST ( ProtocolHTTPTest , StatusCode2Text ) <nl> { <nl> EXPECT_STREQ ( SRS_CONSTS_HTTP_OK_str , srs_generate_http_status_text ( SRS_CONSTS_HTTP_OK ) . c_str ( ) ) ; <nl> VOID TEST ( ProtocolHTTPTest , StatusCode2Text ) <nl> VOID TEST ( ProtocolHTTPTest , ResponseDetect ) <nl> { <nl> EXPECT_STREQ ( " application / octet - stream " , srs_go_http_detect ( NULL , 0 ) . c_str ( ) ) ; <nl> + EXPECT_STREQ ( " application / octet - stream " , srs_go_http_detect ( ( char * ) " Hello , world ! " , 0 ) . c_str ( ) ) ; <nl> } <nl> <nl> - # define __MOCK_HTTP_EXPECT_STREQ ( status , text , w ) \ <nl> - EXPECT_STREQ ( mock_http_response ( status , text ) . c_str ( ) , HELPER_BUFFER2STR ( & w . io . out_buffer ) . c_str ( ) ) <nl> + VOID TEST ( ProtocolHTTPTest , ResponseWriter ) <nl> + { <nl> + if ( true ) { <nl> + MockResponseWriter w ; <nl> + <nl> + char msg [ ] = " Hello , world ! " ; <nl> + w . write ( ( char * ) msg , sizeof ( msg ) - 1 ) ; <nl> + <nl> + __MOCK_HTTP_EXPECT_STREQ ( 200 , " Hello , world ! " , w ) ; <nl> + } <nl> + } <nl> <nl> VOID TEST ( ProtocolHTTPTest , ResponseHTTPError ) <nl> { <nl> VOID TEST ( ProtocolHTTPTest , ResponseHTTPError ) <nl> HELPER_EXPECT_SUCCESS ( srs_go_http_error ( & w , SRS_CONSTS_HTTP_Found ) ) ; <nl> __MOCK_HTTP_EXPECT_STREQ ( 302 , " Found " , w ) ; <nl> } <nl> + <nl> + if ( true ) { <nl> + MockResponseWriter w ; <nl> + HELPER_EXPECT_SUCCESS ( srs_go_http_error ( & w , SRS_CONSTS_HTTP_InternalServerError ) ) ; <nl> + __MOCK_HTTP_EXPECT_STREQ ( 500 , " Internal Server Error " , w ) ; <nl> + } <nl> + <nl> + if ( true ) { <nl> + MockResponseWriter w ; <nl> + HELPER_EXPECT_SUCCESS ( srs_go_http_error ( & w , SRS_CONSTS_HTTP_ServiceUnavailable ) ) ; <nl> + __MOCK_HTTP_EXPECT_STREQ ( 503 , " Service Unavailable " , w ) ; <nl> + } <nl> } <nl> <nl> VOID TEST ( ProtocolHTTPTest , HTTPHeader ) <nl> VOID TEST ( ProtocolHTTPTest , HTTPHeader ) <nl> srs_freep ( o ) ; <nl> } <nl> <nl> - class MockFileReaderFactory : public ISrsFileReaderFactory <nl> + VOID TEST ( ProtocolHTTPTest , HTTPServerMuxer ) <nl> { <nl> - public : <nl> - string bytes ; <nl> - MockFileReaderFactory ( string data ) { <nl> - bytes = data ; <nl> - } <nl> - virtual ~ MockFileReaderFactory ( ) { <nl> - } <nl> - virtual SrsFileReader * create_file_reader ( ) { <nl> - return new MockSrsFileReader ( ( const char * ) bytes . data ( ) , ( int ) bytes . length ( ) ) ; <nl> - } <nl> - } ; <nl> + srs_error_t err ; <nl> <nl> - bool _mock_srs_path_always_exists ( std : : string / * path * / ) <nl> - { <nl> - return true ; <nl> - } <nl> + if ( true ) { <nl> + SrsHttpServeMux s ; <nl> + HELPER_ASSERT_SUCCESS ( s . initialize ( ) ) ; <nl> <nl> - bool _mock_srs_path_not_exists ( std : : string / * path * / ) <nl> - { <nl> - return false ; <nl> + MockHttpHandler * hroot = new MockHttpHandler ( " Hello , world ! " ) ; <nl> + HELPER_ASSERT_SUCCESS ( s . handle ( " / " , hroot ) ) ; <nl> + <nl> + MockResponseWriter w ; <nl> + SrsHttpMessage r ( NULL , NULL ) ; <nl> + HELPER_ASSERT_SUCCESS ( r . set_url ( " / index . html " , false ) ) ; <nl> + <nl> + HELPER_ASSERT_SUCCESS ( s . serve_http ( & w , & r ) ) ; <nl> + __MOCK_HTTP_EXPECT_STREQ ( 200 , " Hello , world ! " , w ) ; <nl> + } <nl> } <nl> <nl> VOID TEST ( ProtocolHTTPTest , VodStreamHandlers ) <nl>
Refactor HttpResponseWriter . write , default to single text mode .
ossrs/srs
d9842b037139d9158a932e22ca49e1139521bf9b
2019-12-17T07:14:59Z
mmm a / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / JavaScriptCore . pro <nl> ppp b / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / JavaScriptCore . pro <nl> SOURCES + = \ <nl> runtime / JSArray . cpp \ <nl> runtime / JSByteArray . cpp \ <nl> runtime / JSCell . cpp \ <nl> + runtime / JSDateMath . cpp \ <nl> runtime / JSFunction . cpp \ <nl> runtime / JSGlobalData . cpp \ <nl> runtime / JSGlobalObject . cpp \ <nl> mmm a / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / runtime / DateConstructor . cpp <nl> ppp b / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / runtime / DateConstructor . cpp <nl> <nl> # include " DateConversion . h " <nl> # include " DateInstance . h " <nl> # include " DatePrototype . h " <nl> + # include " JSDateMath . h " <nl> # include " JSFunction . h " <nl> # include " JSGlobalObject . h " <nl> # include " JSString . h " <nl> <nl> # include " ObjectPrototype . h " <nl> # include < math . h > <nl> # include < time . h > <nl> - # include < wtf / DateMath . h > <nl> # include < wtf / MathExtras . h > <nl> <nl> # if OS ( WINCE ) & & ! PLATFORM ( QT ) <nl> mmm a / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / runtime / DateConversion . cpp <nl> ppp b / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / runtime / DateConversion . cpp <nl> using namespace WTF ; <nl> <nl> namespace JSC { <nl> <nl> - double parseDate ( ExecState * exec , const UString & date ) <nl> - { <nl> - if ( date = = exec - > globalData ( ) . cachedDateString ) <nl> - return exec - > globalData ( ) . cachedDateStringValue ; <nl> - double value = parseES5DateFromNullTerminatedCharacters ( date . utf8 ( ) . data ( ) ) ; <nl> - if ( isnan ( value ) ) <nl> - value = parseDateFromNullTerminatedCharacters ( exec , date . utf8 ( ) . data ( ) ) ; <nl> - exec - > globalData ( ) . cachedDateString = date ; <nl> - exec - > globalData ( ) . cachedDateStringValue = value ; <nl> - return value ; <nl> - } <nl> - <nl> void formatDate ( const GregorianDateTime & t , DateConversionBuffer & buffer ) <nl> { <nl> snprintf ( buffer , DateConversionBufferSize , " % s % s % 02d % 04d " , <nl> mmm a / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / runtime / DateConversion . h <nl> ppp b / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / runtime / DateConversion . h <nl> struct GregorianDateTime ; <nl> static const unsigned DateConversionBufferSize = 100 ; <nl> typedef char DateConversionBuffer [ DateConversionBufferSize ] ; <nl> <nl> - double parseDate ( ExecState * exec , const UString & ) ; <nl> void formatDate ( const GregorianDateTime & , DateConversionBuffer & ) ; <nl> void formatDateUTCVariant ( const GregorianDateTime & , DateConversionBuffer & ) ; <nl> void formatTime ( const GregorianDateTime & , DateConversionBuffer & ) ; <nl> new file mode 100644 <nl> index 000000000 . . 410a89d8b <nl> mmm / dev / null <nl> ppp b / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / runtime / JSDateMath . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 1999 - 2000 Harri Porten ( porten @ kde . org ) <nl> + * Copyright ( C ) 2006 , 2007 Apple Inc . All rights reserved . <nl> + * Copyright ( C ) 2009 Google Inc . All rights reserved . <nl> + * Copyright ( C ) 2007 - 2009 Torch Mobile , Inc . <nl> + * Copyright ( C ) 2010 & yet , LLC . ( nate @ andyet . net ) <nl> + * <nl> + * The Original Code is Mozilla Communicator client code , released <nl> + * March 31 , 1998 . <nl> + * <nl> + * The Initial Developer of the Original Code is <nl> + * Netscape Communications Corporation . <nl> + * Portions created by the Initial Developer are Copyright ( C ) 1998 <nl> + * the Initial Developer . All Rights Reserved . <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> + * Alternatively , the contents of this file may be used under the terms <nl> + * of either the Mozilla Public License Version 1 . 1 , found at <nl> + * http : / / www . mozilla . org / MPL / ( the " MPL " ) or the GNU General Public <nl> + * License Version 2 . 0 , found at http : / / www . fsf . org / copyleft / gpl . html <nl> + * ( the " GPL " ) , in which case the provisions of the MPL or the GPL are <nl> + * applicable instead of those above . If you wish to allow use of your <nl> + * version of this file only under the terms of one of those two <nl> + * licenses ( the MPL or the GPL ) and not to allow others to use your <nl> + * version of this file under the LGPL , indicate your decision by <nl> + * deletingthe provisions above and replace them with the notice and <nl> + * other provisions required by the MPL or the GPL , as the case may be . <nl> + * If you do not delete the provisions above , a recipient may use your <nl> + * version of this file under any of the LGPL , the MPL or the GPL . <nl> + <nl> + * Copyright 2006 - 2008 the V8 project authors . All rights reserved . <nl> + * Redistribution and use in source and binary forms , with or without <nl> + * modification , are permitted provided that the following conditions are <nl> + * met : <nl> + * <nl> + * * Redistributions of source code must retain the above copyright <nl> + * notice , this list of conditions and the following disclaimer . <nl> + * * Redistributions in binary form must reproduce the above <nl> + * copyright notice , this list of conditions and the following <nl> + * disclaimer in the documentation and / or other materials provided <nl> + * with the distribution . <nl> + * * Neither the name of Google Inc . nor the names of its <nl> + * contributors may be used to endorse or promote products derived <nl> + * from this software without specific prior written permission . <nl> + * <nl> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + * " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + * LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + * A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + * LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + * DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + * / <nl> + <nl> + # include " config . h " <nl> + # include " JSDateMath . h " <nl> + <nl> + # include " JSObject . h " <nl> + <nl> + # include < algorithm > <nl> + # include < limits . h > <nl> + # include < limits > <nl> + # include < stdint . h > <nl> + # include < time . h > <nl> + # include < wtf / ASCIICType . h > <nl> + # include < wtf / Assertions . h > <nl> + # include < wtf / CurrentTime . h > <nl> + # include < wtf / MathExtras . h > <nl> + # include < wtf / StdLibExtras . h > <nl> + # include < wtf / StringExtras . h > <nl> + # include < wtf / text / StringBuilder . h > <nl> + <nl> + # if HAVE ( ERRNO_H ) <nl> + # include < errno . h > <nl> + # endif <nl> + <nl> + # if HAVE ( SYS_TIME_H ) <nl> + # include < sys / time . h > <nl> + # endif <nl> + <nl> + # if HAVE ( SYS_TIMEB_H ) <nl> + # include < sys / timeb . h > <nl> + # endif <nl> + <nl> + using namespace WTF ; <nl> + <nl> + namespace JSC { <nl> + <nl> + static inline double timeToMS ( double hour , double min , double sec , double ms ) <nl> + { <nl> + return ( ( ( hour * minutesPerHour + min ) * secondsPerMinute + sec ) * msPerSecond + ms ) ; <nl> + } <nl> + <nl> + static inline int msToSeconds ( double ms ) <nl> + { <nl> + double result = fmod ( floor ( ms / msPerSecond ) , secondsPerMinute ) ; <nl> + if ( result < 0 ) <nl> + result + = secondsPerMinute ; <nl> + return static_cast < int > ( result ) ; <nl> + } <nl> + <nl> + static inline int msToDays ( double ms ) <nl> + { <nl> + return floor ( ms / msPerDay ) ; <nl> + } <nl> + <nl> + / / 0 : Sunday , 1 : Monday , etc . <nl> + static inline int msToWeekDay ( double ms ) <nl> + { <nl> + int wd = ( static_cast < int > ( msToDays ( ms ) ) + 4 ) % 7 ; <nl> + if ( wd < 0 ) <nl> + wd + = 7 ; <nl> + return wd ; <nl> + } <nl> + <nl> + / / Get the DST offset for the time passed in . <nl> + / / <nl> + / / NOTE : The implementation relies on the fact that no time zones have <nl> + / / more than one daylight savings offset change per month . <nl> + / / If this function is called with NaN it returns NaN . <nl> + static double getDSTOffset ( ExecState * exec , double ms , double utcOffset ) <nl> + { <nl> + DSTOffsetCache & cache = exec - > globalData ( ) . dstOffsetCache ; <nl> + double start = cache . start ; <nl> + double end = cache . end ; <nl> + <nl> + if ( start < = ms ) { <nl> + / / If the time fits in the cached interval , return the cached offset . <nl> + if ( ms < = end ) return cache . offset ; <nl> + <nl> + / / Compute a possible new interval end . <nl> + double newEnd = end + cache . increment ; <nl> + <nl> + if ( ms < = newEnd ) { <nl> + double endOffset = calculateDSTOffset ( newEnd , utcOffset ) ; <nl> + if ( cache . offset = = endOffset ) { <nl> + / / If the offset at the end of the new interval still matches <nl> + / / the offset in the cache , we grow the cached time interval <nl> + / / and return the offset . <nl> + cache . end = newEnd ; <nl> + cache . increment = msPerMonth ; <nl> + return endOffset ; <nl> + } else { <nl> + double offset = calculateDSTOffset ( ms , utcOffset ) ; <nl> + if ( offset = = endOffset ) { <nl> + / / The offset at the given time is equal to the offset at the <nl> + / / new end of the interval , so that means that we ' ve just skipped <nl> + / / the point in time where the DST offset change occurred . Updated <nl> + / / the interval to reflect this and reset the increment . <nl> + cache . start = ms ; <nl> + cache . end = newEnd ; <nl> + cache . increment = msPerMonth ; <nl> + } else { <nl> + / / The interval contains a DST offset change and the given time is <nl> + / / before it . Adjust the increment to avoid a linear search for <nl> + / / the offset change point and change the end of the interval . <nl> + cache . increment / = 3 ; <nl> + cache . end = ms ; <nl> + } <nl> + / / Update the offset in the cache and return it . <nl> + cache . offset = offset ; <nl> + return offset ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / Compute the DST offset for the time and shrink the cache interval <nl> + / / to only contain the time . This allows fast repeated DST offset <nl> + / / computations for the same time . <nl> + double offset = calculateDSTOffset ( ms , utcOffset ) ; <nl> + cache . offset = offset ; <nl> + cache . start = ms ; <nl> + cache . end = ms ; <nl> + cache . increment = msPerMonth ; <nl> + return offset ; <nl> + } <nl> + <nl> + double parseDateFromNullTerminatedCharacters ( ExecState * exec , const char * dateString ) <nl> + { <nl> + ASSERT ( exec ) ; <nl> + bool haveTZ ; <nl> + int offset ; <nl> + double ms = WTF : : parseDateFromNullTerminatedCharacters ( dateString , haveTZ , offset ) ; <nl> + if ( isnan ( ms ) ) <nl> + return std : : numeric_limits < double > : : quiet_NaN ( ) ; <nl> + <nl> + / / fall back to local timezone <nl> + if ( ! haveTZ ) { <nl> + double utcOffset = getUTCOffset ( exec ) ; <nl> + double dstOffset = getDSTOffset ( exec , ms , utcOffset ) ; <nl> + offset = static_cast < int > ( ( utcOffset + dstOffset ) / WTF : : msPerMinute ) ; <nl> + } <nl> + <nl> + return ms - ( offset * WTF : : msPerMinute ) ; <nl> + } <nl> + <nl> + double parseDate ( ExecState * exec , const UString & date ) <nl> + { <nl> + if ( date = = exec - > globalData ( ) . cachedDateString ) <nl> + return exec - > globalData ( ) . cachedDateStringValue ; <nl> + double value = parseES5DateFromNullTerminatedCharacters ( date . utf8 ( ) . data ( ) ) ; <nl> + if ( isnan ( value ) ) <nl> + value = parseDateFromNullTerminatedCharacters ( exec , date . utf8 ( ) . data ( ) ) ; <nl> + exec - > globalData ( ) . cachedDateString = date ; <nl> + exec - > globalData ( ) . cachedDateStringValue = value ; <nl> + return value ; <nl> + } <nl> + <nl> + } / / namespace JSC <nl> new file mode 100644 <nl> index 000000000 . . 5823bb1a6 <nl> mmm / dev / null <nl> ppp b / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / runtime / JSDateMath . h <nl> <nl> + / * <nl> + * Copyright ( C ) 1999 - 2000 Harri Porten ( porten @ kde . org ) <nl> + * Copyright ( C ) 2006 , 2007 Apple Inc . All rights reserved . <nl> + * Copyright ( C ) 2009 Google Inc . All rights reserved . <nl> + * Copyright ( C ) 2010 Research In Motion Limited . All rights reserved . <nl> + * <nl> + * Version : MPL 1 . 1 / GPL 2 . 0 / LGPL 2 . 1 <nl> + * <nl> + * The contents of this file are subject to the Mozilla Public License Version <nl> + * 1 . 1 ( the " License " ) ; you may not use this file except in compliance with <nl> + * the License . You may obtain a copy of the License at <nl> + * http : / / www . mozilla . org / MPL / <nl> + * <nl> + * Software distributed under the License is distributed on an " AS IS " basis , <nl> + * WITHOUT WARRANTY OF ANY KIND , either express or implied . See the License <nl> + * for the specific language governing rights and limitations under the <nl> + * License . <nl> + * <nl> + * The Original Code is Mozilla Communicator client code , released <nl> + * March 31 , 1998 . <nl> + * <nl> + * The Initial Developer of the Original Code is <nl> + * Netscape Communications Corporation . <nl> + * Portions created by the Initial Developer are Copyright ( C ) 1998 <nl> + * the Initial Developer . All Rights Reserved . <nl> + * <nl> + * Contributor ( s ) : <nl> + * <nl> + * Alternatively , the contents of this file may be used under the terms of <nl> + * either of the GNU General Public License Version 2 or later ( the " GPL " ) , <nl> + * or the GNU Lesser General Public License Version 2 . 1 or later ( the " LGPL " ) , <nl> + * in which case the provisions of the GPL or the LGPL are applicable instead <nl> + * of those above . If you wish to allow use of your version of this file only <nl> + * under the terms of either the GPL or the LGPL , and not to allow others to <nl> + * use your version of this file under the terms of the MPL , indicate your <nl> + * decision by deleting the provisions above and replace them with the notice <nl> + * and other provisions required by the GPL or the LGPL . If you do not delete <nl> + * the provisions above , a recipient may use your version of this file under <nl> + * the terms of any one of the MPL , the GPL or the LGPL . <nl> + * <nl> + * / <nl> + <nl> + # ifndef JSDateMath_h <nl> + # define JSDateMath_h <nl> + <nl> + # include " UString . h " <nl> + # include < wtf / DateMath . h > <nl> + <nl> + namespace JSC { <nl> + <nl> + class ExecState ; <nl> + <nl> + double parseDateFromNullTerminatedCharacters ( ExecState * , const char * dateString ) ; <nl> + double parseDate ( ExecState * , const UString & ) ; <nl> + <nl> + } / / namespace JSC <nl> + <nl> + # endif / / JSDateMath_h <nl> \ No newline at end of file <nl> mmm a / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / wtf / DateMath . cpp <nl> ppp b / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / wtf / DateMath . cpp <nl> static inline double msToDays ( double ms ) <nl> return floor ( ms / msPerDay ) ; <nl> } <nl> <nl> + static String twoDigitStringFromNumber ( int number ) <nl> + { <nl> + ASSERT ( number > = 0 & & number < 100 ) ; <nl> + if ( number > 9 ) <nl> + return String : : number ( number ) ; <nl> + return makeString ( " 0 " , String : : number ( number ) ) ; <nl> + } <nl> + <nl> int msToYear ( double ms ) <nl> { <nl> int approxYear = static_cast < int > ( floor ( ms / ( msPerDay * 365 . 2425 ) ) + 1970 ) ; <nl> static bool parseLong ( const char * string , char * * stopPosition , int base , long * r <nl> return true ; <nl> } <nl> <nl> - double parseES5DateFromNullTerminatedCharacters ( const char * dateString ) <nl> + / / Parses a date with the format YYYY [ - MM [ - DD ] ] . <nl> + / / Year parsing is lenient , allows any number of digits , and + / - . <nl> + / / Returns 0 if a parse error occurs , else returns the end of the parsed portion of the string . <nl> + static char * parseES5DatePortion ( const char * currentPosition , long & year , long & month , long & day ) <nl> { <nl> - / / This parses a date of the form defined in ECMA - 262 - 5 , section 15 . 9 . 1 . 15 <nl> - / / ( similar to RFC 3339 / ISO 8601 : YYYY - MM - DDTHH : mm : ss [ . sss ] Z ) . <nl> - / / In most cases it is intentionally strict ( e . g . correct field widths , no stray whitespace ) . <nl> - <nl> - static const long daysPerMonth [ 12 ] = { 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; <nl> - <nl> - const char * currentPosition = dateString ; <nl> char * postParsePosition ; <nl> - <nl> + <nl> / / This is a bit more lenient on the year string than ES5 specifies : <nl> / / instead of restricting to 4 digits ( or 6 digits with mandatory + / - ) , <nl> / / it accepts any integer value . Consider this an implementation fallback . <nl> - long year ; <nl> if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & year ) ) <nl> - return NaN ; <nl> + return 0 ; <nl> + <nl> + / / Check for presence of - MM portion . <nl> if ( * postParsePosition ! = ' - ' ) <nl> - return NaN ; <nl> + return postParsePosition ; <nl> currentPosition = postParsePosition + 1 ; <nl> - <nl> - long month ; <nl> + <nl> if ( ! isASCIIDigit ( * currentPosition ) ) <nl> - return NaN ; <nl> + return 0 ; <nl> if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & month ) ) <nl> - return NaN ; <nl> - if ( * postParsePosition ! = ' - ' | | ( postParsePosition - currentPosition ) ! = 2 ) <nl> - return NaN ; <nl> + return 0 ; <nl> + if ( ( postParsePosition - currentPosition ) ! = 2 ) <nl> + return 0 ; <nl> + <nl> + / / Check for presence of - DD portion . <nl> + if ( * postParsePosition ! = ' - ' ) <nl> + return postParsePosition ; <nl> currentPosition = postParsePosition + 1 ; <nl> - <nl> - long day ; <nl> + <nl> if ( ! isASCIIDigit ( * currentPosition ) ) <nl> - return NaN ; <nl> + return 0 ; <nl> if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & day ) ) <nl> - return NaN ; <nl> - if ( * postParsePosition ! = ' T ' | | ( postParsePosition - currentPosition ) ! = 2 ) <nl> - return NaN ; <nl> - currentPosition = postParsePosition + 1 ; <nl> - <nl> - long hours ; <nl> + return 0 ; <nl> + if ( ( postParsePosition - currentPosition ) ! = 2 ) <nl> + return 0 ; <nl> + return postParsePosition ; <nl> + } <nl> + <nl> + / / Parses a time with the format HH : mm [ : ss [ . sss ] ] [ Z | ( + | - ) 00 : 00 ] . <nl> + / / Fractional seconds parsing is lenient , allows any number of digits . <nl> + / / Returns 0 if a parse error occurs , else returns the end of the parsed portion of the string . <nl> + static char * parseES5TimePortion ( char * currentPosition , long & hours , long & minutes , double & seconds , long & timeZoneSeconds ) <nl> + { <nl> + char * postParsePosition ; <nl> if ( ! isASCIIDigit ( * currentPosition ) ) <nl> - return NaN ; <nl> + return 0 ; <nl> if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & hours ) ) <nl> - return NaN ; <nl> + return 0 ; <nl> if ( * postParsePosition ! = ' : ' | | ( postParsePosition - currentPosition ) ! = 2 ) <nl> - return NaN ; <nl> + return 0 ; <nl> currentPosition = postParsePosition + 1 ; <nl> - <nl> - long minutes ; <nl> + <nl> if ( ! isASCIIDigit ( * currentPosition ) ) <nl> - return NaN ; <nl> + return 0 ; <nl> if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & minutes ) ) <nl> - return NaN ; <nl> + return 0 ; <nl> + if ( ( postParsePosition - currentPosition ) ! = 2 ) <nl> + return 0 ; <nl> + currentPosition = postParsePosition ; <nl> + <nl> + / / Seconds are optional . <nl> + if ( * currentPosition = = ' : ' ) { <nl> + + + currentPosition ; <nl> + <nl> + long intSeconds ; <nl> + if ( ! isASCIIDigit ( * currentPosition ) ) <nl> + return 0 ; <nl> + if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & intSeconds ) ) <nl> + return 0 ; <nl> + if ( ( postParsePosition - currentPosition ) ! = 2 ) <nl> + return 0 ; <nl> + seconds = intSeconds ; <nl> + if ( * postParsePosition = = ' . ' ) { <nl> + currentPosition = postParsePosition + 1 ; <nl> + <nl> + / / In ECMA - 262 - 5 it ' s a bit unclear if ' . ' can be present without milliseconds , but <nl> + / / a reasonable interpretation guided by the given examples and RFC 3339 says " no " . <nl> + / / We check the next character to avoid reading + / - timezone hours after an invalid decimal . <nl> + if ( ! isASCIIDigit ( * currentPosition ) ) <nl> + return 0 ; <nl> + <nl> + / / We are more lenient than ES5 by accepting more or less than 3 fraction digits . <nl> + long fracSeconds ; <nl> + if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & fracSeconds ) ) <nl> + return 0 ; <nl> + <nl> + long numFracDigits = postParsePosition - currentPosition ; <nl> + seconds + = fracSeconds * pow ( 10 . 0 , static_cast < double > ( - numFracDigits ) ) ; <nl> + } <nl> + currentPosition = postParsePosition ; <nl> + } <nl> + <nl> + if ( * currentPosition = = ' Z ' ) <nl> + return currentPosition + 1 ; <nl> + <nl> + bool tzNegative ; <nl> + if ( * currentPosition = = ' - ' ) <nl> + tzNegative = true ; <nl> + else if ( * currentPosition = = ' + ' ) <nl> + tzNegative = false ; <nl> + else <nl> + return currentPosition ; / / no timezone <nl> + + + currentPosition ; <nl> + <nl> + long tzHours ; <nl> + long tzHoursAbs ; <nl> + long tzMinutes ; <nl> + <nl> + if ( ! isASCIIDigit ( * currentPosition ) ) <nl> + return 0 ; <nl> + if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & tzHours ) ) <nl> + return 0 ; <nl> if ( * postParsePosition ! = ' : ' | | ( postParsePosition - currentPosition ) ! = 2 ) <nl> - return NaN ; <nl> + return 0 ; <nl> + tzHoursAbs = labs ( tzHours ) ; <nl> currentPosition = postParsePosition + 1 ; <nl> - <nl> - long intSeconds ; <nl> + <nl> if ( ! isASCIIDigit ( * currentPosition ) ) <nl> - return NaN ; <nl> - if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & intSeconds ) ) <nl> - return NaN ; <nl> + return 0 ; <nl> + if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & tzMinutes ) ) <nl> + return 0 ; <nl> if ( ( postParsePosition - currentPosition ) ! = 2 ) <nl> + return 0 ; <nl> + currentPosition = postParsePosition ; <nl> + <nl> + if ( tzHoursAbs > 24 ) <nl> + return 0 ; <nl> + if ( tzMinutes < 0 | | tzMinutes > 59 ) <nl> + return 0 ; <nl> + <nl> + timeZoneSeconds = 60 * ( tzMinutes + ( 60 * tzHoursAbs ) ) ; <nl> + if ( tzNegative ) <nl> + timeZoneSeconds = - timeZoneSeconds ; <nl> + <nl> + return currentPosition ; <nl> + } <nl> + <nl> + double parseES5DateFromNullTerminatedCharacters ( const char * dateString ) <nl> + { <nl> + / / This parses a date of the form defined in ECMA - 262 - 5 , section 15 . 9 . 1 . 15 <nl> + / / ( similar to RFC 3339 / ISO 8601 : YYYY - MM - DDTHH : mm : ss [ . sss ] Z ) . <nl> + / / In most cases it is intentionally strict ( e . g . correct field widths , no stray whitespace ) . <nl> + <nl> + static const long daysPerMonth [ 12 ] = { 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; <nl> + <nl> + / / The year must be present , but the other fields may be omitted - see ES5 . 1 15 . 9 . 1 . 15 . <nl> + long year = 0 ; <nl> + long month = 1 ; <nl> + long day = 1 ; <nl> + long hours = 0 ; <nl> + long minutes = 0 ; <nl> + double seconds = 0 ; <nl> + long timeZoneSeconds = 0 ; <nl> + <nl> + / / Parse the date YYYY [ - MM [ - DD ] ] <nl> + char * currentPosition = parseES5DatePortion ( dateString , year , month , day ) ; <nl> + if ( ! currentPosition ) <nl> return NaN ; <nl> - <nl> - double seconds = intSeconds ; <nl> - if ( * postParsePosition = = ' . ' ) { <nl> - currentPosition = postParsePosition + 1 ; <nl> - <nl> - / / In ECMA - 262 - 5 it ' s a bit unclear if ' . ' can be present without milliseconds , but <nl> - / / a reasonable interpretation guided by the given examples and RFC 3339 says " no " . <nl> - / / We check the next character to avoid reading + / - timezone hours after an invalid decimal . <nl> - if ( ! isASCIIDigit ( * currentPosition ) ) <nl> - return NaN ; <nl> - <nl> - / / We are more lenient than ES5 by accepting more or less than 3 fraction digits . <nl> - long fracSeconds ; <nl> - if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & fracSeconds ) ) <nl> + / / Look for a time portion . <nl> + if ( * currentPosition = = ' T ' ) { <nl> + / / Parse the time HH : mm [ : ss [ . sss ] ] [ Z | ( + | - ) 00 : 00 ] <nl> + currentPosition = parseES5TimePortion ( currentPosition + 1 , hours , minutes , seconds , timeZoneSeconds ) ; <nl> + if ( ! currentPosition ) <nl> return NaN ; <nl> - <nl> - long numFracDigits = postParsePosition - currentPosition ; <nl> - seconds + = fracSeconds * pow ( 10 . 0 , static_cast < double > ( - numFracDigits ) ) ; <nl> } <nl> - currentPosition = postParsePosition ; <nl> - <nl> + / / Check that we have parsed all characters in the string . <nl> + if ( * currentPosition ) <nl> + return NaN ; <nl> + <nl> / / A few of these checks could be done inline above , but since many of them are interrelated <nl> / / we would be sacrificing readability to " optimize " the ( presumably less common ) failure path . <nl> if ( month < 1 | | month > 12 ) <nl> double parseES5DateFromNullTerminatedCharacters ( const char * dateString ) <nl> / / Discard leap seconds by clamping to the end of a minute . <nl> seconds = 60 ; <nl> } <nl> - <nl> - long timeZoneSeconds = 0 ; <nl> - if ( * currentPosition ! = ' Z ' ) { <nl> - bool tzNegative ; <nl> - if ( * currentPosition = = ' - ' ) <nl> - tzNegative = true ; <nl> - else if ( * currentPosition = = ' + ' ) <nl> - tzNegative = false ; <nl> - else <nl> - return NaN ; <nl> - currentPosition + = 1 ; <nl> - <nl> - long tzHours ; <nl> - long tzHoursAbs ; <nl> - long tzMinutes ; <nl> - <nl> - if ( ! isASCIIDigit ( * currentPosition ) ) <nl> - return NaN ; <nl> - if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & tzHours ) ) <nl> - return NaN ; <nl> - if ( * postParsePosition ! = ' : ' | | ( postParsePosition - currentPosition ) ! = 2 ) <nl> - return NaN ; <nl> - tzHoursAbs = labs ( tzHours ) ; <nl> - currentPosition = postParsePosition + 1 ; <nl> - <nl> - if ( ! isASCIIDigit ( * currentPosition ) ) <nl> - return NaN ; <nl> - if ( ! parseLong ( currentPosition , & postParsePosition , 10 , & tzMinutes ) ) <nl> - return NaN ; <nl> - if ( ( postParsePosition - currentPosition ) ! = 2 ) <nl> - return NaN ; <nl> - currentPosition = postParsePosition ; <nl> - <nl> - if ( tzHoursAbs > 24 ) <nl> - return NaN ; <nl> - if ( tzMinutes < 0 | | tzMinutes > 59 ) <nl> - return NaN ; <nl> - <nl> - timeZoneSeconds = 60 * ( tzMinutes + ( 60 * tzHoursAbs ) ) ; <nl> - if ( tzNegative ) <nl> - timeZoneSeconds = - timeZoneSeconds ; <nl> - } else { <nl> - currentPosition + = 1 ; <nl> - } <nl> - if ( * currentPosition ) <nl> - return NaN ; <nl> - <nl> + <nl> double dateSeconds = ymdhmsToSeconds ( year , month , day , hours , minutes , seconds ) - timeZoneSeconds ; <nl> return dateSeconds * msPerSecond ; <nl> } <nl> <nl> / / Odd case where ' exec ' is allowed to be 0 , to accomodate a caller in WebCore . <nl> - static double parseDateFromNullTerminatedCharacters ( const char * dateString , bool & haveTZ , int & offset ) <nl> + double parseDateFromNullTerminatedCharacters ( const char * dateString , bool & haveTZ , int & offset ) <nl> { <nl> haveTZ = false ; <nl> offset = 0 ; <nl> static double parseDateFromNullTerminatedCharacters ( const char * dateString , bool <nl> if ( ! parseLong ( dateString , & newPosStr , 10 , & year ) ) <nl> return NaN ; <nl> dateString = newPosStr ; <nl> + skipSpacesAndComments ( dateString ) ; <nl> } <nl> <nl> - skipSpacesAndComments ( dateString ) ; <nl> - <nl> / / Trailing garbage <nl> if ( * dateString ) <nl> return NaN ; <nl> void msToGregorianDateTime ( ExecState * exec , double ms , bool outputIsUTC , Gregori <nl> } <nl> <nl> const int year = msToYear ( ms ) ; <nl> - tm . second = msToSeconds ( ms ) ; <nl> - tm . minute = msToMinutes ( ms ) ; <nl> - tm . hour = msToHours ( ms ) ; <nl> - tm . weekDay = msToWeekDay ( ms ) ; <nl> - tm . yearDay = dayInYear ( ms , year ) ; <nl> - tm . monthDay = dayInMonthFromDayInYear ( tm . yearDay , isLeapYear ( year ) ) ; <nl> - tm . month = monthFromDayInYear ( tm . yearDay , isLeapYear ( year ) ) ; <nl> - tm . year = year - 1900 ; <nl> - tm . isDST = dstOff ! = 0 . 0 ; <nl> + tm . second = msToSeconds ( ms ) ; <nl> + tm . minute = msToMinutes ( ms ) ; <nl> + tm . hour = msToHours ( ms ) ; <nl> + tm . weekDay = msToWeekDay ( ms ) ; <nl> + tm . yearDay = dayInYear ( ms , year ) ; <nl> + tm . monthDay = dayInMonthFromDayInYear ( tm . yearDay , isLeapYear ( year ) ) ; <nl> + tm . month = monthFromDayInYear ( tm . yearDay , isLeapYear ( year ) ) ; <nl> + tm . year = year - 1900 ; <nl> + tm . isDST = dstOff ! = 0 . 0 ; <nl> tm . utcOffset = static_cast < long > ( ( dstOff + utcOff ) / WTF : : msPerSecond ) ; <nl> - tm . timeZone = nullptr ; <nl> } <nl> <nl> - double parseDateFromNullTerminatedCharacters ( ExecState * exec , const char * dateString ) <nl> - { <nl> - ASSERT ( exec ) ; <nl> - bool haveTZ ; <nl> - int offset ; <nl> - double ms = WTF : : parseDateFromNullTerminatedCharacters ( dateString , haveTZ , offset ) ; <nl> - if ( isnan ( ms ) ) <nl> - return NaN ; <nl> - <nl> - / / fall back to local timezone <nl> - if ( ! haveTZ ) { <nl> - double utcOffset = getUTCOffset ( exec ) ; <nl> - double dstOffset = getDSTOffset ( exec , ms , utcOffset ) ; <nl> - offset = static_cast < int > ( ( utcOffset + dstOffset ) / WTF : : msPerMinute ) ; <nl> - } <nl> - return ms - ( offset * WTF : : msPerMinute ) ; <nl> - } <nl> <nl> } / / namespace JSC <nl> # endif / / USE ( JSC ) <nl> mmm a / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / wtf / DateMath . h <nl> ppp b / src / qt / src / 3rdparty / webkit / Source / JavaScriptCore / wtf / DateMath . h <nl> <nl> # include < wtf / OwnArrayPtr . h > <nl> # include < wtf / PassOwnArrayPtr . h > <nl> # include < wtf / UnusedParam . h > <nl> + # include < wtf / text / WTFString . h > <nl> + # include < wtf / text / StringConcatenate . h > <nl> <nl> namespace WTF { <nl> void initializeDates ( ) ; <nl> int equivalentYearForDST ( int year ) ; <nl> <nl> / / Not really math related , but this is currently the only shared place to put these . <nl> double parseES5DateFromNullTerminatedCharacters ( const char * dateString ) ; <nl> - double parseDateFromNullTerminatedCharacters ( const char * dateString ) ; <nl> + WTF_EXPORT_PRIVATE double parseDateFromNullTerminatedCharacters ( const char * dateString ) ; <nl> + double parseDateFromNullTerminatedCharacters ( const char * dateString , bool & haveTZ , int & offset ) ; <nl> double timeClip ( double ) ; <nl> <nl> inline double jsCurrentTime ( ) <nl> struct GregorianDateTime ; <nl> void msToGregorianDateTime ( ExecState * , double , bool outputIsUTC , GregorianDateTime & ) ; <nl> double gregorianDateTimeToMS ( ExecState * , const GregorianDateTime & , double , bool inputIsUTC ) ; <nl> double getUTCOffset ( ExecState * ) ; <nl> - double parseDateFromNullTerminatedCharacters ( ExecState * , const char * dateString ) ; <nl> <nl> / / Intentionally overridding the default tm of the system . <nl> / / The members of tm differ on various operating systems . <nl> mmm a / test / run - tests . js <nl> ppp b / test / run - tests . js <nl> phantom . injectJs ( " . / fs - spec - 02 . js " ) ; / / < Filesystem Specs 02 ( Attributes ) <nl> phantom . injectJs ( " . / fs - spec - 03 . js " ) ; / / < Filesystem Specs 03 ( Paths ) <nl> phantom . injectJs ( " . / fs - spec - 04 . js " ) ; / / < Filesystem Specs 04 ( Tests ) <nl> phantom . injectJs ( " . / system - spec . js " ) ; <nl> + phantom . injectJs ( " . / webkit - spec . js " ) ; <nl> require ( " . / module_spec . js " ) ; <nl> require ( " . / require / require_spec . js " ) ; <nl> <nl> new file mode 100644 <nl> index 000000000 . . bb0940996 <nl> mmm / dev / null <nl> ppp b / test / webkit - spec . js <nl> <nl> + describe ( " WebKit " , function ( ) { <nl> + it ( " should construct date in mm - dd - yyyy format " , function ( ) { <nl> + var date = new Date ( ' 2012 - 09 - 07 ' ) ; <nl> + expect ( date . toString ( ) ) . toNotEqual ( ' Invalid Date ' ) ; <nl> + } ) ; <nl> + <nl> + it ( " should parse date in ISO8601 format ( yyyy - mm - dd ) " , function ( ) { <nl> + var date = Date . parse ( " 2012 - 01 - 01 " ) ; <nl> + expect ( date ) . toEqual ( 1325376000000 ) ; <nl> + } ) ; <nl> + } ) ; <nl> \ No newline at end of file <nl>
Fix parsing dates in ISO8601 format .
ariya/phantomjs
35c19715950a8a3f7d809479dc91f021060710c2
2012-10-24T07:00:58Z
mmm a / test / compiler - unittests / arm / instruction - selector - arm - unittest . cc <nl> ppp b / test / compiler - unittests / arm / instruction - selector - arm - unittest . cc <nl> static const int32_t kImmediates [ ] = { <nl> / / Data processing instructions . <nl> <nl> <nl> - namespace { <nl> - <nl> - class DPITest : public InstructionSelectorTestWithParam < DPI > { } ; <nl> + typedef InstructionSelectorTestWithParam < DPI > InstructionSelectorDPITest ; <nl> <nl> <nl> - TEST_P ( DPITest , Parameters ) { <nl> + TEST_P ( InstructionSelectorDPITest , Parameters ) { <nl> const DPI dpi = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> m . Return ( ( m . * dpi . constructor ) ( m . Parameter ( 0 ) , m . Parameter ( 1 ) ) ) ; <nl> TEST_P ( DPITest , Parameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , Immediate ) { <nl> + TEST_P ( InstructionSelectorDPITest , Immediate ) { <nl> const DPI dpi = GetParam ( ) ; <nl> TRACED_FOREACH ( int32_t , imm , kImmediates ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( DPITest , Immediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , ShiftByParameter ) { <nl> + TEST_P ( InstructionSelectorDPITest , ShiftByParameter ) { <nl> const DPI dpi = GetParam ( ) ; <nl> TRACED_FOREACH ( Shift , shift , kShifts ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( DPITest , ShiftByParameter ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , ShiftByImmediate ) { <nl> + TEST_P ( InstructionSelectorDPITest , ShiftByImmediate ) { <nl> const DPI dpi = GetParam ( ) ; <nl> TRACED_FOREACH ( Shift , shift , kShifts ) { <nl> TRACED_FORRANGE ( int32_t , imm , shift . i_low , shift . i_high ) { <nl> TEST_P ( DPITest , ShiftByImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , BranchWithParameters ) { <nl> + TEST_P ( InstructionSelectorDPITest , BranchWithParameters ) { <nl> const DPI dpi = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> MLabel a , b ; <nl> TEST_P ( DPITest , BranchWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , BranchWithImmediate ) { <nl> + TEST_P ( InstructionSelectorDPITest , BranchWithImmediate ) { <nl> const DPI dpi = GetParam ( ) ; <nl> TRACED_FOREACH ( int32_t , imm , kImmediates ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( DPITest , BranchWithImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , BranchWithShiftByParameter ) { <nl> + TEST_P ( InstructionSelectorDPITest , BranchWithShiftByParameter ) { <nl> const DPI dpi = GetParam ( ) ; <nl> TRACED_FOREACH ( Shift , shift , kShifts ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( DPITest , BranchWithShiftByParameter ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , BranchWithShiftByImmediate ) { <nl> + TEST_P ( InstructionSelectorDPITest , BranchWithShiftByImmediate ) { <nl> const DPI dpi = GetParam ( ) ; <nl> TRACED_FOREACH ( Shift , shift , kShifts ) { <nl> TRACED_FORRANGE ( int32_t , imm , shift . i_low , shift . i_high ) { <nl> TEST_P ( DPITest , BranchWithShiftByImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , BranchIfZeroWithParameters ) { <nl> + TEST_P ( InstructionSelectorDPITest , BranchIfZeroWithParameters ) { <nl> const DPI dpi = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> MLabel a , b ; <nl> TEST_P ( DPITest , BranchIfZeroWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , BranchIfNotZeroWithParameters ) { <nl> + TEST_P ( InstructionSelectorDPITest , BranchIfNotZeroWithParameters ) { <nl> const DPI dpi = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> MLabel a , b ; <nl> TEST_P ( DPITest , BranchIfNotZeroWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , BranchIfZeroWithImmediate ) { <nl> + TEST_P ( InstructionSelectorDPITest , BranchIfZeroWithImmediate ) { <nl> const DPI dpi = GetParam ( ) ; <nl> TRACED_FOREACH ( int32_t , imm , kImmediates ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( DPITest , BranchIfZeroWithImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( DPITest , BranchIfNotZeroWithImmediate ) { <nl> + TEST_P ( InstructionSelectorDPITest , BranchIfNotZeroWithImmediate ) { <nl> const DPI dpi = GetParam ( ) ; <nl> TRACED_FOREACH ( int32_t , imm , kImmediates ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( DPITest , BranchIfNotZeroWithImmediate ) { <nl> } <nl> } <nl> <nl> - } / / namespace <nl> - <nl> <nl> - INSTANTIATE_TEST_CASE_P ( InstructionSelectorTest , DPITest , <nl> + INSTANTIATE_TEST_CASE_P ( InstructionSelectorTest , InstructionSelectorDPITest , <nl> : : testing : : ValuesIn ( kDPIs ) ) ; <nl> <nl> <nl> INSTANTIATE_TEST_CASE_P ( InstructionSelectorTest , DPITest , <nl> / / Data processing instructions with overflow . <nl> <nl> <nl> - namespace { <nl> - <nl> - class ODPITest : public InstructionSelectorTestWithParam < ODPI > { } ; <nl> + typedef InstructionSelectorTestWithParam < ODPI > InstructionSelectorODPITest ; <nl> <nl> <nl> - TEST_P ( ODPITest , OvfWithParameters ) { <nl> + TEST_P ( InstructionSelectorODPITest , OvfWithParameters ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> m . Return ( <nl> TEST_P ( ODPITest , OvfWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , OvfWithImmediate ) { <nl> + TEST_P ( InstructionSelectorODPITest , OvfWithImmediate ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> TRACED_FOREACH ( int32_t , imm , kImmediates ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ODPITest , OvfWithImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , OvfWithShiftByParameter ) { <nl> + TEST_P ( InstructionSelectorODPITest , OvfWithShiftByParameter ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> TRACED_FOREACH ( Shift , shift , kShifts ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ODPITest , OvfWithShiftByParameter ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , OvfWithShiftByImmediate ) { <nl> + TEST_P ( InstructionSelectorODPITest , OvfWithShiftByImmediate ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> TRACED_FOREACH ( Shift , shift , kShifts ) { <nl> TRACED_FORRANGE ( int32_t , imm , shift . i_low , shift . i_high ) { <nl> TEST_P ( ODPITest , OvfWithShiftByImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , ValWithParameters ) { <nl> + TEST_P ( InstructionSelectorODPITest , ValWithParameters ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> m . Return ( <nl> TEST_P ( ODPITest , ValWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , ValWithImmediate ) { <nl> + TEST_P ( InstructionSelectorODPITest , ValWithImmediate ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> TRACED_FOREACH ( int32_t , imm , kImmediates ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ODPITest , ValWithImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , ValWithShiftByParameter ) { <nl> + TEST_P ( InstructionSelectorODPITest , ValWithShiftByParameter ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> TRACED_FOREACH ( Shift , shift , kShifts ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ODPITest , ValWithShiftByParameter ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , ValWithShiftByImmediate ) { <nl> + TEST_P ( InstructionSelectorODPITest , ValWithShiftByImmediate ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> TRACED_FOREACH ( Shift , shift , kShifts ) { <nl> TRACED_FORRANGE ( int32_t , imm , shift . i_low , shift . i_high ) { <nl> TEST_P ( ODPITest , ValWithShiftByImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , BothWithParameters ) { <nl> + TEST_P ( InstructionSelectorODPITest , BothWithParameters ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> Node * n = ( m . * odpi . constructor ) ( m . Parameter ( 0 ) , m . Parameter ( 1 ) ) ; <nl> TEST_P ( ODPITest , BothWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , BothWithImmediate ) { <nl> + TEST_P ( InstructionSelectorODPITest , BothWithImmediate ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> TRACED_FOREACH ( int32_t , imm , kImmediates ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ODPITest , BothWithImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , BothWithShiftByParameter ) { <nl> + TEST_P ( InstructionSelectorODPITest , BothWithShiftByParameter ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> TRACED_FOREACH ( Shift , shift , kShifts ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ODPITest , BothWithShiftByParameter ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , BothWithShiftByImmediate ) { <nl> + TEST_P ( InstructionSelectorODPITest , BothWithShiftByImmediate ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> TRACED_FOREACH ( Shift , shift , kShifts ) { <nl> TRACED_FORRANGE ( int32_t , imm , shift . i_low , shift . i_high ) { <nl> TEST_P ( ODPITest , BothWithShiftByImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , BranchWithParameters ) { <nl> + TEST_P ( InstructionSelectorODPITest , BranchWithParameters ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> MLabel a , b ; <nl> TEST_P ( ODPITest , BranchWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , BranchWithImmediate ) { <nl> + TEST_P ( InstructionSelectorODPITest , BranchWithImmediate ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> TRACED_FOREACH ( int32_t , imm , kImmediates ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ODPITest , BranchWithImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , BranchIfZeroWithParameters ) { <nl> + TEST_P ( InstructionSelectorODPITest , BranchIfZeroWithParameters ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> MLabel a , b ; <nl> TEST_P ( ODPITest , BranchIfZeroWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( ODPITest , BranchIfNotZeroWithParameters ) { <nl> + TEST_P ( InstructionSelectorODPITest , BranchIfNotZeroWithParameters ) { <nl> const ODPI odpi = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> MLabel a , b ; <nl> TEST_P ( ODPITest , BranchIfNotZeroWithParameters ) { <nl> } <nl> <nl> <nl> - } / / namespace <nl> - <nl> - INSTANTIATE_TEST_CASE_P ( InstructionSelectorTest , ODPITest , <nl> + INSTANTIATE_TEST_CASE_P ( InstructionSelectorTest , InstructionSelectorODPITest , <nl> : : testing : : ValuesIn ( kODPIs ) ) ; <nl> <nl> <nl> INSTANTIATE_TEST_CASE_P ( InstructionSelectorTest , ODPITest , <nl> / / Shifts . <nl> <nl> <nl> - namespace { <nl> - <nl> - class ShiftTest : public InstructionSelectorTestWithParam < Shift > { } ; <nl> + typedef InstructionSelectorTestWithParam < Shift > InstructionSelectorShiftTest ; <nl> <nl> <nl> - TEST_P ( ShiftTest , Parameters ) { <nl> + TEST_P ( InstructionSelectorShiftTest , Parameters ) { <nl> const Shift shift = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> m . Return ( ( m . * shift . constructor ) ( m . Parameter ( 0 ) , m . Parameter ( 1 ) ) ) ; <nl> TEST_P ( ShiftTest , Parameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( ShiftTest , Immediate ) { <nl> + TEST_P ( InstructionSelectorShiftTest , Immediate ) { <nl> const Shift shift = GetParam ( ) ; <nl> TRACED_FORRANGE ( int32_t , imm , shift . i_low , shift . i_high ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ShiftTest , Immediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ShiftTest , Word32EqualWithParameter ) { <nl> + TEST_P ( InstructionSelectorShiftTest , Word32EqualWithParameter ) { <nl> const Shift shift = GetParam ( ) ; <nl> { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ShiftTest , Word32EqualWithParameter ) { <nl> } <nl> <nl> <nl> - TEST_P ( ShiftTest , Word32EqualWithParameterAndImmediate ) { <nl> + TEST_P ( InstructionSelectorShiftTest , Word32EqualWithParameterAndImmediate ) { <nl> const Shift shift = GetParam ( ) ; <nl> TRACED_FORRANGE ( int32_t , imm , shift . i_low , shift . i_high ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ShiftTest , Word32EqualWithParameterAndImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ShiftTest , Word32EqualToZeroWithParameters ) { <nl> + TEST_P ( InstructionSelectorShiftTest , Word32EqualToZeroWithParameters ) { <nl> const Shift shift = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> m . Return ( <nl> TEST_P ( ShiftTest , Word32EqualToZeroWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( ShiftTest , Word32EqualToZeroWithImmediate ) { <nl> + TEST_P ( InstructionSelectorShiftTest , Word32EqualToZeroWithImmediate ) { <nl> const Shift shift = GetParam ( ) ; <nl> TRACED_FORRANGE ( int32_t , imm , shift . i_low , shift . i_high ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ShiftTest , Word32EqualToZeroWithImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ShiftTest , Word32NotWithParameters ) { <nl> + TEST_P ( InstructionSelectorShiftTest , Word32NotWithParameters ) { <nl> const Shift shift = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> m . Return ( m . Word32Not ( ( m . * shift . constructor ) ( m . Parameter ( 0 ) , m . Parameter ( 1 ) ) ) ) ; <nl> TEST_P ( ShiftTest , Word32NotWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( ShiftTest , Word32NotWithImmediate ) { <nl> + TEST_P ( InstructionSelectorShiftTest , Word32NotWithImmediate ) { <nl> const Shift shift = GetParam ( ) ; <nl> TRACED_FORRANGE ( int32_t , imm , shift . i_low , shift . i_high ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ShiftTest , Word32NotWithImmediate ) { <nl> } <nl> <nl> <nl> - TEST_P ( ShiftTest , Word32AndWithWord32NotWithParameters ) { <nl> + TEST_P ( InstructionSelectorShiftTest , Word32AndWithWord32NotWithParameters ) { <nl> const Shift shift = GetParam ( ) ; <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> m . Return ( m . Word32And ( m . Parameter ( 0 ) , m . Word32Not ( ( m . * shift . constructor ) ( <nl> TEST_P ( ShiftTest , Word32AndWithWord32NotWithParameters ) { <nl> } <nl> <nl> <nl> - TEST_P ( ShiftTest , Word32AndWithWord32NotWithImmediate ) { <nl> + TEST_P ( InstructionSelectorShiftTest , Word32AndWithWord32NotWithImmediate ) { <nl> const Shift shift = GetParam ( ) ; <nl> TRACED_FORRANGE ( int32_t , imm , shift . i_low , shift . i_high ) { <nl> StreamBuilder m ( this , kMachInt32 , kMachInt32 , kMachInt32 ) ; <nl> TEST_P ( ShiftTest , Word32AndWithWord32NotWithImmediate ) { <nl> } <nl> <nl> <nl> - } / / namespace <nl> - <nl> - <nl> - INSTANTIATE_TEST_CASE_P ( InstructionSelectorTest , ShiftTest , <nl> + INSTANTIATE_TEST_CASE_P ( InstructionSelectorTest , InstructionSelectorShiftTest , <nl> : : testing : : ValuesIn ( kShifts ) ) ; <nl> <nl> <nl> mmm a / test / compiler - unittests / change - lowering - unittest . cc <nl> ppp b / test / compiler - unittests / change - lowering - unittest . cc <nl> class ChangeLoweringTest : public GraphTest { <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / Common . <nl> <nl> - namespace { <nl> <nl> - class Common : public ChangeLoweringTest , <nl> - public : : testing : : WithParamInterface < MachineType > { <nl> + class ChangeLoweringCommonTest <nl> + : public ChangeLoweringTest , <nl> + public : : testing : : WithParamInterface < MachineType > { <nl> public : <nl> - virtual ~ Common ( ) { } <nl> + virtual ~ ChangeLoweringCommonTest ( ) { } <nl> <nl> virtual MachineType WordRepresentation ( ) const V8_FINAL V8_OVERRIDE { <nl> return GetParam ( ) ; <nl> class Common : public ChangeLoweringTest , <nl> } ; <nl> <nl> <nl> - TARGET_TEST_P ( Common , ChangeBitToBool ) { <nl> + TARGET_TEST_P ( ChangeLoweringCommonTest , ChangeBitToBool ) { <nl> Node * val = Parameter ( 0 ) ; <nl> Node * node = graph ( ) - > NewNode ( simplified ( ) - > ChangeBitToBool ( ) , val ) ; <nl> Reduction reduction = Reduce ( node ) ; <nl> TARGET_TEST_P ( Common , ChangeBitToBool ) { <nl> } <nl> <nl> <nl> - TARGET_TEST_P ( Common , ChangeBoolToBit ) { <nl> + TARGET_TEST_P ( ChangeLoweringCommonTest , ChangeBoolToBit ) { <nl> Node * val = Parameter ( 0 ) ; <nl> Node * node = graph ( ) - > NewNode ( simplified ( ) - > ChangeBoolToBit ( ) , val ) ; <nl> Reduction reduction = Reduce ( node ) ; <nl> TARGET_TEST_P ( Common , ChangeBoolToBit ) { <nl> } <nl> <nl> <nl> - TARGET_TEST_P ( Common , ChangeFloat64ToTagged ) { <nl> + TARGET_TEST_P ( ChangeLoweringCommonTest , ChangeFloat64ToTagged ) { <nl> Node * val = Parameter ( 0 ) ; <nl> Node * node = graph ( ) - > NewNode ( simplified ( ) - > ChangeFloat64ToTagged ( ) , val ) ; <nl> Reduction reduction = Reduce ( node ) ; <nl> TARGET_TEST_P ( Common , ChangeFloat64ToTagged ) { <nl> } <nl> <nl> <nl> - TARGET_TEST_P ( Common , StringAdd ) { <nl> + TARGET_TEST_P ( ChangeLoweringCommonTest , StringAdd ) { <nl> Node * node = <nl> graph ( ) - > NewNode ( simplified ( ) - > StringAdd ( ) , Parameter ( 0 ) , Parameter ( 1 ) ) ; <nl> Reduction reduction = Reduce ( node ) ; <nl> EXPECT_FALSE ( reduction . Changed ( ) ) ; <nl> } <nl> <nl> - } / / namespace <nl> <nl> - <nl> - INSTANTIATE_TEST_CASE_P ( ChangeLoweringTest , Common , <nl> + INSTANTIATE_TEST_CASE_P ( ChangeLoweringTest , ChangeLoweringCommonTest , <nl> : : testing : : Values ( kRepWord32 , kRepWord64 ) ) ; <nl> <nl> <nl>
Revert " [ arm ] Shorter test names for parameterized tests . "
v8/v8
e0e17b905d348fb72493554f1f3cc190291adf8c
2014-08-19T05:24:32Z
mmm a / ports / libsodium / CONTROL <nl> ppp b / ports / libsodium / CONTROL <nl> <nl> Source : libsodium <nl> - Version : 1 . 0 . 18 - 1 <nl> + Version : 1 . 0 . 18 - 2 <nl> Description : A modern and easy - to - use crypto library <nl> Homepage : https : / / github . com / jedisct1 / libsodium <nl>
Update CONTROL
microsoft/vcpkg
56b7f1cefd3596fc06aed80dee8d25f94d233e0f
2019-11-20T11:38:47Z
mmm a / hphp / hhvm / anchor - syms . cpp <nl> ppp b / hphp / hhvm / anchor - syms . cpp <nl> extern Extension s_reflection_extension ; <nl> extern Extension s_ctype_extension ; <nl> extern Extension s_apache_extension ; <nl> extern Extension s_standardurl_extension ; <nl> + extern Extension s_zlib_extension ; <nl> # ifdef HAVE_UODBC <nl> extern Extension s_odbc_extension ; <nl> # endif <nl> const Extension * g_anchor_extensions [ ] = { <nl> & s_ctype_extension , <nl> & s_apache_extension , <nl> & s_standardurl_extension , <nl> + & s_zlib_extension , <nl> # ifdef HAVE_UODBC <nl> & s_odbc_extension , <nl> # endif <nl> mmm a / hphp / runtime / ext / ext . h <nl> ppp b / hphp / runtime / ext / ext . h <nl> <nl> # include " hphp / runtime / ext / ext_xml . h " <nl> # include " hphp / runtime / ext / ext_xmlreader . h " <nl> # include " hphp / runtime / ext / ext_xmlwriter . h " <nl> - # include " hphp / runtime / ext / ext_zlib . h " <nl> # include " hphp / runtime / ext / gd / ext_image . h " <nl> # include " hphp / runtime / ext / mysql / ext_mysql . h " <nl> <nl> mmm a / hphp / runtime / ext / ext_soap . cpp <nl> ppp b / hphp / runtime / ext / ext_soap . cpp <nl> <nl> # include " hphp / runtime / ext / soap / soap . h " <nl> # include " hphp / runtime / ext / soap / packet . h " <nl> # include " hphp / runtime / base / string - util . h " <nl> - # include " hphp / runtime / ext / ext_zlib . h " <nl> + # include " hphp / runtime / ext / zlib / ext_zlib . h " <nl> # include " hphp / runtime / ext / ext_network . h " <nl> # include " hphp / runtime / ext / ext_array . h " <nl> # include " hphp / runtime / ext / ext_function . h " <nl> void c_SoapServer : : t_handle ( const String & request / * = null_string * / ) { <nl> String encoding = g - > get ( s__SERVER ) [ s_HTTP_CONTENT_ENCODING ] . toString ( ) ; <nl> Variant ret ; <nl> if ( encoding = = s_gzip | | encoding = = s_xgzip ) { <nl> - ret = f_gzinflate ( String ( data , size , CopyString ) ) ; <nl> + ret = HHVM_FN ( gzinflate ) ( String ( data , size , CopyString ) ) ; <nl> } else if ( encoding = = s_deflate ) { <nl> - ret = f_gzuncompress ( String ( data , size , CopyString ) ) ; <nl> + ret = HHVM_FN ( gzuncompress ) ( String ( data , size , CopyString ) ) ; <nl> } else { <nl> raise_warning ( " Request is encoded with unknown compression ' % s ' " , <nl> encoding . data ( ) ) ; <nl> Variant c_SoapClient : : t___dorequest ( const String & buf , const String & location , c <nl> if ( level > 0 ) { <nl> Variant ret ; <nl> if ( m_compression & SOAP_COMPRESSION_DEFLATE ) { <nl> - ret = f_gzcompress ( buffer , level ) ; <nl> + ret = HHVM_FN ( gzcompress ) ( buffer , level ) ; <nl> headers [ " Content - Encoding " ] . push_back ( " deflate " ) ; <nl> } else { <nl> - ret = f_gzencode ( buffer , level ) ; <nl> + ret = HHVM_FN ( gzencode ) ( buffer , level ) ; <nl> headers [ " Content - Encoding " ] . push_back ( " gzip " ) ; <nl> } <nl> if ( ! ret . isString ( ) ) return uninit_null ( ) ; <nl> deleted file mode 100644 <nl> index 75c28204361 . . 00000000000 <nl> mmm a / hphp / runtime / ext / ext_zlib . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> - | HipHop for PHP | <nl> - + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> - | Copyright ( c ) 2010 - 2013 Facebook , Inc . ( http : / / www . facebook . com ) | <nl> - | Copyright ( c ) 1997 - 2010 The PHP Group | <nl> - + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> - | This source file is subject to version 3 . 01 of the PHP license , | <nl> - | that is bundled with this package in the file LICENSE , and is | <nl> - | available through the world - wide - web at the following url : | <nl> - | http : / / www . php . net / license / 3_01 . txt | <nl> - | If you did not receive a copy of the PHP license and are unable to | <nl> - | obtain it through the world - wide - web , please send a note to | <nl> - | license @ php . net so we can mail you a copy immediately . | <nl> - + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> - * / <nl> - <nl> - # ifndef incl_HPHP_EXT_ZLIB_H_ <nl> - # define incl_HPHP_EXT_ZLIB_H_ <nl> - <nl> - # include " hphp / runtime / base / base - includes . h " <nl> - # include " hphp / runtime / ext / ext_file . h " <nl> - <nl> - namespace HPHP { <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / zlib functions <nl> - <nl> - Variant f_readgzfile ( const String & filename , bool use_include_path = false ) ; <nl> - Variant f_gzfile ( const String & filename , bool use_include_path = false ) ; <nl> - Variant f_gzcompress ( const String & data , int level = - 1 ) ; <nl> - Variant f_gzuncompress ( const String & data , int limit = 0 ) ; <nl> - Variant f_gzdeflate ( const String & data , int level = - 1 ) ; <nl> - Variant f_gzinflate ( const String & data , int limit = 0 ) ; <nl> - Variant f_gzencode ( const String & data , int level = - 1 , <nl> - int encoding_mode = k_FORCE_GZIP ) ; <nl> - Variant f_gzdecode ( const String & data ) ; <nl> - String f_zlib_get_coding_type ( ) ; <nl> - Variant f_qlzcompress ( const String & data , int level = 1 ) ; <nl> - Variant f_qlzuncompress ( const String & data , int level = 1 ) ; <nl> - Variant f_sncompress ( const String & data ) ; <nl> - Variant f_snuncompress ( const String & data ) ; <nl> - Variant f_nzcompress ( const String & uncompressed ) ; <nl> - Variant f_nzuncompress ( const String & compressed ) ; <nl> - Variant f_lz4compress ( const String & uncompressed ) ; <nl> - Variant f_lz4hccompress ( const String & uncompressed ) ; <nl> - Variant f_lz4uncompress ( const String & compressed ) ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / stream functions <nl> - <nl> - Resource f_gzopen ( const String & filename , const String & mode , <nl> - bool use_include_path = false ) ; <nl> - <nl> - bool f_gzclose ( CResRef zp ) ; <nl> - Variant f_gzread ( CResRef zp , int64_t length = 0 ) ; <nl> - Variant f_gzseek ( CResRef zp , int64_t offset , int64_t whence = k_SEEK_SET ) ; <nl> - Variant f_gztell ( CResRef zp ) ; <nl> - bool f_gzeof ( CResRef zp ) ; <nl> - bool f_gzrewind ( CResRef zp ) ; <nl> - Variant f_gzgetc ( CResRef zp ) ; <nl> - Variant f_gzgets ( CResRef zp , int64_t length = 1024 ) ; <nl> - Variant f_gzgetss ( CResRef zp , int64_t length = 0 , <nl> - const String & allowable_tags = null_string ) ; <nl> - Variant f_gzpassthru ( CResRef zp ) ; <nl> - Variant f_gzputs ( CResRef zp , const String & str , int64_t length = 0 ) ; <nl> - Variant f_gzwrite ( CResRef zp , const String & str , int64_t length = 0 ) ; <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - } <nl> - <nl> - # endif / / incl_HPHP_EXT_ZLIB_H_ <nl> new file mode 100644 <nl> index 00000000000 . . 648a12254fe <nl> mmm / dev / null <nl> ppp b / hphp / runtime / ext / zlib / ext_zlib - qlz . php <nl> <nl> + < ? hh <nl> + <nl> + / * * <nl> + * This function compress the given string using the QuickLZ data format . <nl> + * <nl> + * For details on the QuickLZ compression algorithm go to <nl> + * http : / / www . quicklz . com / ( RFC 1950 ) . <nl> + * <nl> + * @ param string $ data - The data to compress <nl> + * @ param int $ level - The level of compression . Can be given as 1 , 2 or 3 . <nl> + * <nl> + * @ return string - The compressed string or FALSE if an error occurred <nl> + * / <nl> + < < __Native , __HipHopSpecific > > <nl> + function qlzcompress ( string $ data , int $ level = 1 ) : mixed ; <nl> + <nl> + / * * <nl> + * This function uncompress a compressed string <nl> + * <nl> + * @ param string $ data - The data to compressed by qlzcompress ( ) <nl> + * @ param int $ level - The level of compression . Can be given as 1 , 2 or 3 . <nl> + * <nl> + * @ return string - The original uncompressed data or FALSE if an error occurred <nl> + * / <nl> + < < __Native , __HipHopSpecific > > <nl> + function qlzuncompress ( string $ data , int $ level = 1 ) : mixed ; <nl> new file mode 100644 <nl> index 00000000000 . . 9711590c57f <nl> mmm / dev / null <nl> ppp b / hphp / runtime / ext / zlib / ext_zlib - snappy . php <nl> <nl> + < ? hh <nl> + <nl> + / * * <nl> + * This function compress the given string using the Snappy data format . <nl> + * <nl> + * For details on the Snappy compression algorithm go to <nl> + * http : / / code . google . com / p / snappy / . <nl> + * <nl> + * @ param string $ data - The data to compress <nl> + * <nl> + * @ return string - The compressed string or FALSE if an error occurred . <nl> + * / <nl> + < < __Native , __HipHopSpecific > > <nl> + function sncompress ( string $ data ) : mixed ; <nl> + <nl> + / * * <nl> + * This function uncompress a compressed string . <nl> + * <nl> + * @ param string $ data - The data compressed by sncompress ( ) <nl> + * <nl> + * @ return string - The decompressed string or FALSE if an error occurred . <nl> + * / <nl> + < < __Native , __HipHopSpecific > > <nl> + function snuncompress ( string $ data ) : mixed ; <nl> similarity index 77 % <nl> rename from hphp / runtime / ext / ext_zlib . cpp <nl> rename to hphp / runtime / ext / zlib / ext_zlib . cpp <nl> mmm a / hphp / runtime / ext / ext_zlib . cpp <nl> ppp b / hphp / runtime / ext / zlib / ext_zlib . cpp <nl> <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> * / <nl> <nl> - # include " hphp / runtime / ext / ext_zlib . h " <nl> + # include " hphp / runtime / ext / zlib / ext_zlib . h " <nl> # include " hphp / runtime / base / file . h " <nl> # include " hphp / runtime / base / mem - file . h " <nl> - # include " hphp / runtime / base / zip - file . h " <nl> + # include " hphp / runtime / ext / zlib / zip - file . h " <nl> # include " hphp / runtime / base / stream - wrapper . h " <nl> # include " hphp / runtime / base / stream - wrapper - registry . h " <nl> # include " hphp / runtime / base / file - stream - wrapper . h " <nl> static class ZlibStreamWrapper : public Stream : : Wrapper { <nl> } <nl> } s_zlib_stream_wrapper ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / Extension entry point <nl> - <nl> - static class ZlibExtension : Extension { <nl> - public : <nl> - ZlibExtension ( ) : Extension ( " zlib " , " 2 . 0 " ) { } <nl> - virtual void moduleLoad ( Hdf hdf ) { <nl> - s_zlib_stream_wrapper . registerAs ( " compress . zlib " ) ; <nl> - } <nl> - } s_zlib_extension ; <nl> - <nl> } / / nil namespace <nl> <nl> namespace HPHP { <nl> <nl> + const long k_FORCE_GZIP = CODING_GZIP ; <nl> + const long k_FORCE_DEFLATE = CODING_DEFLATE ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / zlib functions <nl> <nl> static Variant gzinflate ( const char * data , int len , int limit / * = 0 * / ) { <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - Variant f_readgzfile ( const String & filename , bool use_include_path / * = false * / ) { <nl> - Resource stream = f_gzopen ( filename , " rb " , use_include_path ) ; <nl> - if ( stream . isNull ( ) ) { <nl> + Variant HHVM_FUNCTION ( readgzfile , const String & filename , <nl> + int64_t use_include_path / * = 0 * / ) { <nl> + Variant stream = HHVM_FN ( gzopen ) ( filename , " rb " , use_include_path ) ; <nl> + if ( stream . isBoolean ( ) & & ! stream . toBoolean ( ) ) { <nl> return false ; <nl> } <nl> - return f_gzpassthru ( stream ) ; <nl> + return HHVM_FN ( gzpassthru ) ( stream . toResource ( ) ) ; <nl> } <nl> <nl> - Variant f_gzfile ( const String & filename , bool use_include_path / * = false * / ) { <nl> - Resource stream = f_gzopen ( filename , " rb " , use_include_path ) ; <nl> - if ( stream . isNull ( ) ) { <nl> + Variant HHVM_FUNCTION ( gzfile , const String & filename , <nl> + int64_t use_include_path / * = 0 * / ) { <nl> + Variant stream = HHVM_FN ( gzopen ) ( filename , " rb " , use_include_path ) ; <nl> + if ( stream . isBoolean ( ) & & ! stream . toBoolean ( ) ) { <nl> return false ; <nl> } <nl> <nl> Array ret ; <nl> Variant line ; <nl> - while ( ! same ( line = f_gzgets ( stream ) , false ) ) { <nl> + while ( ! same ( line = HHVM_FN ( gzgets ) ( stream . toResource ( ) ) , false ) ) { <nl> ret . append ( line ) ; <nl> } <nl> return ret ; <nl> } <nl> <nl> - Variant f_gzcompress ( const String & data , int level / * = - 1 * / ) { <nl> + Variant HHVM_FUNCTION ( gzcompress , const String & data , <nl> + int64_t level / * = - 1 * / ) { <nl> return gzcompress ( data . data ( ) , data . size ( ) , level ) ; <nl> } <nl> <nl> - Variant f_gzuncompress ( const String & data , int limit / * = 0 * / ) { <nl> + Variant HHVM_FUNCTION ( gzuncompress , const String & data , <nl> + int limit / * = 0 * / ) { <nl> return gzuncompress ( data . data ( ) , data . size ( ) , limit ) ; <nl> } <nl> <nl> - Variant f_gzdeflate ( const String & data , int level / * = - 1 * / ) { <nl> + Variant HHVM_FUNCTION ( gzdeflate , const String & data , int level / * = - 1 * / ) { <nl> return gzdeflate ( data . data ( ) , data . size ( ) , level ) ; <nl> } <nl> <nl> - Variant f_gzinflate ( const String & data , int limit / * = 0 * / ) { <nl> + Variant HHVM_FUNCTION ( gzinflate , const String & data , int limit / * = 0 * / ) { <nl> return gzinflate ( data . data ( ) , data . size ( ) , limit ) ; <nl> } <nl> <nl> - Variant f_gzencode ( const String & data , int level / * = - 1 * / , <nl> - int encoding_mode / * = k_FORCE_GZIP * / ) { <nl> + Variant HHVM_FUNCTION ( gzencode , const String & data , int level / * = - 1 * / , <nl> + int encoding_mode / * = k_FORCE_GZIP * / ) { <nl> int len = data . size ( ) ; <nl> char * ret = gzencode ( data . data ( ) , len , level , encoding_mode ) ; <nl> if ( ret = = NULL ) { <nl> Variant f_gzencode ( const String & data , int level / * = - 1 * / , <nl> return String ( ret , len , AttachString ) ; <nl> } <nl> <nl> - Variant f_gzdecode ( const String & data ) { <nl> + Variant HHVM_FUNCTION ( gzdecode , const String & data , int limit / * = 0 * / ) { <nl> int len = data . size ( ) ; <nl> char * ret = gzdecode ( data . data ( ) , len ) ; <nl> if ( ret = = NULL ) { <nl> return false ; <nl> } <nl> - return String ( ret , len , AttachString ) ; <nl> + if ( limit ) { <nl> + return String ( ret , len , AttachString ) . shrink ( limit ) ; <nl> + } else { <nl> + return String ( ret , len , AttachString ) ; <nl> + } <nl> } <nl> <nl> - String f_zlib_get_coding_type ( ) { <nl> + String HHVM_FUNCTION ( zlib_get_coding_type ) { <nl> throw NotSupportedException ( __func__ , " no use " ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / stream functions <nl> <nl> - Resource f_gzopen ( const String & filename , const String & mode , <nl> - bool use_include_path / * = false * / ) { <nl> + Variant HHVM_FUNCTION ( gzopen , const String & filename , const String & mode , <nl> + int64_t use_include_path / * = 0 * / ) { <nl> File * file = NEWOBJ ( ZipFile ) ( ) ; <nl> Resource handle ( file ) ; <nl> bool ret = file - > open ( File : : TranslatePath ( filename ) , mode ) ; <nl> if ( ! ret ) { <nl> raise_warning ( " % s " , folly : : errnoStr ( errno ) . c_str ( ) ) ; <nl> - return NULL ; <nl> + return false ; <nl> } <nl> return handle ; <nl> } <nl> <nl> - bool f_gzclose ( CResRef zp ) { <nl> + bool HHVM_FUNCTION ( gzclose , CResRef zp ) { <nl> return f_fclose ( zp ) ; <nl> } <nl> - Variant f_gzread ( CResRef zp , int64_t length / * = 0 * / ) { <nl> + Variant HHVM_FUNCTION ( gzread , CResRef zp , int64_t length / * = 0 * / ) { <nl> return f_fread ( zp , length ) ; <nl> } <nl> - Variant f_gzseek ( CResRef zp , int64_t offset , int64_t whence / * = k_SEEK_SET * / ) { <nl> + Variant HHVM_FUNCTION ( gzseek , CResRef zp , int64_t offset , <nl> + int64_t whence / * = k_SEEK_SET * / ) { <nl> return f_fseek ( zp , offset , whence ) ; <nl> } <nl> - Variant f_gztell ( CResRef zp ) { <nl> + Variant HHVM_FUNCTION ( gztell , CResRef zp ) { <nl> return f_ftell ( zp ) ; <nl> } <nl> - bool f_gzeof ( CResRef zp ) { <nl> + bool HHVM_FUNCTION ( gzeof , CResRef zp ) { <nl> return f_feof ( zp ) ; <nl> } <nl> - bool f_gzrewind ( CResRef zp ) { <nl> + bool HHVM_FUNCTION ( gzrewind , CResRef zp ) { <nl> return f_rewind ( zp ) ; <nl> } <nl> - Variant f_gzgetc ( CResRef zp ) { <nl> + Variant HHVM_FUNCTION ( gzgetc , CResRef zp ) { <nl> return f_fgetc ( zp ) ; <nl> } <nl> - Variant f_gzgets ( CResRef zp , int64_t length / * = 1024 * / ) { <nl> + Variant HHVM_FUNCTION ( gzgets , CResRef zp , int64_t length / * = 1024 * / ) { <nl> return f_fgets ( zp , length ) ; <nl> } <nl> - Variant f_gzgetss ( CResRef zp , int64_t length / * = 0 * / , <nl> - const String & allowable_tags / * = null_string * / ) { <nl> + Variant HHVM_FUNCTION ( gzgetss , CResRef zp , int64_t length / * = 0 * / , <nl> + const String & allowable_tags / * = null_string * / ) { <nl> return f_fgetss ( zp , length , allowable_tags ) ; <nl> } <nl> - Variant f_gzpassthru ( CResRef zp ) { <nl> + Variant HHVM_FUNCTION ( gzpassthru , CResRef zp ) { <nl> return f_fpassthru ( zp ) ; <nl> } <nl> - Variant f_gzputs ( CResRef zp , const String & str , int64_t length / * = 0 * / ) { <nl> - return f_fwrite ( zp , str , length ) ; <nl> - } <nl> - Variant f_gzwrite ( CResRef zp , const String & str , int64_t length / * = 0 * / ) { <nl> + Variant HHVM_FUNCTION ( gzwrite , CResRef zp , const String & str , <nl> + int64_t length / * = 0 * / ) { <nl> return f_fwrite ( zp , str , length ) ; <nl> } <nl> <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / QuickLZ functions <nl> <nl> namespace QuickLZ1 { <nl> # endif <nl> # define QLZ_COMPRESSION_LEVEL 1 <nl> # define QLZ_STREAMING_BUFFER 0 <nl> - # include " hphp / runtime / ext / quicklz . inc " <nl> + # include " hphp / runtime / ext / zlib / quicklz . inc " <nl> } <nl> <nl> namespace QuickLZ2 { <nl> namespace QuickLZ2 { <nl> # endif <nl> # define QLZ_COMPRESSION_LEVEL 2 <nl> # define QLZ_STREAMING_BUFFER 100000 <nl> - # include " hphp / runtime / ext / quicklz . inc " <nl> + # include " hphp / runtime / ext / zlib / quicklz . inc " <nl> } <nl> <nl> namespace QuickLZ3 { <nl> namespace QuickLZ3 { <nl> # endif <nl> # define QLZ_COMPRESSION_LEVEL 3 <nl> # define QLZ_STREAMING_BUFFER 1000000 <nl> - # include " hphp / runtime / ext / quicklz . inc " <nl> + # include " hphp / runtime / ext / zlib / quicklz . inc " <nl> } <nl> <nl> - # endif / / HAVE_QUICKLZ <nl> - <nl> - Variant f_qlzcompress ( const String & data , int level / * = 1 * / ) { <nl> - # ifndef HAVE_QUICKLZ <nl> - throw NotSupportedException ( __func__ , " QuickLZ library cannot be found " ) ; <nl> - # else <nl> + Variant HHVM_FUNCTION ( qlzcompress , const String & data , int level / * = 1 * / ) { <nl> if ( level < 1 | | level > 3 ) { <nl> throw_invalid_argument ( " level : % d " , level ) ; <nl> return false ; <nl> Variant f_qlzcompress ( const String & data , int level / * = 1 * / ) { <nl> <nl> assert ( size < = ( size_t ) data . size ( ) + 400 ) ; <nl> return str . shrink ( size ) ; <nl> - # endif <nl> } <nl> <nl> - Variant f_qlzuncompress ( const String & data , int level / * = 1 * / ) { <nl> - # ifndef HAVE_QUICKLZ <nl> - throw NotSupportedException ( __func__ , " QuickLZ library cannot be found " ) ; <nl> - # else <nl> + Variant HHVM_FUNCTION ( qlzuncompress , const String & data , int level / * = 1 * / ) { <nl> if ( level < 1 | | level > 3 ) { <nl> throw_invalid_argument ( " level : % d " , level ) ; <nl> return false ; <nl> Variant f_qlzuncompress ( const String & data , int level / * = 1 * / ) { <nl> <nl> assert ( dsize = = size ) ; <nl> return s . setSize ( dsize ) ; <nl> - # endif <nl> } <nl> + # endif / / HAVE_QUICKLZ <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / Snappy functions <nl> + <nl> + # ifdef HAVE_SNAPPY <nl> <nl> - Variant f_sncompress ( const String & data ) { <nl> - # ifndef HAVE_SNAPPY <nl> - throw NotSupportedException ( __func__ , " Snappy library cannot be found " ) ; <nl> - # else <nl> + Variant HHVM_FUNCTION ( sncompress , const String & data ) { <nl> size_t size ; <nl> char * compressed = <nl> ( char * ) malloc ( snappy : : MaxCompressedLength ( data . size ( ) ) + 1 ) ; <nl> Variant f_sncompress ( const String & data ) { <nl> compressed = ( char * ) realloc ( compressed , size + 1 ) ; <nl> compressed [ size ] = ' \ 0 ' ; <nl> return String ( compressed , size , AttachString ) ; <nl> - # endif <nl> } <nl> <nl> - Variant f_snuncompress ( const String & data ) { <nl> - # ifndef HAVE_SNAPPY <nl> - throw NotSupportedException ( __func__ , " Snappy library cannot be found " ) ; <nl> - # else <nl> + Variant HHVM_FUNCTION ( snuncompress , const String & data ) { <nl> size_t dsize ; <nl> <nl> snappy : : GetUncompressedLength ( data . data ( ) , data . size ( ) , & dsize ) ; <nl> Variant f_snuncompress ( const String & data ) { <nl> return false ; <nl> } <nl> return s . setSize ( dsize ) ; <nl> - # endif <nl> } <nl> + # endif / / HAVE_SNAPPY <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / NZLIB functions <nl> <nl> # define NZLIB_MAGIC 0x6e7a6c69 / * nzli * / <nl> / * The new compression format stores a magic number and the size <nl> typedef struct nzlib_format_s { <nl> Bytef buf [ 0 ] ; <nl> } nzlib_format_t ; <nl> <nl> - Variant f_nzcompress ( const String & uncompressed ) { <nl> + Variant HHVM_FUNCTION ( nzcompress , const String & uncompressed ) { <nl> size_t len = compressBound ( uncompressed . size ( ) ) ; <nl> String str ( sizeof ( nzlib_format_t ) + len , ReserveString ) ; <nl> nzlib_format_t * format = ( nzlib_format_t * ) str . bufferSlice ( ) . ptr ; <nl> Variant f_nzcompress ( const String & uncompressed ) { <nl> return false ; <nl> } <nl> <nl> - Variant f_nzuncompress ( const String & compressed ) { <nl> + Variant HHVM_FUNCTION ( nzuncompress , const String & compressed ) { <nl> if ( compressed . size ( ) < ( ssize_t ) sizeof ( nzlib_format_t ) ) { <nl> return false ; <nl> } <nl> Variant f_nzuncompress ( const String & compressed ) { <nl> return str . setSize ( len ) ; <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / LZ4 functions <nl> + <nl> / / Varint helper functions for lz4 <nl> int VarintSize ( int val ) { <nl> int s = 1 ; <nl> int VarintDecode ( const char * * src , int max_size ) { <nl> return val ; <nl> } <nl> <nl> - Variant f_lz4compress ( const String & uncompressed ) { <nl> + Variant HHVM_FUNCTION ( lz4compress , const String & uncompressed ) { <nl> int bufsize = LZ4_compressBound ( uncompressed . size ( ) ) ; <nl> if ( bufsize < 0 ) { <nl> return false ; <nl> Variant f_lz4compress ( const String & uncompressed ) { <nl> return s . setSize ( bufsize ) ; <nl> } <nl> <nl> - Variant f_lz4hccompress ( const String & uncompressed ) { <nl> + Variant HHVM_FUNCTION ( lz4hccompress , const String & uncompressed ) { <nl> int bufsize = LZ4_compressBound ( uncompressed . size ( ) ) ; <nl> if ( bufsize < 0 ) { <nl> return false ; <nl> Variant f_lz4hccompress ( const String & uncompressed ) { <nl> return s . shrink ( bufsize ) ; <nl> } <nl> <nl> - Variant f_lz4uncompress ( const String & compressed ) { <nl> + Variant HHVM_FUNCTION ( lz4uncompress , const String & compressed ) { <nl> const char * compressed_ptr = compressed . data ( ) ; <nl> int dsize = VarintDecode ( & compressed_ptr , compressed . size ( ) ) ; <nl> if ( dsize < 0 ) { <nl> Variant f_lz4uncompress ( const String & compressed ) { <nl> return s . setSize ( dsize ) ; <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + const StaticString s_FORCE_GZIP ( " FORCE_GZIP " ) ; <nl> + const StaticString s_FORCE_DEFLATE ( " FORCE_DEFLATE " ) ; <nl> + <nl> + class ZlibExtension : public Extension { <nl> + public : <nl> + ZlibExtension ( ) : Extension ( " zlib " , " 2 . 0 " ) { } <nl> + virtual void moduleLoad ( Hdf hdf ) { <nl> + s_zlib_stream_wrapper . registerAs ( " compress . zlib " ) ; <nl> + } <nl> + virtual void moduleInit ( ) { <nl> + Native : : registerConstant < KindOfInt64 > ( <nl> + s_FORCE_GZIP . get ( ) , k_FORCE_GZIP <nl> + ) ; <nl> + Native : : registerConstant < KindOfInt64 > ( <nl> + s_FORCE_DEFLATE . get ( ) , k_FORCE_DEFLATE <nl> + ) ; <nl> + <nl> + HHVM_FE ( readgzfile ) ; <nl> + HHVM_FE ( gzfile ) ; <nl> + HHVM_FE ( gzcompress ) ; <nl> + HHVM_FE ( gzuncompress ) ; <nl> + HHVM_FE ( gzdeflate ) ; <nl> + HHVM_FE ( gzinflate ) ; <nl> + HHVM_FE ( gzencode ) ; <nl> + HHVM_FE ( gzdecode ) ; <nl> + HHVM_FE ( zlib_get_coding_type ) ; <nl> + HHVM_FE ( gzopen ) ; <nl> + HHVM_FE ( gzclose ) ; <nl> + HHVM_FE ( gzread ) ; <nl> + HHVM_FE ( gzseek ) ; <nl> + HHVM_FE ( gztell ) ; <nl> + HHVM_FE ( gzeof ) ; <nl> + HHVM_FE ( gzrewind ) ; <nl> + HHVM_FE ( gzgetc ) ; <nl> + HHVM_FE ( gzgets ) ; <nl> + HHVM_FE ( gzgetss ) ; <nl> + HHVM_FE ( gzpassthru ) ; <nl> + HHVM_FE ( gzwrite ) ; <nl> + # ifdef HAVE_QUICKLZ <nl> + HHVM_FE ( qlzcompress ) ; <nl> + HHVM_FE ( qlzuncompress ) ; <nl> + # endif <nl> + # ifdef HAVE_SNAPPY <nl> + HHVM_FE ( sncompress ) ; <nl> + HHVM_FE ( snuncompress ) ; <nl> + # endif <nl> + HHVM_FE ( nzcompress ) ; <nl> + HHVM_FE ( nzuncompress ) ; <nl> + HHVM_FE ( lz4compress ) ; <nl> + HHVM_FE ( lz4hccompress ) ; <nl> + HHVM_FE ( lz4uncompress ) ; <nl> + <nl> + loadSystemlib ( ) ; <nl> + # ifdef HAVE_QUICKLZ <nl> + loadSystemlib ( " zlib - qlz " ) ; <nl> + # endif <nl> + # ifdef HAVE_SNAPPY <nl> + loadSystemlib ( " zlib - snappy " ) ; <nl> + # endif <nl> + } <nl> + } s_zlib_extension ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . 51c05e56939 <nl> mmm / dev / null <nl> ppp b / hphp / runtime / ext / zlib / ext_zlib . h <nl> <nl> + / * <nl> + + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> + | HipHop for PHP | <nl> + + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> + | Copyright ( c ) ; 2010 - 2013 Facebook , Inc . ( http : / / www . facebook . com ) ; | <nl> + | Copyright ( c ) ; 1997 - 2010 The PHP Group | <nl> + + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> + | This source file is subject to version 3 . 01 of the PHP license , | <nl> + | that is bundled with this package in the file LICENSE , and is | <nl> + | available through the world - wide - web at the following url : | <nl> + | http : / / www . php . net / license / 3_01 . txt | <nl> + | If you did not receive a copy of the PHP license and are unable to | <nl> + | obtain it through the world - wide - web , please send a note to | <nl> + | license @ php . net so we can mail you a copy immediately . | <nl> + + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> + * / <nl> + <nl> + # ifndef incl_HPHP_EXT_ZLIB_H_ <nl> + # define incl_HPHP_EXT_ZLIB_H_ <nl> + <nl> + # include " hphp / runtime / base / base - includes . h " <nl> + # include " hphp / runtime / ext / ext_file . h " <nl> + <nl> + namespace HPHP { <nl> + <nl> + extern const long k_FORCE_GZIP ; <nl> + extern const long k_FORCE_DEFLATE ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / zlib functions <nl> + <nl> + Variant HHVM_FUNCTION ( readgzfile , const String & filename , <nl> + int64_t use_include_path = 0 ) ; <nl> + Variant HHVM_FUNCTION ( gzfile , const String & filename , <nl> + int64_t use_include_path = 0 ) ; <nl> + Variant HHVM_FUNCTION ( gzcompress , const String & data , <nl> + int64_t level = - 1 ) ; <nl> + Variant HHVM_FUNCTION ( gzuncompress , const String & data , <nl> + int limit = 0 ) ; <nl> + Variant HHVM_FUNCTION ( gzdeflate , const String & data , int level = - 1 ) ; <nl> + Variant HHVM_FUNCTION ( gzinflate , const String & data , int limit = 0 ) ; <nl> + Variant HHVM_FUNCTION ( gzencode , const String & data , int level = - 1 , <nl> + int encoding_mode = k_FORCE_GZIP ) ; <nl> + Variant HHVM_FUNCTION ( gzdecode , const String & data , int limit = 0 ) ; <nl> + String HHVM_FUNCTION ( zlib_get_coding_type ) ; <nl> + # ifdef HAVE_QUICKLZ <nl> + Variant HHVM_FUNCTION ( qlzcompress , const String & data , int level = 1 ) ; <nl> + Variant HHVM_FUNCTION ( qlzuncompress , const String & data , int level = 1 ) ; <nl> + # endif <nl> + # ifdef HAVE_SNAPPY <nl> + Variant HHVM_FUNCTION ( sncompress , const String & data ) ; <nl> + Variant HHVM_FUNCTION ( snuncompress , const String & data ) ; <nl> + # endif <nl> + Variant HHVM_FUNCTION ( nzcompress , const String & uncompressed ) ; <nl> + Variant HHVM_FUNCTION ( nzuncompress , const String & compressed ) ; <nl> + Variant HHVM_FUNCTION ( lz4compress , const String & uncompressed ) ; <nl> + Variant HHVM_FUNCTION ( lz4hccompress , const String & uncompressed ) ; <nl> + Variant HHVM_FUNCTION ( lz4uncompress , const String & compressed ) ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / stream functions <nl> + <nl> + Variant HHVM_FUNCTION ( gzopen , const String & filename , const String & mode , <nl> + int64_t use_include_path = 0 ) ; <nl> + bool HHVM_FUNCTION ( gzclose , CResRef zp ) ; <nl> + Variant HHVM_FUNCTION ( gzread , CResRef zp , int64_t length = 0 ) ; <nl> + Variant HHVM_FUNCTION ( gzseek , CResRef zp , int64_t offset , <nl> + int64_t whence = k_SEEK_SET ) ; <nl> + Variant HHVM_FUNCTION ( gztell , CResRef zp ) ; <nl> + bool HHVM_FUNCTION ( gzeof , CResRef zp ) ; <nl> + bool HHVM_FUNCTION ( gzrewind , CResRef zp ) ; <nl> + Variant HHVM_FUNCTION ( gzgetc , CResRef zp ) ; <nl> + Variant HHVM_FUNCTION ( gzgets , CResRef zp , int64_t length = 1024 ) ; <nl> + Variant HHVM_FUNCTION ( gzgetss , CResRef zp , int64_t length = 0 , <nl> + const String & allowable_tags = null_string ) ; <nl> + Variant HHVM_FUNCTION ( gzpassthru , CResRef zp ) ; <nl> + Variant HHVM_FUNCTION ( gzwrite , CResRef zp , const String & str , <nl> + int64_t length = 0 ) ; <nl> + } <nl> + <nl> + # endif / / incl_HPHP_EXT_ZLIB_H_ <nl> new file mode 100644 <nl> index 00000000000 . . beb1b0861b6 <nl> mmm / dev / null <nl> ppp b / hphp / runtime / ext / zlib / ext_zlib . php <nl> <nl> + < ? hh <nl> + / / @ generated by docskel . php <nl> + <nl> + / * * <nl> + * Close an open gz - file pointer <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * <nl> + * @ return bool - <nl> + * / <nl> + < < __Native > > <nl> + function gzclose ( resource $ zp ) : bool ; <nl> + <nl> + / * * <nl> + * Compress a string <nl> + * <nl> + * @ param string $ data - The data to compress . <nl> + * @ param int $ level - The level of compression . Can be given as 0 for no <nl> + * compression up to 9 for maximum compression . If - 1 is used , the <nl> + * default compression of the zlib library is used which is 6 . <nl> + * <nl> + * @ return string - The compressed string or FALSE if an error occurred . <nl> + * / <nl> + < < __Native > > <nl> + function gzcompress ( string $ data , int $ level = - 1 ) : mixed ; <nl> + <nl> + / * * <nl> + * Decodes a gzip compressed string <nl> + * <nl> + * @ param string $ data - The data to decode , encoded by gzencode ( ) . <nl> + * @ param int $ length - The maximum length of data to decode . <nl> + * <nl> + * @ return string - The decoded string , or FALSE if an error occurred . <nl> + * / <nl> + < < __Native > > <nl> + function gzdecode ( string $ data , <nl> + int $ length = 0 ) : mixed ; <nl> + <nl> + / * * <nl> + * Deflate a string <nl> + * <nl> + * @ param string $ data - The data to deflate . <nl> + * @ param int $ level - The level of compression . Can be given as 0 for no <nl> + * compression up to 9 for maximum compression . If not given , the default <nl> + * compression level will be the default compression level of the zlib <nl> + * library . <nl> + * <nl> + * @ return string - The deflated string or FALSE if an error occurred . <nl> + * / <nl> + < < __Native > > <nl> + function gzdeflate ( string $ data , int $ level = - 1 ) : mixed ; <nl> + <nl> + / * * <nl> + * Create a gzip compressed string <nl> + * <nl> + * @ param string $ data - The data to encode . <nl> + * @ param int $ level - The level of compression . Can be given as 0 for no <nl> + * compression up to 9 for maximum compression . If not given , the default <nl> + * compression level will be the default compression level of the zlib <nl> + * library . <nl> + * @ param int $ encoding_mode - The encoding mode . Can be FORCE_GZIP ( the <nl> + * default ) or FORCE_DEFLATE . Prior to PHP 5 . 4 . 0 , using FORCE_DEFLATE <nl> + * results in a standard zlib deflated string ( inclusive zlib headers ) <nl> + * after a gzip file header but without the trailing crc32 checksum . In <nl> + * PHP 5 . 4 . 0 and later , FORCE_DEFLATE generates RFC 1950 compliant <nl> + * output , consisting of a zlib header , the deflated data , and an Adler <nl> + * checksum . <nl> + * <nl> + * @ return string - The encoded string , or FALSE if an error occurred . <nl> + * / <nl> + < < __Native > > <nl> + function gzencode ( string $ data , <nl> + int $ level = - 1 , <nl> + int $ encoding_mode = FORCE_GZIP ) : mixed ; <nl> + <nl> + / * * <nl> + * Test for on a gz - file pointer <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * <nl> + * @ return bool - Returns TRUE if the gz - file pointer is at EOF or an <nl> + * error occurs ; otherwise returns FALSE . <nl> + * / <nl> + < < __Native > > <nl> + function gzeof ( resource $ zp ) : bool ; <nl> + <nl> + / * * <nl> + * Read entire gz - file into an array <nl> + * <nl> + * @ param string $ filename - The file name . <nl> + * @ param int $ use_include_path - You can set this optional parameter to <nl> + * 1 , if you want to search for the file in the include_path too . <nl> + * <nl> + * @ return array - An array containing the file , one line per cell . <nl> + * / <nl> + < < __Native > > <nl> + function gzfile ( string $ filename , <nl> + int $ use_include_path = 0 ) : mixed ; <nl> + <nl> + / * * <nl> + * Get character from gz - file pointer <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * <nl> + * @ return string - The uncompressed character or FALSE on EOF ( unlike <nl> + * gzeof ( ) ) . <nl> + * / <nl> + < < __Native > > <nl> + function gzgetc ( resource $ zp ) : mixed ; <nl> + <nl> + / * * <nl> + * Get line from file pointer <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * @ param int $ length - The length of data to get . <nl> + * <nl> + * @ return string - The uncompressed string , or FALSE on error . <nl> + * / <nl> + < < __Native > > <nl> + function gzgets ( resource $ zp , <nl> + int $ length = 1024 ) : mixed ; <nl> + <nl> + / * * <nl> + * Get line from gz - file pointer and strip HTML tags <nl> + * <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * @ param int $ length - The length of data to get . <nl> + * @ param string $ allowable_tags - You can use this optional parameter to <nl> + * specify tags which should not be stripped . <nl> + * <nl> + * @ return string - The uncompressed and striped string , or FALSE on <nl> + * error . <nl> + * / <nl> + < < __Native > > <nl> + function gzgetss ( resource $ zp , <nl> + int $ length = 0 , <nl> + string $ allowable_tags = ' ' ) : mixed ; <nl> + <nl> + / * * <nl> + * Inflate a deflated string <nl> + * <nl> + * @ param string $ data - The data compressed by gzdeflate ( ) . <nl> + * @ param int $ length - The maximum length of data to decode . <nl> + * <nl> + * @ return string - The original uncompressed data or FALSE on error . <nl> + * The function will return an error if the uncompressed data is more <nl> + * than 32768 times the length of the compressed input data or more than <nl> + * the optional parameter length . <nl> + * / <nl> + < < __Native > > <nl> + function gzinflate ( string $ data , int $ length = 0 ) : mixed ; <nl> + <nl> + / * * <nl> + * Open gz - file <nl> + * <nl> + * @ param string $ filename - The file name . <nl> + * @ param string $ mode - As in fopen ( ) ( rb or wb ) but can also include a <nl> + * compression level ( wb9 ) or a strategy : f for filtered data as in wb6f , <nl> + * h for Huffman only compression as in wb1h . ( See the description of <nl> + * deflateInit2 in zlib . h for more information about the strategy <nl> + * parameter . ) <nl> + * @ param int $ use_include_path - You can set this optional parameter to <nl> + * 1 , if you want to search for the file in the include_path too . <nl> + * <nl> + * @ return resource - Returns a file pointer to the file opened , after <nl> + * that , everything you read from this file descriptor will be <nl> + * transparently decompressed and what you write gets compressed . If <nl> + * the open fails , the function returns FALSE . <nl> + * / <nl> + < < __Native > > <nl> + function gzopen ( string $ filename , <nl> + string $ mode , <nl> + int $ use_include_path = 0 ) : mixed ; <nl> + <nl> + / * * <nl> + * Output all remaining data on a gz - file pointer <nl> + * <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * <nl> + * @ return int - The number of uncompressed characters read from gz and <nl> + * passed through to the input , or FALSE on error . <nl> + * / <nl> + < < __Native > > <nl> + function gzpassthru ( resource $ zp ) : mixed ; <nl> + <nl> + / * * <nl> + * Alias of gzwrite ( ) <nl> + * / <nl> + function gzputs ( resource $ zp , string $ string , int $ length = 0 ) : mixed { <nl> + return gzwrite ( $ zp , $ string , $ length ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Binary - safe gz - file read <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * @ param int $ length - The number of bytes to read . <nl> + * <nl> + * @ return string - The data that have been read . <nl> + * / <nl> + < < __Native > > <nl> + function gzread ( resource $ zp , <nl> + int $ length = 0 ) : mixed ; <nl> + <nl> + / * * <nl> + * Rewind the position of a gz - file pointer <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * <nl> + * @ return bool - <nl> + * / <nl> + < < __Native > > <nl> + function gzrewind ( resource $ zp ) : bool ; <nl> + <nl> + / * * <nl> + * Seek on a gz - file pointer <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * @ param int $ offset - The seeked offset . <nl> + * @ param int $ whence - whence values are : SEEK_SET - Set position equal <nl> + * to offset bytes . SEEK_CUR - Set position to current location plus <nl> + * offset . If whence is not specified , it is assumed to be SEEK_SET . <nl> + * <nl> + * @ return int - Upon success , returns 0 ; otherwise , returns - 1 . Note <nl> + * that seeking past EOF is not considered an error . <nl> + * / <nl> + < < __Native > > <nl> + function gzseek ( resource $ zp , <nl> + int $ offset , <nl> + int $ whence = SEEK_SET ) : mixed ; <nl> + <nl> + / * * <nl> + * Tell gz - file pointer read / write position <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * <nl> + * @ return int - The position of the file pointer or FALSE if an error <nl> + * occurs . <nl> + * / <nl> + < < __Native > > <nl> + function gztell ( resource $ zp ) : mixed ; <nl> + <nl> + / * * <nl> + * Uncompress a compressed string <nl> + * <nl> + * @ param string $ data - The data compressed by gzcompress ( ) . <nl> + * @ param int $ length - The maximum length of data to decode . <nl> + * <nl> + * @ return string - The original uncompressed data or FALSE on error . <nl> + * The function will return an error if the uncompressed data is more <nl> + * than 32768 times the length of the compressed input data or more than <nl> + * the optional parameter length . <nl> + * / <nl> + < < __Native > > <nl> + function gzuncompress ( string $ data , int $ length = 0 ) : mixed ; <nl> + <nl> + / * * <nl> + * Binary - safe gz - file write <nl> + * <nl> + * @ param resource $ zp - The gz - file pointer . It must be valid , and must <nl> + * point to a file successfully opened by gzopen ( ) . <nl> + * @ param string $ string - The string to write . <nl> + * @ param int $ length - The number of uncompressed bytes to write . If <nl> + * supplied , writing will stop after length ( uncompressed ) bytes have <nl> + * been written or the end of string is reached , whichever comes first . <nl> + * Note that if the length argument is given , then the <nl> + * magic_quotes_runtime configuration option will be ignored and no <nl> + * slashes will be stripped from string . <nl> + * <nl> + * @ return int - Returns the number of ( uncompressed ) bytes written to <nl> + * the given gz - file stream . <nl> + * / <nl> + < < __Native > > <nl> + function gzwrite ( resource $ zp , <nl> + string $ string , <nl> + int $ length = 0 ) : mixed ; <nl> + <nl> + / * * <nl> + * Output a gz - file <nl> + * <nl> + * @ param string $ filename - The file name . This file will be opened from <nl> + * the filesystem and its contents written to standard output . <nl> + * @ param int $ use_include_path - You can set this optional parameter to <nl> + * 1 , if you want to search for the file in the include_path too . <nl> + * <nl> + * @ return int - Returns the number of ( uncompressed ) bytes read from the <nl> + * file . If an error occurs , FALSE is returned and unless the function <nl> + * was called as @ readgzfile , an error message is printed . <nl> + * / <nl> + < < __Native > > <nl> + function readgzfile ( string $ filename , <nl> + int $ use_include_path = 0 ) : mixed ; <nl> + <nl> + / * * <nl> + * This function compresses the given string using the nzlib data format , which <nl> + * is primarily used for compressing and uncompressing memcache values . <nl> + * <nl> + * @ param string $ uncompressed - The uncompressed data <nl> + * <nl> + * @ return string - The compressed data , or FALSE on error <nl> + * / <nl> + < < __Native , __HipHopSpecific > > <nl> + function nzcompress ( string $ uncompressed ) : mixed ; <nl> + <nl> + / * * <nl> + * This function uncompresses the given string given that it is in the nzlib <nl> + * data format , which is primarily used for compressing and uncompressing <nl> + * memcache values <nl> + * <nl> + * @ param string $ compressed - The data compressed by nzcompress ( ) . <nl> + * <nl> + * @ return string - The uncompressed data or FALSE on error <nl> + * / <nl> + < < __Native , __HipHopSpecific > > <nl> + function nzuncompress ( string $ compressed ) : mixed ; <nl> + <nl> + / * * <nl> + * This function compresses the given string using the lz4lib data format , which <nl> + * is primarily used for compressing and uncompressing memcache values . <nl> + * <nl> + * @ param string $ uncompressed - The uncompressed data <nl> + * <nl> + * @ return string - The compressed data , or FALSE on error <nl> + * / <nl> + < < __Native , __HipHopSpecific > > <nl> + function lz4compress ( string $ uncompressed ) : mixed ; <nl> + <nl> + / * * <nl> + * This function compresses the given string using the lz4lib data format , which <nl> + * is primarily used for compressing and uncompressing memcache values . <nl> + * <nl> + * @ param string $ uncompressed - The uncompressed data <nl> + * <nl> + * @ return string - The compressed data , or FALSE on error <nl> + * / <nl> + < < __Native , __HipHopSpecific > > <nl> + function lz4hccompress ( string $ uncompressed ) : mixed ; <nl> + <nl> + / * * <nl> + * This function uncompresses the given string given that it is in the lz4lib <nl> + * data format , which is primarily used for compressing and uncompressing <nl> + * memcache values <nl> + * <nl> + * @ param string $ compressed - The data compressed by lz4compress ( ) . <nl> + * <nl> + * @ return string - The uncompressed data or FALSE on error <nl> + * / <nl> + < < __Native , __HipHopSpecific > > <nl> + function lz4uncompress ( string $ compressed ) : mixed ; <nl> similarity index 100 % <nl> rename from hphp / runtime / ext / quicklz . h <nl> rename to hphp / runtime / ext / zlib / quicklz . h <nl> similarity index 99 % <nl> rename from hphp / runtime / ext / quicklz . inc <nl> rename to hphp / runtime / ext / zlib / quicklz . inc <nl> mmm a / hphp / runtime / ext / quicklz . inc <nl> ppp b / hphp / runtime / ext / zlib / quicklz . inc <nl> size_t qlz_compress ( const void * source , char * destination , size_t size , qlz_stat <nl> memcpy ( src , source , size ) ; <nl> r = base + qlz_compress_core ( src , ( unsigned char * ) destination + base , size , state ) ; <nl> <nl> - if ( r = = base ) <nl> + if ( r = = base ) <nl> { <nl> memcpy ( destination + base , src , size ) ; <nl> r = size + base ; <nl> size_t qlz_decompress ( const char * source , void * destination , qlz_state_decompres <nl> # endif <nl> return dsiz ; <nl> } <nl> - <nl> similarity index 98 % <nl> rename from hphp / runtime / base / zip - file . cpp <nl> rename to hphp / runtime / ext / zlib / zip - file . cpp <nl> mmm a / hphp / runtime / base / zip - file . cpp <nl> ppp b / hphp / runtime / ext / zlib / zip - file . cpp <nl> <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> * / <nl> <nl> - # include " hphp / runtime / base / zip - file . h " <nl> + # include " hphp / runtime / ext / zlib / zip - file . h " <nl> # include " hphp / runtime / base / complex - types . h " <nl> # include " hphp / runtime / base / runtime - error . h " <nl> <nl> similarity index 100 % <nl> rename from hphp / runtime / base / zip - file . h <nl> rename to hphp / runtime / ext / zlib / zip - file . h <nl> mmm a / hphp / system / idl / constants . idl . json <nl> ppp b / hphp / system / idl / constants . idl . json <nl> <nl> " name " : " FNM_PERIOD " , <nl> " value " : 4 <nl> } , <nl> - { <nl> - " name " : " FORCE_DEFLATE " , <nl> - " value " : 2 <nl> - } , <nl> - { <nl> - " name " : " FORCE_GZIP " , <nl> - " value " : 1 <nl> - } , <nl> { <nl> " name " : " FT_INTERNAL " , <nl> " value " : 8 <nl> deleted file mode 100644 <nl> index c32c9705203 . . 00000000000 <nl> mmm a / hphp / system / idl / zlib . idl . json <nl> ppp / dev / null <nl> <nl> - { <nl> - " preamble " : " " , <nl> - " consts " : [ <nl> - ] , <nl> - " funcs " : [ <nl> - { <nl> - " name " : " readgzfile " , <nl> - " desc " : " Reads a file , decompresses it and writes it to standard output . \ n \ nreadgzfile ( ) can be used to read a file which is not in gzip format ; in this case readgzfile ( ) will directly read from the file without decompression . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " Returns the number of ( uncompressed ) bytes read from the file . If an error occurs , FALSE is returned and unless the function was called as @ readgzfile , an error message is printed . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " filename " , <nl> - " type " : " String " , <nl> - " desc " : " The file name . This file will be opened from the filesystem and its contents written to standard output . " <nl> - } , <nl> - { <nl> - " name " : " use_include_path " , <nl> - " type " : " Boolean " , <nl> - " value " : " false " , <nl> - " desc " : " You can set this optional parameter to 1 , if you want to search for the file in the include_path too . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzfile " , <nl> - " desc " : " This function is identical to readgzfile ( ) , except that it returns the file in an array . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " An array containing the file , one line per cell . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " filename " , <nl> - " type " : " String " , <nl> - " desc " : " The file name . " <nl> - } , <nl> - { <nl> - " name " : " use_include_path " , <nl> - " type " : " Boolean " , <nl> - " value " : " false " , <nl> - " desc " : " You can set this optional parameter to 1 , if you want to search for the file in the include_path too . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzcompress " , <nl> - " desc " : null , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The compressed string or FALSE if an error occurred . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " data " , <nl> - " type " : " String " , <nl> - " desc " : " The data to compress . " <nl> - } , <nl> - { <nl> - " name " : " level " , <nl> - " type " : " Int32 " , <nl> - " value " : " - 1 " , <nl> - " desc " : " The level of compression . Can be given as 0 for no compression up to 9 for maximum compression . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzuncompress " , <nl> - " desc " : " This function uncompress a compressed string . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The original uncompressed data or FALSE on error . \ n \ nThe function will return an error if the uncompressed data is more than 32768 times the length of the compressed input data or more than the optional parameter length . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " data " , <nl> - " type " : " String " , <nl> - " desc " : " The data compressed by gzcompress ( ) . " <nl> - } , <nl> - { <nl> - " name " : " limit " , <nl> - " type " : " Int32 " , <nl> - " value " : " 0 " , <nl> - " desc " : " The maximum length of data to decode . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzdeflate " , <nl> - " desc " : null , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The deflated string or FALSE if an error occurred . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " data " , <nl> - " type " : " String " , <nl> - " desc " : " The data to deflate . " <nl> - } , <nl> - { <nl> - " name " : " level " , <nl> - " type " : " Int32 " , <nl> - " value " : " - 1 " , <nl> - " desc " : " The level of compression . Can be given as 0 for no compression up to 9 for maximum compression . If not given , the default compression level will be the default compression level of the zlib library . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzinflate " , <nl> - " desc " : " This function inflate a deflated string . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The original uncompressed data or FALSE on error . \ n \ nThe function will return an error if the uncompressed data is more than 32768 times the length of the compressed input data or more than the optional parameter length . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " data " , <nl> - " type " : " String " , <nl> - " desc " : " The data compressed by gzdeflate ( ) . " <nl> - } , <nl> - { <nl> - " name " : " limit " , <nl> - " type " : " Int32 " , <nl> - " value " : " 0 " , <nl> - " desc " : " The maximum length of data to decode . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzencode " , <nl> - " desc " : null , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The encoded string , or FALSE if an error occurred . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " data " , <nl> - " type " : " String " , <nl> - " desc " : " The data to encode . " <nl> - } , <nl> - { <nl> - " name " : " level " , <nl> - " type " : " Int32 " , <nl> - " value " : " - 1 " , <nl> - " desc " : " The level of compression . Can be given as 0 for no compression up to 9 for maximum compression . If not given , the default compression level will be the default compression level of the zlib library . " <nl> - } , <nl> - { <nl> - " name " : " encoding_mode " , <nl> - " type " : " Int32 " , <nl> - " value " : " k_FORCE_GZIP " , <nl> - " desc " : " The encoding mode . Can be FORCE_GZIP ( the default ) or FORCE_DEFLATE . \ n \ nIf you use FORCE_DEFLATE , you get a standard zlib deflated string ( inclusive zlib headers ) after the gzip file header but without the trailing crc32 checksum . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzdecode " , <nl> - " desc " : " This function returns a decoded version of the input data . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The decoded string , or FALSE if an error occurred . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " data " , <nl> - " type " : " String " , <nl> - " desc " : " The data to decode , encoded by gzencode ( ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " zlib_get_coding_type " , <nl> - " desc " : " Returns the coding type used for output compression . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " String " , <nl> - " desc " : " Possible return values are gzip , deflate , or FALSE . " <nl> - } , <nl> - " args " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzopen " , <nl> - " desc " : " Opens a gzip ( . gz ) file for reading or writing . \ n \ ngzopen ( ) can be used to read a file which is not in gzip format ; in this case gzread ( ) will directly read from the file without decompression . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Resource " , <nl> - " desc " : " Returns a file pointer to the file opened , after that , everything you read from this file descriptor will be transparently decompressed and what you write gets compressed . \ n \ nIf the open fails , the function returns FALSE . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " filename " , <nl> - " type " : " String " , <nl> - " desc " : " The file name . " <nl> - } , <nl> - { <nl> - " name " : " mode " , <nl> - " type " : " String " , <nl> - " desc " : " As in fopen ( ) ( rb or wb ) but can also include a compression level ( wb9 ) or a strategy : f for filtered data as in wb6f , h for Huffman only compression as in wb1h . ( See the description of deflateInit2 in zlib . h for more information about the strategy parameter . ) " <nl> - } , <nl> - { <nl> - " name " : " use_include_path " , <nl> - " type " : " Boolean " , <nl> - " value " : " false " , <nl> - " desc " : " You can set this optional parameter to 1 , if you want to search for the file in the include_path too . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzclose " , <nl> - " desc " : " Closes the given gz - file pointer . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Boolean " , <nl> - " desc " : " Returns TRUE on success or FALSE on failure . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzrewind " , <nl> - " desc " : " Sets the file position indicator of the given gz - file pointer to the beginning of the file stream . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Boolean " , <nl> - " desc " : " Returns TRUE on success or FALSE on failure . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzeof " , <nl> - " desc " : " Tests the given GZ file pointer for EOF . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Boolean " , <nl> - " desc " : " Returns TRUE if the gz - file pointer is at EOF or an error occurs ; otherwise returns FALSE . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzgetc " , <nl> - " desc " : " Returns a string containing a single ( uncompressed ) character read from the given gz - file pointer . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The uncompressed character or FALSE on EOF ( unlike gzeof ( ) ) . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzgets " , <nl> - " desc " : " Gets a ( uncompressed ) string of up to length - 1 bytes read from the given file pointer . Reading ends when length - 1 bytes have been read , on a newline , or on EOF ( whichever comes first ) . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The uncompressed string , or FALSE on error . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } , <nl> - { <nl> - " name " : " length " , <nl> - " type " : " Int64 " , <nl> - " value " : " 1024 " , <nl> - " desc " : " The length of data to get . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzgetss " , <nl> - " desc " : " Identical to gzgets ( ) , except that gzgetss ( ) attempts to strip any HTML and PHP tags from the text it reads . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The uncompressed and striped string , or FALSE on error . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } , <nl> - { <nl> - " name " : " length " , <nl> - " type " : " Int64 " , <nl> - " value " : " 0 " , <nl> - " desc " : " The length of data to get . " <nl> - } , <nl> - { <nl> - " name " : " allowable_tags " , <nl> - " type " : " String " , <nl> - " value " : " null_string " , <nl> - " desc " : " You can use this optional parameter to specify tags which should not be stripped . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzread " , <nl> - " desc " : " gzread ( ) reads up to length bytes from the given gz - file pointer . Reading stops when length ( uncompressed ) bytes have been read or EOF is reached , whichever comes first . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The data that have been read . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } , <nl> - { <nl> - " name " : " length " , <nl> - " type " : " Int64 " , <nl> - " value " : " 0 " , <nl> - " desc " : " The number of bytes to read . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzpassthru " , <nl> - " desc " : " Reads to EOF on the given gz - file pointer from the current position and writes the ( uncompressed ) results to standard output . \ n \ nYou may need to call gzrewind ( ) to reset the file pointer to the beginning of the file if you have already written data to it . Tip \ n \ nIf you just want to dump the contents of a file to the output buffer , without first modifying it or seeking to a particular offset , you may want to use the readgzfile ( ) function , which saves you the gzopen ( ) call . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The number of uncompressed characters read from gz and passed through to the input , or FALSE on error . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzseek " , <nl> - " desc " : " Sets the file position indicator for the given file pointer to the given offset byte into the file stream . Equivalent to calling ( in C ) gzseek ( zp , offset , SEEK_SET ) . \ n \ nIf the file is opened for reading , this function is emulated but can be extremely slow . If the file is opened for writing , only forward seeks are supported ; gzseek ( ) then compresses a sequence of zeroes up to the new starting position . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " Upon success , returns 0 ; otherwise , returns - 1 . Note that seeking past EOF is not considered an error . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } , <nl> - { <nl> - " name " : " offset " , <nl> - " type " : " Int64 " , <nl> - " desc " : " The seeked offset . " <nl> - } , <nl> - { <nl> - " name " : " whence " , <nl> - " type " : " Int64 " , <nl> - " value " : " k_SEEK_SET " , <nl> - " desc " : " whence values are : SEEK_SET - Set position equal to offset bytes . SEEK_CUR - Set position to current location plus offset . \ n \ nIf whence is not specified , it is assumed to be SEEK_SET . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gztell " , <nl> - " desc " : " Gets the position of the given file pointer ; i . e . , its offset into the uncompressed file stream . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The position of the file pointer or FALSE if an error occurs . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzwrite " , <nl> - " desc " : " gzwrite ( ) writes the contents of string to the given gz - file . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " Returns the number of ( uncompressed ) bytes written to the given gz - file stream . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " , <nl> - " desc " : " The gz - file pointer . It must be valid , and must point to a file successfully opened by gzopen ( ) . " <nl> - } , <nl> - { <nl> - " name " : " str " , <nl> - " type " : " String " , <nl> - " desc " : " The string to write . " <nl> - } , <nl> - { <nl> - " name " : " length " , <nl> - " type " : " Int64 " , <nl> - " value " : " 0 " , <nl> - " desc " : " The number of uncompressed bytes to write . If supplied , writing will stop after length ( uncompressed ) bytes have been written or the end of string is reached , whichever comes first . \ n \ nNote that if the length argument is given , then the magic_quotes_runtime configuration option will be ignored and no slashes will be stripped from string . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " gzputs " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " zp " , <nl> - " type " : " Resource " <nl> - } , <nl> - { <nl> - " name " : " str " , <nl> - " type " : " String " <nl> - } , <nl> - { <nl> - " name " : " length " , <nl> - " type " : " Int64 " , <nl> - " value " : " 0 " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " qlzcompress " , <nl> - " desc " : " This function compress the given string using the QuickLZ data format . \ n \ nFor details on the QuickLZ compression algorithm go to http : \ / \ / www . quicklz . com \ / ( RFC 1950 ) . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The compressed string or FALSE if an error occurred . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " data " , <nl> - " type " : " String " , <nl> - " desc " : " The data to compress . " <nl> - } , <nl> - { <nl> - " name " : " level " , <nl> - " type " : " Int32 " , <nl> - " value " : " 1 " , <nl> - " desc " : " The level of compression . Can be given as 1 , 2 or 3 . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " qlzuncompress " , <nl> - " desc " : " This function uncompress a compressed string . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The original uncompressed data or FALSE on error . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " data " , <nl> - " type " : " String " , <nl> - " desc " : " The data compressed by qlzcompress ( ) . " <nl> - } , <nl> - { <nl> - " name " : " level " , <nl> - " type " : " Int32 " , <nl> - " value " : " 1 " , <nl> - " desc " : " The level of compression . Can be given as 1 , 2 or 3 . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " sncompress " , <nl> - " desc " : " This function compress the given string using the Snappy data format . \ n \ nFor details on the Snappy compression algorithm go to http : \ / \ / code . google . com \ / p \ / snappy \ / . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The compressed string or FALSE if an error occurred . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " data " , <nl> - " type " : " String " , <nl> - " desc " : " The data to compress . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " snuncompress " , <nl> - " desc " : " This function uncompress a compressed string . " , <nl> - " flags " : [ <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The compressed string or FALSE if an error occurred . " <nl> - } , <nl> - " args " : [ <nl> - { <nl> - " name " : " data " , <nl> - " type " : " String " , <nl> - " desc " : " The data compressed by sncompress ( ) . " <nl> - } <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " nzcompress " , <nl> - " desc " : " This function compresses the given string using the nzlib data format , which is primarily used for compressing and uncompressing memcache values " , <nl> - " args " : [ <nl> - { <nl> - " name " : " uncompressed " , <nl> - " type " : " String " , <nl> - " desc " : " The uncompressed data " <nl> - } <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The compressed data , or FALSE on error . " <nl> - } , <nl> - " flags " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " nzuncompress " , <nl> - " desc " : " This function uncompresses the given string given that it is in the nzlib data format , which is primarily used for compressing and uncompressing memcache values " , <nl> - " args " : [ <nl> - { <nl> - " name " : " compressed " , <nl> - " type " : " String " , <nl> - " desc " : " The data compressed by nzcompress ( ) . " <nl> - } <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The uncompressed data , or FALSE on error " <nl> - } , <nl> - " flags " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " lz4compress " , <nl> - " desc " : " This function compresses the given string using the lz4lib data format , which is primarily used for compressing and uncompressing memcache values " , <nl> - " args " : [ <nl> - { <nl> - " name " : " uncompressed " , <nl> - " type " : " String " , <nl> - " desc " : " The uncompressed data " <nl> - } <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The compressed data , or FALSE on error . " <nl> - } , <nl> - " flags " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " lz4hccompress " , <nl> - " desc " : " This function compresses the given string using the lz4lib data format , which is primarily used for compressing and uncompressing memcache values " , <nl> - " args " : [ <nl> - { <nl> - " name " : " uncompressed " , <nl> - " type " : " String " , <nl> - " desc " : " The uncompressed data " <nl> - } <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The compressed data , or FALSE on error . " <nl> - } , <nl> - " flags " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " lz4uncompress " , <nl> - " desc " : " This function uncompresses the given string given that it is in the lz4lib data format , which is primarily used for compressing and uncompressing memcache values " , <nl> - " args " : [ <nl> - { <nl> - " name " : " compressed " , <nl> - " type " : " String " , <nl> - " desc " : " The data compressed by lz4compress ( ) . " <nl> - } <nl> - ] , <nl> - " return " : { <nl> - " type " : " Variant " , <nl> - " desc " : " The uncompressed data , or FALSE on error " <nl> - } , <nl> - " flags " : [ <nl> - ] <nl> - } <nl> - ] , <nl> - " classes " : [ <nl> - ] <nl> - } <nl> \ No newline at end of file <nl> mmm a / hphp / test / ext / test_ext_curl . cpp <nl> ppp b / hphp / test / ext / test_ext_curl . cpp <nl> <nl> # include " hphp / test / ext / test_ext_curl . h " <nl> # include " hphp / runtime / ext / ext_curl . h " <nl> # include " hphp / runtime / ext / ext_output . h " <nl> - # include " hphp / runtime / ext / ext_zlib . h " <nl> + # include " hphp / runtime / ext / zlib / ext_zlib . h " <nl> # include " hphp / runtime / server / libevent - server . h " <nl> <nl> # define PORT_MIN 7100 <nl> mmm a / hphp / tools / license . php <nl> ppp b / hphp / tools / license . php <nl> <nl> ' util / cronoutils . h ' , <nl> ' util / cronoutils . cpp ' , <nl> ' vixl / ' , <nl> - ' runtime / ext / quicklz . h ' , <nl> - ' runtime / ext / quicklz . inc ' , <nl> + ' runtime / ext / zlib / quicklz . h ' , <nl> + ' runtime / ext / zlib / quicklz . inc ' , <nl> ' facebook ' , <nl> ' submodules ' , <nl> <nl>
Convert ext / zlib to HNI
facebook/hhvm
a9c43f1b82cc741ebbca114fd344dc88dc93e744
2014-01-28T17:17:55Z
mmm a / Vagrantfile <nl> ppp b / Vagrantfile <nl> Vagrant . configure ( 2 ) do | config | <nl> v . memory = ` grep ' MemTotal ' / proc / meminfo | sed - e ' s / MemTotal : / / ' - e ' s / kB / / ' ` . to_i / 1024 / 2 <nl> end <nl> <nl> - config . vm . synced_folder " . " , " / home / vagrant / proton " , type : " rsync " , rsync__exclude : [ " / output / " ] , rsync__args : [ " - - verbose " , " - - archive " , " - z " , " - - links " , " - - update " ] <nl> + config . vm . synced_folder " . / vagrant_share / " , " / vagrant / " , id : " share " , create : true <nl> + config . vm . synced_folder " . " , " / home / vagrant / proton " , id : " proton " , type : " rsync " , rsync__exclude : [ " / output / " , " vagrant_share " ] , rsync__args : [ " - - verbose " , " - - archive " , " - z " , " - - links " , " - - update " ] <nl> <nl> config . vm . provision " shell " , privileged : " true " , inline : < < - SHELL <nl> dpkg - - add - architecture i386 <nl>
Vagrantfile : Add / vagrant mount point
ValveSoftware/Proton
9b5b0d36e6b8bc8a66be10147bbc39f96ab3709d
2018-11-05T16:17:03Z
mmm a / PowerEditor / src / MISC / Common / Common . cpp <nl> ppp b / PowerEditor / src / MISC / Common / Common . cpp <nl> <nl> <nl> WcharMbcsConvertor * WcharMbcsConvertor : : _pSelf = new WcharMbcsConvertor ; <nl> <nl> - void systemMessage ( const TCHAR * title ) <nl> - { <nl> - LPVOID lpMsgBuf ; <nl> - FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS , <nl> - NULL , <nl> - : : GetLastError ( ) , <nl> - MAKELANGID ( LANG_NEUTRAL , SUBLANG_DEFAULT ) , / / Default language <nl> - ( LPTSTR ) & lpMsgBuf , <nl> - 0 , <nl> - NULL ) ; / / Process any inserts in lpMsgBuf . <nl> - MessageBox ( NULL , ( LPTSTR ) lpMsgBuf , title , MB_OK | MB_ICONSTOP ) ; <nl> - : : LocalFree ( lpMsgBuf ) ; <nl> - } <nl> - <nl> void printInt ( int int2print ) <nl> { <nl> TCHAR str [ 32 ] ; <nl> mmm a / PowerEditor / src / MISC / Common / Common . h <nl> ppp b / PowerEditor / src / MISC / Common / Common . h <nl> typedef std : : basic_string < TCHAR > generic_string ; <nl> <nl> void folderBrowser ( HWND parent , int outputCtrlID , const TCHAR * defaultStr = NULL ) ; <nl> <nl> - void systemMessage ( const TCHAR * title ) ; <nl> - / / DWORD ShortToLongPathName ( LPCTSTR lpszShortPath , LPTSTR lpszLongPath , DWORD cchBuffer ) ; <nl> void printInt ( int int2print ) ; <nl> void printStr ( const TCHAR * str2print ) ; <nl> <nl> void writeLog ( const TCHAR * logFileName , const char * log2write ) ; <nl> int filter ( unsigned int code , struct _EXCEPTION_POINTERS * ep ) ; <nl> - / / int getCpFromStringValue ( const char * encodingStr ) ; <nl> generic_string purgeMenuItemString ( const TCHAR * menuItemStr , bool keepAmpersand = false ) ; <nl> std : : vector < generic_string > tokenizeString ( const generic_string & tokenString , const char delim ) ; <nl> <nl> mmm a / PowerEditor / src / MISC / Process / Process . cpp <nl> ppp b / PowerEditor / src / MISC / Process / Process . cpp <nl> BOOL Process : : run ( ) <nl> try { <nl> / / Create stdout pipe <nl> if ( ! : : CreatePipe ( & _hPipeOutR , & hPipeOutW , & sa , 0 ) ) <nl> - error ( TEXT ( " CreatePipe " ) , result , 1000 ) ; <nl> + throw std : : runtime_error ( " Create stdout pipe failed " ) ; <nl> <nl> / / Create stderr pipe <nl> if ( ! : : CreatePipe ( & _hPipeErrR , & hPipeErrW , & sa , 0 ) ) <nl> - error ( TEXT ( " CreatePipe " ) , result , 1001 ) ; <nl> + throw std : : runtime_error ( " Create stderr pipe failed " ) ; <nl> <nl> STARTUPINFO startup ; <nl> PROCESS_INFORMATION procinfo ; <nl> BOOL Process : : run ( ) <nl> _hProcessThread = procinfo . hThread ; <nl> <nl> if ( ! started ) <nl> - error ( TEXT ( " CreateProcess " ) , result , 1002 ) ; <nl> + throw std : : runtime_error ( " CreateProcess function call failed " ) ; <nl> <nl> if ( _type = = CONSOLE_PROG ) <nl> { <nl> hListenerEvent [ 0 ] = : : CreateEvent ( NULL , FALSE , FALSE , TEXT ( " listenerEvent " ) ) ; <nl> if ( ! hListenerEvent [ 0 ] ) <nl> - error ( TEXT ( " CreateEvent " ) , result , 1003 ) ; <nl> + throw std : : runtime_error ( " Create listenerEvent failed " ) ; <nl> <nl> hListenerEvent [ 1 ] = : : CreateEvent ( NULL , FALSE , FALSE , TEXT ( " listenerStdErrEvent " ) ) ; <nl> if ( ! hListenerEvent [ 1 ] ) <nl> - error ( TEXT ( " CreateEvent " ) , result , 1004 ) ; <nl> + throw std : : runtime_error ( " Create listenerStdErrEvent failed " ) ; <nl> <nl> <nl> / / The process is running so we set this to FALSE <nl> BOOL Process : : run ( ) <nl> <nl> hWaitForProcessEndThread = : : CreateThread ( NULL , 0 , staticWaitForProcessEnd , this , 0 , NULL ) ; <nl> if ( ! hWaitForProcessEndThread ) <nl> - error ( TEXT ( " CreateThread " ) , result , 1005 ) ; <nl> + throw std : : runtime_error ( " CreateThread for staticWaitForProcessEnd failed " ) ; <nl> <nl> hListenerStdOutThread = : : CreateThread ( NULL , 0 , staticListenerStdOut , this , 0 , NULL ) ; <nl> if ( ! hListenerStdOutThread ) <nl> - error ( TEXT ( " CreateThread " ) , result , 1006 ) ; <nl> + throw std : : runtime_error ( " CreateThread for staticListenerStdOut failed " ) ; <nl> <nl> hListenerStdErrThread = : : CreateThread ( NULL , 0 , staticListenerStdErr , this , 0 , NULL ) ; <nl> if ( ! hListenerStdErrThread ) <nl> - error ( TEXT ( " CreateThread " ) , result , 1007 ) ; <nl> + throw std : : runtime_error ( " CreateThread for staticListenerStdErr failed " ) ; <nl> <nl> / / We wait until the process is over <nl> / / TO DO : This should be a bit secured in case something happen and the <nl> void Process : : listenerStdOut ( ) <nl> <nl> if ( ! : : SetEvent ( hListenerEvent ) ) <nl> { <nl> - systemMessage ( TEXT ( " Thread listenerStdOut " ) ) ; <nl> + : : MessageBox ( NULL , TEXT ( " SetEvent function call failed " ) , TEXT ( " Thread listenerStdOut " ) , MB_OK ) ; <nl> } <nl> } <nl> <nl> void Process : : listenerStdErr ( ) <nl> <nl> if ( ! : : SetEvent ( hListenerEvent ) ) <nl> { <nl> - systemMessage ( TEXT ( " Thread stdout listener " ) ) ; <nl> + : : MessageBox ( NULL , TEXT ( " SetEvent function call failed " ) , TEXT ( " Thread stdout listener " ) , MB_OK ) ; <nl> } <nl> } <nl> <nl> void Process : : waitForProcessEnd ( ) <nl> <nl> _bProcessEnd = TRUE ; <nl> } <nl> - <nl> - void Process : : error ( const TCHAR * txt2display , BOOL & returnCode , int errCode ) <nl> - { <nl> - systemMessage ( txt2display ) ; <nl> - returnCode = FALSE ; <nl> - throw int ( errCode ) ; <nl> - } <nl> mmm a / PowerEditor / src / ScitillaComponent / Printer . cpp <nl> ppp b / PowerEditor / src / ScitillaComponent / Printer . cpp <nl> size_t Printer : : doPrint ( bool justDoIt ) <nl> lengthDoc = lengthDocMax ; <nl> } <nl> <nl> - RangeToFormat frPrint ; <nl> + NPP_RangeToFormat frPrint ; <nl> frPrint . hdc = _pdlg . hDC ; <nl> frPrint . hdcTarget = _pdlg . hDC ; <nl> frPrint . rc . left = rectMargins . left - rectPhysMargins . left ; <nl> mmm a / PowerEditor / src / ScitillaComponent / Printer . h <nl> ppp b / PowerEditor / src / ScitillaComponent / Printer . h <nl> <nl> # endif / / SCINTILLA_EDIT_VIEW_H <nl> <nl> <nl> - struct RangeToFormat { <nl> + struct NPP_RangeToFormat { <nl> HDC hdc ; <nl> HDC hdcTarget ; <nl> RECT rc ; <nl> mmm a / PowerEditor / src / WinControls / ColourPicker / ColourPicker . cpp <nl> ppp b / PowerEditor / src / WinControls / ColourPicker / ColourPicker . cpp <nl> void ColourPicker : : init ( HINSTANCE hInst , HWND parent ) <nl> ( LPVOID ) 0 ) ; <nl> if ( ! _hSelf ) <nl> { <nl> - systemMessage ( TEXT ( " System Err " ) ) ; <nl> throw std : : runtime_error ( " ColourPicker : : init : CreateWindowEx ( ) function return null " ) ; <nl> } <nl> <nl> mmm a / PowerEditor / visual . net / notepadPlus . vcproj <nl> ppp b / PowerEditor / visual . net / notepadPlus . vcproj <nl> <nl> RuntimeLibrary = " 1 " <nl> UsePrecompiledHeader = " 1 " <nl> PrecompiledHeaderThrough = " precompiledHeaders . h " <nl> - PrecompiledHeaderFile = " " <nl> + PrecompiledHeaderFile = " $ ( IntDir ) \ $ ( TargetName ) . pch " <nl> WarningLevel = " 4 " <nl> WarnAsError = " true " <nl> Detect64BitPortabilityProblems = " false " <nl> mmm a / readmeFirst . txt <nl> ppp b / readmeFirst . txt <nl> Notepad + + is a free ( as in " free speech " and also as in " free beer " ) source code <nl> To build Notepad + + package from source code : <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> - For generating the executable file ( notepad + + . exe ) , you can use Visual Studio 2005 or MinGW 3 . 0 / 2 . X ( a makefile is available , but not maintained ) . <nl> - A CMakeLists . txt ( located in the PowerEditor \ src directory ) is available ( but not maintained anymore ) for generating the different VC project and MinGW makefile via cmake . <nl> - <nl> - For generating the the dll file ( SciLexer . dll ) , you have 2 choices : VC + + 6 ( from v2 . 5 ) or MinGW 3 . 0 / 2 . X <nl> + There should be several ways to generate Notepad + + binaries , here we show you only the way with which Notepad + + official releases are generated . <nl> + * notepad + + . exe : Visual Studio 2005 <nl> + * SciLexer . dll : VC + + 6 <nl> <nl> Notepad + + Unicode release binary ( notepad + + . exe ) and Scintilla release binary ( SciLexer . dll ) will be built in the directories " notepad + + \ trunk \ PowerEditor \ bin " and " notepad + + \ trunk \ scintilla \ bin " respectively . <nl> You have to copy SciLexer . dll in " notepad + + \ PowerEditor \ bin " in order to launch notepad + + . exe <nl> <nl> <nl> Go to Notepad + + official site for more information : <nl> - http : / / notepad - plus . sourceforge . net / <nl> + http : / / notepad - plus - plus . org / <nl> <nl> <nl> Notepad + + team <nl> - http : / / sourceforge . net / project / memberlist . php ? group_id = 95717 <nl> + http : / / notepad - plus - plus . org / members / <nl>
[ UPDATE ] Update the readmeFirst . txt for the build information .
notepad-plus-plus/notepad-plus-plus
e0773602b25363e01e873aea6f2615ed7922b851
2010-07-18T12:38:27Z
mmm a / src / net . cpp <nl> ppp b / src / net . cpp <nl> bool CNode : : Misbehaving ( int howmuch ) <nl> { <nl> if ( addr . IsLocal ( ) ) <nl> { <nl> - printf ( " Warning : local node % s misbehaving \ n " , addrName . c_str ( ) ) ; <nl> + printf ( " Warning : local node % s misbehaving ( delta : % d ) \ n " , addrName . c_str ( ) , howmuch ) ; <nl> return false ; <nl> } <nl> <nl> bool CNode : : Misbehaving ( int howmuch ) <nl> if ( nMisbehavior > = GetArg ( " - banscore " , 100 ) ) <nl> { <nl> int64 banTime = GetTime ( ) + GetArg ( " - bantime " , 60 * 60 * 24 ) ; / / Default 24 - hour ban <nl> + printf ( " Misbehaving : % s ( % d - > % d ) DISCONNECTING \ n " , addr . ToString ( ) . c_str ( ) , nMisbehavior - howmuch , nMisbehavior ) ; <nl> { <nl> LOCK ( cs_setBanned ) ; <nl> if ( setBanned [ addr ] < banTime ) <nl> setBanned [ addr ] = banTime ; <nl> } <nl> CloseSocketDisconnect ( ) ; <nl> - printf ( " Disconnected % s for misbehavior ( score = % d ) \ n " , addrName . c_str ( ) , nMisbehavior ) ; <nl> return true ; <nl> - } <nl> + } else <nl> + printf ( " Misbehaving : % s ( % d - > % d ) \ n " , addr . ToString ( ) . c_str ( ) , nMisbehavior - howmuch , nMisbehavior ) ; <nl> return false ; <nl> } <nl> <nl>
Show when node is misbehaving , not just at the point that it gets banned .
bitcoin/bitcoin
90c838da9faca667a0809a44a7b6202772de04ec
2012-07-02T20:58:47Z
mmm a / atom / browser / api / atom_api_window . cc <nl> ppp b / atom / browser / api / atom_api_window . cc <nl> bool Window : : IsFullscreen ( ) { <nl> return window_ - > IsFullscreen ( ) ; <nl> } <nl> <nl> - void Window : : SetBounds ( mate : : Arguments * args ) { <nl> - gfx : : Rect rect ; <nl> + void Window : : SetBounds ( const gfx : : Rect & bounds , mate : : Arguments * args ) { <nl> bool animate = false ; <nl> - if ( ! args - > GetNext ( & rect ) | | <nl> - ( args - > Length ( ) = = 2 & & ! args - > GetNext ( & animate ) ) ) { <nl> - args - > ThrowError ( ) ; <nl> - return ; <nl> - } <nl> - window_ - > SetBounds ( rect , animate ) ; <nl> + args - > GetNext ( & animate ) ; <nl> + window_ - > SetBounds ( bounds , animate ) ; <nl> } <nl> <nl> gfx : : Rect Window : : GetBounds ( ) { <nl> return window_ - > GetBounds ( ) ; <nl> } <nl> <nl> - void Window : : SetSize ( mate : : Arguments * args ) { <nl> - int width = 0 , height = 0 ; <nl> + void Window : : SetSize ( int width , int height , mate : : Arguments * args ) { <nl> bool animate = false ; <nl> - if ( ! args - > GetNext ( & width ) | | ! args - > GetNext ( & height ) | | <nl> - ( args - > Length ( ) = = 3 & & ! args - > GetNext ( & animate ) ) ) { <nl> - args - > ThrowError ( ) ; <nl> - return ; <nl> - } <nl> + args - > GetNext ( & animate ) ; <nl> window_ - > SetSize ( gfx : : Size ( width , height ) , animate ) ; <nl> } <nl> <nl> std : : vector < int > Window : : GetSize ( ) { <nl> return result ; <nl> } <nl> <nl> - void Window : : SetContentSize ( mate : : Arguments * args ) { <nl> - int width = 0 , height = 0 ; <nl> + void Window : : SetContentSize ( int width , int height , mate : : Arguments * args ) { <nl> bool animate = false ; <nl> - if ( ! args - > GetNext ( & width ) | | ! args - > GetNext ( & height ) | | <nl> - ( args - > Length ( ) = = 3 & & ! args - > GetNext ( & animate ) ) ) { <nl> - args - > ThrowError ( ) ; <nl> - return ; <nl> - } <nl> + args - > GetNext ( & animate ) ; <nl> window_ - > SetContentSize ( gfx : : Size ( width , height ) , animate ) ; <nl> } <nl> <nl> void Window : : Center ( ) { <nl> window_ - > Center ( ) ; <nl> } <nl> <nl> - void Window : : SetPosition ( mate : : Arguments * args ) { <nl> - int x = 0 , y = 0 ; <nl> + void Window : : SetPosition ( int x , int y , mate : : Arguments * args ) { <nl> bool animate = false ; <nl> - if ( ! args - > GetNext ( & x ) | | ! args - > GetNext ( & y ) | | <nl> - ( args - > Length ( ) = = 3 & & ! args - > GetNext ( & animate ) ) ) { <nl> - args - > ThrowError ( ) ; <nl> - return ; <nl> - } <nl> + args - > GetNext ( & animate ) ; <nl> window_ - > SetPosition ( gfx : : Point ( x , y ) , animate ) ; <nl> } <nl> <nl> mmm a / atom / browser / api / atom_api_window . h <nl> ppp b / atom / browser / api / atom_api_window . h <nl> class Window : public mate : : TrackableObject < Window > , <nl> bool IsMinimized ( ) ; <nl> void SetFullScreen ( bool fullscreen ) ; <nl> bool IsFullscreen ( ) ; <nl> - void SetBounds ( mate : : Arguments * args ) ; <nl> + void SetBounds ( const gfx : : Rect & bounds , mate : : Arguments * args ) ; <nl> gfx : : Rect GetBounds ( ) ; <nl> - void SetSize ( mate : : Arguments * args ) ; <nl> + void SetSize ( int width , int height , mate : : Arguments * args ) ; <nl> std : : vector < int > GetSize ( ) ; <nl> - void SetContentSize ( mate : : Arguments * args ) ; <nl> + void SetContentSize ( int width , int height , mate : : Arguments * args ) ; <nl> std : : vector < int > GetContentSize ( ) ; <nl> void SetMinimumSize ( int width , int height ) ; <nl> std : : vector < int > GetMinimumSize ( ) ; <nl> class Window : public mate : : TrackableObject < Window > , <nl> void SetAlwaysOnTop ( bool top ) ; <nl> bool IsAlwaysOnTop ( ) ; <nl> void Center ( ) ; <nl> - void SetPosition ( mate : : Arguments * args ) ; <nl> + void SetPosition ( int x , int y , mate : : Arguments * args ) ; <nl> std : : vector < int > GetPosition ( ) ; <nl> void SetTitle ( const std : : string & title ) ; <nl> std : : string GetTitle ( ) ; <nl> mmm a / atom / browser / native_window . cc <nl> ppp b / atom / browser / native_window . cc <nl> void NativeWindow : : InitFromOptions ( const mate : : Dictionary & options ) { <nl> int x = - 1 , y = - 1 ; <nl> bool center ; <nl> if ( options . Get ( options : : kX , & x ) & & options . Get ( options : : kY , & y ) ) { <nl> - SetPosition ( gfx : : Point ( x , y ) , false ) ; <nl> + SetPosition ( gfx : : Point ( x , y ) ) ; <nl> } else if ( options . Get ( options : : kCenter , & center ) & & center ) { <nl> Center ( ) ; <nl> } <nl> mmm a / atom / browser / native_window . h <nl> ppp b / atom / browser / native_window . h <nl> class NativeWindow : public base : : SupportsUserData , <nl> virtual bool IsMinimized ( ) = 0 ; <nl> virtual void SetFullScreen ( bool fullscreen ) = 0 ; <nl> virtual bool IsFullscreen ( ) const = 0 ; <nl> - virtual void SetBounds ( const gfx : : Rect & bounds , bool animate ) = 0 ; <nl> + virtual void SetBounds ( const gfx : : Rect & bounds , bool animate = false ) = 0 ; <nl> virtual gfx : : Rect GetBounds ( ) = 0 ; <nl> - virtual void SetSize ( const gfx : : Size & size , bool animate ) ; <nl> + virtual void SetSize ( const gfx : : Size & size , bool animate = false ) ; <nl> virtual gfx : : Size GetSize ( ) ; <nl> - virtual void SetPosition ( const gfx : : Point & position , bool animate ) ; <nl> + virtual void SetPosition ( const gfx : : Point & position , bool animate = false ) ; <nl> virtual gfx : : Point GetPosition ( ) ; <nl> - virtual void SetContentSize ( const gfx : : Size & size , bool animate ) ; <nl> + virtual void SetContentSize ( const gfx : : Size & size , bool animate = false ) ; <nl> virtual gfx : : Size GetContentSize ( ) ; <nl> virtual void SetSizeConstraints ( <nl> const extensions : : SizeConstraints & size_constraints ) ; <nl> mmm a / atom / browser / native_window_mac . h <nl> ppp b / atom / browser / native_window_mac . h <nl> class NativeWindowMac : public NativeWindow { <nl> bool IsMinimized ( ) override ; <nl> void SetFullScreen ( bool fullscreen ) override ; <nl> bool IsFullscreen ( ) const override ; <nl> - void SetBounds ( const gfx : : Rect & bounds , bool animate ) override ; <nl> + void SetBounds ( const gfx : : Rect & bounds , bool animate = false ) override ; <nl> gfx : : Rect GetBounds ( ) override ; <nl> void SetContentSizeConstraints ( <nl> const extensions : : SizeConstraints & size_constraints ) override ; <nl> mmm a / atom / browser / native_window_mac . mm <nl> ppp b / atom / browser / native_window_mac . mm <nl> - ( void ) drawRect : ( NSRect ) dirtyRect { <nl> bool use_content_size = false ; <nl> options . Get ( options : : kUseContentSize , & use_content_size ) ; <nl> if ( ! has_frame ( ) | | ! use_content_size ) <nl> - SetSize ( gfx : : Size ( width , height ) , false ) ; <nl> + SetSize ( gfx : : Size ( width , height ) ) ; <nl> <nl> / / Enable the NSView to accept first mouse event . <nl> bool acceptsFirstMouse = false ; <nl> mmm a / atom / browser / native_window_views . cc <nl> ppp b / atom / browser / native_window_views . cc <nl> bool NativeWindowViews : : IsFullscreen ( ) const { <nl> return window_ - > IsFullscreen ( ) ; <nl> } <nl> <nl> - void NativeWindowViews : : SetBounds ( const gfx : : Rect & bounds , bool animate ) { <nl> + void NativeWindowViews : : SetBounds ( const gfx : : Rect & bounds , bool animate = false ) { <nl> # if defined ( USE_X11 ) <nl> / / On Linux the minimum and maximum size should be updated with window size <nl> / / when window is not resizable . <nl> void NativeWindowViews : : SetMenu ( ui : : MenuModel * menu_model ) { <nl> SetContentSizeConstraints ( constraints ) ; <nl> <nl> / / Resize the window to make sure content size is not changed . <nl> - SetContentSize ( content_size , false ) ; <nl> + SetContentSize ( content_size ) ; <nl> } <nl> } <nl> } <nl> mmm a / atom / browser / native_window_views_win . cc <nl> ppp b / atom / browser / native_window_views_win . cc <nl> void NativeWindowViews : : HandleSizeEvent ( WPARAM w_param , LPARAM l_param ) { <nl> <nl> / / When the window is restored we resize it to the previous known <nl> / / normal size . <nl> - NativeWindow : : SetSize ( last_normal_size_ , false ) ; <nl> + NativeWindow : : SetSize ( last_normal_size_ ) ; <nl> <nl> NotifyWindowUnmaximize ( ) ; <nl> break ; <nl> void NativeWindowViews : : HandleSizeEvent ( WPARAM w_param , LPARAM l_param ) { <nl> <nl> / / When the window is restored we resize it to the previous known <nl> / / normal size . <nl> - NativeWindow : : SetSize ( last_normal_size_ , false ) ; <nl> + NativeWindow : : SetSize ( last_normal_size_ ) ; <nl> <nl> NotifyWindowRestore ( ) ; <nl> } <nl> mmm a / docs / api / browser - window . md <nl> ppp b / docs / api / browser - window . md <nl> height areas you have within the overall content view . <nl> <nl> # # # ` win . setBounds ( options [ , animate ] ) ` <nl> <nl> - ` options ` Object , properties : <nl> + * ` options ` Object , properties : <nl> <nl> - * ` x ` Integer <nl> - * ` y ` Integer <nl> - * ` width ` Integer <nl> - * ` height ` Integer <nl> + * ` x ` Integer <nl> + * ` y ` Integer <nl> + * ` width ` Integer <nl> + * ` height ` Integer <nl> <nl> - ` animate ` Boolean ( optional ) _OS X_ <nl> + * ` animate ` Boolean ( optional ) _OS X_ <nl> <nl> Resizes and moves the window to ` width ` , ` height ` , ` x ` , ` y ` . <nl> <nl>
arguments handing rewritten , doc updated
electron/electron
b75dccb0be78512638e9d6aa0f3ae6578ad4c36f
2016-01-15T16:31:31Z
mmm a / configure . in <nl> ppp b / configure . in <nl> XB_CONFIG_MODULE ( [ lib / libdvd / libdvdcss ] , [ <nl> . / configure \ <nl> CC = " $ CC " \ <nl> CXX = " $ CXX " \ <nl> - CFLAGS = " $ CFLAGS " \ <nl> + CFLAGS = " $ CFLAGS - D_FILE_OFFSET_BITS = 64 - D_OFF_T_DEFINED_ - Doff_t = off64_t - Dlseek = lseek64 " \ <nl> - - prefix = " $ { prefix } " - - includedir = " $ { includedir } " - - libdir = " $ { libdir } " - - datadir = " $ { datadir } " \ <nl> - - host = $ host_alias \ <nl> - - build = $ build_alias \ <nl> XB_CONFIG_MODULE ( [ lib / libdvd / libdvdcss ] , [ <nl> <nl> XB_CONFIG_MODULE ( [ lib / libdvd / libdvdread ] , [ <nl> . / configure2 \ <nl> - - - extra - cflags = " $ CFLAGS $ DVDREAD_CFLAGS - I ` pwd ` / . . / libdvdcss / src " \ <nl> + - - extra - cflags = " $ CFLAGS $ DVDREAD_CFLAGS - I ` pwd ` / . . / libdvdcss / src - D_FILE_OFFSET_BITS = 64 - D_OFF_T_DEFINED_ - Doff_t = off64_t - Dlseek = lseek64 " \ <nl> - - prefix = " $ { prefix } " - - includedir = " $ { includedir } " - - libdir = " $ { libdir } " - - datadir = " $ { datadir } " \ <nl> - - host = $ host_alias \ <nl> - - build = $ build_alias \ <nl> XB_CONFIG_MODULE ( [ lib / libdvd / libdvdread ] , [ <nl> <nl> XB_CONFIG_MODULE ( [ lib / libdvd / libdvdnav ] , [ <nl> . / configure2 \ <nl> - - - extra - cflags = " $ CFLAGS $ DVDREAD_CFLAGS - I ` pwd ` / . . / includes " \ <nl> + - - extra - cflags = " $ CFLAGS $ DVDREAD_CFLAGS - I ` pwd ` / . . / includes - D_FILE_OFFSET_BITS = 64 - D_OFF_T_DEFINED_ - Doff_t = off64_t - Dlseek = lseek64 " \ <nl> - - extra - ldflags = " - L ` pwd ` / . . / libdvdread / obj " \ <nl> - - with - dvdread - config = " ` pwd ` / . . / libdvdread / obj / dvdread - config " \ <nl> - - prefix = " $ { prefix } " - - includedir = " $ { includedir } " - - libdir = " $ { libdir } " - - datadir = " $ { datadir } " \ <nl> mmm a / xbmc / cores / DllLoader / exports / emu_msvcrt . h <nl> ppp b / xbmc / cores / DllLoader / exports / emu_msvcrt . h <nl> <nl> # define _onexit_t void * <nl> # endif <nl> <nl> - # if defined ( TARGET_DARWIN ) | | defined ( TARGET_FREEBSD ) <nl> + # if defined ( TARGET_DARWIN ) | | defined ( TARGET_FREEBSD ) | | defined ( TARGET_ANDROID ) <nl> typedef off_t __off_t ; <nl> typedef int64_t off64_t ; <nl> typedef off64_t __off64_t ; <nl> typedef fpos_t fpos64_t ; <nl> # endif <nl> - # if defined ( TARGET_ANDROID ) <nl> - typedef long int __off_t ; <nl> - typedef long int __off64_t ; <nl> - typedef fpos_t fpos64_t ; / / no 64 - bit on android <nl> - # endif <nl> <nl> # ifdef TARGET_WINDOWS <nl> # include " win32 / dirent . h " <nl>
FIX : [ droid ] fix dvd playing on > 2Gb iso
xbmc/xbmc
0190287030be6a9f19b3062a6ee67b42f3449fba
2013-08-31T00:41:40Z
mmm a / AUTHORS <nl> ppp b / AUTHORS <nl> a license to everyone to use it as detailed in LICENSE . ) <nl> * Arnab Choudhury < achoudhury @ tableau . com > ( copyright owned by Tableau Software , Inc . ) <nl> * Charles Vaughn < cvaughn @ tableau . com > ( copyright owned by Tableau Software , Inc . ) <nl> * Pierre Krieger < pierre . krieger1708 @ gmail . com > <nl> + * Jakob Stoklund Olesen < stoklund @ 2pi . dk > <nl>
Add myself to AUTHORS
emscripten-core/emscripten
3f8f00f4f5024056b14c205d3f9a9e3b46e644be
2016-02-18T20:47:07Z
mmm a / modules / control / common / BUILD <nl> ppp b / modules / control / common / BUILD <nl> load ( " / / tools : cpplint . bzl " , " cpplint " ) <nl> <nl> package ( default_visibility = [ " / / visibility : public " ] ) <nl> <nl> + cc_library ( <nl> + name = " control_gflags " , <nl> + srcs = [ <nl> + " control_gflags . cc " , <nl> + ] , <nl> + hdrs = [ <nl> + " control_gflags . h " , <nl> + ] , <nl> + deps = [ <nl> + " / / external : gflags " , <nl> + ] , <nl> + ) <nl> + <nl> cc_library ( <nl> name = " hysteresis_filter " , <nl> srcs = [ <nl> cc_library ( <nl> cc_library ( <nl> name = " common " , <nl> deps = [ <nl> + " : control_gflags " , <nl> " : hysteresis_filter " , <nl> " : interpolation_1d " , <nl> " : interpolation_2d " , <nl> new file mode 100644 <nl> index 00000000000 . . 7bbbb351b0c <nl> mmm / dev / null <nl> ppp b / modules / control / common / control_gflags . 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 " modules / control / common / control_gflags . h " <nl> + <nl> + DEFINE_string ( control_conf_file , " modules / control / conf / lincoln . pb . txt " , <nl> + " default control conf data file " ) ; <nl> + <nl> + DEFINE_string ( control_adapter_config_filename , <nl> + " modules / control / conf / adapter . conf " , " The adapter config file " ) ; <nl> + <nl> + DEFINE_bool ( enable_csv_debug , false , " True to write out csv debug file . " ) ; <nl> + DEFINE_bool ( enable_speed_station_preview , true , " enable speed / station preview " ) ; <nl> + DEFINE_string ( control_node_name , " control " , " The control node name in proto " ) ; <nl> + DEFINE_bool ( is_control_test_mode , false , " True to run control in test mode " ) ; <nl> + DEFINE_double ( control_test_duration , - 1 . 0 , <nl> + " Control testing duration in seconds . This number is will not " <nl> + " take effect if negative " ) ; <nl> + DEFINE_bool ( use_preview_speed_for_table , false , <nl> + " True to use preview speed for table lookup " ) ; <nl> + <nl> + DEFINE_bool ( enable_input_timestamp_check , true , <nl> + " True to enable input timestamp delay check " ) ; <nl> + <nl> + DEFINE_int32 ( max_localization_miss_num , 20 , <nl> + " Max missing number of localization before entering estop mode " ) ; <nl> + DEFINE_int32 ( max_chassis_miss_num , 20 , <nl> + " Max missing number of chassis before entering estop mode " ) ; <nl> + DEFINE_int32 ( max_planning_miss_num , 20 , <nl> + " Max missing number of planning before entering estop mode " ) ; <nl> + <nl> + DEFINE_double ( max_acceleration_when_stopped , 0 . 01 , <nl> + " max acceleration can be observed when vehicle is stopped " ) ; <nl> + <nl> + DEFINE_double ( steer_angle_rate , 100 . 0 , <nl> + " Steer angle change rate in percentage . " ) ; <nl> + DEFINE_bool ( enable_gain_scheduler , false , <nl> + " Enable gain scheduler for higher vehicle speed " ) ; <nl> + DEFINE_bool ( set_steer_limit , false , " Set steer limit " ) ; <nl> + <nl> + DEFINE_bool ( enable_slope_offset , false , " Enable slope offset compensation " ) ; <nl> + <nl> + DEFINE_double ( lock_steer_speed , 0 . 081 , <nl> + " Minimum speed to lock the steer , in m / s " ) ; <nl> + <nl> + DEFINE_bool ( enable_navigation_mode_error_filter , false , <nl> + " Enable error_filter for navigation mode " ) ; <nl> + <nl> + DEFINE_bool ( enable_navigation_mode_position_update , true , <nl> + " Enable position update for navigation mode " ) ; <nl> + <nl> + DEFINE_bool ( enable_persistent_estop , false , <nl> + " True to persistent keep estop status , " <nl> + " pad reset can reset the estop status . " ) ; <nl> new file mode 100644 <nl> index 00000000000 . . 0a9440ebbad <nl> mmm / dev / null <nl> ppp b / modules / control / common / control_gflags . h <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> + # ifndef MODULES_CONTROL_COMMON_CONTROL_GFLAGS_H_ <nl> + # define MODULES_CONTROL_COMMON_CONTROL_GFLAGS_H_ <nl> + <nl> + # include " gflags / gflags . h " <nl> + <nl> + / / data file <nl> + DECLARE_string ( control_conf_file ) ; <nl> + <nl> + DECLARE_double ( control_test_duration ) ; <nl> + <nl> + DECLARE_string ( control_adapter_config_filename ) ; <nl> + <nl> + DECLARE_bool ( enable_csv_debug ) ; <nl> + <nl> + / / temporary gflag for test purpose <nl> + DECLARE_bool ( enable_speed_station_preview ) ; <nl> + <nl> + DECLARE_string ( control_node_name ) ; <nl> + DECLARE_bool ( is_control_test_mode ) ; <nl> + DECLARE_bool ( use_preview_speed_for_table ) ; <nl> + <nl> + DECLARE_bool ( enable_input_timestamp_check ) ; <nl> + <nl> + DECLARE_int32 ( max_localization_miss_num ) ; <nl> + DECLARE_int32 ( max_chassis_miss_num ) ; <nl> + DECLARE_int32 ( max_planning_miss_num ) ; <nl> + <nl> + DECLARE_double ( max_acceleration_when_stopped ) ; <nl> + <nl> + DECLARE_double ( steer_angle_rate ) ; <nl> + DECLARE_bool ( enable_gain_scheduler ) ; <nl> + DECLARE_bool ( set_steer_limit ) ; <nl> + DECLARE_bool ( enable_slope_offset ) ; <nl> + <nl> + DECLARE_double ( lock_steer_speed ) ; <nl> + <nl> + DECLARE_bool ( enable_navigation_mode_error_filter ) ; <nl> + DECLARE_bool ( enable_navigation_mode_position_update ) ; <nl> + <nl> + DECLARE_bool ( enable_persistent_estop ) ; <nl> + <nl> + # endif / / MODULES_CONTROL_COMMON_CONTROL_GFLAGS_H_ <nl>
Revert " Control : remove gflags in control and compile control / common "
ApolloAuto/apollo
367e7aa2d50f06f16dce0620875b7c2494728d56
2018-09-13T17:51:13Z
mmm a / lib / Sema / TypeCheckDecl . cpp <nl> ppp b / lib / Sema / TypeCheckDecl . cpp <nl> class DeclChecker : public DeclVisitor < DeclChecker > { <nl> } <nl> <nl> visitValueDecl ( FD ) ; <nl> - <nl> - assert ( ( ! FD - > getBody ( ) | | <nl> - FD - > getType ( ) - > isEqual ( FD - > getBody ( ) - > getType ( ) ) ) & & <nl> - " Unexpected func body " ) ; <nl> } <nl> void visitOneOfElementDecl ( OneOfElementDecl * ED ) { <nl> / / Ignore element decls that carry no type . <nl>
Remove an assert that will fire on invalid code ( e . g . , when one of
apple/swift
2b7d77aecd66478446eba5f4331e8dd4656641b1
2012-05-22T21:00:59Z
mmm a / Makefile . in <nl> ppp b / Makefile . in <nl> unittests - verbose : <nl> start - server : <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | STARTING SERVER | | " <nl> + @ echo " < < STARTING SERVER > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> start - server : <nl> @ ENABLE_BOOST_TEST_TRUE @ unittests - boost : <nl> @ ENABLE_BOOST_TEST_TRUE @ @ echo <nl> @ ENABLE_BOOST_TEST_TRUE @ @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ ENABLE_BOOST_TEST_TRUE @ @ echo " | | BOOST TESTS | | " <nl> + @ ENABLE_BOOST_TEST_TRUE @ @ echo " < < BOOST TESTS > > " <nl> @ ENABLE_BOOST_TEST_TRUE @ @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ ENABLE_BOOST_TEST_TRUE @ @ echo <nl> <nl> start - server : <nl> @ ENABLE_BOOST_TEST_FALSE @ unittests - boost : <nl> @ ENABLE_BOOST_TEST_FALSE @ @ echo <nl> @ ENABLE_BOOST_TEST_FALSE @ @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ ENABLE_BOOST_TEST_FALSE @ @ echo " | | BOOST TESTS | | " <nl> + @ ENABLE_BOOST_TEST_FALSE @ @ echo " < < BOOST TESTS > > " <nl> @ ENABLE_BOOST_TEST_FALSE @ @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ ENABLE_BOOST_TEST_FALSE @ @ echo <nl> <nl> start - server : <nl> unittests - shell - server : <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | SHELL SERVER TESTS ( BASCIS ) | | " <nl> + @ echo " < < SHELL SERVER TESTS ( BASCIS ) > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> unittests - shell - server : <nl> unittests - shell - server - ahuacatl : <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | SHELL SERVER TESTS ( AHUACATL ) | | " <nl> + @ echo " < < SHELL SERVER TESTS ( AHUACATL ) > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> unittests - shell - server - ahuacatl : <nl> unittests - shell - server - index : <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | SHELL SERVER TESTS ( INDEX & QUERY ) | | " <nl> + @ echo " < < SHELL SERVER TESTS ( INDEX & QUERY ) > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> unittests - shell - client : <nl> <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | SHELL CLIENT TESTS | | " <nl> + @ echo " < < SHELL CLIENT TESTS > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> unittests - http - server : <nl> <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | HTTP SERVER TESTS | | " <nl> + @ echo " < < HTTP SERVER TESTS > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> mmm a / Makefile . unittests <nl> ppp b / Makefile . unittests <nl> CLIENT_OPT : = - - startup . directory . / js - - startup . modules - path . / js / client / module <nl> start - server : <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | STARTING SERVER | | " <nl> + @ echo " < < STARTING SERVER > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> if ENABLE_BOOST_TEST <nl> unittests - boost : <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | BOOST TESTS | | " <nl> + @ echo " < < BOOST TESTS > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> else <nl> unittests - boost : <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | BOOST TESTS | | " <nl> + @ echo " < < BOOST TESTS > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> UNITTESTS_SERVER = $ ( addprefix - - unit - tests , $ ( SHELL_SERVER ) ) <nl> unittests - shell - server : <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | SHELL SERVER TESTS ( BASCIS ) | | " <nl> + @ echo " < < SHELL SERVER TESTS ( BASCIS ) > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> UNITTESTS_SERVER_AHUACATL = $ ( addprefix - - unit - tests , $ ( SHELL_SERVER_AHUACATL ) ) <nl> unittests - shell - server - ahuacatl : <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | SHELL SERVER TESTS ( AHUACATL ) | | " <nl> + @ echo " < < SHELL SERVER TESTS ( AHUACATL ) > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> UNITTESTS_SERVER_INDEX = $ ( addprefix - - unit - tests , $ ( SHELL_SERVER_INDEX ) ) <nl> unittests - shell - server - index : <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | SHELL SERVER TESTS ( INDEX & QUERY ) | | " <nl> + @ echo " < < SHELL SERVER TESTS ( INDEX & QUERY ) > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> unittests - shell - client : <nl> <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | SHELL CLIENT TESTS | | " <nl> + @ echo " < < SHELL CLIENT TESTS > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> unittests - http - server : <nl> <nl> @ echo <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> - @ echo " | | HTTP SERVER TESTS | | " <nl> + @ echo " < < HTTP SERVER TESTS > > " <nl> @ echo " = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = " <nl> @ echo <nl> <nl> mmm a / build . sh <nl> ppp b / build . sh <nl> <nl> echo " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # " <nl> echo " # build . sh # " <nl> echo " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # " <nl> + echo <nl> <nl> . config / detect_distro . sh <nl> <nl> OPTIONS = " - - disable - dependency - tracking - - disable - relative " <nl> PREFIX = " - - prefix = / usr - - sysconfdir = / etc " <nl> - RESULTS = " avocado avocsh " <nl> + RESULTS = " avocado avocsh avocirb " <nl> <nl> export CPPFLAGS = " " <nl> export LDFLAGS = " " <nl> export MAKEJ = 2 <nl> export LDD_INFO = " no " <nl> - export VALGRIND_TEST = " no " <nl> - export RSPEC_AVAILABLE = " yes " <nl> <nl> echo <nl> echo " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # " <nl> case $ TRI_OS_LONG in <nl> Linux - openSUSE - 11 * ) <nl> echo " Using configuration for openSuSE 11 " <nl> OPTIONS = " $ OPTIONS - - enable - all - in - one " <nl> - VALGRIND_TEST = " yes " <nl> LDD_INFO = " yes " <nl> ; ; <nl> <nl> case $ TRI_OS_LONG in <nl> echo " Using configuration for Debian " <nl> OPTIONS = " $ OPTIONS - - enable - all - in - one " <nl> LDD_INFO = " yes " <nl> - RSPEC_AVAILABLE = " no " <nl> ; ; <nl> <nl> Linux - CentOS - * ) <nl> echo " Using configuration for Centos " <nl> OPTIONS = " $ OPTIONS - - enable - all - in - one " <nl> LDD_INFO = " yes " <nl> - RSPEC_AVAILABLE = " no " <nl> ; ; <nl> <nl> Linux - Ubuntu - 11 . 10 * ) <nl> for result in $ RESULTS ; do <nl> echo <nl> fi <nl> done <nl> - <nl> - echo <nl> - <nl> - echo <nl> - echo " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # " <nl> - echo " unittests : " <nl> - echo " make unittests " <nl> - echo " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # " <nl> - echo <nl> - <nl> - make unittests - boost | | exit 1 <nl> - make unittests - shell - server | | exit 1 <nl> - <nl> - if text " x $ RSPEC_AVAILABLE " = " xyes " ; then <nl> - make unittests - http - server | | exit 1 <nl> - fi <nl> - <nl> - make unittests - shell - client | | exit 1 <nl> - <nl> - if test " x $ VALGRIND_TEST " = " xyes " ; then <nl> - echo <nl> - echo " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # " <nl> - echo " unittests with VALGRIND : " <nl> - echo " make unittests VALGRIND = valgrind - - leak - check = full " <nl> - echo " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # " <nl> - echo <nl> - <nl> - make unittests VALGRIND = " valgrind - - leak - check = full " | | exit 1 <nl> - fi <nl> mmm a / config / detect_distro . sh <nl> ppp b / config / detect_distro . sh <nl> <nl> echo " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " <nl> echo " . Detect OS and Distribution . " <nl> echo " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " <nl> + echo <nl> <nl> OS = ` uname - s ` <nl> REV = ` uname - r ` <nl>
cosmetics
arangodb/arangodb
2baeeddb9d1ed61a3359b89c099366e39fa03671
2012-04-24T12:37:53Z
mmm a / utils / build - presets . ini <nl> ppp b / utils / build - presets . ini <nl> mixin - preset = buildbot_linux <nl> skip - build - llvm <nl> skip - build - cmark <nl> skip - build - benchmarks <nl> + skip - test - cmark <nl> <nl> # Then we inject two cmake arguments that cause us not to build tools and to <nl> # assume we are working with the host compiler . <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
28f2a1aaa9afcd017aae383f87f4f2cbd150355f
2019-06-07T19:49:58Z
mmm a / libraries / chain / CMakeLists . txt <nl> ppp b / libraries / chain / CMakeLists . txt <nl> add_library ( eosio_chain <nl> protocol_feature_activation . cpp <nl> protocol_feature_manager . cpp <nl> genesis_intrinsics . cpp <nl> + whitelisted_intrinsics . cpp <nl> $ { HEADERS } <nl> ) <nl> <nl> mmm a / libraries / chain / controller . cpp <nl> ppp b / libraries / chain / controller . cpp <nl> <nl> # include < eosio / chain / transaction_object . hpp > <nl> # include < eosio / chain / reversible_block_object . hpp > <nl> # include < eosio / chain / genesis_intrinsics . hpp > <nl> + # include < eosio / chain / whitelisted_intrinsics . hpp > <nl> <nl> # include < eosio / chain / protocol_feature_manager . hpp > <nl> # include < eosio / chain / authorization_manager . hpp > <nl> struct controller_impl { <nl> db . create < global_property_object > ( [ & ] ( auto & gpo ) { <nl> gpo . configuration = conf . genesis . initial_configuration ; <nl> for ( const auto & i : genesis_intrinsics ) { <nl> - gpo . add_intrinsic_to_whitelist ( i ) ; <nl> + add_intrinsic_to_whitelist ( gpo . whitelisted_intrinsics , i ) ; <nl> } <nl> } ) ; <nl> db . create < dynamic_global_property_object > ( [ ] ( auto & ) { } ) ; <nl> mmm a / libraries / chain / genesis_intrinsics . cpp <nl> ppp b / libraries / chain / genesis_intrinsics . cpp <nl> const std : : vector < const char * > genesis_intrinsics = { <nl> " db_idx_long_double_end " , <nl> " db_idx_long_double_next " , <nl> " db_idx_long_double_previous " , <nl> - " db_idx64_store " , <nl> - " db_idx64_remove " , <nl> - " db_idx64_update " , <nl> - " db_idx64_find_primary " , <nl> - " db_idx64_find_secondary " , <nl> - " db_idx64_lowerbound " , <nl> - " db_idx64_upperbound " , <nl> - " db_idx64_end " , <nl> - " db_idx64_next " , <nl> - " db_idx64_previous " , <nl> - " db_idx128_store " , <nl> - " db_idx128_remove " , <nl> - " db_idx128_update " , <nl> - " db_idx128_find_primary " , <nl> - " db_idx128_find_secondary " , <nl> - " db_idx128_lowerbound " , <nl> - " db_idx128_upperbound " , <nl> - " db_idx128_end " , <nl> - " db_idx128_next " , <nl> - " db_idx128_previous " , <nl> - " db_idx256_store " , <nl> - " db_idx256_remove " , <nl> - " db_idx256_update " , <nl> - " db_idx256_find_primary " , <nl> - " db_idx256_find_secondary " , <nl> - " db_idx256_lowerbound " , <nl> - " db_idx256_upperbound " , <nl> - " db_idx256_end " , <nl> - " db_idx256_next " , <nl> - " db_idx256_previous " , <nl> - " db_idx_double_store " , <nl> - " db_idx_double_remove " , <nl> - " db_idx_double_update " , <nl> - " db_idx_double_find_primary " , <nl> - " db_idx_double_find_secondary " , <nl> - " db_idx_double_lowerbound " , <nl> - " db_idx_double_upperbound " , <nl> - " db_idx_double_end " , <nl> - " db_idx_double_next " , <nl> - " db_idx_double_previous " , <nl> - " db_idx_long_double_store " , <nl> - " db_idx_long_double_remove " , <nl> - " db_idx_long_double_update " , <nl> - " db_idx_long_double_find_primary " , <nl> - " db_idx_long_double_find_secondary " , <nl> - " db_idx_long_double_lowerbound " , <nl> - " db_idx_long_double_upperbound " , <nl> - " db_idx_long_double_end " , <nl> - " db_idx_long_double_next " , <nl> - " db_idx_long_double_previous " , <nl> " db_store_i64 " , <nl> " db_update_i64 " , <nl> " db_remove_i64 " , <nl> mmm a / libraries / chain / include / eosio / chain / global_property_object . hpp <nl> ppp b / libraries / chain / include / eosio / chain / global_property_object . hpp <nl> <nl> # include < eosio / chain / chain_config . hpp > <nl> # include < eosio / chain / producer_schedule . hpp > <nl> # include < eosio / chain / incremental_merkle . hpp > <nl> + # include < eosio / chain / whitelisted_intrinsics . hpp > <nl> # include < chainbase / chainbase . hpp > <nl> # include " multi_index_includes . hpp " <nl> <nl> namespace eosio { namespace chain { <nl> OBJECT_CTOR ( global_property_object , ( proposed_schedule ) ( preactivated_protocol_features ) ( whitelisted_intrinsics ) ) <nl> <nl> public : <nl> - <nl> - inline void add_intrinsic_to_whitelist ( const char * name ) { <nl> - uint64_t h = static_cast < uint64_t > ( std : : hash < std : : string > { } ( std : : string ( name ) ) ) ; <nl> - whitelisted_intrinsics . emplace ( std : : piecewise_construct , <nl> - std : : forward_as_tuple ( h ) , <nl> - std : : forward_as_tuple ( name , whitelisted_intrinsics . get_allocator ( ) ) <nl> - ) ; <nl> - } <nl> - <nl> - inline void add_intrinsic_to_whitelist ( const std : : string & name ) { <nl> - uint64_t h = static_cast < uint64_t > ( std : : hash < std : : string > { } ( name ) ) ; <nl> - whitelisted_intrinsics . emplace ( std : : piecewise_construct , <nl> - std : : forward_as_tuple ( h ) , <nl> - std : : forward_as_tuple ( name . c_str ( ) , name . size ( ) , <nl> - whitelisted_intrinsics . get_allocator ( ) ) <nl> - ) ; <nl> - } <nl> - <nl> - id_type id ; <nl> - optional < block_num_type > proposed_schedule_block_num ; <nl> - shared_producer_schedule_type proposed_schedule ; <nl> - chain_config configuration ; <nl> - shared_vector < digest_type > preactivated_protocol_features ; <nl> - shared_flat_multimap < uint64_t , shared_string > whitelisted_intrinsics ; <nl> + id_type id ; <nl> + optional < block_num_type > proposed_schedule_block_num ; <nl> + shared_producer_schedule_type proposed_schedule ; <nl> + chain_config configuration ; <nl> + shared_vector < digest_type > preactivated_protocol_features ; <nl> + whitelisted_intrinsics_type whitelisted_intrinsics ; <nl> } ; <nl> <nl> <nl> mmm a / libraries / chain / include / eosio / chain / wasm_interface . hpp <nl> ppp b / libraries / chain / include / eosio / chain / wasm_interface . hpp <nl> <nl> # pragma once <nl> # include < eosio / chain / types . hpp > <nl> + # include < eosio / chain / whitelisted_intrinsics . hpp > <nl> # include < eosio / chain / exceptions . hpp > <nl> # include " Runtime / Linker . h " <nl> # include " Runtime / Runtime . h " <nl> namespace eosio { namespace chain { <nl> <nl> root_resolver ( ) { } <nl> <nl> - root_resolver ( const shared_flat_multimap < uint64_t , shared_string > & whitelisted_intrinsics ) <nl> + root_resolver ( const whitelisted_intrinsics_type & whitelisted_intrinsics ) <nl> : whitelisted_intrinsics ( & whitelisted_intrinsics ) <nl> { } <nl> <nl> namespace eosio { namespace chain { <nl> " importing from module that is not ' env ' : $ { module } . $ { export } " , <nl> ( " module " , mod_name ) ( " export " , export_name ) ) ; <nl> <nl> - / / Only consider imports that are in the whitelisted set of intrinsics : <nl> - uint64_t hash = static_cast < uint64_t > ( std : : hash < string > { } ( export_name ) ) ; <nl> - auto itr = whitelisted_intrinsics - > lower_bound ( hash ) ; <nl> - fail = true ; <nl> - for ( const auto end = whitelisted_intrinsics - > end ( ) ; itr ! = end & & itr - > first = = hash ; + + itr ) { <nl> - if ( itr - > second . compare ( 0 , itr - > second . size ( ) , export_name . c_str ( ) , export_name . size ( ) ) = = 0 ) { <nl> - fail = false ; <nl> - break ; <nl> - } <nl> - } <nl> + / / Only consider imports that are in the whitelisted set of intrinsics <nl> + fail = ! is_intrinsic_whitelisted ( * whitelisted_intrinsics , export_name ) ; <nl> } <nl> <nl> / / Try to resolve an intrinsic first . <nl> namespace eosio { namespace chain { <nl> } FC_CAPTURE_AND_RETHROW ( ( mod_name ) ( export_name ) ) } <nl> <nl> protected : <nl> - const shared_flat_multimap < uint64_t , shared_string > * whitelisted_intrinsics = nullptr ; <nl> + const whitelisted_intrinsics_type * whitelisted_intrinsics = nullptr ; <nl> } ; <nl> } } <nl> <nl> new file mode 100644 <nl> index 0000000000 . . d9466114af <nl> mmm / dev / null <nl> ppp b / libraries / chain / include / eosio / chain / whitelisted_intrinsics . hpp <nl> <nl> + <nl> + / * * <nl> + * @ file <nl> + * @ copyright defined in eos / LICENSE <nl> + * / <nl> + # pragma once <nl> + <nl> + # include < eosio / chain / types . hpp > <nl> + <nl> + namespace eosio { namespace chain { <nl> + <nl> + using whitelisted_intrinsics_type = shared_flat_multimap < uint64_t , shared_string > ; <nl> + <nl> + / / TODO : Improve performance by using std : : string_view when we switch to C + + 17 . <nl> + <nl> + bool is_intrinsic_whitelisted ( const whitelisted_intrinsics_type & whitelisted_intrinsics , const std : : string & name ) ; <nl> + <nl> + void add_intrinsic_to_whitelist ( whitelisted_intrinsics_type & whitelisted_intrinsics , const std : : string & name ) ; <nl> + <nl> + void remove_intrinsic_from_whitelist ( whitelisted_intrinsics_type & whitelisted_intrinsics , const std : : string & name ) ; <nl> + <nl> + } } / / namespace eosio : : chain <nl> new file mode 100644 <nl> index 0000000000 . . 7b5ca67b86 <nl> mmm / dev / null <nl> ppp b / libraries / chain / whitelisted_intrinsics . cpp <nl> <nl> + / * * <nl> + * @ file <nl> + * @ copyright defined in eos / LICENSE <nl> + * / <nl> + # include < eosio / chain / whitelisted_intrinsics . hpp > <nl> + # include < eosio / chain / exceptions . hpp > <nl> + <nl> + namespace eosio { namespace chain { <nl> + <nl> + template < typename Iterator > <nl> + bool find_intrinsic_helper ( uint64_t h , const std : : string & name , Iterator & itr , const Iterator & end ) { <nl> + for ( ; itr ! = end & & itr - > first = = h ; + + itr ) { <nl> + if ( itr - > second . compare ( 0 , itr - > second . size ( ) , name . c_str ( ) , name . size ( ) ) = = 0 ) { <nl> + return true ; <nl> + } <nl> + } <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + whitelisted_intrinsics_type : : iterator <nl> + find_intrinsic ( whitelisted_intrinsics_type & whitelisted_intrinsics , uint64_t h , const std : : string & name ) <nl> + { <nl> + auto itr = whitelisted_intrinsics . lower_bound ( h ) ; <nl> + const auto end = whitelisted_intrinsics . end ( ) ; <nl> + <nl> + if ( ! find_intrinsic_helper ( h , name , itr , end ) ) <nl> + return end ; <nl> + <nl> + return itr ; <nl> + } <nl> + <nl> + whitelisted_intrinsics_type : : const_iterator <nl> + find_intrinsic ( const whitelisted_intrinsics_type & whitelisted_intrinsics , uint64_t h , const std : : string & name ) <nl> + { <nl> + auto itr = whitelisted_intrinsics . lower_bound ( h ) ; <nl> + const auto end = whitelisted_intrinsics . end ( ) ; <nl> + <nl> + if ( ! find_intrinsic_helper ( h , name , itr , end ) ) <nl> + return end ; <nl> + <nl> + return itr ; <nl> + } <nl> + <nl> + bool is_intrinsic_whitelisted ( const whitelisted_intrinsics_type & whitelisted_intrinsics , const std : : string & name ) <nl> + { <nl> + uint64_t h = static_cast < uint64_t > ( std : : hash < std : : string > { } ( name ) ) ; <nl> + auto itr = whitelisted_intrinsics . lower_bound ( h ) ; <nl> + const auto end = whitelisted_intrinsics . end ( ) ; <nl> + <nl> + return find_intrinsic_helper ( h , name , itr , end ) ; <nl> + } <nl> + <nl> + <nl> + void add_intrinsic_to_whitelist ( whitelisted_intrinsics_type & whitelisted_intrinsics , const std : : string & name ) <nl> + { <nl> + uint64_t h = static_cast < uint64_t > ( std : : hash < std : : string > { } ( name ) ) ; <nl> + auto itr = find_intrinsic ( whitelisted_intrinsics , h , name ) ; <nl> + EOS_ASSERT ( itr = = whitelisted_intrinsics . end ( ) , database_exception , <nl> + " cannot add intrinsic ' $ { name } ' since it already exists in the whitelist " , <nl> + ( " name " , name ) <nl> + ) ; <nl> + <nl> + whitelisted_intrinsics . emplace ( std : : piecewise_construct , <nl> + std : : forward_as_tuple ( h ) , <nl> + std : : forward_as_tuple ( name . c_str ( ) , name . size ( ) , <nl> + whitelisted_intrinsics . get_allocator ( ) ) <nl> + ) ; <nl> + } <nl> + <nl> + void remove_intrinsic_from_whitelist ( whitelisted_intrinsics_type & whitelisted_intrinsics , const std : : string & name ) <nl> + { <nl> + uint64_t h = static_cast < uint64_t > ( std : : hash < std : : string > { } ( name ) ) ; <nl> + auto itr = find_intrinsic ( whitelisted_intrinsics , h , name ) ; <nl> + EOS_ASSERT ( itr ! = whitelisted_intrinsics . end ( ) , database_exception , <nl> + " cannot remove intrinsic ' $ { name } ' since it does not exist in the whitelist " , <nl> + ( " name " , name ) <nl> + ) ; <nl> + <nl> + whitelisted_intrinsics . erase ( itr ) ; <nl> + } <nl> + <nl> + } } <nl>
bug fixes and improvements
EOSIO/eos
feb6456701e65758be1e3618d0abffc171b51b91
2019-02-28T21:49:25Z
mmm a / bench / async_bench . cpp <nl> ppp b / bench / async_bench . cpp <nl> int count_lines ( const char * filename ) <nl> <nl> void verify_file ( const char * filename , int expected_count ) <nl> { <nl> + spdlog : : info ( " Verifying { } to contain { : n } line . . " , filename , expected_count ) ; <nl> auto count = count_lines ( filename ) ; <nl> if ( count ! = expected_count ) <nl> { <nl> int main ( int argc , char * argv [ ] ) <nl> auto file_sink = std : : make_shared < spdlog : : sinks : : basic_file_sink_mt > ( filename , true ) ; <nl> auto logger = std : : make_shared < async_logger > ( " async_logger " , std : : move ( file_sink ) , std : : move ( tp ) , async_overflow_policy : : block ) ; <nl> bench_mt ( howmany , std : : move ( logger ) , threads ) ; <nl> - <nl> - verify_file ( filename , howmany ) ; <nl> - # ifdef SPDLOG_ASYNC_BENCH_VERIFY <nl> verify_file ( filename , howmany ) ; <nl> - # endif / / SPDLOG_ASYNC_BENCH_VERIFY <nl> } <nl> <nl> spdlog : : info ( " " ) ; <nl> int main ( int argc , char * argv [ ] ) <nl> spdlog : : info ( " Queue Overflow Policy : overrun " ) ; <nl> spdlog : : info ( " * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * " ) ; <nl> / / do same test but discard oldest if queue is full instead of blocking <nl> + filename = " logs / basic_async - overrun . log " ; <nl> for ( int i = 0 ; i < iters ; i + + ) <nl> { <nl> auto tp = std : : make_shared < details : : thread_pool > ( queue_size , 1 ) ; <nl>
Update async bench
gabime/spdlog
25d3c83d3be3d894157f7906432b8272f8efe7c6
2019-08-25T21:53:52Z
mmm a / tests / nodeos_under_min_avail_ram . py <nl> ppp b / tests / nodeos_under_min_avail_ram . py <nl> def setName ( self , num ) : <nl> break <nl> <nl> Print ( " Failed to push create action to eosio contract . sleep for 5 seconds " ) <nl> + count - = 1 # failed attempt shouldn ' t be counted <nl> time . sleep ( 5 ) <nl> else : <nl> timeOutCount = 0 <nl> def setName ( self , num ) : <nl> # spread the actions to all accounts , to use each accounts tps bandwidth <nl> fromIndexStart = fromIndex + 1 if fromIndex + 1 < namedAccounts . numAccounts else 0 <nl> <nl> - if count < 5 or count > 15 : <nl> - strMsg = " little " if count < 15 else " much " <nl> + # min and max are subjective , just assigned to make sure that many small changes in nodeos don ' t <nl> + # result in the test not correctly validating behavior <nl> + if count < 5 or count > 20 : <nl> + strMsg = " little " if count < 20 else " much " <nl> Utils . cmdError ( " Was able to send % d store actions which was too % s " % ( count , strMsg ) ) <nl> errorExit ( " Incorrect number of store actions sent " ) <nl> <nl>
Merge pull request from EOSIO / 8191 - under - min - available - send - count_rel - 2 . 0
EOSIO/eos
0f9df63e1eca4dda4cb7df30683f4a1220599444
2019-11-08T21:10:31Z
mmm a / lib / Sema / TypeCheckProtocol . cpp <nl> ppp b / lib / Sema / TypeCheckProtocol . cpp <nl> void TypeChecker : : useObjectiveCBridgeableConformances ( DeclContext * dc , <nl> : TC ( tc ) , DC ( dc ) , Proto ( proto ) { } <nl> <nl> virtual Action walkToTypePre ( Type ty ) { <nl> + ConformanceCheckOptions options = ConformanceCheckFlags : : InExpression <nl> + | ConformanceCheckFlags : : Used <nl> + | ConformanceCheckFlags : : SuppressDependencyTracking ; <nl> + <nl> / / If we have a nominal type , " use " its conformance to <nl> / / _ObjectiveCBridgeable if it has one . <nl> - if ( ty - > getAnyNominal ( ) ) { <nl> - ConformanceCheckOptions options = ConformanceCheckFlags : : InExpression <nl> - | ConformanceCheckFlags : : Used <nl> - | ConformanceCheckFlags : : SuppressDependencyTracking ; <nl> + if ( auto * nominalDecl = ty - > getAnyNominal ( ) ) { <nl> ( void ) TC . conformsToProtocol ( ty , Proto , DC , options ) ; <nl> + <nl> + if ( nominalDecl = = TC . Context . getSetDecl ( ) | | <nl> + nominalDecl = = TC . Context . getDictionaryDecl ( ) ) { <nl> + auto args = ty - > castTo < BoundGenericType > ( ) - > getGenericArgs ( ) ; <nl> + if ( ! args . empty ( ) ) { <nl> + auto keyType = args [ 0 ] ; <nl> + auto * hashableProto = <nl> + TC . Context . getProtocol ( KnownProtocolKind : : Hashable ) ; <nl> + ( void ) TC . conformsToProtocol ( keyType , hashableProto , DC , options ) ; <nl> + } <nl> + } <nl> } <nl> <nl> return Action : : Continue ; <nl> mmm a / test / IRGen / objc_generic_class_metadata . sil <nl> ppp b / test / IRGen / objc_generic_class_metadata . sil <nl> entry ( % 0 : $ Subclass ) : <nl> unreachable <nl> } <nl> <nl> + sil @ _TToFC27objc_generic_class_metadata8SubclasscfT7optionsGSqGVs10DictionaryVSC13GenericOptionP____GSQS0__ : $ @ convention ( objc_method ) ( @ owned Subclass , @ owned NSDictionary ) - > @ owned Subclass { <nl> + entry ( % 0 : $ Subclass , % 1 : $ NSDictionary ) : <nl> + unreachable <nl> + } <nl> + <nl> / / CHECK - LABEL : define linkonce_odr hidden % swift . type * @ _TMaCSo12GenericClass ( ) <nl> / / CHECK : [ [ T0 : % . * ] ] = load % objc_class * , % objc_class * * @ " OBJC_CLASS_REF_ $ _GenericClass " , <nl> / / CHECK : call % objc_class * @ rt_swift_getInitializedObjCClass ( % objc_class * [ [ T0 ] ] ) <nl> mmm a / test / Inputs / clang - importer - sdk / usr / include / objc_generics . h <nl> ppp b / test / Inputs / clang - importer - sdk / usr / include / objc_generics . h <nl> <nl> # import < Foundation . h > <nl> <nl> + # define _CF_TYPED_ENUM __attribute__ ( ( swift_wrapper ( enum ) ) ) <nl> + # define NS_STRING_ENUM _CF_TYPED_ENUM <nl> + # define NS_SWIFT_NAME ( Name ) __attribute__ ( ( swift_name ( # Name ) ) ) <nl> + <nl> + typedef NSString * GenericOption NS_STRING_ENUM ; <nl> + <nl> + GenericOption const GenericOptionMultithreaded NS_SWIFT_NAME ( multithreaded ) ; <nl> + <nl> + <nl> @ interface GenericClass < T > : NSObject <nl> - ( id ) initWithThing : ( T ) thing ; <nl> - ( id ) initWithArrayOfThings : ( NSArray < T > * __nonnull ) things ; <nl> + - ( id ) initWithOptions : ( nullable NSDictionary < GenericOption , id > * ) options ; <nl> - ( void ) dealloc ; <nl> - ( __nullable T ) thing ; <nl> - ( int ) count ; <nl> mmm a / test / SILGen / objc_imported_generic . swift <nl> ppp b / test / SILGen / objc_imported_generic . swift <nl> func genericFunc < V : AnyObject > ( _ v : V . Type ) { <nl> } <nl> } <nl> <nl> + / / CHECK - LABEL : sil hidden @ _TF21objc_imported_generic23configureWithoutOptionsFT_T_ : $ @ convention ( thin ) ( ) - > ( ) <nl> + / / CHECK : [ [ NIL_FN : % . * ] ] = function_ref @ _TFSqCfT10nilLiteralT__GSqx_ : $ @ convention ( method ) < τ_0_0 > ( @ thin Optional < τ_0_0 > . Type ) - > @ out Optional < τ_0_0 > <nl> + / / CHECK : apply [ [ NIL_FN ] ] < [ GenericOption : Any ] > ( { { . * } } ) <nl> + / / CHECK : return <nl> + func configureWithoutOptions ( ) { <nl> + _ = GenericClass < NSObject > ( options : nil ) <nl> + } <nl> + <nl> + / / foreign to native thunk for init ( options : ) , uses GenericOption : Hashable <nl> + / / conformance <nl> + <nl> + / / CHECK - LABEL : sil shared [ thunk ] @ _TTOFCSo12GenericClasscfT7optionsGSqGVs10DictionaryVSC13GenericOptionP____GSQGS_x__ : $ @ convention ( method ) < T where T : AnyObject > ( @ owned Optional < Dictionary < GenericOption , Any > > , @ owned GenericClass < T > ) - > @ owned ImplicitlyUnwrappedOptional < GenericClass < T > > <nl> + / / CHECK : [ [ FN : % . * ] ] = function_ref @ _TFE10FoundationVs10Dictionary19_bridgeToObjectiveCfT_CSo12NSDictionary : $ @ convention ( method ) < τ_0_0 , τ_0_1 where τ_0_0 : Hashable > ( @ guaranteed Dictionary < τ_0_0 , τ_0_1 > ) - > @ owned NSDictionary <nl> + / / CHECK : apply [ [ FN ] ] < GenericOption , Any > ( { { . * } } ) : $ @ convention ( method ) < τ_0_0 , τ_0_1 where τ_0_0 : Hashable > ( @ guaranteed Dictionary < τ_0_0 , τ_0_1 > ) - > @ owned NSDictionary <nl> + / / CHECK : return <nl> + <nl> + / / This gets emitted down here for some reason <nl> + <nl> / / CHECK - LABEL : sil shared [ thunk ] @ _TTOFCSo12GenericClasscfT13arrayOfThings <nl> / / CHECK : class_method [ volatile ] { { % . * } } : $ GenericClass < T > , # GenericClass . init ! initializer . 1 . foreign { { . * } } , $ @ convention ( objc_method ) @ pseudogeneric < τ_0_0 where τ_0_0 : AnyObject > ( NSArray , @ owned GenericClass < τ_0_0 > ) - > @ owned ImplicitlyUnwrappedOptional < GenericClass < τ_0_0 > > <nl> + <nl> + / / Make sure we emitted the witness table for the above conformance <nl> + <nl> + / / CHECK - LABEL : sil_witness_table shared [ fragile ] GenericOption : Hashable module objc_generics { <nl> + / / CHECK : method # Hashable . hashValue ! getter . 1 : @ _TTWVSC13GenericOptions8Hashable13objc_genericsFS0_g9hashValueSi <nl> + / / CHECK : } <nl> mmm a / validation - test / stdlib / SceneKit . swift <nl> ppp b / validation - test / stdlib / SceneKit . swift <nl> if # available ( iOS 8 . 0 , * ) { <nl> let sceneData = sceneDescription . data ( <nl> using : . utf8 , <nl> allowLossyConversion : true ) ! <nl> - let sceneSource = SCNSceneSource ( data : sceneData as Data , options : [ : ] ) ! <nl> + let sceneSource = SCNSceneSource ( data : sceneData as Data , options : nil ) ! <nl> <nl> do { <nl> var unarchivedPlaneGeometry = <nl>
Merge pull request from slavapestov / fix - for - missing - conformance
apple/swift
714075a123633d680abf4aad584c15e7d21d38d4
2016-08-16T05:12:44Z
mmm a / src / hydrogen - instructions . cc <nl> ppp b / src / hydrogen - instructions . cc <nl> void HPhi : : DeleteFromGraph ( ) { <nl> void HPhi : : InitRealUses ( int phi_id ) { <nl> / / Initialize real uses . <nl> phi_id_ = phi_id ; <nl> + / / Compute a conservative approximation of truncating uses before inferring <nl> + / / representations . The proper , exact computation will be done later , when <nl> + / / inserting representation changes . <nl> + SetFlag ( kTruncatingToInt32 ) ; <nl> for ( HUseIterator it ( uses ( ) ) ; ! it . Done ( ) ; it . Advance ( ) ) { <nl> HValue * value = it . value ( ) ; <nl> if ( ! value - > IsPhi ( ) ) { <nl> void HPhi : : InitRealUses ( int phi_id ) { <nl> PrintF ( " # % d Phi is used by real # % d % s as % s \ n " , <nl> id ( ) , value - > id ( ) , value - > Mnemonic ( ) , rep . Mnemonic ( ) ) ; <nl> } <nl> + if ( ! value - > IsSimulate ( ) & & ! value - > CheckFlag ( kTruncatingToInt32 ) ) { <nl> + ClearFlag ( kTruncatingToInt32 ) ; <nl> + } <nl> } <nl> } <nl> } <nl> mmm a / src / hydrogen . cc <nl> ppp b / src / hydrogen . cc <nl> void HInferRepresentation : : Analyze ( ) { <nl> } <nl> } <nl> <nl> + / / Set truncation flags for groups of connected phis . This is a conservative <nl> + / / approximation ; the flag will be properly re - computed after representations <nl> + / / have been determined . <nl> + if ( phi_count > 0 ) { <nl> + BitVector * done = new ( zone ( ) ) BitVector ( phi_count , graph_ - > zone ( ) ) ; <nl> + for ( int i = 0 ; i < phi_count ; + + i ) { <nl> + if ( done - > Contains ( i ) ) continue ; <nl> + <nl> + / / Check if all uses of all connected phis in this group are truncating . <nl> + bool all_uses_everywhere_truncating = true ; <nl> + for ( BitVector : : Iterator it ( connected_phis . at ( i ) ) ; <nl> + ! it . Done ( ) ; <nl> + it . Advance ( ) ) { <nl> + int index = it . Current ( ) ; <nl> + all_uses_everywhere_truncating & = <nl> + phi_list - > at ( index ) - > CheckFlag ( HInstruction : : kTruncatingToInt32 ) ; <nl> + done - > Add ( index ) ; <nl> + } <nl> + if ( all_uses_everywhere_truncating ) { <nl> + continue ; / / Great , nothing to do . <nl> + } <nl> + / / Clear truncation flag of this group of connected phis . <nl> + for ( BitVector : : Iterator it ( connected_phis . at ( i ) ) ; <nl> + ! it . Done ( ) ; <nl> + it . Advance ( ) ) { <nl> + int index = it . Current ( ) ; <nl> + phi_list - > at ( index ) - > ClearFlag ( HInstruction : : kTruncatingToInt32 ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> / / Simplify constant phi inputs where possible . <nl> + / / This step uses kTruncatingToInt32 flags of phis . <nl> for ( int i = 0 ; i < phi_count ; + + i ) { <nl> phi_list - > at ( i ) - > SimplifyConstantInputs ( ) ; <nl> } <nl>
Detect truncating Phi uses of Phis with constant inputs
v8/v8
f78f583110502ca0518bea72f62a722bbca9d85e
2013-05-02T16:30:58Z
mmm a / docs / px4_multi_vehicle . md <nl> ppp b / docs / px4_multi_vehicle . md <nl> <nl> The [ PX4 SITL stack ] ( px4_sitl . md ) comes with a ` sitl_multiple_run . sh ` shell script that runs multiple instances of the PX4 binary . This would allow the SITL stack to listen to connections from multiple AirSim vehicles on multiple TCP ports starting from 4560 . <nl> However , the provided script does not let us view the PX4 console . If you want to run the instances manually while being able to view each instance ' s console ( * * Recommended * * ) see [ this section ] ( px4_multi_vehicle . md # starting - sitl - instances - with - px4 - console ) <nl> <nl> - # Setting up multiple instances of PX4 Software - in - Loop <nl> + # # Setting up multiple instances of PX4 Software - in - Loop <nl> <nl> * * Note * * you have to build PX4 with ` make px4_sitl_default none_iris ` as shown [ here ] ( px4_sitl . md # setting - up - px4 - software - in - loop ) before trying to run multiple PX4 instances . <nl> <nl> there is no Pixhawk hardware plugged in , otherwise QGroundControl will choose <nl> to use that instead . Note that as we don ' t have a physical board , an RC cannot be connected directly to it . So the alternatives are either use XBox 360 Controller or connect your RC using USB ( for example , in case of FrSky Taranis X9D Plus ) or using trainer USB cable to your PC . This makes your RC look like a joystick . You will need to do extra set up in QGroundControl to use virtual joystick for RC control . You do not need to do this unless you plan to fly a drone manually in AirSim . Autonomous flight using the Python <nl> API does not require RC , see [ ` No Remote Control ` ] ( px4_sitl . md # No - Remote - Control ) . <nl> <nl> - # Starting SITL instances with PX4 console <nl> + # # Starting SITL instances with PX4 console <nl> <nl> If you want to start your SITL instances while being able to view the PX4 console , you will need to run the shell scripts found [ here ] ( / PX4Scripts ) rather than ` sitl_multiple_run . sh ` . <nl> Here is how you would do so : <nl>
Update px4_multi_vehicle . md
microsoft/AirSim
be40c77f99298f366df778394a24f8c62eb869bb
2020-12-18T06:23:52Z
mmm a / core / cowdata . h <nl> ppp b / core / cowdata . h <nl> Error CowData < T > : : resize ( int p_size ) { <nl> <nl> ERR_FAIL_COND_V ( p_size < 0 , ERR_INVALID_PARAMETER ) ; <nl> <nl> - if ( p_size = = size ( ) ) <nl> + int current_size = size ( ) ; <nl> + <nl> + if ( p_size = = current_size ) <nl> return OK ; <nl> <nl> if ( p_size = = 0 ) { <nl> Error CowData < T > : : resize ( int p_size ) { <nl> / / possibly changing size , copy on write <nl> _copy_on_write ( ) ; <nl> <nl> + size_t current_alloc_size = _get_alloc_size ( current_size ) ; <nl> size_t alloc_size ; <nl> ERR_FAIL_COND_V ( ! _get_alloc_size_checked ( p_size , & alloc_size ) , ERR_OUT_OF_MEMORY ) ; <nl> <nl> - if ( p_size > size ( ) ) { <nl> + if ( p_size > current_size ) { <nl> <nl> - if ( size ( ) = = 0 ) { <nl> - / / alloc from scratch <nl> - uint32_t * ptr = ( uint32_t * ) Memory : : alloc_static ( alloc_size , true ) ; <nl> - ERR_FAIL_COND_V ( ! ptr , ERR_OUT_OF_MEMORY ) ; <nl> - * ( ptr - 1 ) = 0 ; / / size , currently none <nl> - * ( ptr - 2 ) = 1 ; / / refcount <nl> + if ( alloc_size ! = current_alloc_size ) { <nl> + if ( current_size = = 0 ) { <nl> + / / alloc from scratch <nl> + uint32_t * ptr = ( uint32_t * ) Memory : : alloc_static ( alloc_size , true ) ; <nl> + ERR_FAIL_COND_V ( ! ptr , ERR_OUT_OF_MEMORY ) ; <nl> + * ( ptr - 1 ) = 0 ; / / size , currently none <nl> + * ( ptr - 2 ) = 1 ; / / refcount <nl> <nl> - _ptr = ( T * ) ptr ; <nl> + _ptr = ( T * ) ptr ; <nl> <nl> - } else { <nl> - void * _ptrnew = ( T * ) Memory : : realloc_static ( _ptr , alloc_size , true ) ; <nl> - ERR_FAIL_COND_V ( ! _ptrnew , ERR_OUT_OF_MEMORY ) ; <nl> - _ptr = ( T * ) ( _ptrnew ) ; <nl> + } else { <nl> + void * _ptrnew = ( T * ) Memory : : realloc_static ( _ptr , alloc_size , true ) ; <nl> + ERR_FAIL_COND_V ( ! _ptrnew , ERR_OUT_OF_MEMORY ) ; <nl> + _ptr = ( T * ) ( _ptrnew ) ; <nl> + } <nl> } <nl> <nl> / / construct the newly created elements <nl> Error CowData < T > : : resize ( int p_size ) { <nl> <nl> * _get_size ( ) = p_size ; <nl> <nl> - } else if ( p_size < size ( ) ) { <nl> + } else if ( p_size < current_size ) { <nl> <nl> if ( ! __has_trivial_destructor ( T ) ) { <nl> / / deinitialize no longer needed elements <nl> Error CowData < T > : : resize ( int p_size ) { <nl> } <nl> } <nl> <nl> - void * _ptrnew = ( T * ) Memory : : realloc_static ( _ptr , alloc_size , true ) ; <nl> - ERR_FAIL_COND_V ( ! _ptrnew , ERR_OUT_OF_MEMORY ) ; <nl> + if ( alloc_size ! = current_alloc_size ) { <nl> + void * _ptrnew = ( T * ) Memory : : realloc_static ( _ptr , alloc_size , true ) ; <nl> + ERR_FAIL_COND_V ( ! _ptrnew , ERR_OUT_OF_MEMORY ) ; <nl> <nl> - _ptr = ( T * ) ( _ptrnew ) ; <nl> + _ptr = ( T * ) ( _ptrnew ) ; <nl> + } <nl> <nl> * _get_size ( ) = p_size ; <nl> } <nl>
Merge pull request from reduz / fix - vector - resize
godotengine/godot
f8cb0a1b3c32c32836d9e132d061d0e6980a2345
2020-03-28T15:19:28Z
mmm a / src / arm / code - stubs - arm . cc <nl> ppp b / src / arm / code - stubs - arm . cc <nl> void InstanceofStub : : Generate ( MacroAssembler * masm ) { <nl> <nl> void FunctionPrototypeStub : : Generate ( MacroAssembler * masm ) { <nl> Label miss ; <nl> - Register receiver ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register name = LoadIC : : NameRegister ( ) ; <nl> + <nl> + ASSERT ( kind ( ) = = Code : : LOAD_IC | | <nl> + kind ( ) = = Code : : KEYED_LOAD_IC ) ; <nl> + <nl> if ( kind ( ) = = Code : : KEYED_LOAD_IC ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - lr : return address <nl> - / / - - r0 : key <nl> - / / - - r1 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - __ cmp ( r0 , Operand ( isolate ( ) - > factory ( ) - > prototype_string ( ) ) ) ; <nl> + __ cmp ( name , Operand ( isolate ( ) - > factory ( ) - > prototype_string ( ) ) ) ; <nl> __ b ( ne , & miss ) ; <nl> - receiver = r1 ; <nl> - } else { <nl> - ASSERT ( kind ( ) = = Code : : LOAD_IC ) ; <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - r2 : name <nl> - / / - - lr : return address <nl> - / / - - r0 : receiver <nl> - / / - - sp [ 0 ] : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - receiver = r0 ; <nl> } <nl> <nl> StubCompiler : : GenerateLoadFunctionPrototype ( masm , receiver , r3 , r4 , & miss ) ; <nl> mmm a / src / arm / debug - arm . cc <nl> ppp b / src / arm / debug - arm . cc <nl> void DebugCodegen : : GenerateStoreICDebugBreak ( MacroAssembler * masm ) { <nl> <nl> void DebugCodegen : : GenerateKeyedLoadICDebugBreak ( MacroAssembler * masm ) { <nl> / / Calling convention for keyed IC load ( from ic - arm . cc ) . <nl> - Register receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register name = KeyedLoadIC : : NameRegister ( ) ; <nl> - Generate_DebugBreakCallHelper ( masm , receiver . bit ( ) | name . bit ( ) , 0 ) ; <nl> + GenerateLoadICDebugBreak ( masm ) ; <nl> } <nl> <nl> <nl> mmm a / src / arm / full - codegen - arm . cc <nl> ppp b / src / arm / full - codegen - arm . cc <nl> void FullCodeGenerator : : VisitAssignment ( Assignment * expr ) { <nl> break ; <nl> case NAMED_PROPERTY : <nl> if ( expr - > is_compound ( ) ) { <nl> - / / We need the receiver both on the stack and in the accumulator . <nl> - VisitForAccumulatorValue ( property - > obj ( ) ) ; <nl> - __ push ( result_register ( ) ) ; <nl> + / / We need the receiver both on the stack and in the register . <nl> + VisitForStackValue ( property - > obj ( ) ) ; <nl> + __ ldr ( LoadIC : : ReceiverRegister ( ) , MemOperand ( sp , 0 ) ) ; <nl> } else { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> } <nl> void FullCodeGenerator : : VisitAssignment ( Assignment * expr ) { <nl> case KEYED_PROPERTY : <nl> if ( expr - > is_compound ( ) ) { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> - VisitForAccumulatorValue ( property - > key ( ) ) ; <nl> - __ ldr ( r1 , MemOperand ( sp , 0 ) ) ; <nl> - __ push ( r0 ) ; <nl> + VisitForStackValue ( property - > key ( ) ) ; <nl> + __ ldr ( LoadIC : : ReceiverRegister ( ) , MemOperand ( sp , 1 * kPointerSize ) ) ; <nl> + __ ldr ( LoadIC : : NameRegister ( ) , MemOperand ( sp , 0 ) ) ; <nl> } else { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> VisitForStackValue ( property - > key ( ) ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> Label l_catch , l_try , l_suspend , l_continuation , l_resume ; <nl> Label l_next , l_call , l_loop ; <nl> + Register load_receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register load_name = LoadIC : : NameRegister ( ) ; <nl> + <nl> / / Initial send value is undefined . <nl> __ LoadRoot ( r0 , Heap : : kUndefinedValueRootIndex ) ; <nl> __ b ( & l_next ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> / / catch ( e ) { receiver = iter ; f = ' throw ' ; arg = e ; goto l_call ; } <nl> __ bind ( & l_catch ) ; <nl> handler_table ( ) - > set ( expr - > index ( ) , Smi : : FromInt ( l_catch . pos ( ) ) ) ; <nl> - __ LoadRoot ( r2 , Heap : : kthrow_stringRootIndex ) ; / / " throw " <nl> - __ ldr ( r3 , MemOperand ( sp , 1 * kPointerSize ) ) ; / / iter <nl> - __ Push ( r2 , r3 , r0 ) ; / / " throw " , iter , except <nl> + __ LoadRoot ( load_name , Heap : : kthrow_stringRootIndex ) ; / / " throw " <nl> + __ ldr ( r3 , MemOperand ( sp , 1 * kPointerSize ) ) ; / / iter <nl> + __ Push ( load_name , r3 , r0 ) ; / / " throw " , iter , except <nl> __ jmp ( & l_call ) ; <nl> <nl> / / try { received = % yield result } <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> / / receiver = iter ; f = ' next ' ; arg = received ; <nl> __ bind ( & l_next ) ; <nl> - Register keyedload_receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register keyedload_name = KeyedLoadIC : : NameRegister ( ) ; <nl> - ASSERT ( keyedload_receiver . is ( r1 ) ) ; <nl> - ASSERT ( keyedload_name . is ( r0 ) ) ; <nl> <nl> - __ LoadRoot ( r2 , Heap : : knext_stringRootIndex ) ; / / " next " <nl> - __ ldr ( r3 , MemOperand ( sp , 1 * kPointerSize ) ) ; / / iter <nl> - __ Push ( r2 , r3 , r0 ) ; / / " next " , iter , received <nl> + __ LoadRoot ( load_name , Heap : : knext_stringRootIndex ) ; / / " next " <nl> + __ ldr ( r3 , MemOperand ( sp , 1 * kPointerSize ) ) ; / / iter <nl> + __ Push ( load_name , r3 , r0 ) ; / / " next " , iter , received <nl> <nl> / / result = receiver [ f ] ( arg ) ; <nl> __ bind ( & l_call ) ; <nl> - __ ldr ( keyedload_receiver , MemOperand ( sp , kPointerSize ) ) ; <nl> - __ ldr ( keyedload_name , MemOperand ( sp , 2 * kPointerSize ) ) ; <nl> + __ ldr ( load_receiver , MemOperand ( sp , kPointerSize ) ) ; <nl> + __ ldr ( load_name , MemOperand ( sp , 2 * kPointerSize ) ) ; <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > KeyedLoadIC_Initialize ( ) ; <nl> CallIC ( ic , TypeFeedbackId : : None ( ) ) ; <nl> __ mov ( r1 , r0 ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> / / if ( ! result . done ) goto l_try ; <nl> __ bind ( & l_loop ) ; <nl> - Register load_receiver = LoadIC : : ReceiverRegister ( ) ; <nl> - Register load_name = LoadIC : : NameRegister ( ) ; <nl> - ASSERT ( load_receiver . is ( r0 ) ) ; <nl> - ASSERT ( load_name . is ( r2 ) ) ; <nl> + __ Move ( load_receiver , r0 ) ; <nl> <nl> __ push ( load_receiver ) ; / / save result <nl> __ LoadRoot ( load_name , Heap : : kdone_stringRootIndex ) ; / / " done " <nl> void FullCodeGenerator : : VisitProperty ( Property * expr ) { <nl> <nl> if ( key - > IsPropertyName ( ) ) { <nl> VisitForAccumulatorValue ( expr - > obj ( ) ) ; <nl> - ASSERT ( r0 . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> + __ Move ( LoadIC : : ReceiverRegister ( ) , r0 ) ; <nl> EmitNamedPropertyLoad ( expr ) ; <nl> PrepareForBailoutForId ( expr - > LoadId ( ) , TOS_REG ) ; <nl> context ( ) - > Plug ( r0 ) ; <nl> } else { <nl> VisitForStackValue ( expr - > obj ( ) ) ; <nl> VisitForAccumulatorValue ( expr - > key ( ) ) ; <nl> - ASSERT ( r0 . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> - __ pop ( KeyedLoadIC : : ReceiverRegister ( ) ) ; <nl> + __ Move ( LoadIC : : NameRegister ( ) , r0 ) ; <nl> + __ pop ( LoadIC : : ReceiverRegister ( ) ) ; <nl> EmitKeyedPropertyLoad ( expr ) ; <nl> context ( ) - > Plug ( r0 ) ; <nl> } <nl> void FullCodeGenerator : : EmitKeyedCallWithLoadIC ( Call * expr , <nl> Expression * key ) { <nl> / / Load the key . <nl> VisitForAccumulatorValue ( key ) ; <nl> - ASSERT ( r0 . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> <nl> Expression * callee = expr - > expression ( ) ; <nl> <nl> / / Load the function from the receiver . <nl> ASSERT ( callee - > IsProperty ( ) ) ; <nl> - __ ldr ( KeyedLoadIC : : ReceiverRegister ( ) , MemOperand ( sp , 0 ) ) ; <nl> + __ ldr ( LoadIC : : ReceiverRegister ( ) , MemOperand ( sp , 0 ) ) ; <nl> + __ Move ( LoadIC : : NameRegister ( ) , r0 ) ; <nl> EmitKeyedPropertyLoad ( callee - > AsProperty ( ) ) ; <nl> PrepareForBailoutForId ( callee - > AsProperty ( ) - > LoadId ( ) , TOS_REG ) ; <nl> <nl> void FullCodeGenerator : : VisitCallRuntime ( CallRuntime * expr ) { <nl> <nl> if ( expr - > is_jsruntime ( ) ) { <nl> / / Push the builtins object as the receiver . <nl> - __ ldr ( r0 , GlobalObjectOperand ( ) ) ; <nl> - __ ldr ( r0 , FieldMemOperand ( r0 , GlobalObject : : kBuiltinsOffset ) ) ; <nl> - __ push ( r0 ) ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + __ ldr ( receiver , GlobalObjectOperand ( ) ) ; <nl> + __ ldr ( receiver , FieldMemOperand ( receiver , GlobalObject : : kBuiltinsOffset ) ) ; <nl> + __ push ( receiver ) ; <nl> <nl> / / Load the function from the receiver . <nl> - ASSERT ( r0 . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> __ mov ( LoadIC : : NameRegister ( ) , Operand ( expr - > name ( ) ) ) ; <nl> CallLoadIC ( NOT_CONTEXTUAL , expr - > CallRuntimeFeedbackId ( ) ) ; <nl> <nl> void FullCodeGenerator : : VisitCountOperation ( CountOperation * expr ) { <nl> __ push ( ip ) ; <nl> } <nl> if ( assign_type = = NAMED_PROPERTY ) { <nl> - / / Put the object both on the stack and in the accumulator . <nl> - VisitForAccumulatorValue ( prop - > obj ( ) ) ; <nl> - ASSERT ( r0 . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> - __ push ( LoadIC : : ReceiverRegister ( ) ) ; <nl> + / / Put the object both on the stack and in the register . <nl> + VisitForStackValue ( prop - > obj ( ) ) ; <nl> + __ ldr ( LoadIC : : ReceiverRegister ( ) , MemOperand ( sp , 0 ) ) ; <nl> EmitNamedPropertyLoad ( prop ) ; <nl> } else { <nl> VisitForStackValue ( prop - > obj ( ) ) ; <nl> - VisitForAccumulatorValue ( prop - > key ( ) ) ; <nl> - ASSERT ( r0 . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> - __ ldr ( KeyedLoadIC : : ReceiverRegister ( ) , MemOperand ( sp , 0 ) ) ; <nl> - __ push ( KeyedLoadIC : : NameRegister ( ) ) ; <nl> + VisitForStackValue ( prop - > key ( ) ) ; <nl> + __ ldr ( LoadIC : : ReceiverRegister ( ) , MemOperand ( sp , 1 * kPointerSize ) ) ; <nl> + __ ldr ( LoadIC : : NameRegister ( ) , MemOperand ( sp , 0 ) ) ; <nl> EmitKeyedPropertyLoad ( prop ) ; <nl> } <nl> } <nl> mmm a / src / arm / ic - arm . cc <nl> ppp b / src / arm / ic - arm . cc <nl> static void GenerateKeyNameCheck ( MacroAssembler * masm , <nl> <nl> <nl> void LoadIC : : GenerateMegamorphic ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - r2 : name <nl> - / / - - lr : return address <nl> - / / - - r0 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( r0 . is ( ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( r2 . is ( NameRegister ( ) ) ) ; <nl> + / / The return address is in lr . <nl> + Register receiver = ReceiverRegister ( ) ; <nl> + Register name = NameRegister ( ) ; <nl> + ASSERT ( receiver . is ( r1 ) ) ; <nl> + ASSERT ( name . is ( r2 ) ) ; <nl> <nl> / / Probe the stub cache . <nl> Code : : Flags flags = Code : : ComputeHandlerFlags ( Code : : LOAD_IC ) ; <nl> masm - > isolate ( ) - > stub_cache ( ) - > GenerateProbe ( <nl> - masm , flags , r0 , r2 , r3 , r4 , r5 , r6 ) ; <nl> + masm , flags , receiver , name , r3 , r4 , r5 , r6 ) ; <nl> <nl> / / Cache miss : Jump to runtime . <nl> GenerateMiss ( masm ) ; <nl> void LoadIC : : GenerateNormal ( MacroAssembler * masm ) { <nl> / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> / / - - r2 : name <nl> / / - - lr : return address <nl> - / / - - r0 : receiver <nl> + / / - - r1 : receiver <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( r0 . is ( ReceiverRegister ( ) ) ) ; <nl> + ASSERT ( r1 . is ( ReceiverRegister ( ) ) ) ; <nl> ASSERT ( r2 . is ( NameRegister ( ) ) ) ; <nl> <nl> Label miss , slow ; <nl> <nl> - GenerateNameDictionaryReceiverCheck ( masm , r0 , r1 , r3 , r4 , & miss ) ; <nl> + GenerateNameDictionaryReceiverCheck ( masm , r1 , r0 , r3 , r4 , & miss ) ; <nl> <nl> - / / r1 : elements <nl> - GenerateDictionaryLoad ( masm , & slow , r1 , r2 , r0 , r3 , r4 ) ; <nl> + / / r0 : elements <nl> + GenerateDictionaryLoad ( masm , & slow , r0 , r2 , r0 , r3 , r4 ) ; <nl> __ Ret ( ) ; <nl> <nl> / / Dictionary load failed , go slow ( but don ' t miss ) . <nl> static const Register LoadIC_TempRegister ( ) { return r3 ; } <nl> <nl> <nl> void LoadIC : : GenerateMiss ( MacroAssembler * masm ) { <nl> - / / The return address is on the stack . <nl> + / / The return address is in lr . <nl> Isolate * isolate = masm - > isolate ( ) ; <nl> <nl> __ IncrementCounter ( isolate - > counters ( ) - > load_miss ( ) , 1 , r3 , r4 ) ; <nl> void LoadIC : : GenerateMiss ( MacroAssembler * masm ) { <nl> <nl> <nl> void LoadIC : : GenerateRuntimeGetProperty ( MacroAssembler * masm ) { <nl> - / / The return address is on the stack . <nl> + / / The return address is in lr . <nl> <nl> __ mov ( LoadIC_TempRegister ( ) , ReceiverRegister ( ) ) ; <nl> __ Push ( LoadIC_TempRegister ( ) , NameRegister ( ) ) ; <nl> static MemOperand GenerateUnmappedArgumentsLookup ( MacroAssembler * masm , <nl> <nl> <nl> void KeyedLoadIC : : GenerateSloppyArguments ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - S t a t e mmmmmmmmmmmm - - <nl> - / / - - lr : return address <nl> - / / - - r0 : key <nl> - / / - - r1 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( r1 . is ( ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( r0 . is ( NameRegister ( ) ) ) ; <nl> + / / The return address is in lr . <nl> + Register receiver = ReceiverRegister ( ) ; <nl> + Register key = NameRegister ( ) ; <nl> + ASSERT ( receiver . is ( r1 ) ) ; <nl> + ASSERT ( key . is ( r2 ) ) ; <nl> + <nl> Label slow , notin ; <nl> MemOperand mapped_location = <nl> - GenerateMappedArgumentsLookup ( masm , r1 , r0 , r2 , r3 , r4 , & notin , & slow ) ; <nl> + GenerateMappedArgumentsLookup ( <nl> + masm , receiver , key , r0 , r3 , r4 , & notin , & slow ) ; <nl> __ ldr ( r0 , mapped_location ) ; <nl> __ Ret ( ) ; <nl> __ bind ( & notin ) ; <nl> - / / The unmapped lookup expects that the parameter map is in r2 . <nl> + / / The unmapped lookup expects that the parameter map is in r0 . <nl> MemOperand unmapped_location = <nl> - GenerateUnmappedArgumentsLookup ( masm , r0 , r2 , r3 , & slow ) ; <nl> - __ ldr ( r2 , unmapped_location ) ; <nl> + GenerateUnmappedArgumentsLookup ( masm , key , r0 , r3 , & slow ) ; <nl> + __ ldr ( r0 , unmapped_location ) ; <nl> __ LoadRoot ( r3 , Heap : : kTheHoleValueRootIndex ) ; <nl> - __ cmp ( r2 , r3 ) ; <nl> + __ cmp ( r0 , r3 ) ; <nl> __ b ( eq , & slow ) ; <nl> - __ mov ( r0 , r2 ) ; <nl> __ Ret ( ) ; <nl> __ bind ( & slow ) ; <nl> GenerateMiss ( masm ) ; <nl> void KeyedStoreIC : : GenerateSloppyArguments ( MacroAssembler * masm ) { <nl> <nl> <nl> void KeyedLoadIC : : GenerateMiss ( MacroAssembler * masm ) { <nl> - / / The return address is on the stack . <nl> + / / The return address is in lr . <nl> Isolate * isolate = masm - > isolate ( ) ; <nl> <nl> __ IncrementCounter ( isolate - > counters ( ) - > keyed_load_miss ( ) , 1 , r3 , r4 ) ; <nl> void KeyedLoadIC : : GenerateMiss ( MacroAssembler * masm ) { <nl> <nl> <nl> / / IC register specifications <nl> - const Register LoadIC : : ReceiverRegister ( ) { return r0 ; } <nl> + const Register LoadIC : : ReceiverRegister ( ) { return r1 ; } <nl> const Register LoadIC : : NameRegister ( ) { return r2 ; } <nl> - const Register KeyedLoadIC : : ReceiverRegister ( ) { return r1 ; } <nl> - const Register KeyedLoadIC : : NameRegister ( ) { return r0 ; } <nl> <nl> <nl> void KeyedLoadIC : : GenerateRuntimeGetProperty ( MacroAssembler * masm ) { <nl> - / / The return address is on the stack . <nl> + / / The return address is in lr . <nl> <nl> __ Push ( ReceiverRegister ( ) , NameRegister ( ) ) ; <nl> <nl> void KeyedLoadIC : : GenerateRuntimeGetProperty ( MacroAssembler * masm ) { <nl> <nl> <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - S t a t e mmmmmmmmmmmm - - <nl> - / / - - lr : return address <nl> - / / - - r0 : key <nl> - / / - - r1 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / The return address is in lr . <nl> Label slow , check_name , index_smi , index_name , property_array_property ; <nl> Label probe_dictionary , check_number_dictionary ; <nl> <nl> Register key = NameRegister ( ) ; <nl> Register receiver = ReceiverRegister ( ) ; <nl> - ASSERT ( key . is ( r0 ) ) ; <nl> + ASSERT ( key . is ( r2 ) ) ; <nl> ASSERT ( receiver . is ( r1 ) ) ; <nl> <nl> Isolate * isolate = masm - > isolate ( ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> / / where a numeric string is converted to a smi . <nl> <nl> GenerateKeyedLoadReceiverCheck ( <nl> - masm , receiver , r2 , r3 , Map : : kHasIndexedInterceptor , & slow ) ; <nl> + masm , receiver , r0 , r3 , Map : : kHasIndexedInterceptor , & slow ) ; <nl> <nl> / / Check the receiver ' s map to see if it has fast elements . <nl> - __ CheckFastElements ( r2 , r3 , & check_number_dictionary ) ; <nl> + __ CheckFastElements ( r0 , r3 , & check_number_dictionary ) ; <nl> <nl> GenerateFastArrayLoad ( <nl> - masm , receiver , key , r4 , r3 , r2 , r0 , NULL , & slow ) ; <nl> - __ IncrementCounter ( isolate - > counters ( ) - > keyed_load_generic_smi ( ) , 1 , r2 , r3 ) ; <nl> + masm , receiver , key , r0 , r3 , r4 , r0 , NULL , & slow ) ; <nl> + __ IncrementCounter ( isolate - > counters ( ) - > keyed_load_generic_smi ( ) , 1 , r4 , r3 ) ; <nl> __ Ret ( ) ; <nl> <nl> __ bind ( & check_number_dictionary ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> __ ldr ( r3 , FieldMemOperand ( r4 , JSObject : : kMapOffset ) ) ; <nl> <nl> / / Check whether the elements is a number dictionary . <nl> - / / r0 : key <nl> / / r3 : elements map <nl> / / r4 : elements <nl> __ LoadRoot ( ip , Heap : : kHashTableMapRootIndex ) ; <nl> __ cmp ( r3 , ip ) ; <nl> __ b ( ne , & slow ) ; <nl> - __ SmiUntag ( r2 , r0 ) ; <nl> - __ LoadFromNumberDictionary ( & slow , r4 , r0 , r0 , r2 , r3 , r5 ) ; <nl> + __ SmiUntag ( r0 , key ) ; <nl> + __ LoadFromNumberDictionary ( & slow , r4 , key , r0 , r0 , r3 , r5 ) ; <nl> __ Ret ( ) ; <nl> <nl> - / / Slow case , key and receiver still in r0 and r1 . <nl> + / / Slow case , key and receiver still in r2 and r1 . <nl> __ bind ( & slow ) ; <nl> __ IncrementCounter ( isolate - > counters ( ) - > keyed_load_generic_slow ( ) , <nl> - 1 , r2 , r3 ) ; <nl> + 1 , r4 , r3 ) ; <nl> GenerateRuntimeGetProperty ( masm ) ; <nl> <nl> __ bind ( & check_name ) ; <nl> - GenerateKeyNameCheck ( masm , key , r2 , r3 , & index_name , & slow ) ; <nl> + GenerateKeyNameCheck ( masm , key , r0 , r3 , & index_name , & slow ) ; <nl> <nl> GenerateKeyedLoadReceiverCheck ( <nl> - masm , receiver , r2 , r3 , Map : : kHasNamedInterceptor , & slow ) ; <nl> + masm , receiver , r0 , r3 , Map : : kHasNamedInterceptor , & slow ) ; <nl> <nl> / / If the receiver is a fast - case object , check the keyed lookup <nl> / / cache . Otherwise probe the dictionary . <nl> - __ ldr ( r3 , FieldMemOperand ( r1 , JSObject : : kPropertiesOffset ) ) ; <nl> + __ ldr ( r3 , FieldMemOperand ( receiver , JSObject : : kPropertiesOffset ) ) ; <nl> __ ldr ( r4 , FieldMemOperand ( r3 , HeapObject : : kMapOffset ) ) ; <nl> __ LoadRoot ( ip , Heap : : kHashTableMapRootIndex ) ; <nl> __ cmp ( r4 , ip ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> <nl> / / Load the map of the receiver , compute the keyed lookup cache hash <nl> / / based on 32 bits of the map pointer and the name hash . <nl> - __ ldr ( r2 , FieldMemOperand ( r1 , HeapObject : : kMapOffset ) ) ; <nl> - __ mov ( r3 , Operand ( r2 , ASR , KeyedLookupCache : : kMapHashShift ) ) ; <nl> - __ ldr ( r4 , FieldMemOperand ( r0 , Name : : kHashFieldOffset ) ) ; <nl> + __ ldr ( r0 , FieldMemOperand ( receiver , HeapObject : : kMapOffset ) ) ; <nl> + __ mov ( r3 , Operand ( r0 , ASR , KeyedLookupCache : : kMapHashShift ) ) ; <nl> + __ ldr ( r4 , FieldMemOperand ( key , Name : : kHashFieldOffset ) ) ; <nl> __ eor ( r3 , r3 , Operand ( r4 , ASR , Name : : kHashShift ) ) ; <nl> int mask = KeyedLookupCache : : kCapacityMask & KeyedLookupCache : : kHashMask ; <nl> __ And ( r3 , r3 , Operand ( mask ) ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> Label try_next_entry ; <nl> / / Load map and move r4 to next entry . <nl> __ ldr ( r5 , MemOperand ( r4 , kPointerSize * 2 , PostIndex ) ) ; <nl> - __ cmp ( r2 , r5 ) ; <nl> + __ cmp ( r0 , r5 ) ; <nl> __ b ( ne , & try_next_entry ) ; <nl> __ ldr ( r5 , MemOperand ( r4 , - kPointerSize ) ) ; / / Load name <nl> - __ cmp ( r0 , r5 ) ; <nl> + __ cmp ( key , r5 ) ; <nl> __ b ( eq , & hit_on_nth_entry [ i ] ) ; <nl> __ bind ( & try_next_entry ) ; <nl> } <nl> <nl> / / Last entry : Load map and move r4 to name . <nl> __ ldr ( r5 , MemOperand ( r4 , kPointerSize , PostIndex ) ) ; <nl> - __ cmp ( r2 , r5 ) ; <nl> + __ cmp ( r0 , r5 ) ; <nl> __ b ( ne , & slow ) ; <nl> __ ldr ( r5 , MemOperand ( r4 ) ) ; <nl> - __ cmp ( r0 , r5 ) ; <nl> + __ cmp ( key , r5 ) ; <nl> __ b ( ne , & slow ) ; <nl> <nl> / / Get field offset . <nl> - / / r0 : key <nl> - / / r1 : receiver <nl> - / / r2 : receiver ' s map <nl> + / / r0 : receiver ' s map <nl> / / r3 : lookup cache index <nl> ExternalReference cache_field_offsets = <nl> ExternalReference : : keyed_lookup_cache_field_offsets ( isolate ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> __ add ( r3 , r3 , Operand ( i ) ) ; <nl> } <nl> __ ldr ( r5 , MemOperand ( r4 , r3 , LSL , kPointerSizeLog2 ) ) ; <nl> - __ ldrb ( r6 , FieldMemOperand ( r2 , Map : : kInObjectPropertiesOffset ) ) ; <nl> + __ ldrb ( r6 , FieldMemOperand ( r0 , Map : : kInObjectPropertiesOffset ) ) ; <nl> __ sub ( r5 , r5 , r6 , SetCC ) ; <nl> __ b ( ge , & property_array_property ) ; <nl> if ( i ! = 0 ) { <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> <nl> / / Load in - object property . <nl> __ bind ( & load_in_object_property ) ; <nl> - __ ldrb ( r6 , FieldMemOperand ( r2 , Map : : kInstanceSizeOffset ) ) ; <nl> + __ ldrb ( r6 , FieldMemOperand ( r0 , Map : : kInstanceSizeOffset ) ) ; <nl> __ add ( r6 , r6 , r5 ) ; / / Index from start of object . <nl> - __ sub ( r1 , r1 , Operand ( kHeapObjectTag ) ) ; / / Remove the heap tag . <nl> - __ ldr ( r0 , MemOperand ( r1 , r6 , LSL , kPointerSizeLog2 ) ) ; <nl> + __ sub ( receiver , receiver , Operand ( kHeapObjectTag ) ) ; / / Remove the heap tag . <nl> + __ ldr ( r0 , MemOperand ( receiver , r6 , LSL , kPointerSizeLog2 ) ) ; <nl> __ IncrementCounter ( isolate - > counters ( ) - > keyed_load_generic_lookup_cache ( ) , <nl> - 1 , r2 , r3 ) ; <nl> + 1 , r4 , r3 ) ; <nl> __ Ret ( ) ; <nl> <nl> / / Load property array property . <nl> __ bind ( & property_array_property ) ; <nl> - __ ldr ( r1 , FieldMemOperand ( r1 , JSObject : : kPropertiesOffset ) ) ; <nl> - __ add ( r1 , r1 , Operand ( FixedArray : : kHeaderSize - kHeapObjectTag ) ) ; <nl> - __ ldr ( r0 , MemOperand ( r1 , r5 , LSL , kPointerSizeLog2 ) ) ; <nl> + __ ldr ( receiver , FieldMemOperand ( receiver , JSObject : : kPropertiesOffset ) ) ; <nl> + __ add ( receiver , receiver , Operand ( FixedArray : : kHeaderSize - kHeapObjectTag ) ) ; <nl> + __ ldr ( r0 , MemOperand ( receiver , r5 , LSL , kPointerSizeLog2 ) ) ; <nl> __ IncrementCounter ( isolate - > counters ( ) - > keyed_load_generic_lookup_cache ( ) , <nl> - 1 , r2 , r3 ) ; <nl> + 1 , r4 , r3 ) ; <nl> __ Ret ( ) ; <nl> <nl> / / Do a quick inline probe of the receiver ' s dictionary , if it <nl> / / exists . <nl> __ bind ( & probe_dictionary ) ; <nl> - / / r1 : receiver <nl> - / / r0 : key <nl> / / r3 : elements <nl> - __ ldr ( r2 , FieldMemOperand ( r1 , HeapObject : : kMapOffset ) ) ; <nl> - __ ldrb ( r2 , FieldMemOperand ( r2 , Map : : kInstanceTypeOffset ) ) ; <nl> - GenerateGlobalInstanceTypeCheck ( masm , r2 , & slow ) ; <nl> + __ ldr ( r0 , FieldMemOperand ( receiver , HeapObject : : kMapOffset ) ) ; <nl> + __ ldrb ( r0 , FieldMemOperand ( r0 , Map : : kInstanceTypeOffset ) ) ; <nl> + GenerateGlobalInstanceTypeCheck ( masm , r0 , & slow ) ; <nl> / / Load the property to r0 . <nl> - GenerateDictionaryLoad ( masm , & slow , r3 , r0 , r0 , r2 , r4 ) ; <nl> + GenerateDictionaryLoad ( masm , & slow , r3 , key , r0 , r5 , r4 ) ; <nl> __ IncrementCounter ( <nl> - isolate - > counters ( ) - > keyed_load_generic_symbol ( ) , 1 , r2 , r3 ) ; <nl> + isolate - > counters ( ) - > keyed_load_generic_symbol ( ) , 1 , r4 , r3 ) ; <nl> __ Ret ( ) ; <nl> <nl> __ bind ( & index_name ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> <nl> <nl> void KeyedLoadIC : : GenerateString ( MacroAssembler * masm ) { <nl> - / / Return address is on the stack . <nl> + / / Return address is in lr . <nl> Label miss ; <nl> <nl> Register receiver = ReceiverRegister ( ) ; <nl> void KeyedLoadIC : : GenerateString ( MacroAssembler * masm ) { <nl> <nl> <nl> void KeyedLoadIC : : GenerateIndexedInterceptor ( MacroAssembler * masm ) { <nl> - / / Return address is on the stack . <nl> + / / Return address is in lr . <nl> Label slow ; <nl> <nl> Register receiver = ReceiverRegister ( ) ; <nl> Register key = NameRegister ( ) ; <nl> - Register scratch1 = r2 ; <nl> - Register scratch2 = r3 ; <nl> + Register scratch1 = r3 ; <nl> + Register scratch2 = r4 ; <nl> ASSERT ( ! scratch1 . is ( receiver ) & & ! scratch1 . is ( key ) ) ; <nl> ASSERT ( ! scratch2 . is ( receiver ) & & ! scratch2 . is ( key ) ) ; <nl> <nl> mmm a / src / arm / lithium - arm . cc <nl> ppp b / src / arm / lithium - arm . cc <nl> LInstruction * LChunkBuilder : : DoLoadKeyed ( HLoadKeyed * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoLoadKeyedGeneric ( HLoadKeyedGeneric * instr ) { <nl> LOperand * context = UseFixed ( instr - > context ( ) , cp ) ; <nl> - LOperand * object = UseFixed ( instr - > object ( ) , KeyedLoadIC : : ReceiverRegister ( ) ) ; <nl> - LOperand * key = UseFixed ( instr - > key ( ) , KeyedLoadIC : : NameRegister ( ) ) ; <nl> + LOperand * object = UseFixed ( instr - > object ( ) , LoadIC : : ReceiverRegister ( ) ) ; <nl> + LOperand * key = UseFixed ( instr - > key ( ) , LoadIC : : NameRegister ( ) ) ; <nl> <nl> LInstruction * result = <nl> DefineFixed ( new ( zone ( ) ) LLoadKeyedGeneric ( context , object , key ) , r0 ) ; <nl> mmm a / src / arm / lithium - codegen - arm . cc <nl> ppp b / src / arm / lithium - codegen - arm . cc <nl> MemOperand LCodeGen : : PrepareKeyedOperand ( Register key , <nl> <nl> void LCodeGen : : DoLoadKeyedGeneric ( LLoadKeyedGeneric * instr ) { <nl> ASSERT ( ToRegister ( instr - > context ( ) ) . is ( cp ) ) ; <nl> - ASSERT ( ToRegister ( instr - > object ( ) ) . is ( KeyedLoadIC : : ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( ToRegister ( instr - > key ( ) ) . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> + ASSERT ( ToRegister ( instr - > object ( ) ) . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> + ASSERT ( ToRegister ( instr - > key ( ) ) . is ( LoadIC : : NameRegister ( ) ) ) ; <nl> <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > KeyedLoadIC_Initialize ( ) ; <nl> CallCode ( ic , RelocInfo : : CODE_TARGET , instr , NEVER_INLINE_TARGET_ADDRESS ) ; <nl> mmm a / src / arm / stub - cache - arm . cc <nl> ppp b / src / arm / stub - cache - arm . cc <nl> Register * LoadStubCompiler : : registers ( ) { <nl> / / receiver , name , scratch1 , scratch2 , scratch3 , scratch4 . <nl> Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> Register name = LoadIC : : NameRegister ( ) ; <nl> - static Register registers [ ] = { receiver , name , r3 , r1 , r4 , r5 } ; <nl> + static Register registers [ ] = { receiver , name , r3 , r0 , r4 , r5 } ; <nl> return registers ; <nl> } <nl> <nl> <nl> Register * KeyedLoadStubCompiler : : registers ( ) { <nl> / / receiver , name , scratch1 , scratch2 , scratch3 , scratch4 . <nl> - Register receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register name = KeyedLoadIC : : NameRegister ( ) ; <nl> - static Register registers [ ] = { receiver , name , r2 , r3 , r4 , r5 } ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register name = LoadIC : : NameRegister ( ) ; <nl> + static Register registers [ ] = { receiver , name , r3 , r0 , r4 , r5 } ; <nl> return registers ; <nl> } <nl> <nl> Handle < Code > KeyedStoreStubCompiler : : CompileStorePolymorphic ( <nl> <nl> void KeyedLoadStubCompiler : : GenerateLoadDictionaryElement ( <nl> MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - S t a t e mmmmmmmmmmmm - - <nl> - / / - - lr : return address <nl> - / / - - r0 : key <nl> - / / - - r1 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( r1 . is ( KeyedLoadIC : : ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( r0 . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> + / / The return address is in lr . <nl> Label slow , miss ; <nl> <nl> - Register key = r0 ; <nl> - Register receiver = r1 ; <nl> + Register key = LoadIC : : NameRegister ( ) ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + ASSERT ( receiver . is ( r1 ) ) ; <nl> + ASSERT ( key . is ( r2 ) ) ; <nl> <nl> - __ UntagAndJumpIfNotSmi ( r2 , key , & miss ) ; <nl> + __ UntagAndJumpIfNotSmi ( r6 , key , & miss ) ; <nl> __ ldr ( r4 , FieldMemOperand ( receiver , JSObject : : kElementsOffset ) ) ; <nl> - __ LoadFromNumberDictionary ( & slow , r4 , key , r0 , r2 , r3 , r5 ) ; <nl> + __ LoadFromNumberDictionary ( & slow , r4 , key , r0 , r6 , r3 , r5 ) ; <nl> __ Ret ( ) ; <nl> <nl> __ bind ( & slow ) ; <nl> void KeyedLoadStubCompiler : : GenerateLoadDictionaryElement ( <nl> masm - > isolate ( ) - > counters ( ) - > keyed_load_external_array_slow ( ) , <nl> 1 , r2 , r3 ) ; <nl> <nl> - / / mmmmmmmmm - S t a t e mmmmmmmmmmmm - - <nl> - / / - - lr : return address <nl> - / / - - r0 : key <nl> - / / - - r1 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> TailCallBuiltin ( masm , Builtins : : kKeyedLoadIC_Slow ) ; <nl> <nl> / / Miss case , call the runtime . <nl> __ bind ( & miss ) ; <nl> <nl> - / / mmmmmmmmm - S t a t e mmmmmmmmmmmm - - <nl> - / / - - lr : return address <nl> - / / - - r0 : key <nl> - / / - - r1 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> TailCallBuiltin ( masm , Builtins : : kKeyedLoadIC_Miss ) ; <nl> } <nl> <nl> mmm a / src / arm64 / code - stubs - arm64 . cc <nl> ppp b / src / arm64 / code - stubs - arm64 . cc <nl> void JSEntryStub : : GenerateBody ( MacroAssembler * masm , bool is_construct ) { <nl> <nl> void FunctionPrototypeStub : : Generate ( MacroAssembler * masm ) { <nl> Label miss ; <nl> - Register receiver ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register name = LoadIC : : NameRegister ( ) ; <nl> + <nl> + ASSERT ( kind ( ) = = Code : : LOAD_IC | | <nl> + kind ( ) = = Code : : KEYED_LOAD_IC ) ; <nl> + <nl> if ( kind ( ) = = Code : : KEYED_LOAD_IC ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - lr : return address <nl> - / / - - x1 : receiver <nl> - / / - - x0 : key <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - Register key = x0 ; <nl> - receiver = x1 ; <nl> - __ Cmp ( key , Operand ( isolate ( ) - > factory ( ) - > prototype_string ( ) ) ) ; <nl> + __ Cmp ( name , Operand ( isolate ( ) - > factory ( ) - > prototype_string ( ) ) ) ; <nl> __ B ( ne , & miss ) ; <nl> - } else { <nl> - ASSERT ( kind ( ) = = Code : : LOAD_IC ) ; <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - lr : return address <nl> - / / - - x2 : name <nl> - / / - - x0 : receiver <nl> - / / - - sp [ 0 ] : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - receiver = x0 ; <nl> } <nl> <nl> StubCompiler : : GenerateLoadFunctionPrototype ( masm , receiver , x10 , x11 , & miss ) ; <nl> mmm a / src / arm64 / debug - arm64 . cc <nl> ppp b / src / arm64 / debug - arm64 . cc <nl> void DebugCodegen : : GenerateStoreICDebugBreak ( MacroAssembler * masm ) { <nl> <nl> void DebugCodegen : : GenerateKeyedLoadICDebugBreak ( MacroAssembler * masm ) { <nl> / / Calling convention for keyed IC load ( from ic - arm . cc ) . <nl> - Register receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register name = KeyedLoadIC : : NameRegister ( ) ; <nl> - Generate_DebugBreakCallHelper ( masm , receiver . Bit ( ) | name . Bit ( ) , 0 , x10 ) ; <nl> + GenerateLoadICDebugBreak ( masm ) ; <nl> } <nl> <nl> <nl> mmm a / src / arm64 / full - codegen - arm64 . cc <nl> ppp b / src / arm64 / full - codegen - arm64 . cc <nl> void FullCodeGenerator : : VisitAssignment ( Assignment * expr ) { <nl> break ; <nl> case NAMED_PROPERTY : <nl> if ( expr - > is_compound ( ) ) { <nl> - / / We need the receiver both on the stack and in the accumulator . <nl> - VisitForAccumulatorValue ( property - > obj ( ) ) ; <nl> - __ Push ( result_register ( ) ) ; <nl> + / / We need the receiver both on the stack and in the register . <nl> + VisitForStackValue ( property - > obj ( ) ) ; <nl> + __ Peek ( LoadIC : : ReceiverRegister ( ) , 0 ) ; <nl> } else { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> } <nl> void FullCodeGenerator : : VisitAssignment ( Assignment * expr ) { <nl> case KEYED_PROPERTY : <nl> if ( expr - > is_compound ( ) ) { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> - VisitForAccumulatorValue ( property - > key ( ) ) ; <nl> - __ Peek ( x1 , 0 ) ; <nl> - __ Push ( x0 ) ; <nl> + VisitForStackValue ( property - > key ( ) ) ; <nl> + __ Peek ( LoadIC : : ReceiverRegister ( ) , 1 * kPointerSize ) ; <nl> + __ Peek ( LoadIC : : NameRegister ( ) , 0 ) ; <nl> } else { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> VisitForStackValue ( property - > key ( ) ) ; <nl> void FullCodeGenerator : : VisitProperty ( Property * expr ) { <nl> <nl> if ( key - > IsPropertyName ( ) ) { <nl> VisitForAccumulatorValue ( expr - > obj ( ) ) ; <nl> - ASSERT ( x0 . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> + __ Move ( LoadIC : : ReceiverRegister ( ) , x0 ) ; <nl> EmitNamedPropertyLoad ( expr ) ; <nl> PrepareForBailoutForId ( expr - > LoadId ( ) , TOS_REG ) ; <nl> context ( ) - > Plug ( x0 ) ; <nl> } else { <nl> VisitForStackValue ( expr - > obj ( ) ) ; <nl> VisitForAccumulatorValue ( expr - > key ( ) ) ; <nl> - ASSERT ( x0 . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> - __ Pop ( KeyedLoadIC : : ReceiverRegister ( ) ) ; <nl> + __ Move ( LoadIC : : NameRegister ( ) , x0 ) ; <nl> + __ Pop ( LoadIC : : ReceiverRegister ( ) ) ; <nl> EmitKeyedPropertyLoad ( expr ) ; <nl> context ( ) - > Plug ( x0 ) ; <nl> } <nl> void FullCodeGenerator : : EmitKeyedCallWithLoadIC ( Call * expr , <nl> Expression * key ) { <nl> / / Load the key . <nl> VisitForAccumulatorValue ( key ) ; <nl> - ASSERT ( x0 . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> <nl> Expression * callee = expr - > expression ( ) ; <nl> <nl> / / Load the function from the receiver . <nl> ASSERT ( callee - > IsProperty ( ) ) ; <nl> - __ Peek ( KeyedLoadIC : : ReceiverRegister ( ) , 0 ) ; <nl> + __ Peek ( LoadIC : : ReceiverRegister ( ) , 0 ) ; <nl> + __ Move ( LoadIC : : NameRegister ( ) , x0 ) ; <nl> EmitKeyedPropertyLoad ( callee - > AsProperty ( ) ) ; <nl> PrepareForBailoutForId ( callee - > AsProperty ( ) - > LoadId ( ) , TOS_REG ) ; <nl> <nl> void FullCodeGenerator : : VisitCountOperation ( CountOperation * expr ) { <nl> __ Push ( xzr ) ; <nl> } <nl> if ( assign_type = = NAMED_PROPERTY ) { <nl> - / / Put the object both on the stack and in the accumulator . <nl> - VisitForAccumulatorValue ( prop - > obj ( ) ) ; <nl> - ASSERT ( x0 . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> - __ Push ( LoadIC : : ReceiverRegister ( ) ) ; <nl> + / / Put the object both on the stack and in the register . <nl> + VisitForStackValue ( prop - > obj ( ) ) ; <nl> + __ Peek ( LoadIC : : ReceiverRegister ( ) , 0 ) ; <nl> EmitNamedPropertyLoad ( prop ) ; <nl> } else { <nl> / / KEYED_PROPERTY <nl> VisitForStackValue ( prop - > obj ( ) ) ; <nl> - VisitForAccumulatorValue ( prop - > key ( ) ) ; <nl> - ASSERT ( x0 . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> - __ Peek ( KeyedLoadIC : : ReceiverRegister ( ) , 0 ) ; <nl> - __ Push ( KeyedLoadIC : : NameRegister ( ) ) ; <nl> + VisitForStackValue ( prop - > key ( ) ) ; <nl> + __ Peek ( LoadIC : : ReceiverRegister ( ) , 1 * kPointerSize ) ; <nl> + __ Peek ( LoadIC : : NameRegister ( ) , 0 ) ; <nl> EmitKeyedPropertyLoad ( prop ) ; <nl> } <nl> } <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> Label l_catch , l_try , l_suspend , l_continuation , l_resume ; <nl> Label l_next , l_call , l_loop ; <nl> + Register load_receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register load_name = LoadIC : : NameRegister ( ) ; <nl> + <nl> / / Initial send value is undefined . <nl> __ LoadRoot ( x0 , Heap : : kUndefinedValueRootIndex ) ; <nl> __ B ( & l_next ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> / / catch ( e ) { receiver = iter ; f = ' throw ' ; arg = e ; goto l_call ; } <nl> __ Bind ( & l_catch ) ; <nl> handler_table ( ) - > set ( expr - > index ( ) , Smi : : FromInt ( l_catch . pos ( ) ) ) ; <nl> - __ LoadRoot ( x2 , Heap : : kthrow_stringRootIndex ) ; / / " throw " <nl> - __ Peek ( x3 , 1 * kPointerSize ) ; / / iter <nl> - __ Push ( x2 , x3 , x0 ) ; / / " throw " , iter , except <nl> + __ LoadRoot ( load_name , Heap : : kthrow_stringRootIndex ) ; / / " throw " <nl> + __ Peek ( x3 , 1 * kPointerSize ) ; / / iter <nl> + __ Push ( load_name , x3 , x0 ) ; / / " throw " , iter , except <nl> __ B ( & l_call ) ; <nl> <nl> / / try { received = % yield result } <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> / / receiver = iter ; f = ' next ' ; arg = received ; <nl> __ Bind ( & l_next ) ; <nl> - Register keyedload_receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register keyedload_name = KeyedLoadIC : : NameRegister ( ) ; <nl> - ASSERT ( keyedload_receiver . is ( x1 ) ) ; <nl> - ASSERT ( keyedload_name . is ( x0 ) ) ; <nl> <nl> - __ LoadRoot ( x2 , Heap : : knext_stringRootIndex ) ; / / " next " <nl> - __ Peek ( x3 , 1 * kPointerSize ) ; / / iter <nl> - __ Push ( x2 , x3 , x0 ) ; / / " next " , iter , received <nl> + __ LoadRoot ( load_name , Heap : : knext_stringRootIndex ) ; / / " next " <nl> + __ Peek ( x3 , 1 * kPointerSize ) ; / / iter <nl> + __ Push ( load_name , x3 , x0 ) ; / / " next " , iter , received <nl> <nl> / / result = receiver [ f ] ( arg ) ; <nl> __ Bind ( & l_call ) ; <nl> - __ Peek ( keyedload_receiver , 1 * kPointerSize ) ; <nl> - __ Peek ( keyedload_name , 2 * kPointerSize ) ; <nl> + __ Peek ( load_receiver , 1 * kPointerSize ) ; <nl> + __ Peek ( load_name , 2 * kPointerSize ) ; <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > KeyedLoadIC_Initialize ( ) ; <nl> CallIC ( ic , TypeFeedbackId : : None ( ) ) ; <nl> __ Mov ( x1 , x0 ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> / / if ( ! result . done ) goto l_try ; <nl> __ Bind ( & l_loop ) ; <nl> - Register load_receiver = LoadIC : : ReceiverRegister ( ) ; <nl> - Register load_name = LoadIC : : NameRegister ( ) ; <nl> - ASSERT ( load_receiver . is ( x0 ) ) ; <nl> - ASSERT ( load_name . is ( x2 ) ) ; <nl> + __ Move ( load_receiver , x0 ) ; <nl> + <nl> __ Push ( load_receiver ) ; / / save result <nl> __ LoadRoot ( load_name , Heap : : kdone_stringRootIndex ) ; / / " done " <nl> CallLoadIC ( NOT_CONTEXTUAL ) ; / / x0 = result . done <nl> mmm a / src / arm64 / ic - arm64 . cc <nl> ppp b / src / arm64 / ic - arm64 . cc <nl> static MemOperand GenerateUnmappedArgumentsLookup ( MacroAssembler * masm , <nl> <nl> <nl> void LoadIC : : GenerateMegamorphic ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - x2 : name <nl> - / / - - lr : return address <nl> - / / - - x0 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( x0 . is ( ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( x2 . is ( NameRegister ( ) ) ) ; <nl> + / / The return address is in lr . <nl> + Register receiver = ReceiverRegister ( ) ; <nl> + Register name = NameRegister ( ) ; <nl> + ASSERT ( receiver . is ( x1 ) ) ; <nl> + ASSERT ( name . is ( x2 ) ) ; <nl> <nl> / / Probe the stub cache . <nl> Code : : Flags flags = Code : : ComputeHandlerFlags ( Code : : LOAD_IC ) ; <nl> masm - > isolate ( ) - > stub_cache ( ) - > GenerateProbe ( <nl> - masm , flags , x0 , x2 , x3 , x4 , x5 , x6 ) ; <nl> + masm , flags , receiver , name , x3 , x4 , x5 , x6 ) ; <nl> <nl> / / Cache miss : Jump to runtime . <nl> GenerateMiss ( masm ) ; <nl> void LoadIC : : GenerateNormal ( MacroAssembler * masm ) { <nl> / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> / / - - x2 : name <nl> / / - - lr : return address <nl> - / / - - x0 : receiver <nl> + / / - - x1 : receiver <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( x0 . is ( ReceiverRegister ( ) ) ) ; <nl> + ASSERT ( x1 . is ( ReceiverRegister ( ) ) ) ; <nl> ASSERT ( x2 . is ( NameRegister ( ) ) ) ; <nl> Label miss , slow ; <nl> <nl> - GenerateNameDictionaryReceiverCheck ( masm , x0 , x1 , x3 , x4 , & miss ) ; <nl> + GenerateNameDictionaryReceiverCheck ( masm , x1 , x0 , x3 , x4 , & miss ) ; <nl> <nl> - / / x1 now holds the property dictionary . <nl> - GenerateDictionaryLoad ( masm , & slow , x1 , x2 , x0 , x3 , x4 ) ; <nl> + / / x0 now holds the property dictionary . <nl> + GenerateDictionaryLoad ( masm , & slow , x0 , x2 , x0 , x3 , x4 ) ; <nl> __ Ret ( ) ; <nl> <nl> / / Dictionary load failed , go slow ( but don ' t miss ) . <nl> void LoadIC : : GenerateNormal ( MacroAssembler * masm ) { <nl> <nl> <nl> void LoadIC : : GenerateMiss ( MacroAssembler * masm ) { <nl> - / / The return address is on the stack . <nl> + / / The return address is in lr . <nl> Isolate * isolate = masm - > isolate ( ) ; <nl> ASM_LOCATION ( " LoadIC : : GenerateMiss " ) ; <nl> <nl> void LoadIC : : GenerateMiss ( MacroAssembler * masm ) { <nl> <nl> <nl> void LoadIC : : GenerateRuntimeGetProperty ( MacroAssembler * masm ) { <nl> - / / The return address is on the stack . <nl> + / / The return address is in lr . <nl> __ Push ( ReceiverRegister ( ) , NameRegister ( ) ) ; <nl> __ TailCallRuntime ( Runtime : : kGetProperty , 2 , 1 ) ; <nl> } <nl> <nl> <nl> void KeyedLoadIC : : GenerateSloppyArguments ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - S t a t e mmmmmmmmmmmm - - <nl> - / / - - lr : return address <nl> - / / - - x0 : key <nl> - / / - - x1 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / The return address is in lr . <nl> Register result = x0 ; <nl> Register receiver = ReceiverRegister ( ) ; <nl> Register key = NameRegister ( ) ; <nl> ASSERT ( receiver . is ( x1 ) ) ; <nl> - ASSERT ( key . is ( x0 ) ) ; <nl> + ASSERT ( key . is ( x2 ) ) ; <nl> <nl> Label miss , unmapped ; <nl> <nl> - Register map_scratch = x2 ; <nl> + Register map_scratch = x0 ; <nl> MemOperand mapped_location = GenerateMappedArgumentsLookup ( <nl> masm , receiver , key , map_scratch , x3 , x4 , & unmapped , & miss ) ; <nl> __ Ldr ( result , mapped_location ) ; <nl> void KeyedLoadIC : : GenerateSloppyArguments ( MacroAssembler * masm ) { <nl> / / Parameter map is left in map_scratch when a jump on unmapped is done . <nl> MemOperand unmapped_location = <nl> GenerateUnmappedArgumentsLookup ( masm , key , map_scratch , x3 , & miss ) ; <nl> - __ Ldr ( x2 , unmapped_location ) ; <nl> - __ JumpIfRoot ( x2 , Heap : : kTheHoleValueRootIndex , & miss ) ; <nl> - / / Move the result in x0 . x0 must be preserved on miss . <nl> - __ Mov ( result , x2 ) ; <nl> + __ Ldr ( result , unmapped_location ) ; <nl> + __ JumpIfRoot ( result , Heap : : kTheHoleValueRootIndex , & miss ) ; <nl> __ Ret ( ) ; <nl> <nl> __ Bind ( & miss ) ; <nl> void KeyedStoreIC : : GenerateSloppyArguments ( MacroAssembler * masm ) { <nl> <nl> <nl> void KeyedLoadIC : : GenerateMiss ( MacroAssembler * masm ) { <nl> - / / The return address is on the stack . <nl> + / / The return address is in lr . <nl> Isolate * isolate = masm - > isolate ( ) ; <nl> <nl> __ IncrementCounter ( isolate - > counters ( ) - > keyed_load_miss ( ) , 1 , x10 , x11 ) ; <nl> void KeyedLoadIC : : GenerateMiss ( MacroAssembler * masm ) { <nl> <nl> <nl> / / IC register specifications <nl> - const Register LoadIC : : ReceiverRegister ( ) { return x0 ; } <nl> + const Register LoadIC : : ReceiverRegister ( ) { return x1 ; } <nl> const Register LoadIC : : NameRegister ( ) { return x2 ; } <nl> - const Register KeyedLoadIC : : ReceiverRegister ( ) { return x1 ; } <nl> - const Register KeyedLoadIC : : NameRegister ( ) { return x0 ; } <nl> <nl> <nl> void KeyedLoadIC : : GenerateRuntimeGetProperty ( MacroAssembler * masm ) { <nl> - / / The return address is on the stack . <nl> + / / The return address is in lr . <nl> __ Push ( ReceiverRegister ( ) , NameRegister ( ) ) ; <nl> __ TailCallRuntime ( Runtime : : kKeyedGetProperty , 2 , 1 ) ; <nl> } <nl> static void GenerateKeyedLoadWithNameKey ( MacroAssembler * masm , <nl> <nl> <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - S t a t e mmmmmmmmmmmm - - <nl> - / / - - lr : return address <nl> - / / - - x0 : key <nl> - / / - - x1 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / The return address is in lr . <nl> Label slow , check_name , index_smi , index_name ; <nl> <nl> Register key = NameRegister ( ) ; <nl> Register receiver = ReceiverRegister ( ) ; <nl> - ASSERT ( key . is ( x0 ) ) ; <nl> + ASSERT ( key . is ( x2 ) ) ; <nl> ASSERT ( receiver . is ( x1 ) ) ; <nl> <nl> __ JumpIfNotSmi ( key , & check_name ) ; <nl> __ Bind ( & index_smi ) ; <nl> / / Now the key is known to be a smi . This place is also jumped to from below <nl> / / where a numeric string is converted to a smi . <nl> - GenerateKeyedLoadWithSmiKey ( masm , key , receiver , x2 , x3 , x4 , x5 , x6 , & slow ) ; <nl> + GenerateKeyedLoadWithSmiKey ( masm , key , receiver , x7 , x3 , x4 , x5 , x6 , & slow ) ; <nl> <nl> - / / Slow case , key and receiver still in x0 and x1 . <nl> + / / Slow case . <nl> __ Bind ( & slow ) ; <nl> __ IncrementCounter ( <nl> - masm - > isolate ( ) - > counters ( ) - > keyed_load_generic_slow ( ) , 1 , x2 , x3 ) ; <nl> + masm - > isolate ( ) - > counters ( ) - > keyed_load_generic_slow ( ) , 1 , x4 , x3 ) ; <nl> GenerateRuntimeGetProperty ( masm ) ; <nl> <nl> __ Bind ( & check_name ) ; <nl> - GenerateKeyNameCheck ( masm , key , x2 , x3 , & index_name , & slow ) ; <nl> + GenerateKeyNameCheck ( masm , key , x0 , x3 , & index_name , & slow ) ; <nl> <nl> - GenerateKeyedLoadWithNameKey ( masm , key , receiver , x2 , x3 , x4 , x5 , x6 , & slow ) ; <nl> + GenerateKeyedLoadWithNameKey ( masm , key , receiver , x7 , x3 , x4 , x5 , x6 , & slow ) ; <nl> <nl> __ Bind ( & index_name ) ; <nl> __ IndexFromHash ( x3 , key ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> <nl> <nl> void KeyedLoadIC : : GenerateString ( MacroAssembler * masm ) { <nl> - / / Return address is on the stack . <nl> + / / Return address is in lr . <nl> Label miss ; <nl> <nl> Register receiver = ReceiverRegister ( ) ; <nl> void KeyedLoadIC : : GenerateString ( MacroAssembler * masm ) { <nl> <nl> <nl> void KeyedLoadIC : : GenerateIndexedInterceptor ( MacroAssembler * masm ) { <nl> - / / Return address is on the stack . <nl> + / / Return address is in lr . <nl> Label slow ; <nl> <nl> Register receiver = ReceiverRegister ( ) ; <nl> Register key = NameRegister ( ) ; <nl> - Register scratch1 = x2 ; <nl> - Register scratch2 = x3 ; <nl> - ASSERT ( ! scratch1 . is ( receiver ) & & ! scratch1 . is ( key ) ) ; <nl> - ASSERT ( ! scratch2 . is ( receiver ) & & ! scratch2 . is ( key ) ) ; <nl> + Register scratch1 = x3 ; <nl> + Register scratch2 = x4 ; <nl> + ASSERT ( ! AreAliased ( scratch1 , scratch2 , receiver , key ) ) ; <nl> <nl> / / Check that the receiver isn ' t a smi . <nl> __ JumpIfSmi ( receiver , & slow ) ; <nl> mmm a / src / arm64 / lithium - arm64 . cc <nl> ppp b / src / arm64 / lithium - arm64 . cc <nl> LInstruction * LChunkBuilder : : DoLoadKeyed ( HLoadKeyed * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoLoadKeyedGeneric ( HLoadKeyedGeneric * instr ) { <nl> LOperand * context = UseFixed ( instr - > context ( ) , cp ) ; <nl> - LOperand * object = UseFixed ( instr - > object ( ) , KeyedLoadIC : : ReceiverRegister ( ) ) ; <nl> - LOperand * key = UseFixed ( instr - > key ( ) , KeyedLoadIC : : NameRegister ( ) ) ; <nl> + LOperand * object = UseFixed ( instr - > object ( ) , LoadIC : : ReceiverRegister ( ) ) ; <nl> + LOperand * key = UseFixed ( instr - > key ( ) , LoadIC : : NameRegister ( ) ) ; <nl> <nl> LInstruction * result = <nl> DefineFixed ( new ( zone ( ) ) LLoadKeyedGeneric ( context , object , key ) , x0 ) ; <nl> mmm a / src / arm64 / lithium - codegen - arm64 . cc <nl> ppp b / src / arm64 / lithium - codegen - arm64 . cc <nl> void LCodeGen : : DoLoadKeyedFixed ( LLoadKeyedFixed * instr ) { <nl> <nl> void LCodeGen : : DoLoadKeyedGeneric ( LLoadKeyedGeneric * instr ) { <nl> ASSERT ( ToRegister ( instr - > context ( ) ) . is ( cp ) ) ; <nl> - ASSERT ( ToRegister ( instr - > object ( ) ) . is ( KeyedLoadIC : : ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( ToRegister ( instr - > key ( ) ) . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> + ASSERT ( ToRegister ( instr - > object ( ) ) . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> + ASSERT ( ToRegister ( instr - > key ( ) ) . is ( LoadIC : : NameRegister ( ) ) ) ; <nl> <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > KeyedLoadIC_Initialize ( ) ; <nl> CallCode ( ic , RelocInfo : : CODE_TARGET , instr ) ; <nl> void LCodeGen : : DoLoadNamedGeneric ( LLoadNamedGeneric * instr ) { <nl> ASSERT ( ToRegister ( instr - > context ( ) ) . is ( cp ) ) ; <nl> / / LoadIC expects name and receiver in registers . <nl> ASSERT ( ToRegister ( instr - > object ( ) ) . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( ToRegister ( instr - > object ( ) ) . is ( x0 ) ) ; <nl> __ Mov ( LoadIC : : NameRegister ( ) , Operand ( instr - > name ( ) ) ) ; <nl> <nl> Handle < Code > ic = LoadIC : : initialize_stub ( isolate ( ) , NOT_CONTEXTUAL ) ; <nl> mmm a / src / arm64 / stub - cache - arm64 . cc <nl> ppp b / src / arm64 / stub - cache - arm64 . cc <nl> Register * LoadStubCompiler : : registers ( ) { <nl> / / receiver , name , scratch1 , scratch2 , scratch3 , scratch4 . <nl> Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> Register name = LoadIC : : NameRegister ( ) ; <nl> - static Register registers [ ] = { receiver , name , x3 , x1 , x4 , x5 } ; <nl> + static Register registers [ ] = { receiver , name , x3 , x0 , x4 , x5 } ; <nl> return registers ; <nl> } <nl> <nl> <nl> Register * KeyedLoadStubCompiler : : registers ( ) { <nl> / / receiver , name , scratch1 , scratch2 , scratch3 , scratch4 . <nl> - Register receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register name = KeyedLoadIC : : NameRegister ( ) ; <nl> - static Register registers [ ] = { receiver , name , x2 , x3 , x4 , x5 } ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register name = LoadIC : : NameRegister ( ) ; <nl> + static Register registers [ ] = { receiver , name , x3 , x0 , x4 , x5 } ; <nl> return registers ; <nl> } <nl> <nl> Handle < Code > KeyedStoreStubCompiler : : CompileStorePolymorphic ( <nl> <nl> void KeyedLoadStubCompiler : : GenerateLoadDictionaryElement ( <nl> MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - S t a t e mmmmmmmmmmmm - - <nl> - / / - - lr : return address <nl> - / / - - x0 : key <nl> - / / - - x1 : receiver <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( x1 . is ( KeyedLoadIC : : ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( x0 . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> + / / The return address is in lr . <nl> Label slow , miss ; <nl> <nl> Register result = x0 ; <nl> - Register key = x0 ; <nl> - Register receiver = x1 ; <nl> + Register key = LoadIC : : NameRegister ( ) ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + ASSERT ( receiver . is ( x1 ) ) ; <nl> + ASSERT ( key . is ( x2 ) ) ; <nl> <nl> __ JumpIfNotSmi ( key , & miss ) ; <nl> __ Ldr ( x4 , FieldMemOperand ( receiver , JSObject : : kElementsOffset ) ) ; <nl> - __ LoadFromNumberDictionary ( & slow , x4 , key , result , x2 , x3 , x5 , x6 ) ; <nl> + __ LoadFromNumberDictionary ( & slow , x4 , key , result , x7 , x3 , x5 , x6 ) ; <nl> __ Ret ( ) ; <nl> <nl> __ Bind ( & slow ) ; <nl> __ IncrementCounter ( <nl> - masm - > isolate ( ) - > counters ( ) - > keyed_load_external_array_slow ( ) , 1 , x2 , x3 ) ; <nl> + masm - > isolate ( ) - > counters ( ) - > keyed_load_external_array_slow ( ) , 1 , x4 , x3 ) ; <nl> TailCallBuiltin ( masm , Builtins : : kKeyedLoadIC_Slow ) ; <nl> <nl> / / Miss case , call the runtime . <nl> mmm a / src / code - stubs . cc <nl> ppp b / src / code - stubs . cc <nl> void JSEntryStub : : FinishCode ( Handle < Code > code ) { <nl> <nl> void KeyedLoadFastElementStub : : InitializeInterfaceDescriptor ( <nl> CodeStubInterfaceDescriptor * descriptor ) { <nl> - Register registers [ ] = { KeyedLoadIC : : ReceiverRegister ( ) , <nl> - KeyedLoadIC : : NameRegister ( ) } ; <nl> - STATIC_ASSERT ( KeyedLoadIC : : kRegisterArgumentCount = = 2 ) ; <nl> + Register registers [ ] = { LoadIC : : ReceiverRegister ( ) , <nl> + LoadIC : : NameRegister ( ) } ; <nl> + STATIC_ASSERT ( LoadIC : : kRegisterArgumentCount = = 2 ) ; <nl> descriptor - > Initialize ( ARRAY_SIZE ( registers ) , registers , <nl> FUNCTION_ADDR ( KeyedLoadIC_MissFromStubFailure ) ) ; <nl> } <nl> void KeyedLoadFastElementStub : : InitializeInterfaceDescriptor ( <nl> <nl> void KeyedLoadDictionaryElementStub : : InitializeInterfaceDescriptor ( <nl> CodeStubInterfaceDescriptor * descriptor ) { <nl> - Register registers [ ] = { KeyedLoadIC : : ReceiverRegister ( ) , <nl> - KeyedLoadIC : : NameRegister ( ) } ; <nl> - STATIC_ASSERT ( KeyedLoadIC : : kRegisterArgumentCount = = 2 ) ; <nl> + Register registers [ ] = { LoadIC : : ReceiverRegister ( ) , <nl> + LoadIC : : NameRegister ( ) } ; <nl> + STATIC_ASSERT ( LoadIC : : kRegisterArgumentCount = = 2 ) ; <nl> descriptor - > Initialize ( ARRAY_SIZE ( registers ) , registers , <nl> FUNCTION_ADDR ( KeyedLoadIC_MissFromStubFailure ) ) ; <nl> } <nl> void KeyedLoadDictionaryElementStub : : InitializeInterfaceDescriptor ( <nl> <nl> void KeyedLoadGenericElementStub : : InitializeInterfaceDescriptor ( <nl> CodeStubInterfaceDescriptor * descriptor ) { <nl> - Register registers [ ] = { KeyedLoadIC : : ReceiverRegister ( ) , <nl> - KeyedLoadIC : : NameRegister ( ) } ; <nl> - STATIC_ASSERT ( KeyedLoadIC : : kRegisterArgumentCount = = 2 ) ; <nl> + Register registers [ ] = { LoadIC : : ReceiverRegister ( ) , <nl> + LoadIC : : NameRegister ( ) } ; <nl> + STATIC_ASSERT ( LoadIC : : kRegisterArgumentCount = = 2 ) ; <nl> descriptor - > Initialize ( <nl> ARRAY_SIZE ( registers ) , registers , <nl> Runtime : : FunctionForId ( Runtime : : kKeyedGetProperty ) - > entry ) ; <nl> void LoadFieldStub : : InitializeInterfaceDescriptor ( <nl> <nl> void KeyedLoadFieldStub : : InitializeInterfaceDescriptor ( <nl> CodeStubInterfaceDescriptor * descriptor ) { <nl> - Register registers [ ] = { KeyedLoadIC : : ReceiverRegister ( ) } ; <nl> + Register registers [ ] = { LoadIC : : ReceiverRegister ( ) } ; <nl> descriptor - > Initialize ( ARRAY_SIZE ( registers ) , registers ) ; <nl> } <nl> <nl> void StringLengthStub : : InitializeInterfaceDescriptor ( <nl> <nl> void KeyedStringLengthStub : : InitializeInterfaceDescriptor ( <nl> CodeStubInterfaceDescriptor * descriptor ) { <nl> - Register registers [ ] = { KeyedLoadIC : : ReceiverRegister ( ) , <nl> - KeyedLoadIC : : NameRegister ( ) } ; <nl> + Register registers [ ] = { LoadIC : : ReceiverRegister ( ) , <nl> + LoadIC : : NameRegister ( ) } ; <nl> descriptor - > Initialize ( ARRAY_SIZE ( registers ) , registers ) ; <nl> } <nl> <nl> mmm a / src / ia32 / builtins - ia32 . cc <nl> ppp b / src / ia32 / builtins - ia32 . cc <nl> void Builtins : : Generate_FunctionApply ( MacroAssembler * masm ) { <nl> <nl> / / Copy all arguments from the array to the stack . <nl> Label entry , loop ; <nl> - __ mov ( ecx , Operand ( ebp , kIndexOffset ) ) ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register key = LoadIC : : NameRegister ( ) ; <nl> + __ mov ( key , Operand ( ebp , kIndexOffset ) ) ; <nl> __ jmp ( & entry ) ; <nl> __ bind ( & loop ) ; <nl> - __ mov ( edx , Operand ( ebp , kArgumentsOffset ) ) ; / / load arguments <nl> + __ mov ( receiver , Operand ( ebp , kArgumentsOffset ) ) ; / / load arguments <nl> <nl> / / Use inline caching to speed up access to arguments . <nl> Handle < Code > ic = masm - > isolate ( ) - > builtins ( ) - > KeyedLoadIC_Initialize ( ) ; <nl> void Builtins : : Generate_FunctionApply ( MacroAssembler * masm ) { <nl> / / Push the nth argument . <nl> __ push ( eax ) ; <nl> <nl> - / / Update the index on the stack and in register eax . <nl> - __ mov ( ecx , Operand ( ebp , kIndexOffset ) ) ; <nl> - __ add ( ecx , Immediate ( 1 < < kSmiTagSize ) ) ; <nl> - __ mov ( Operand ( ebp , kIndexOffset ) , ecx ) ; <nl> + / / Update the index on the stack and in register key . <nl> + __ mov ( key , Operand ( ebp , kIndexOffset ) ) ; <nl> + __ add ( key , Immediate ( 1 < < kSmiTagSize ) ) ; <nl> + __ mov ( Operand ( ebp , kIndexOffset ) , key ) ; <nl> <nl> __ bind ( & entry ) ; <nl> - __ cmp ( ecx , Operand ( ebp , kLimitOffset ) ) ; <nl> + __ cmp ( key , Operand ( ebp , kLimitOffset ) ) ; <nl> __ j ( not_equal , & loop ) ; <nl> <nl> / / Call the function . <nl> Label call_proxy ; <nl> - __ mov ( eax , ecx ) ; <nl> ParameterCount actual ( eax ) ; <nl> + __ Move ( eax , key ) ; <nl> __ SmiUntag ( eax ) ; <nl> __ mov ( edi , Operand ( ebp , kFunctionOffset ) ) ; <nl> __ CmpObjectType ( edi , JS_FUNCTION_TYPE , ecx ) ; <nl> mmm a / src / ia32 / debug - ia32 . cc <nl> ppp b / src / ia32 / debug - ia32 . cc <nl> void DebugCodegen : : GenerateStoreICDebugBreak ( MacroAssembler * masm ) { <nl> <nl> void DebugCodegen : : GenerateKeyedLoadICDebugBreak ( MacroAssembler * masm ) { <nl> / / Register state for keyed IC load call ( from ic - ia32 . cc ) . <nl> - Register receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register name = KeyedLoadIC : : NameRegister ( ) ; <nl> - Generate_DebugBreakCallHelper ( masm , receiver . bit ( ) | name . bit ( ) , 0 , false ) ; <nl> + GenerateLoadICDebugBreak ( masm ) ; <nl> } <nl> <nl> <nl> mmm a / src / ia32 / full - codegen - ia32 . cc <nl> ppp b / src / ia32 / full - codegen - ia32 . cc <nl> void FullCodeGenerator : : VisitAssignment ( Assignment * expr ) { <nl> break ; <nl> case NAMED_PROPERTY : <nl> if ( expr - > is_compound ( ) ) { <nl> - / / We need the receiver both on the stack and in edx . <nl> + / / We need the receiver both on the stack and in the register . <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> - __ mov ( edx , Operand ( esp , 0 ) ) ; <nl> + __ mov ( LoadIC : : ReceiverRegister ( ) , Operand ( esp , 0 ) ) ; <nl> } else { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> } <nl> void FullCodeGenerator : : VisitAssignment ( Assignment * expr ) { <nl> if ( expr - > is_compound ( ) ) { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> VisitForStackValue ( property - > key ( ) ) ; <nl> - __ mov ( edx , Operand ( esp , kPointerSize ) ) ; / / Object . <nl> - __ mov ( ecx , Operand ( esp , 0 ) ) ; / / Key . <nl> + __ mov ( LoadIC : : ReceiverRegister ( ) , Operand ( esp , kPointerSize ) ) ; <nl> + __ mov ( LoadIC : : NameRegister ( ) , Operand ( esp , 0 ) ) ; <nl> } else { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> VisitForStackValue ( property - > key ( ) ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> Label l_catch , l_try , l_suspend , l_continuation , l_resume ; <nl> Label l_next , l_call , l_loop ; <nl> + Register load_receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register load_name = LoadIC : : NameRegister ( ) ; <nl> + <nl> / / Initial send value is undefined . <nl> __ mov ( eax , isolate ( ) - > factory ( ) - > undefined_value ( ) ) ; <nl> __ jmp ( & l_next ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> / / catch ( e ) { receiver = iter ; f = ' throw ' ; arg = e ; goto l_call ; } <nl> __ bind ( & l_catch ) ; <nl> handler_table ( ) - > set ( expr - > index ( ) , Smi : : FromInt ( l_catch . pos ( ) ) ) ; <nl> - __ mov ( ecx , isolate ( ) - > factory ( ) - > throw_string ( ) ) ; / / " throw " <nl> - __ push ( ecx ) ; / / " throw " <nl> - __ push ( Operand ( esp , 2 * kPointerSize ) ) ; / / iter <nl> - __ push ( eax ) ; / / exception <nl> + __ mov ( load_name , isolate ( ) - > factory ( ) - > throw_string ( ) ) ; / / " throw " <nl> + __ push ( load_name ) ; / / " throw " <nl> + __ push ( Operand ( esp , 2 * kPointerSize ) ) ; / / iter <nl> + __ push ( eax ) ; / / exception <nl> __ jmp ( & l_call ) ; <nl> <nl> / / try { received = % yield result } <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> / / receiver = iter ; f = iter . next ; arg = received ; <nl> __ bind ( & l_next ) ; <nl> - Register keyedload_receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register keyedload_name = KeyedLoadIC : : NameRegister ( ) ; <nl> - ASSERT ( keyedload_receiver . is ( edx ) ) ; <nl> - ASSERT ( keyedload_name . is ( ecx ) ) ; <nl> <nl> - __ mov ( keyedload_name , <nl> - isolate ( ) - > factory ( ) - > next_string ( ) ) ; / / " next " <nl> - __ push ( keyedload_name ) ; <nl> - __ push ( Operand ( esp , 2 * kPointerSize ) ) ; / / iter <nl> - __ push ( eax ) ; / / received <nl> + __ mov ( load_name , isolate ( ) - > factory ( ) - > next_string ( ) ) ; <nl> + __ push ( load_name ) ; / / " next " <nl> + __ push ( Operand ( esp , 2 * kPointerSize ) ) ; / / iter <nl> + __ push ( eax ) ; / / received <nl> <nl> / / result = receiver [ f ] ( arg ) ; <nl> __ bind ( & l_call ) ; <nl> - __ mov ( keyedload_receiver , Operand ( esp , kPointerSize ) ) ; <nl> + __ mov ( load_receiver , Operand ( esp , kPointerSize ) ) ; <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > KeyedLoadIC_Initialize ( ) ; <nl> CallIC ( ic , TypeFeedbackId : : None ( ) ) ; <nl> __ mov ( edi , eax ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> / / if ( ! result . done ) goto l_try ; <nl> __ bind ( & l_loop ) ; <nl> __ push ( eax ) ; / / save result <nl> - Register load_receiver = LoadIC : : ReceiverRegister ( ) ; <nl> - Register load_name = LoadIC : : NameRegister ( ) ; <nl> - ASSERT ( load_receiver . is ( edx ) ) ; <nl> - ASSERT ( load_name . is ( ecx ) ) ; <nl> - __ mov ( load_receiver , eax ) ; / / result <nl> + __ Move ( load_receiver , eax ) ; / / result <nl> __ mov ( load_name , <nl> isolate ( ) - > factory ( ) - > done_string ( ) ) ; / / " done " <nl> CallLoadIC ( NOT_CONTEXTUAL ) ; / / result . done in eax <nl> void FullCodeGenerator : : VisitProperty ( Property * expr ) { <nl> <nl> if ( key - > IsPropertyName ( ) ) { <nl> VisitForAccumulatorValue ( expr - > obj ( ) ) ; <nl> - __ mov ( LoadIC : : ReceiverRegister ( ) , result_register ( ) ) ; <nl> + __ Move ( LoadIC : : ReceiverRegister ( ) , result_register ( ) ) ; <nl> EmitNamedPropertyLoad ( expr ) ; <nl> PrepareForBailoutForId ( expr - > LoadId ( ) , TOS_REG ) ; <nl> context ( ) - > Plug ( eax ) ; <nl> } else { <nl> VisitForStackValue ( expr - > obj ( ) ) ; <nl> VisitForAccumulatorValue ( expr - > key ( ) ) ; <nl> - __ pop ( KeyedLoadIC : : ReceiverRegister ( ) ) ; / / Object . <nl> - __ mov ( KeyedLoadIC : : NameRegister ( ) , result_register ( ) ) ; / / Key . <nl> + __ pop ( LoadIC : : ReceiverRegister ( ) ) ; / / Object . <nl> + __ Move ( LoadIC : : NameRegister ( ) , result_register ( ) ) ; / / Key . <nl> EmitKeyedPropertyLoad ( expr ) ; <nl> context ( ) - > Plug ( eax ) ; <nl> } <nl> void FullCodeGenerator : : EmitKeyedCallWithLoadIC ( Call * expr , <nl> <nl> / / Load the function from the receiver . <nl> ASSERT ( callee - > IsProperty ( ) ) ; <nl> - __ mov ( KeyedLoadIC : : ReceiverRegister ( ) , Operand ( esp , 0 ) ) ; <nl> - / / Move the key into the right register for the keyed load IC . <nl> - __ mov ( KeyedLoadIC : : NameRegister ( ) , eax ) ; <nl> + __ mov ( LoadIC : : ReceiverRegister ( ) , Operand ( esp , 0 ) ) ; <nl> + __ mov ( LoadIC : : NameRegister ( ) , eax ) ; <nl> EmitKeyedPropertyLoad ( callee - > AsProperty ( ) ) ; <nl> PrepareForBailoutForId ( callee - > AsProperty ( ) - > LoadId ( ) , TOS_REG ) ; <nl> <nl> void FullCodeGenerator : : VisitCountOperation ( CountOperation * expr ) { <nl> __ push ( Immediate ( Smi : : FromInt ( 0 ) ) ) ; <nl> } <nl> if ( assign_type = = NAMED_PROPERTY ) { <nl> - / / Put the object both on the stack and in edx . <nl> - VisitForAccumulatorValue ( prop - > obj ( ) ) ; <nl> - ASSERT ( ! eax . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> - __ push ( eax ) ; <nl> - __ mov ( LoadIC : : ReceiverRegister ( ) , eax ) ; <nl> + / / Put the object both on the stack and in the register . <nl> + VisitForStackValue ( prop - > obj ( ) ) ; <nl> + __ mov ( LoadIC : : ReceiverRegister ( ) , Operand ( esp , 0 ) ) ; <nl> EmitNamedPropertyLoad ( prop ) ; <nl> } else { <nl> VisitForStackValue ( prop - > obj ( ) ) ; <nl> VisitForStackValue ( prop - > key ( ) ) ; <nl> - __ mov ( KeyedLoadIC : : ReceiverRegister ( ) , <nl> - Operand ( esp , kPointerSize ) ) ; / / Object . <nl> - __ mov ( KeyedLoadIC : : NameRegister ( ) , Operand ( esp , 0 ) ) ; / / Key . <nl> + __ mov ( LoadIC : : ReceiverRegister ( ) , <nl> + Operand ( esp , kPointerSize ) ) ; / / Object . <nl> + __ mov ( LoadIC : : NameRegister ( ) , Operand ( esp , 0 ) ) ; / / Key . <nl> EmitKeyedPropertyLoad ( prop ) ; <nl> } <nl> } <nl> mmm a / src / ia32 / ic - ia32 . cc <nl> ppp b / src / ia32 / ic - ia32 . cc <nl> static Operand GenerateUnmappedArgumentsLookup ( MacroAssembler * masm , <nl> <nl> <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - ecx : key <nl> - / / - - edx : receiver <nl> - / / - - esp [ 0 ] : return address <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( edx . is ( ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( ecx . is ( NameRegister ( ) ) ) ; <nl> + / / The return address is on the stack . <nl> Label slow , check_name , index_smi , index_name , property_array_property ; <nl> Label probe_dictionary , check_number_dictionary ; <nl> <nl> + Register receiver = ReceiverRegister ( ) ; <nl> + Register key = NameRegister ( ) ; <nl> + ASSERT ( receiver . is ( edx ) ) ; <nl> + ASSERT ( key . is ( ecx ) ) ; <nl> + <nl> / / Check that the key is a smi . <nl> - __ JumpIfNotSmi ( ecx , & check_name ) ; <nl> + __ JumpIfNotSmi ( key , & check_name ) ; <nl> __ bind ( & index_smi ) ; <nl> / / Now the key is known to be a smi . This place is also jumped to from <nl> / / where a numeric string is converted to a smi . <nl> <nl> GenerateKeyedLoadReceiverCheck ( <nl> - masm , edx , eax , Map : : kHasIndexedInterceptor , & slow ) ; <nl> + masm , receiver , eax , Map : : kHasIndexedInterceptor , & slow ) ; <nl> <nl> / / Check the receiver ' s map to see if it has fast elements . <nl> __ CheckFastElements ( eax , & check_number_dictionary ) ; <nl> <nl> - GenerateFastArrayLoad ( masm , edx , ecx , eax , eax , NULL , & slow ) ; <nl> + GenerateFastArrayLoad ( masm , receiver , key , eax , eax , NULL , & slow ) ; <nl> Isolate * isolate = masm - > isolate ( ) ; <nl> Counters * counters = isolate - > counters ( ) ; <nl> __ IncrementCounter ( counters - > keyed_load_generic_smi ( ) , 1 ) ; <nl> __ ret ( 0 ) ; <nl> <nl> __ bind ( & check_number_dictionary ) ; <nl> - __ mov ( ebx , ecx ) ; <nl> + __ mov ( ebx , key ) ; <nl> __ SmiUntag ( ebx ) ; <nl> - __ mov ( eax , FieldOperand ( edx , JSObject : : kElementsOffset ) ) ; <nl> + __ mov ( eax , FieldOperand ( receiver , JSObject : : kElementsOffset ) ) ; <nl> <nl> / / Check whether the elements is a number dictionary . <nl> - / / edx : receiver <nl> / / ebx : untagged index <nl> - / / ecx : key <nl> / / eax : elements <nl> __ CheckMap ( eax , <nl> isolate - > factory ( ) - > hash_table_map ( ) , <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> Label slow_pop_receiver ; <nl> / / Push receiver on the stack to free up a register for the dictionary <nl> / / probing . <nl> - __ push ( edx ) ; <nl> - __ LoadFromNumberDictionary ( & slow_pop_receiver , eax , ecx , ebx , edx , edi , eax ) ; <nl> + __ push ( receiver ) ; <nl> + __ LoadFromNumberDictionary ( & slow_pop_receiver , eax , key , ebx , edx , edi , eax ) ; <nl> / / Pop receiver before returning . <nl> - __ pop ( edx ) ; <nl> + __ pop ( receiver ) ; <nl> __ ret ( 0 ) ; <nl> <nl> __ bind ( & slow_pop_receiver ) ; <nl> / / Pop the receiver from the stack and jump to runtime . <nl> - __ pop ( edx ) ; <nl> + __ pop ( receiver ) ; <nl> <nl> __ bind ( & slow ) ; <nl> / / Slow case : jump to runtime . <nl> - / / edx : receiver <nl> - / / ecx : key <nl> __ IncrementCounter ( counters - > keyed_load_generic_slow ( ) , 1 ) ; <nl> GenerateRuntimeGetProperty ( masm ) ; <nl> <nl> __ bind ( & check_name ) ; <nl> - GenerateKeyNameCheck ( masm , ecx , eax , ebx , & index_name , & slow ) ; <nl> + GenerateKeyNameCheck ( masm , key , eax , ebx , & index_name , & slow ) ; <nl> <nl> GenerateKeyedLoadReceiverCheck ( <nl> - masm , edx , eax , Map : : kHasNamedInterceptor , & slow ) ; <nl> + masm , receiver , eax , Map : : kHasNamedInterceptor , & slow ) ; <nl> <nl> / / If the receiver is a fast - case object , check the keyed lookup <nl> / / cache . Otherwise probe the dictionary . <nl> - __ mov ( ebx , FieldOperand ( edx , JSObject : : kPropertiesOffset ) ) ; <nl> + __ mov ( ebx , FieldOperand ( receiver , JSObject : : kPropertiesOffset ) ) ; <nl> __ cmp ( FieldOperand ( ebx , HeapObject : : kMapOffset ) , <nl> Immediate ( isolate - > factory ( ) - > hash_table_map ( ) ) ) ; <nl> __ j ( equal , & probe_dictionary ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> / / The receiver ' s map is still in eax , compute the keyed lookup cache hash <nl> / / based on 32 bits of the map pointer and the string hash . <nl> if ( FLAG_debug_code ) { <nl> - __ cmp ( eax , FieldOperand ( edx , HeapObject : : kMapOffset ) ) ; <nl> + __ cmp ( eax , FieldOperand ( receiver , HeapObject : : kMapOffset ) ) ; <nl> __ Check ( equal , kMapIsNoLongerInEax ) ; <nl> } <nl> __ mov ( ebx , eax ) ; / / Keep the map around for later . <nl> __ shr ( eax , KeyedLookupCache : : kMapHashShift ) ; <nl> - __ mov ( edi , FieldOperand ( ecx , String : : kHashFieldOffset ) ) ; <nl> + __ mov ( edi , FieldOperand ( key , String : : kHashFieldOffset ) ) ; <nl> __ shr ( edi , String : : kHashShift ) ; <nl> __ xor_ ( eax , edi ) ; <nl> __ and_ ( eax , KeyedLookupCache : : kCapacityMask & KeyedLookupCache : : kHashMask ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> __ cmp ( ebx , Operand : : StaticArray ( edi , times_1 , cache_keys ) ) ; <nl> __ j ( not_equal , & try_next_entry ) ; <nl> __ add ( edi , Immediate ( kPointerSize ) ) ; <nl> - __ cmp ( ecx , Operand : : StaticArray ( edi , times_1 , cache_keys ) ) ; <nl> + __ cmp ( key , Operand : : StaticArray ( edi , times_1 , cache_keys ) ) ; <nl> __ j ( equal , & hit_on_nth_entry [ i ] ) ; <nl> __ bind ( & try_next_entry ) ; <nl> } <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> __ cmp ( ebx , Operand : : StaticArray ( edi , times_1 , cache_keys ) ) ; <nl> __ j ( not_equal , & slow ) ; <nl> __ add ( edi , Immediate ( kPointerSize ) ) ; <nl> - __ cmp ( ecx , Operand : : StaticArray ( edi , times_1 , cache_keys ) ) ; <nl> + __ cmp ( key , Operand : : StaticArray ( edi , times_1 , cache_keys ) ) ; <nl> __ j ( not_equal , & slow ) ; <nl> <nl> / / Get field offset . <nl> - / / edx : receiver <nl> - / / ebx : receiver ' s map <nl> - / / ecx : key <nl> - / / eax : lookup cache index <nl> + / / ebx : receiver ' s map <nl> + / / eax : lookup cache index <nl> ExternalReference cache_field_offsets = <nl> ExternalReference : : keyed_lookup_cache_field_offsets ( masm - > isolate ( ) ) ; <nl> <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> __ bind ( & load_in_object_property ) ; <nl> __ movzx_b ( eax , FieldOperand ( ebx , Map : : kInstanceSizeOffset ) ) ; <nl> __ add ( eax , edi ) ; <nl> - __ mov ( eax , FieldOperand ( edx , eax , times_pointer_size , 0 ) ) ; <nl> + __ mov ( eax , FieldOperand ( receiver , eax , times_pointer_size , 0 ) ) ; <nl> __ IncrementCounter ( counters - > keyed_load_generic_lookup_cache ( ) , 1 ) ; <nl> __ ret ( 0 ) ; <nl> <nl> / / Load property array property . <nl> __ bind ( & property_array_property ) ; <nl> - __ mov ( eax , FieldOperand ( edx , JSObject : : kPropertiesOffset ) ) ; <nl> + __ mov ( eax , FieldOperand ( receiver , JSObject : : kPropertiesOffset ) ) ; <nl> __ mov ( eax , FieldOperand ( eax , edi , times_pointer_size , <nl> FixedArray : : kHeaderSize ) ) ; <nl> __ IncrementCounter ( counters - > keyed_load_generic_lookup_cache ( ) , 1 ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> / / exists . <nl> __ bind ( & probe_dictionary ) ; <nl> <nl> - __ mov ( eax , FieldOperand ( edx , JSObject : : kMapOffset ) ) ; <nl> + __ mov ( eax , FieldOperand ( receiver , JSObject : : kMapOffset ) ) ; <nl> __ movzx_b ( eax , FieldOperand ( eax , Map : : kInstanceTypeOffset ) ) ; <nl> GenerateGlobalInstanceTypeCheck ( masm , eax , & slow ) ; <nl> <nl> - GenerateDictionaryLoad ( masm , & slow , ebx , ecx , eax , edi , eax ) ; <nl> + GenerateDictionaryLoad ( masm , & slow , ebx , key , eax , edi , eax ) ; <nl> __ IncrementCounter ( counters - > keyed_load_generic_symbol ( ) , 1 ) ; <nl> __ ret ( 0 ) ; <nl> <nl> __ bind ( & index_name ) ; <nl> - __ IndexFromHash ( ebx , ecx ) ; <nl> + __ IndexFromHash ( ebx , key ) ; <nl> / / Now jump to the place where smi keys are handled . <nl> __ jmp ( & index_smi ) ; <nl> } <nl> void KeyedLoadIC : : GenerateIndexedInterceptor ( MacroAssembler * masm ) { <nl> <nl> <nl> void KeyedLoadIC : : GenerateSloppyArguments ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - ecx : key <nl> - / / - - edx : receiver <nl> - / / - - esp [ 0 ] : return address <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( edx . is ( ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( ecx . is ( NameRegister ( ) ) ) ; <nl> + / / The return address is on the stack . <nl> + Register receiver = ReceiverRegister ( ) ; <nl> + Register key = NameRegister ( ) ; <nl> + ASSERT ( receiver . is ( edx ) ) ; <nl> + ASSERT ( key . is ( ecx ) ) ; <nl> + <nl> Label slow , notin ; <nl> Factory * factory = masm - > isolate ( ) - > factory ( ) ; <nl> Operand mapped_location = <nl> - GenerateMappedArgumentsLookup ( masm , edx , ecx , ebx , eax , & notin , & slow ) ; <nl> + GenerateMappedArgumentsLookup ( <nl> + masm , receiver , key , ebx , eax , & notin , & slow ) ; <nl> __ mov ( eax , mapped_location ) ; <nl> __ Ret ( ) ; <nl> __ bind ( & notin ) ; <nl> / / The unmapped lookup expects that the parameter map is in ebx . <nl> Operand unmapped_location = <nl> - GenerateUnmappedArgumentsLookup ( masm , ecx , ebx , eax , & slow ) ; <nl> + GenerateUnmappedArgumentsLookup ( masm , key , ebx , eax , & slow ) ; <nl> __ cmp ( unmapped_location , factory - > the_hole_value ( ) ) ; <nl> __ j ( equal , & slow ) ; <nl> __ mov ( eax , unmapped_location ) ; <nl> void KeyedStoreIC : : GenerateGeneric ( MacroAssembler * masm , <nl> <nl> <nl> void LoadIC : : GenerateMegamorphic ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - ecx : name <nl> - / / - - edx : receiver <nl> - / / - - esp [ 0 ] : return address <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( edx . is ( ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( ecx . is ( NameRegister ( ) ) ) ; <nl> + / / The return address is on the stack . <nl> + Register receiver = ReceiverRegister ( ) ; <nl> + Register name = NameRegister ( ) ; <nl> + ASSERT ( receiver . is ( edx ) ) ; <nl> + ASSERT ( name . is ( ecx ) ) ; <nl> <nl> / / Probe the stub cache . <nl> Code : : Flags flags = Code : : ComputeHandlerFlags ( Code : : LOAD_IC ) ; <nl> masm - > isolate ( ) - > stub_cache ( ) - > GenerateProbe ( <nl> - masm , flags , edx , ecx , ebx , eax ) ; <nl> + masm , flags , receiver , name , ebx , eax ) ; <nl> <nl> / / Cache miss : Jump to runtime . <nl> GenerateMiss ( masm ) ; <nl> const Register LoadIC : : ReceiverRegister ( ) { return edx ; } <nl> const Register LoadIC : : NameRegister ( ) { return ecx ; } <nl> <nl> <nl> - const Register KeyedLoadIC : : ReceiverRegister ( ) { <nl> - return LoadIC : : ReceiverRegister ( ) ; <nl> - } <nl> - <nl> - <nl> - const Register KeyedLoadIC : : NameRegister ( ) { return LoadIC : : NameRegister ( ) ; } <nl> - <nl> - <nl> void KeyedLoadIC : : GenerateRuntimeGetProperty ( MacroAssembler * masm ) { <nl> / / Return address is on the stack . <nl> __ pop ( KeyedLoadIC_TempRegister ( ) ) ; <nl> mmm a / src / ia32 / lithium - codegen - ia32 . cc <nl> ppp b / src / ia32 / lithium - codegen - ia32 . cc <nl> Operand LCodeGen : : BuildFastArrayOperand ( <nl> <nl> void LCodeGen : : DoLoadKeyedGeneric ( LLoadKeyedGeneric * instr ) { <nl> ASSERT ( ToRegister ( instr - > context ( ) ) . is ( esi ) ) ; <nl> - ASSERT ( ToRegister ( instr - > object ( ) ) . is ( KeyedLoadIC : : ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( ToRegister ( instr - > key ( ) ) . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> + ASSERT ( ToRegister ( instr - > object ( ) ) . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> + ASSERT ( ToRegister ( instr - > key ( ) ) . is ( LoadIC : : NameRegister ( ) ) ) ; <nl> <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > KeyedLoadIC_Initialize ( ) ; <nl> CallCode ( ic , RelocInfo : : CODE_TARGET , instr ) ; <nl> mmm a / src / ia32 / lithium - ia32 . cc <nl> ppp b / src / ia32 / lithium - ia32 . cc <nl> LInstruction * LChunkBuilder : : DoLoadKeyed ( HLoadKeyed * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoLoadKeyedGeneric ( HLoadKeyedGeneric * instr ) { <nl> LOperand * context = UseFixed ( instr - > context ( ) , esi ) ; <nl> - LOperand * object = UseFixed ( instr - > object ( ) , KeyedLoadIC : : ReceiverRegister ( ) ) ; <nl> - LOperand * key = UseFixed ( instr - > key ( ) , KeyedLoadIC : : NameRegister ( ) ) ; <nl> + LOperand * object = UseFixed ( instr - > object ( ) , LoadIC : : ReceiverRegister ( ) ) ; <nl> + LOperand * key = UseFixed ( instr - > key ( ) , LoadIC : : NameRegister ( ) ) ; <nl> <nl> LLoadKeyedGeneric * result = <nl> new ( zone ( ) ) LLoadKeyedGeneric ( context , object , key ) ; <nl> mmm a / src / ia32 / stub - cache - ia32 . cc <nl> ppp b / src / ia32 / stub - cache - ia32 . cc <nl> Register * LoadStubCompiler : : registers ( ) { <nl> <nl> Register * KeyedLoadStubCompiler : : registers ( ) { <nl> / / receiver , name , scratch1 , scratch2 , scratch3 , scratch4 . <nl> - Register receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register name = KeyedLoadIC : : NameRegister ( ) ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register name = LoadIC : : NameRegister ( ) ; <nl> static Register registers [ ] = { receiver , name , ebx , eax , edi , no_reg } ; <nl> return registers ; <nl> } <nl> void KeyedLoadStubCompiler : : GenerateLoadDictionaryElement ( <nl> / / - - edx : receiver <nl> / / - - esp [ 0 ] : return address <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( edx . is ( KeyedLoadIC : : ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( ecx . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> + ASSERT ( edx . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> + ASSERT ( ecx . is ( LoadIC : : NameRegister ( ) ) ) ; <nl> Label slow , miss ; <nl> <nl> / / This stub is meant to be tail - jumped to , the receiver must already <nl> mmm a / src / ic . h <nl> ppp b / src / ic . h <nl> class KeyedLoadIC : public LoadIC { <nl> ASSERT ( target ( ) - > is_keyed_load_stub ( ) ) ; <nl> } <nl> <nl> - static const Register ReceiverRegister ( ) ; <nl> - static const Register NameRegister ( ) ; <nl> - <nl> MUST_USE_RESULT MaybeHandle < Object > Load ( Handle < Object > object , <nl> Handle < Object > key ) ; <nl> <nl> mmm a / src / x64 / builtins - x64 . cc <nl> ppp b / src / x64 / builtins - x64 . cc <nl> void Builtins : : Generate_FunctionApply ( MacroAssembler * masm ) { <nl> <nl> / / Copy all arguments from the array to the stack . <nl> Label entry , loop ; <nl> - __ movp ( rax , Operand ( rbp , kIndexOffset ) ) ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register key = LoadIC : : NameRegister ( ) ; <nl> + __ movp ( key , Operand ( rbp , kIndexOffset ) ) ; <nl> __ jmp ( & entry ) ; <nl> __ bind ( & loop ) ; <nl> - __ movp ( rdx , Operand ( rbp , kArgumentsOffset ) ) ; / / load arguments <nl> + __ movp ( receiver , Operand ( rbp , kArgumentsOffset ) ) ; / / load arguments <nl> <nl> / / Use inline caching to speed up access to arguments . <nl> Handle < Code > ic = <nl> void Builtins : : Generate_FunctionApply ( MacroAssembler * masm ) { <nl> / / Push the nth argument . <nl> __ Push ( rax ) ; <nl> <nl> - / / Update the index on the stack and in register rax . <nl> - __ movp ( rax , Operand ( rbp , kIndexOffset ) ) ; <nl> - __ SmiAddConstant ( rax , rax , Smi : : FromInt ( 1 ) ) ; <nl> - __ movp ( Operand ( rbp , kIndexOffset ) , rax ) ; <nl> + / / Update the index on the stack and in register key . <nl> + __ movp ( key , Operand ( rbp , kIndexOffset ) ) ; <nl> + __ SmiAddConstant ( key , key , Smi : : FromInt ( 1 ) ) ; <nl> + __ movp ( Operand ( rbp , kIndexOffset ) , key ) ; <nl> <nl> __ bind ( & entry ) ; <nl> - __ cmpp ( rax , Operand ( rbp , kLimitOffset ) ) ; <nl> + __ cmpp ( key , Operand ( rbp , kLimitOffset ) ) ; <nl> __ j ( not_equal , & loop ) ; <nl> <nl> / / Call the function . <nl> Label call_proxy ; <nl> ParameterCount actual ( rax ) ; <nl> - __ SmiToInteger32 ( rax , rax ) ; <nl> + __ SmiToInteger32 ( rax , key ) ; <nl> __ movp ( rdi , Operand ( rbp , kFunctionOffset ) ) ; <nl> __ CmpObjectType ( rdi , JS_FUNCTION_TYPE , rcx ) ; <nl> __ j ( not_equal , & call_proxy ) ; <nl> mmm a / src / x64 / code - stubs - x64 . cc <nl> ppp b / src / x64 / code - stubs - x64 . cc <nl> void MathPowStub : : Generate ( MacroAssembler * masm ) { <nl> <nl> void FunctionPrototypeStub : : Generate ( MacroAssembler * masm ) { <nl> Label miss ; <nl> - Register receiver ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register name = LoadIC : : NameRegister ( ) ; <nl> + <nl> + ASSERT ( kind ( ) = = Code : : LOAD_IC | | <nl> + kind ( ) = = Code : : KEYED_LOAD_IC ) ; <nl> + <nl> if ( kind ( ) = = Code : : KEYED_LOAD_IC ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - rax : key <nl> - / / - - rdx : receiver <nl> - / / - - rsp [ 0 ] : return address <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - __ Cmp ( rax , isolate ( ) - > factory ( ) - > prototype_string ( ) ) ; <nl> + __ Cmp ( name , isolate ( ) - > factory ( ) - > prototype_string ( ) ) ; <nl> __ j ( not_equal , & miss ) ; <nl> - receiver = rdx ; <nl> - } else { <nl> - ASSERT ( kind ( ) = = Code : : LOAD_IC ) ; <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - rax : receiver <nl> - / / - - rcx : name <nl> - / / - - rsp [ 0 ] : return address <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - receiver = rax ; <nl> } <nl> <nl> StubCompiler : : GenerateLoadFunctionPrototype ( masm , receiver , r8 , r9 , & miss ) ; <nl> mmm a / src / x64 / debug - x64 . cc <nl> ppp b / src / x64 / debug - x64 . cc <nl> void DebugCodegen : : GenerateStoreICDebugBreak ( MacroAssembler * masm ) { <nl> <nl> void DebugCodegen : : GenerateKeyedLoadICDebugBreak ( MacroAssembler * masm ) { <nl> / / Register state for keyed IC load call ( from ic - x64 . cc ) . <nl> - Register receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register name = KeyedLoadIC : : NameRegister ( ) ; <nl> - Generate_DebugBreakCallHelper ( masm , receiver . bit ( ) | name . bit ( ) , 0 , false ) ; <nl> + GenerateLoadICDebugBreak ( masm ) ; <nl> } <nl> <nl> <nl> mmm a / src / x64 / full - codegen - x64 . cc <nl> ppp b / src / x64 / full - codegen - x64 . cc <nl> void FullCodeGenerator : : VisitAssignment ( Assignment * expr ) { <nl> break ; <nl> case NAMED_PROPERTY : <nl> if ( expr - > is_compound ( ) ) { <nl> - / / We need the receiver both on the stack and in the accumulator . <nl> - VisitForAccumulatorValue ( property - > obj ( ) ) ; <nl> - __ Push ( result_register ( ) ) ; <nl> + / / We need the receiver both on the stack and in the register . <nl> + VisitForStackValue ( property - > obj ( ) ) ; <nl> + __ movp ( LoadIC : : ReceiverRegister ( ) , Operand ( rsp , 0 ) ) ; <nl> } else { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> } <nl> void FullCodeGenerator : : VisitAssignment ( Assignment * expr ) { <nl> case KEYED_PROPERTY : { <nl> if ( expr - > is_compound ( ) ) { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> - VisitForAccumulatorValue ( property - > key ( ) ) ; <nl> - __ movp ( rdx , Operand ( rsp , 0 ) ) ; <nl> - __ Push ( rax ) ; <nl> + VisitForStackValue ( property - > key ( ) ) ; <nl> + __ movp ( LoadIC : : ReceiverRegister ( ) , Operand ( rsp , kPointerSize ) ) ; <nl> + __ movp ( LoadIC : : NameRegister ( ) , Operand ( rsp , 0 ) ) ; <nl> } else { <nl> VisitForStackValue ( property - > obj ( ) ) ; <nl> VisitForStackValue ( property - > key ( ) ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> Label l_catch , l_try , l_suspend , l_continuation , l_resume ; <nl> Label l_next , l_call , l_loop ; <nl> + Register load_receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register load_name = LoadIC : : NameRegister ( ) ; <nl> + <nl> / / Initial send value is undefined . <nl> __ LoadRoot ( rax , Heap : : kUndefinedValueRootIndex ) ; <nl> __ jmp ( & l_next ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> / / catch ( e ) { receiver = iter ; f = ' throw ' ; arg = e ; goto l_call ; } <nl> __ bind ( & l_catch ) ; <nl> handler_table ( ) - > set ( expr - > index ( ) , Smi : : FromInt ( l_catch . pos ( ) ) ) ; <nl> - __ LoadRoot ( rcx , Heap : : kthrow_stringRootIndex ) ; / / " throw " <nl> - __ Push ( rcx ) ; <nl> - __ Push ( Operand ( rsp , 2 * kPointerSize ) ) ; / / iter <nl> - __ Push ( rax ) ; / / exception <nl> + __ LoadRoot ( load_name , Heap : : kthrow_stringRootIndex ) ; / / " throw " <nl> + __ Push ( load_name ) ; <nl> + __ Push ( Operand ( rsp , 2 * kPointerSize ) ) ; / / iter <nl> + __ Push ( rax ) ; / / exception <nl> __ jmp ( & l_call ) ; <nl> <nl> / / try { received = % yield result } <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> / / receiver = iter ; f = ' next ' ; arg = received ; <nl> __ bind ( & l_next ) ; <nl> - Register keyedload_receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register keyedload_name = KeyedLoadIC : : NameRegister ( ) ; <nl> - ASSERT ( keyedload_receiver . is ( rdx ) ) ; <nl> - ASSERT ( keyedload_name . is ( rax ) ) ; <nl> <nl> - __ LoadRoot ( rcx , Heap : : knext_stringRootIndex ) ; / / " next " <nl> - __ Push ( rcx ) ; <nl> - __ Push ( Operand ( rsp , 2 * kPointerSize ) ) ; / / iter <nl> - __ Push ( rax ) ; / / received <nl> + __ LoadRoot ( load_name , Heap : : knext_stringRootIndex ) ; <nl> + __ Push ( load_name ) ; / / " next " <nl> + __ Push ( Operand ( rsp , 2 * kPointerSize ) ) ; / / iter <nl> + __ Push ( rax ) ; / / received <nl> <nl> / / result = receiver [ f ] ( arg ) ; <nl> __ bind ( & l_call ) ; <nl> - __ movp ( keyedload_receiver , Operand ( rsp , kPointerSize ) ) ; <nl> - __ movp ( keyedload_name , Operand ( rsp , 2 * kPointerSize ) ) ; <nl> + __ movp ( load_receiver , Operand ( rsp , kPointerSize ) ) ; <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > KeyedLoadIC_Initialize ( ) ; <nl> CallIC ( ic , TypeFeedbackId : : None ( ) ) ; <nl> __ movp ( rdi , rax ) ; <nl> void FullCodeGenerator : : VisitYield ( Yield * expr ) { <nl> <nl> / / if ( ! result . done ) goto l_try ; <nl> __ bind ( & l_loop ) ; <nl> - Register load_receiver = LoadIC : : ReceiverRegister ( ) ; <nl> - Register load_name = LoadIC : : NameRegister ( ) ; <nl> - ASSERT ( load_receiver . is ( rax ) ) ; <nl> - ASSERT ( load_name . is ( rcx ) ) ; <nl> - <nl> + __ Move ( load_receiver , rax ) ; <nl> __ Push ( load_receiver ) ; / / save result <nl> __ LoadRoot ( load_name , Heap : : kdone_stringRootIndex ) ; / / " done " <nl> CallLoadIC ( NOT_CONTEXTUAL ) ; / / rax = result . done <nl> void FullCodeGenerator : : VisitProperty ( Property * expr ) { <nl> <nl> if ( key - > IsPropertyName ( ) ) { <nl> VisitForAccumulatorValue ( expr - > obj ( ) ) ; <nl> - ASSERT ( rax . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> + ASSERT ( ! rax . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> + __ movp ( LoadIC : : ReceiverRegister ( ) , rax ) ; <nl> EmitNamedPropertyLoad ( expr ) ; <nl> PrepareForBailoutForId ( expr - > LoadId ( ) , TOS_REG ) ; <nl> context ( ) - > Plug ( rax ) ; <nl> } else { <nl> VisitForStackValue ( expr - > obj ( ) ) ; <nl> VisitForAccumulatorValue ( expr - > key ( ) ) ; <nl> - ASSERT ( rax . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> - __ Pop ( KeyedLoadIC : : ReceiverRegister ( ) ) ; <nl> + __ Move ( LoadIC : : NameRegister ( ) , rax ) ; <nl> + __ Pop ( LoadIC : : ReceiverRegister ( ) ) ; <nl> EmitKeyedPropertyLoad ( expr ) ; <nl> context ( ) - > Plug ( rax ) ; <nl> } <nl> void FullCodeGenerator : : EmitKeyedCallWithLoadIC ( Call * expr , <nl> Expression * key ) { <nl> / / Load the key . <nl> VisitForAccumulatorValue ( key ) ; <nl> - ASSERT ( rax . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> <nl> Expression * callee = expr - > expression ( ) ; <nl> <nl> / / Load the function from the receiver . <nl> ASSERT ( callee - > IsProperty ( ) ) ; <nl> - __ movp ( KeyedLoadIC : : ReceiverRegister ( ) , Operand ( rsp , 0 ) ) ; <nl> + __ movp ( LoadIC : : ReceiverRegister ( ) , Operand ( rsp , 0 ) ) ; <nl> + __ Move ( LoadIC : : NameRegister ( ) , rax ) ; <nl> EmitKeyedPropertyLoad ( callee - > AsProperty ( ) ) ; <nl> PrepareForBailoutForId ( callee - > AsProperty ( ) - > LoadId ( ) , TOS_REG ) ; <nl> <nl> void FullCodeGenerator : : VisitCountOperation ( CountOperation * expr ) { <nl> __ Push ( Smi : : FromInt ( 0 ) ) ; <nl> } <nl> if ( assign_type = = NAMED_PROPERTY ) { <nl> - VisitForAccumulatorValue ( prop - > obj ( ) ) ; <nl> - ASSERT ( rax . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> - __ Push ( rax ) ; / / Copy of receiver , needed for later store . <nl> + VisitForStackValue ( prop - > obj ( ) ) ; <nl> + __ movp ( LoadIC : : ReceiverRegister ( ) , Operand ( rsp , 0 ) ) ; <nl> EmitNamedPropertyLoad ( prop ) ; <nl> } else { <nl> VisitForStackValue ( prop - > obj ( ) ) ; <nl> - VisitForAccumulatorValue ( prop - > key ( ) ) ; <nl> - ASSERT ( rax . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> + VisitForStackValue ( prop - > key ( ) ) ; <nl> / / Leave receiver on stack <nl> - __ movp ( KeyedLoadIC : : ReceiverRegister ( ) , Operand ( rsp , 0 ) ) ; <nl> + __ movp ( LoadIC : : ReceiverRegister ( ) , Operand ( rsp , kPointerSize ) ) ; <nl> / / Copy of key , needed for later store . <nl> - __ Push ( KeyedLoadIC : : NameRegister ( ) ) ; <nl> + __ movp ( LoadIC : : NameRegister ( ) , Operand ( rsp , 0 ) ) ; <nl> EmitKeyedPropertyLoad ( prop ) ; <nl> } <nl> } <nl> mmm a / src / x64 / ic - x64 . cc <nl> ppp b / src / x64 / ic - x64 . cc <nl> static void GenerateKeyNameCheck ( MacroAssembler * masm , <nl> <nl> <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - rax : key <nl> - / / - - rdx : receiver <nl> - / / - - rsp [ 0 ] : return address <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( rdx . is ( ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( rax . is ( NameRegister ( ) ) ) ; <nl> + / / The return address is on the stack . <nl> Label slow , check_name , index_smi , index_name , property_array_property ; <nl> Label probe_dictionary , check_number_dictionary ; <nl> <nl> + Register receiver = ReceiverRegister ( ) ; <nl> + Register key = NameRegister ( ) ; <nl> + ASSERT ( receiver . is ( rdx ) ) ; <nl> + ASSERT ( key . is ( rcx ) ) ; <nl> + <nl> / / Check that the key is a smi . <nl> - __ JumpIfNotSmi ( rax , & check_name ) ; <nl> + __ JumpIfNotSmi ( key , & check_name ) ; <nl> __ bind ( & index_smi ) ; <nl> / / Now the key is known to be a smi . This place is also jumped to from below <nl> / / where a numeric string is converted to a smi . <nl> <nl> GenerateKeyedLoadReceiverCheck ( <nl> - masm , rdx , rcx , Map : : kHasIndexedInterceptor , & slow ) ; <nl> + masm , receiver , rax , Map : : kHasIndexedInterceptor , & slow ) ; <nl> <nl> / / Check the receiver ' s map to see if it has fast elements . <nl> - __ CheckFastElements ( rcx , & check_number_dictionary ) ; <nl> + __ CheckFastElements ( rax , & check_number_dictionary ) ; <nl> <nl> GenerateFastArrayLoad ( masm , <nl> - rdx , <nl> + receiver , <nl> + key , <nl> rax , <nl> - rcx , <nl> rbx , <nl> rax , <nl> NULL , <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> __ ret ( 0 ) ; <nl> <nl> __ bind ( & check_number_dictionary ) ; <nl> - __ SmiToInteger32 ( rbx , rax ) ; <nl> - __ movp ( rcx , FieldOperand ( rdx , JSObject : : kElementsOffset ) ) ; <nl> + __ SmiToInteger32 ( rbx , key ) ; <nl> + __ movp ( rax , FieldOperand ( receiver , JSObject : : kElementsOffset ) ) ; <nl> <nl> / / Check whether the elements is a number dictionary . <nl> - / / rdx : receiver <nl> - / / rax : key <nl> / / rbx : key as untagged int32 <nl> - / / rcx : elements <nl> - __ CompareRoot ( FieldOperand ( rcx , HeapObject : : kMapOffset ) , <nl> + / / rax : elements <nl> + __ CompareRoot ( FieldOperand ( rax , HeapObject : : kMapOffset ) , <nl> Heap : : kHashTableMapRootIndex ) ; <nl> __ j ( not_equal , & slow ) ; <nl> - __ LoadFromNumberDictionary ( & slow , rcx , rax , rbx , r9 , rdi , rax ) ; <nl> + __ LoadFromNumberDictionary ( & slow , rax , key , rbx , r9 , rdi , rax ) ; <nl> __ ret ( 0 ) ; <nl> <nl> __ bind ( & slow ) ; <nl> / / Slow case : Jump to runtime . <nl> - / / rdx : receiver <nl> - / / rax : key <nl> __ IncrementCounter ( counters - > keyed_load_generic_slow ( ) , 1 ) ; <nl> GenerateRuntimeGetProperty ( masm ) ; <nl> <nl> __ bind ( & check_name ) ; <nl> - GenerateKeyNameCheck ( masm , rax , rcx , rbx , & index_name , & slow ) ; <nl> + GenerateKeyNameCheck ( masm , key , rax , rbx , & index_name , & slow ) ; <nl> <nl> GenerateKeyedLoadReceiverCheck ( <nl> - masm , rdx , rcx , Map : : kHasNamedInterceptor , & slow ) ; <nl> + masm , receiver , rax , Map : : kHasNamedInterceptor , & slow ) ; <nl> <nl> / / If the receiver is a fast - case object , check the keyed lookup <nl> - / / cache . Otherwise probe the dictionary leaving result in rcx . <nl> - __ movp ( rbx , FieldOperand ( rdx , JSObject : : kPropertiesOffset ) ) ; <nl> + / / cache . Otherwise probe the dictionary leaving result in key . <nl> + __ movp ( rbx , FieldOperand ( receiver , JSObject : : kPropertiesOffset ) ) ; <nl> __ CompareRoot ( FieldOperand ( rbx , HeapObject : : kMapOffset ) , <nl> Heap : : kHashTableMapRootIndex ) ; <nl> __ j ( equal , & probe_dictionary ) ; <nl> <nl> / / Load the map of the receiver , compute the keyed lookup cache hash <nl> / / based on 32 bits of the map pointer and the string hash . <nl> - __ movp ( rbx , FieldOperand ( rdx , HeapObject : : kMapOffset ) ) ; <nl> - __ movl ( rcx , rbx ) ; <nl> - __ shrl ( rcx , Immediate ( KeyedLookupCache : : kMapHashShift ) ) ; <nl> - __ movl ( rdi , FieldOperand ( rax , String : : kHashFieldOffset ) ) ; <nl> + __ movp ( rbx , FieldOperand ( receiver , HeapObject : : kMapOffset ) ) ; <nl> + __ movl ( rax , rbx ) ; <nl> + __ shrl ( rax , Immediate ( KeyedLookupCache : : kMapHashShift ) ) ; <nl> + __ movl ( rdi , FieldOperand ( key , String : : kHashFieldOffset ) ) ; <nl> __ shrl ( rdi , Immediate ( String : : kHashShift ) ) ; <nl> - __ xorp ( rcx , rdi ) ; <nl> + __ xorp ( rax , rdi ) ; <nl> int mask = ( KeyedLookupCache : : kCapacityMask & KeyedLookupCache : : kHashMask ) ; <nl> - __ andp ( rcx , Immediate ( mask ) ) ; <nl> + __ andp ( rax , Immediate ( mask ) ) ; <nl> <nl> / / Load the key ( consisting of map and internalized string ) from the cache and <nl> / / check for match . <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> <nl> for ( int i = 0 ; i < kEntriesPerBucket - 1 ; i + + ) { <nl> Label try_next_entry ; <nl> - __ movp ( rdi , rcx ) ; <nl> + __ movp ( rdi , rax ) ; <nl> __ shlp ( rdi , Immediate ( kPointerSizeLog2 + 1 ) ) ; <nl> __ LoadAddress ( kScratchRegister , cache_keys ) ; <nl> int off = kPointerSize * i * 2 ; <nl> __ cmpp ( rbx , Operand ( kScratchRegister , rdi , times_1 , off ) ) ; <nl> __ j ( not_equal , & try_next_entry ) ; <nl> - __ cmpp ( rax , Operand ( kScratchRegister , rdi , times_1 , off + kPointerSize ) ) ; <nl> + __ cmpp ( key , Operand ( kScratchRegister , rdi , times_1 , off + kPointerSize ) ) ; <nl> __ j ( equal , & hit_on_nth_entry [ i ] ) ; <nl> __ bind ( & try_next_entry ) ; <nl> } <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> int off = kPointerSize * ( kEntriesPerBucket - 1 ) * 2 ; <nl> __ cmpp ( rbx , Operand ( kScratchRegister , rdi , times_1 , off ) ) ; <nl> __ j ( not_equal , & slow ) ; <nl> - __ cmpp ( rax , Operand ( kScratchRegister , rdi , times_1 , off + kPointerSize ) ) ; <nl> + __ cmpp ( key , Operand ( kScratchRegister , rdi , times_1 , off + kPointerSize ) ) ; <nl> __ j ( not_equal , & slow ) ; <nl> <nl> / / Get field offset , which is a 32 - bit integer . <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> for ( int i = kEntriesPerBucket - 1 ; i > = 0 ; i - - ) { <nl> __ bind ( & hit_on_nth_entry [ i ] ) ; <nl> if ( i ! = 0 ) { <nl> - __ addl ( rcx , Immediate ( i ) ) ; <nl> + __ addl ( rax , Immediate ( i ) ) ; <nl> } <nl> __ LoadAddress ( kScratchRegister , cache_field_offsets ) ; <nl> - __ movl ( rdi , Operand ( kScratchRegister , rcx , times_4 , 0 ) ) ; <nl> - __ movzxbp ( rcx , FieldOperand ( rbx , Map : : kInObjectPropertiesOffset ) ) ; <nl> - __ subp ( rdi , rcx ) ; <nl> + __ movl ( rdi , Operand ( kScratchRegister , rax , times_4 , 0 ) ) ; <nl> + __ movzxbp ( rax , FieldOperand ( rbx , Map : : kInObjectPropertiesOffset ) ) ; <nl> + __ subp ( rdi , rax ) ; <nl> __ j ( above_equal , & property_array_property ) ; <nl> if ( i ! = 0 ) { <nl> __ jmp ( & load_in_object_property ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> <nl> / / Load in - object property . <nl> __ bind ( & load_in_object_property ) ; <nl> - __ movzxbp ( rcx , FieldOperand ( rbx , Map : : kInstanceSizeOffset ) ) ; <nl> - __ addp ( rcx , rdi ) ; <nl> - __ movp ( rax , FieldOperand ( rdx , rcx , times_pointer_size , 0 ) ) ; <nl> + __ movzxbp ( rax , FieldOperand ( rbx , Map : : kInstanceSizeOffset ) ) ; <nl> + __ addp ( rax , rdi ) ; <nl> + __ movp ( rax , FieldOperand ( receiver , rax , times_pointer_size , 0 ) ) ; <nl> __ IncrementCounter ( counters - > keyed_load_generic_lookup_cache ( ) , 1 ) ; <nl> __ ret ( 0 ) ; <nl> <nl> / / Load property array property . <nl> __ bind ( & property_array_property ) ; <nl> - __ movp ( rax , FieldOperand ( rdx , JSObject : : kPropertiesOffset ) ) ; <nl> + __ movp ( rax , FieldOperand ( receiver , JSObject : : kPropertiesOffset ) ) ; <nl> __ movp ( rax , FieldOperand ( rax , rdi , times_pointer_size , <nl> FixedArray : : kHeaderSize ) ) ; <nl> __ IncrementCounter ( counters - > keyed_load_generic_lookup_cache ( ) , 1 ) ; <nl> void KeyedLoadIC : : GenerateGeneric ( MacroAssembler * masm ) { <nl> / / Do a quick inline probe of the receiver ' s dictionary , if it <nl> / / exists . <nl> __ bind ( & probe_dictionary ) ; <nl> - / / rdx : receiver <nl> - / / rax : key <nl> / / rbx : elements <nl> <nl> - __ movp ( rcx , FieldOperand ( rdx , JSObject : : kMapOffset ) ) ; <nl> - __ movb ( rcx , FieldOperand ( rcx , Map : : kInstanceTypeOffset ) ) ; <nl> - GenerateGlobalInstanceTypeCheck ( masm , rcx , & slow ) ; <nl> + __ movp ( rax , FieldOperand ( receiver , JSObject : : kMapOffset ) ) ; <nl> + __ movb ( rax , FieldOperand ( rax , Map : : kInstanceTypeOffset ) ) ; <nl> + GenerateGlobalInstanceTypeCheck ( masm , rax , & slow ) ; <nl> <nl> - GenerateDictionaryLoad ( masm , & slow , rbx , rax , rcx , rdi , rax ) ; <nl> + GenerateDictionaryLoad ( masm , & slow , rbx , key , rax , rdi , rax ) ; <nl> __ IncrementCounter ( counters - > keyed_load_generic_symbol ( ) , 1 ) ; <nl> __ ret ( 0 ) ; <nl> <nl> __ bind ( & index_name ) ; <nl> - __ IndexFromHash ( rbx , rax ) ; <nl> + __ IndexFromHash ( rbx , key ) ; <nl> __ jmp ( & index_smi ) ; <nl> } <nl> <nl> void KeyedLoadIC : : GenerateString ( MacroAssembler * masm ) { <nl> <nl> Register receiver = ReceiverRegister ( ) ; <nl> Register index = NameRegister ( ) ; <nl> - Register scratch = rcx ; <nl> + Register scratch = rbx ; <nl> Register result = rax ; <nl> ASSERT ( ! scratch . is ( receiver ) & & ! scratch . is ( index ) ) ; <nl> <nl> void KeyedLoadIC : : GenerateIndexedInterceptor ( MacroAssembler * masm ) { <nl> <nl> Register receiver = ReceiverRegister ( ) ; <nl> Register key = NameRegister ( ) ; <nl> - Register scratch = rcx ; <nl> + Register scratch = rax ; <nl> ASSERT ( ! scratch . is ( receiver ) & & ! scratch . is ( key ) ) ; <nl> <nl> / / Check that the receiver isn ' t a smi . <nl> static Operand GenerateUnmappedArgumentsLookup ( MacroAssembler * masm , <nl> <nl> <nl> void KeyedLoadIC : : GenerateSloppyArguments ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - rax : key <nl> - / / - - rdx : receiver <nl> - / / - - rsp [ 0 ] : return address <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( rdx . is ( ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( rax . is ( NameRegister ( ) ) ) ; <nl> + / / The return address is on the stack . <nl> + Register receiver = ReceiverRegister ( ) ; <nl> + Register key = NameRegister ( ) ; <nl> + ASSERT ( receiver . is ( rdx ) ) ; <nl> + ASSERT ( key . is ( rcx ) ) ; <nl> + <nl> Label slow , notin ; <nl> Operand mapped_location = <nl> GenerateMappedArgumentsLookup ( <nl> - masm , rdx , rax , rbx , rcx , rdi , & notin , & slow ) ; <nl> + masm , receiver , key , rbx , rax , rdi , & notin , & slow ) ; <nl> __ movp ( rax , mapped_location ) ; <nl> __ Ret ( ) ; <nl> __ bind ( & notin ) ; <nl> / / The unmapped lookup expects that the parameter map is in rbx . <nl> Operand unmapped_location = <nl> - GenerateUnmappedArgumentsLookup ( masm , rax , rbx , rcx , & slow ) ; <nl> + GenerateUnmappedArgumentsLookup ( masm , key , rbx , rax , & slow ) ; <nl> __ CompareRoot ( unmapped_location , Heap : : kTheHoleValueRootIndex ) ; <nl> __ j ( equal , & slow ) ; <nl> __ movp ( rax , unmapped_location ) ; <nl> void KeyedStoreIC : : GenerateSloppyArguments ( MacroAssembler * masm ) { <nl> <nl> <nl> void LoadIC : : GenerateMegamorphic ( MacroAssembler * masm ) { <nl> - / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - rax : receiver <nl> - / / - - rcx : name <nl> - / / - - rsp [ 0 ] : return address <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( rax . is ( ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( rcx . is ( NameRegister ( ) ) ) ; <nl> + / / The return address is on the stack . <nl> + Register receiver = ReceiverRegister ( ) ; <nl> + Register name = NameRegister ( ) ; <nl> + ASSERT ( receiver . is ( rdx ) ) ; <nl> + ASSERT ( name . is ( rcx ) ) ; <nl> <nl> / / Probe the stub cache . <nl> Code : : Flags flags = Code : : ComputeHandlerFlags ( Code : : LOAD_IC ) ; <nl> masm - > isolate ( ) - > stub_cache ( ) - > GenerateProbe ( <nl> - masm , flags , rax , rcx , rbx , rdx ) ; <nl> + masm , flags , receiver , name , rbx , rax ) ; <nl> <nl> GenerateMiss ( masm ) ; <nl> } <nl> void LoadIC : : GenerateMegamorphic ( MacroAssembler * masm ) { <nl> <nl> void LoadIC : : GenerateNormal ( MacroAssembler * masm ) { <nl> / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - rax : receiver <nl> + / / - - rdx : receiver <nl> / / - - rcx : name <nl> / / - - rsp [ 0 ] : return address <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( rax . is ( ReceiverRegister ( ) ) ) ; <nl> + ASSERT ( rdx . is ( ReceiverRegister ( ) ) ) ; <nl> ASSERT ( rcx . is ( NameRegister ( ) ) ) ; <nl> Label miss , slow ; <nl> <nl> - GenerateNameDictionaryReceiverCheck ( masm , rax , rdx , rbx , & miss ) ; <nl> + GenerateNameDictionaryReceiverCheck ( masm , rdx , rax , rbx , & miss ) ; <nl> <nl> - / / rdx : elements <nl> + / / rax : elements <nl> / / Search the dictionary placing the result in rax . <nl> - GenerateDictionaryLoad ( masm , & slow , rdx , rcx , rbx , rdi , rax ) ; <nl> + GenerateDictionaryLoad ( masm , & slow , rax , rcx , rbx , rdi , rax ) ; <nl> __ ret ( 0 ) ; <nl> <nl> / / Dictionary load failed , go slow ( but don ' t miss ) . <nl> void KeyedLoadIC : : GenerateMiss ( MacroAssembler * masm ) { <nl> <nl> <nl> / / IC register specifications <nl> - const Register LoadIC : : ReceiverRegister ( ) { return rax ; } <nl> + const Register LoadIC : : ReceiverRegister ( ) { return rdx ; } <nl> const Register LoadIC : : NameRegister ( ) { return rcx ; } <nl> - const Register KeyedLoadIC : : ReceiverRegister ( ) { return rdx ; } <nl> - const Register KeyedLoadIC : : NameRegister ( ) { return rax ; } <nl> <nl> <nl> void KeyedLoadIC : : GenerateRuntimeGetProperty ( MacroAssembler * masm ) { <nl> mmm a / src / x64 / lithium - codegen - x64 . cc <nl> ppp b / src / x64 / lithium - codegen - x64 . cc <nl> Operand LCodeGen : : BuildFastArrayOperand ( <nl> <nl> void LCodeGen : : DoLoadKeyedGeneric ( LLoadKeyedGeneric * instr ) { <nl> ASSERT ( ToRegister ( instr - > context ( ) ) . is ( rsi ) ) ; <nl> - ASSERT ( ToRegister ( instr - > object ( ) ) . is ( KeyedLoadIC : : ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( ToRegister ( instr - > key ( ) ) . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> + ASSERT ( ToRegister ( instr - > object ( ) ) . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> + ASSERT ( ToRegister ( instr - > key ( ) ) . is ( LoadIC : : NameRegister ( ) ) ) ; <nl> <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > KeyedLoadIC_Initialize ( ) ; <nl> CallCode ( ic , RelocInfo : : CODE_TARGET , instr ) ; <nl> mmm a / src / x64 / lithium - x64 . cc <nl> ppp b / src / x64 / lithium - x64 . cc <nl> LInstruction * LChunkBuilder : : DoLoadKeyed ( HLoadKeyed * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoLoadKeyedGeneric ( HLoadKeyedGeneric * instr ) { <nl> LOperand * context = UseFixed ( instr - > context ( ) , rsi ) ; <nl> - LOperand * object = UseFixed ( instr - > object ( ) , KeyedLoadIC : : ReceiverRegister ( ) ) ; <nl> - LOperand * key = UseFixed ( instr - > key ( ) , KeyedLoadIC : : NameRegister ( ) ) ; <nl> + LOperand * object = UseFixed ( instr - > object ( ) , LoadIC : : ReceiverRegister ( ) ) ; <nl> + LOperand * key = UseFixed ( instr - > key ( ) , LoadIC : : NameRegister ( ) ) ; <nl> <nl> LLoadKeyedGeneric * result = <nl> new ( zone ( ) ) LLoadKeyedGeneric ( context , object , key ) ; <nl> mmm a / src / x64 / stub - cache - x64 . cc <nl> ppp b / src / x64 / stub - cache - x64 . cc <nl> Register * LoadStubCompiler : : registers ( ) { <nl> / / receiver , name , scratch1 , scratch2 , scratch3 , scratch4 . <nl> Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> Register name = LoadIC : : NameRegister ( ) ; <nl> - static Register registers [ ] = { receiver , name , rdx , rbx , rdi , r8 } ; <nl> + static Register registers [ ] = { receiver , name , rax , rbx , rdi , r8 } ; <nl> return registers ; <nl> } <nl> <nl> <nl> Register * KeyedLoadStubCompiler : : registers ( ) { <nl> / / receiver , name , scratch1 , scratch2 , scratch3 , scratch4 . <nl> - Register receiver = KeyedLoadIC : : ReceiverRegister ( ) ; <nl> - Register name = KeyedLoadIC : : NameRegister ( ) ; <nl> - static Register registers [ ] = { receiver , name , rbx , rcx , rdi , r8 } ; <nl> + Register receiver = LoadIC : : ReceiverRegister ( ) ; <nl> + Register name = LoadIC : : NameRegister ( ) ; <nl> + static Register registers [ ] = { receiver , name , rax , rbx , rdi , r8 } ; <nl> return registers ; <nl> } <nl> <nl> Handle < Code > BaseLoadStoreStubCompiler : : CompilePolymorphicIC ( <nl> void KeyedLoadStubCompiler : : GenerateLoadDictionaryElement ( <nl> MacroAssembler * masm ) { <nl> / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - rax : key <nl> + / / - - rcx : key <nl> / / - - rdx : receiver <nl> / / - - rsp [ 0 ] : return address <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - ASSERT ( rdx . is ( KeyedLoadIC : : ReceiverRegister ( ) ) ) ; <nl> - ASSERT ( rax . is ( KeyedLoadIC : : NameRegister ( ) ) ) ; <nl> + ASSERT ( rdx . is ( LoadIC : : ReceiverRegister ( ) ) ) ; <nl> + ASSERT ( rcx . is ( LoadIC : : NameRegister ( ) ) ) ; <nl> Label slow , miss ; <nl> <nl> / / This stub is meant to be tail - jumped to , the receiver must already <nl> / / have been verified by the caller to not be a smi . <nl> <nl> - __ JumpIfNotSmi ( rax , & miss ) ; <nl> - __ SmiToInteger32 ( rbx , rax ) ; <nl> - __ movp ( rcx , FieldOperand ( rdx , JSObject : : kElementsOffset ) ) ; <nl> + __ JumpIfNotSmi ( rcx , & miss ) ; <nl> + __ SmiToInteger32 ( rbx , rcx ) ; <nl> + __ movp ( rax , FieldOperand ( rdx , JSObject : : kElementsOffset ) ) ; <nl> <nl> / / Check whether the elements is a number dictionary . <nl> / / rdx : receiver <nl> - / / rax : key <nl> + / / rcx : key <nl> / / rbx : key as untagged int32 <nl> - / / rcx : elements <nl> - __ LoadFromNumberDictionary ( & slow , rcx , rax , rbx , r9 , rdi , rax ) ; <nl> + / / rax : elements <nl> + __ LoadFromNumberDictionary ( & slow , rax , rcx , rbx , r9 , rdi , rax ) ; <nl> __ ret ( 0 ) ; <nl> <nl> __ bind ( & slow ) ; <nl> / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - rax : key <nl> + / / - - rcx : key <nl> / / - - rdx : receiver <nl> / / - - rsp [ 0 ] : return address <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> void KeyedLoadStubCompiler : : GenerateLoadDictionaryElement ( <nl> <nl> __ bind ( & miss ) ; <nl> / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> - / / - - rax : key <nl> + / / - - rcx : key <nl> / / - - rdx : receiver <nl> / / - - rsp [ 0 ] : return address <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl>
KeyedLoadIC should have same register spec as LoadIC .
v8/v8
351ed4c8a1a6e58fe78e5b140f6c76c4c6f79d8a
2014-06-30T15:56:50Z
mmm a / mars / stn / src / smart_heartbeat . cc <nl> ppp b / mars / stn / src / smart_heartbeat . cc <nl> void SmartHeartbeat : : __LoadINI ( ) { <nl> xassert2 ( ret ) ; <nl> __SaveINI ( ) ; <nl> } <nl> + __DumpHeartInfo ( ) ; <nl> } <nl> <nl> # define MAX_INI_SECTIONS ( 20 ) <nl>
add log review by elviswu
Tencent/mars
3b0c489265f6b7608580844cbff5584f016a91e1
2018-03-27T08:16:57Z