diff
stringlengths
41
2.03M
msg
stringlengths
1
1.5k
repo
stringlengths
5
40
sha
stringlengths
40
40
time
stringlengths
20
20
mmm a / util / fault_injection_test_env . cc <nl> ppp b / util / fault_injection_test_env . cc <nl> Status FaultInjectionTestEnv : : NewWritableFile ( const std : : string & fname , <nl> return s ; <nl> } <nl> <nl> + Status FaultInjectionTestEnv : : NewRandomAccessFile ( <nl> + const std : : string & fname , std : : unique_ptr < RandomAccessFile > * result , <nl> + const EnvOptions & soptions ) { <nl> + if ( ! IsFilesystemActive ( ) ) { <nl> + return GetError ( ) ; <nl> + } <nl> + return target ( ) - > NewRandomAccessFile ( fname , result , soptions ) ; <nl> + } <nl> + <nl> Status FaultInjectionTestEnv : : DeleteFile ( const std : : string & f ) { <nl> if ( ! IsFilesystemActive ( ) ) { <nl> return GetError ( ) ; <nl> mmm a / util / fault_injection_test_env . h <nl> ppp b / util / fault_injection_test_env . h <nl> class FaultInjectionTestEnv : public EnvWrapper { <nl> unique_ptr < WritableFile > * result , <nl> const EnvOptions & soptions ) override ; <nl> <nl> + Status NewRandomAccessFile ( const std : : string & fname , <nl> + std : : unique_ptr < RandomAccessFile > * result , <nl> + const EnvOptions & soptions ) override ; <nl> + <nl> virtual Status DeleteFile ( const std : : string & f ) override ; <nl> <nl> virtual Status RenameFile ( const std : : string & s , <nl> mmm a / utilities / blob_db / blob_db_impl . cc <nl> ppp b / utilities / blob_db / blob_db_impl . cc <nl> void BlobDBImpl : : CloseRandomAccessLocked ( <nl> open_file_count_ - - ; <nl> } <nl> <nl> - std : : shared_ptr < RandomAccessFileReader > BlobDBImpl : : GetOrOpenRandomAccessReader ( <nl> - const std : : shared_ptr < BlobFile > & bfile , Env * env , <nl> - const EnvOptions & env_options ) { <nl> + Status BlobDBImpl : : GetBlobFileReader ( <nl> + const std : : shared_ptr < BlobFile > & blob_file , <nl> + std : : shared_ptr < RandomAccessFileReader > * reader ) { <nl> + assert ( reader ! = nullptr ) ; <nl> bool fresh_open = false ; <nl> - auto rar = bfile - > GetOrOpenRandomAccessReader ( env , env_options , & fresh_open ) ; <nl> - if ( fresh_open ) open_file_count_ + + ; <nl> - return rar ; <nl> + Status s = blob_file - > GetReader ( env_ , env_options_ , reader , & fresh_open ) ; <nl> + if ( s . ok ( ) & & fresh_open ) { <nl> + assert ( * reader ! = nullptr ) ; <nl> + open_file_count_ + + ; <nl> + } <nl> + return s ; <nl> } <nl> <nl> std : : shared_ptr < BlobFile > BlobDBImpl : : NewBlobFile ( const std : : string & reason ) { <nl> Status BlobDBImpl : : GetBlobValue ( const Slice & key , const Slice & index_entry , <nl> } <nl> <nl> / / takes locks when called <nl> - std : : shared_ptr < RandomAccessFileReader > reader = <nl> - GetOrOpenRandomAccessReader ( bfile , env_ , env_options_ ) ; <nl> + std : : shared_ptr < RandomAccessFileReader > reader ; <nl> + s = GetBlobFileReader ( bfile , & reader ) ; <nl> + if ( ! s . ok ( ) ) { <nl> + return s ; <nl> + } <nl> <nl> assert ( blob_index . offset ( ) > key . size ( ) + sizeof ( uint32_t ) ) ; <nl> uint64_t record_offset = blob_index . offset ( ) - key . size ( ) - sizeof ( uint32_t ) ; <nl> mmm a / utilities / blob_db / blob_db_impl . h <nl> ppp b / utilities / blob_db / blob_db_impl . h <nl> class BlobDBImpl : public BlobDB { <nl> / / Open all blob files found in blob_dir . <nl> Status OpenAllBlobFiles ( ) ; <nl> <nl> - / / hold write mutex on file and call <nl> - / / creates a Random Access reader for GET call <nl> - std : : shared_ptr < RandomAccessFileReader > GetOrOpenRandomAccessReader ( <nl> - const std : : shared_ptr < BlobFile > & bfile , Env * env , <nl> - const EnvOptions & env_options ) ; <nl> + Status GetBlobFileReader ( const std : : shared_ptr < BlobFile > & blob_file , <nl> + std : : shared_ptr < RandomAccessFileReader > * reader ) ; <nl> <nl> / / hold write mutex on file and call . <nl> / / Close the above Random Access reader <nl> mmm a / utilities / blob_db / blob_db_test . cc <nl> ppp b / utilities / blob_db / blob_db_test . cc <nl> <nl> # include " port / port . h " <nl> # include " rocksdb / utilities / debug . h " <nl> # include " util / cast_util . h " <nl> + # include " util / fault_injection_test_env . h " <nl> # include " util / random . h " <nl> # include " util / string_util . h " <nl> # include " util / sync_point . h " <nl> class BlobDBTest : public testing : : Test { <nl> BlobDBTest ( ) <nl> : dbname_ ( test : : PerThreadDBPath ( " blob_db_test " ) ) , <nl> mock_env_ ( new MockTimeEnv ( Env : : Default ( ) ) ) , <nl> + fault_injection_env_ ( new FaultInjectionTestEnv ( Env : : Default ( ) ) ) , <nl> blob_db_ ( nullptr ) { <nl> Status s = DestroyBlobDB ( dbname_ , Options ( ) , BlobDBOptions ( ) ) ; <nl> assert ( s . ok ( ) ) ; <nl> class BlobDBTest : public testing : : Test { <nl> <nl> const std : : string dbname_ ; <nl> std : : unique_ptr < MockTimeEnv > mock_env_ ; <nl> + std : : unique_ptr < FaultInjectionTestEnv > fault_injection_env_ ; <nl> BlobDB * blob_db_ ; <nl> } ; / / class BlobDBTest <nl> <nl> TEST_F ( BlobDBTest , GetExpiration ) { <nl> ASSERT_EQ ( 300 / * = 100 + 200 * / , expiration ) ; <nl> } <nl> <nl> + TEST_F ( BlobDBTest , GetIOError ) { <nl> + Options options ; <nl> + options . env = fault_injection_env_ . get ( ) ; <nl> + BlobDBOptions bdb_options ; <nl> + bdb_options . min_blob_size = 0 ; / / Make sure value write to blob file <nl> + bdb_options . disable_background_tasks = true ; <nl> + Open ( bdb_options , options ) ; <nl> + ColumnFamilyHandle * column_family = blob_db_ - > DefaultColumnFamily ( ) ; <nl> + PinnableSlice value ; <nl> + ASSERT_OK ( Put ( " foo " , " bar " ) ) ; <nl> + fault_injection_env_ - > SetFilesystemActive ( false , Status : : IOError ( ) ) ; <nl> + Status s = blob_db_ - > Get ( ReadOptions ( ) , column_family , " foo " , & value ) ; <nl> + ASSERT_TRUE ( s . IsIOError ( ) ) ; <nl> + / / Reactivate file system to allow test to close DB . <nl> + fault_injection_env_ - > SetFilesystemActive ( true ) ; <nl> + } <nl> + <nl> TEST_F ( BlobDBTest , WriteBatch ) { <nl> Random rnd ( 301 ) ; <nl> BlobDBOptions bdb_options ; <nl> TEST_F ( BlobDBTest , DecompressAfterReopen ) { <nl> Reopen ( bdb_options ) ; <nl> VerifyDB ( data ) ; <nl> } <nl> - <nl> # endif <nl> <nl> TEST_F ( BlobDBTest , MultipleWriters ) { <nl> mmm a / utilities / blob_db / blob_file . cc <nl> ppp b / utilities / blob_db / blob_file . cc <nl> void BlobFile : : CloseRandomAccessLocked ( ) { <nl> last_access_ = - 1 ; <nl> } <nl> <nl> - std : : shared_ptr < RandomAccessFileReader > BlobFile : : GetOrOpenRandomAccessReader ( <nl> - Env * env , const EnvOptions & env_options , bool * fresh_open ) { <nl> + Status BlobFile : : GetReader ( Env * env , const EnvOptions & env_options , <nl> + std : : shared_ptr < RandomAccessFileReader > * reader , <nl> + bool * fresh_open ) { <nl> + assert ( reader ! = nullptr ) ; <nl> + assert ( fresh_open ! = nullptr ) ; <nl> * fresh_open = false ; <nl> int64_t current_time = 0 ; <nl> env - > GetCurrentTime ( & current_time ) ; <nl> last_access_ . store ( current_time ) ; <nl> + Status s ; <nl> <nl> { <nl> ReadLock lockbfile_r ( & mutex_ ) ; <nl> - if ( ra_file_reader_ ) return ra_file_reader_ ; <nl> + if ( ra_file_reader_ ) { <nl> + * reader = ra_file_reader_ ; <nl> + return s ; <nl> + } <nl> } <nl> <nl> WriteLock lockbfile_w ( & mutex_ ) ; <nl> - if ( ra_file_reader_ ) return ra_file_reader_ ; <nl> + / / Double check . <nl> + if ( ra_file_reader_ ) { <nl> + * reader = ra_file_reader_ ; <nl> + return s ; <nl> + } <nl> <nl> std : : unique_ptr < RandomAccessFile > rfile ; <nl> - Status s = env - > NewRandomAccessFile ( PathName ( ) , & rfile , env_options ) ; <nl> + s = env - > NewRandomAccessFile ( PathName ( ) , & rfile , env_options ) ; <nl> if ( ! s . ok ( ) ) { <nl> ROCKS_LOG_ERROR ( info_log_ , <nl> " Failed to open blob file for random - read : % s status : ' % s ' " <nl> " exists : ' % s ' " , <nl> PathName ( ) . c_str ( ) , s . ToString ( ) . c_str ( ) , <nl> env - > FileExists ( PathName ( ) ) . ToString ( ) . c_str ( ) ) ; <nl> - return nullptr ; <nl> + return s ; <nl> } <nl> <nl> ra_file_reader_ = std : : make_shared < RandomAccessFileReader > ( std : : move ( rfile ) , <nl> PathName ( ) ) ; <nl> + * reader = ra_file_reader_ ; <nl> * fresh_open = true ; <nl> - return ra_file_reader_ ; <nl> + return s ; <nl> } <nl> <nl> Status BlobFile : : ReadMetadata ( Env * env , const EnvOptions & env_options ) { <nl> mmm a / utilities / blob_db / blob_file . h <nl> ppp b / utilities / blob_db / blob_file . h <nl> class BlobFile { <nl> / / footer_valid_ to false and return Status : : OK . <nl> Status ReadMetadata ( Env * env , const EnvOptions & env_options ) ; <nl> <nl> + Status GetReader ( Env * env , const EnvOptions & env_options , <nl> + std : : shared_ptr < RandomAccessFileReader > * reader , <nl> + bool * fresh_open ) ; <nl> + <nl> private : <nl> std : : shared_ptr < Reader > OpenRandomAccessReader ( <nl> Env * env , const DBOptions & db_options , <nl> class BlobFile { <nl> <nl> Status WriteFooterAndCloseLocked ( ) ; <nl> <nl> - std : : shared_ptr < RandomAccessFileReader > GetOrOpenRandomAccessReader ( <nl> - Env * env , const EnvOptions & env_options , bool * fresh_open ) ; <nl> - <nl> void CloseRandomAccessLocked ( ) ; <nl> <nl> / / this is used , when you are reading only the footer of a <nl>
BlobDB : handle IO error on read ( )
facebook/rocksdb
04d373b26034464a8ad08e7123c3911609e20adc
2018-09-20T23:58:45Z
new file mode 100644 <nl> index 00000000000 . . 38462ff8884 <nl> mmm / dev / null <nl> ppp b / dbms / src / Functions / CRC . cpp <nl> <nl> + # include < zlib . h > <nl> + # include < DataTypes / DataTypeString . h > <nl> + # include < Functions / FunctionFactory . h > <nl> + # include < Functions / FunctionStringOrArrayToT . h > <nl> + <nl> + namespace <nl> + { <nl> + <nl> + template < class T > <nl> + struct CRCBase <nl> + { <nl> + T tab [ 256 ] ; <nl> + CRCBase ( T polynomial ) <nl> + { <nl> + for ( size_t i = 0 ; i < 256 ; + + i ) <nl> + { <nl> + T c = i ; <nl> + for ( size_t j = 0 ; j < 8 ; + + j ) <nl> + { <nl> + c = c & 1 ? polynomial ^ ( c > > 1 ) : c > > 1 ; <nl> + } <nl> + tab [ i ] = c ; <nl> + } <nl> + } <nl> + } ; <nl> + <nl> + template < class T , T polynomial > <nl> + struct CRCImpl <nl> + { <nl> + using ReturnType = T ; <nl> + <nl> + static T make_crc ( const unsigned char * buf , size_t size ) <nl> + { <nl> + static CRCBase < ReturnType > base ( polynomial ) ; <nl> + <nl> + T i , crc ; <nl> + <nl> + crc = 0 ; <nl> + for ( i = 0 ; i < size ; i + + ) <nl> + { <nl> + crc = base . tab [ ( crc ^ buf [ i ] ) & 0xff ] ^ ( crc > > 8 ) ; <nl> + } <nl> + return crc ; <nl> + } <nl> + } ; <nl> + <nl> + static constexpr UInt64 CRC64_ECMA = 0xc96c5795d7870f42ULL ; <nl> + struct CRC64ECMAImpl : public CRCImpl < UInt64 , CRC64_ECMA > <nl> + { <nl> + static constexpr auto name = " CRC64 " ; <nl> + } ; <nl> + <nl> + static constexpr UInt32 CRC32_IEEE = 0xedb88320 ; <nl> + struct CRC32IEEEImpl : public CRCImpl < UInt32 , CRC32_IEEE > <nl> + { <nl> + static constexpr auto name = " CRC32IEEE " ; <nl> + } ; <nl> + <nl> + struct CRC32ZLIBImpl <nl> + { <nl> + using ReturnType = UInt32 ; <nl> + static constexpr auto name = " CRC32 " ; <nl> + <nl> + static UInt32 make_crc ( const unsigned char * buf , size_t size ) <nl> + { return crc32 ( 0L , buf , size ) ; } <nl> + } ; <nl> + <nl> + } / / \ anonymous <nl> + <nl> + namespace DB <nl> + { <nl> + <nl> + namespace ErrorCodes <nl> + { <nl> + extern const int ILLEGAL_TYPE_OF_ARGUMENT ; <nl> + } <nl> + <nl> + template < class Impl > <nl> + struct CRCFunctionWrapper <nl> + { <nl> + static constexpr auto is_fixed_to_constant = true ; <nl> + using ReturnType = typename Impl : : ReturnType ; <nl> + <nl> + static void vector ( const ColumnString : : Chars & data , const ColumnString : : Offsets & offsets , PaddedPODArray < ReturnType > & res ) <nl> + { <nl> + size_t size = offsets . size ( ) ; <nl> + <nl> + ColumnString : : Offset prev_offset = 0 ; <nl> + for ( size_t i = 0 ; i < size ; + + i ) <nl> + { <nl> + res [ i ] = do_crc ( data , prev_offset , offsets [ i ] - prev_offset - 1 ) ; <nl> + prev_offset = offsets [ i ] ; <nl> + } <nl> + } <nl> + <nl> + static void vector_fixed_to_constant ( const ColumnString : : Chars & data , size_t n , ReturnType & res ) { res = do_crc ( data , 0 , n ) ; } <nl> + <nl> + static void vector_fixed_to_vector ( const ColumnString : : Chars & data , size_t n , PaddedPODArray < ReturnType > & res ) <nl> + { <nl> + size_t size = data . size ( ) / n ; <nl> + <nl> + for ( size_t i = 0 ; i < size ; + + i ) <nl> + { <nl> + res [ i ] = do_crc ( data , i * n , n ) ; <nl> + } <nl> + } <nl> + <nl> + [ [ noreturn ] ] static void array ( const ColumnString : : Offsets & / * offsets * / , PaddedPODArray < ReturnType > & / * res * / ) <nl> + { <nl> + throw Exception ( " Cannot apply function " + std : : string ( Impl : : name ) + " to Array argument " , ErrorCodes : : ILLEGAL_TYPE_OF_ARGUMENT ) ; <nl> + } <nl> + <nl> + private : <nl> + static ReturnType do_crc ( const ColumnString : : Chars & buf , size_t offset , size_t size ) <nl> + { <nl> + const unsigned char * p = reinterpret_cast < const unsigned char * > ( & buf [ 0 ] ) + offset ; <nl> + return Impl : : make_crc ( p , size ) ; <nl> + } <nl> + } ; <nl> + <nl> + template < class T > <nl> + using FunctionCRC = FunctionStringOrArrayToT < CRCFunctionWrapper < T > , T , typename T : : ReturnType > ; <nl> + / / The same as IEEE variant , but uses 0xffffffff as initial value <nl> + / / This is the default <nl> + / / <nl> + / / ( And zlib is used here , since it has optimized version ) <nl> + using FunctionCRC32ZLIB = FunctionCRC < CRC32ZLIBImpl > ; <nl> + / / Uses CRC - 32 - IEEE 802 . 3 polynomial <nl> + using FunctionCRC32IEEE = FunctionCRC < CRC32IEEEImpl > ; <nl> + / / Uses CRC - 64 - ECMA polynomial <nl> + using FunctionCRC64ECMA = FunctionCRC < CRC64ECMAImpl > ; <nl> + <nl> + template < class T > <nl> + void registerFunctionCRCImpl ( FunctionFactory & factory ) <nl> + { <nl> + factory . registerFunction < T > ( T : : name , FunctionFactory : : CaseInsensitive ) ; <nl> + } <nl> + <nl> + void registerFunctionCRC ( FunctionFactory & factory ) <nl> + { <nl> + registerFunctionCRCImpl < FunctionCRC32ZLIB > ( factory ) ; <nl> + registerFunctionCRCImpl < FunctionCRC32IEEE > ( factory ) ; <nl> + registerFunctionCRCImpl < FunctionCRC64ECMA > ( factory ) ; <nl> + } <nl> + <nl> + } <nl> deleted file mode 100644 <nl> index 80e0f163571 . . 00000000000 <nl> mmm a / dbms / src / Functions / CRC32 . cpp <nl> ppp / dev / null <nl> <nl> - # include < zlib . h > <nl> - # include < DataTypes / DataTypeString . h > <nl> - # include < Functions / FunctionFactory . h > <nl> - # include < Functions / FunctionStringOrArrayToT . h > <nl> - <nl> - <nl> - namespace DB <nl> - { <nl> - namespace ErrorCodes <nl> - { <nl> - extern const int ILLEGAL_TYPE_OF_ARGUMENT ; <nl> - } <nl> - <nl> - / * * Calculates the CRC32 of a string <nl> - * / <nl> - struct CRC32Impl <nl> - { <nl> - static constexpr auto is_fixed_to_constant = true ; <nl> - <nl> - static void vector ( const ColumnString : : Chars & data , const ColumnString : : Offsets & offsets , PaddedPODArray < UInt32 > & res ) <nl> - { <nl> - size_t size = offsets . size ( ) ; <nl> - <nl> - ColumnString : : Offset prev_offset = 0 ; <nl> - for ( size_t i = 0 ; i < size ; + + i ) <nl> - { <nl> - res [ i ] = do_crc32 ( data , prev_offset , offsets [ i ] - prev_offset - 1 ) ; <nl> - prev_offset = offsets [ i ] ; <nl> - } <nl> - } <nl> - <nl> - static void vector_fixed_to_constant ( const ColumnString : : Chars & data , size_t n , UInt32 & res ) { res = do_crc32 ( data , 0 , n ) ; } <nl> - <nl> - static void vector_fixed_to_vector ( const ColumnString : : Chars & data , size_t n , PaddedPODArray < UInt32 > & res ) <nl> - { <nl> - size_t size = data . size ( ) / n ; <nl> - <nl> - for ( size_t i = 0 ; i < size ; + + i ) <nl> - { <nl> - res [ i ] = do_crc32 ( data , i * n , n ) ; <nl> - } <nl> - } <nl> - <nl> - [ [ noreturn ] ] static void array ( const ColumnString : : Offsets & / * offsets * / , PaddedPODArray < UInt32 > & / * res * / ) <nl> - { <nl> - throw Exception ( " Cannot apply function CRC32 to Array argument " , ErrorCodes : : ILLEGAL_TYPE_OF_ARGUMENT ) ; <nl> - } <nl> - <nl> - private : <nl> - static uint32_t do_crc32 ( const ColumnString : : Chars & buf , size_t offset , size_t size ) <nl> - { <nl> - const unsigned char * p = reinterpret_cast < const unsigned char * > ( & buf [ 0 ] ) + offset ; <nl> - return crc32 ( 0L , p , size ) ; <nl> - } <nl> - } ; <nl> - <nl> - struct NameCRC32 <nl> - { <nl> - static constexpr auto name = " CRC32 " ; <nl> - } ; <nl> - using FunctionCRC32 = FunctionStringOrArrayToT < CRC32Impl , NameCRC32 , UInt32 > ; <nl> - <nl> - void registerFunctionCRC32 ( FunctionFactory & factory ) <nl> - { <nl> - factory . registerFunction < FunctionCRC32 > ( NameCRC32 : : name , FunctionFactory : : CaseInsensitive ) ; <nl> - } <nl> - <nl> - } <nl> mmm a / dbms / src / Functions / registerFunctionsString . cpp <nl> ppp b / dbms / src / Functions / registerFunctionsString . cpp <nl> void registerFunctionReverseUTF8 ( FunctionFactory & ) ; <nl> void registerFunctionsConcat ( FunctionFactory & ) ; <nl> void registerFunctionFormat ( FunctionFactory & ) ; <nl> void registerFunctionSubstring ( FunctionFactory & ) ; <nl> - void registerFunctionCRC32 ( FunctionFactory & ) ; <nl> + void registerFunctionCRC ( FunctionFactory & ) ; <nl> void registerFunctionAppendTrailingCharIfAbsent ( FunctionFactory & ) ; <nl> void registerFunctionStartsWith ( FunctionFactory & ) ; <nl> void registerFunctionEndsWith ( FunctionFactory & ) ; <nl> void registerFunctionsString ( FunctionFactory & factory ) <nl> registerFunctionLowerUTF8 ( factory ) ; <nl> registerFunctionUpperUTF8 ( factory ) ; <nl> registerFunctionReverse ( factory ) ; <nl> - registerFunctionCRC32 ( factory ) ; <nl> + registerFunctionCRC ( factory ) ; <nl> registerFunctionReverseUTF8 ( factory ) ; <nl> registerFunctionsConcat ( factory ) ; <nl> registerFunctionFormat ( factory ) ; <nl> similarity index 87 % <nl> rename from dbms / tests / queries / 0_stateless / 00936_crc32_function . reference <nl> rename to dbms / tests / queries / 0_stateless / 00936_crc_functions . reference <nl> mmm a / dbms / tests / queries / 0_stateless / 00936_crc32_function . reference <nl> ppp b / dbms / tests / queries / 0_stateless / 00936_crc_functions . reference <nl> qwerty string 55151997 2663297705 <nl> qqq aaa 3142898280 4027020077 <nl> zxcqwer 3358319860 0 <nl> aasq xxz 3369829874 4069886758 <nl> + CRC32IEEE ( ) <nl> + 7332BC33 <nl> + CRC64 ( ) <nl> + 72D5B9EA0B70CE1E <nl> similarity index 88 % <nl> rename from dbms / tests / queries / 0_stateless / 00936_crc32_function . sql <nl> rename to dbms / tests / queries / 0_stateless / 00936_crc_functions . sql <nl> mmm a / dbms / tests / queries / 0_stateless / 00936_crc32_function . sql <nl> ppp b / dbms / tests / queries / 0_stateless / 00936_crc_functions . sql <nl> select CRC32 ( str1 ) , CRC32 ( str2 ) from table1 order by CRC32 ( str1 ) , CRC32 ( str2 ) ; <nl> select str1 , str2 , CRC32 ( str1 ) , CRC32 ( str2 ) from table1 order by CRC32 ( str1 ) , CRC32 ( str2 ) ; <nl> <nl> DROP TABLE table1 ; <nl> + <nl> + SELECT ' CRC32IEEE ( ) ' ; <nl> + SELECT hex ( CRC32IEEE ( ' foo ' ) ) ; <nl> + SELECT ' CRC64 ( ) ' ; <nl> + SELECT hex ( CRC64 ( ' foo ' ) ) ; <nl> mmm a / docs / en / query_language / functions / string_functions . md <nl> ppp b / docs / en / query_language / functions / string_functions . md <nl> Returns a string that removes the whitespace characters on either side . <nl> <nl> # # CRC32 ( s ) <nl> <nl> - Returns the CRC32 checksum of a string <nl> + Returns the CRC32 checksum of a string , using CRC - 32 - IEEE 802 . 3 polynomial and initial value ` 0xffffffff ` ( zlib implementation ) . <nl> + <nl> + The result type is UInt32 . <nl> + <nl> + # # CRC32IEEE ( s ) <nl> + <nl> + Returns the CRC32 checksum of a string , using CRC - 32 - IEEE 802 . 3 polynomial . <nl> + <nl> The result type is UInt32 . <nl> <nl> + # # CRC64 ( s ) <nl> + <nl> + Returns the CRC64 checksum of a string , using CRC - 64 - ECMA polynomial . <nl> + <nl> + The result type is UInt64 . <nl> + <nl> [ Original article ] ( https : / / clickhouse . yandex / docs / en / query_language / functions / string_functions / ) < ! - - hide - - > <nl> mmm a / docs / ru / query_language / functions / string_functions . md <nl> ppp b / docs / ru / query_language / functions / string_functions . md <nl> SELECT startsWith ( ' Hello , world ! ' , ' He ' ) ; <nl> <nl> # # CRC32 ( s ) <nl> <nl> - Возвращает чексумму CRC32 данной строки . <nl> + Возвращает чексумму CRC32 данной строки , используется CRC - 32 - IEEE 802 . 3 многочлен и начальным значением ` 0xffffffff ` ( т . к . используется реализация из zlib ) . <nl> + <nl> + Тип результата - UInt32 . <nl> + <nl> + # # CRC32IEEE ( s ) <nl> + <nl> + Возвращает чексумму CRC32 данной строки , используется CRC - 32 - IEEE 802 . 3 многочлен . <nl> + <nl> Тип результата - UInt32 . <nl> <nl> + # # CRC64 ( s ) <nl> + <nl> + Возвращает чексумму CRC64 данной строки , используется CRC - 64 - ECMA многочлен . <nl> + <nl> + Тип результата - UInt64 . <nl> + <nl> [ Оригинальная статья ] ( https : / / clickhouse . yandex / docs / ru / query_language / functions / string_functions / ) < ! - - hide - - > <nl>
Add CRC32IEEE ( ) / CRC64 ( ) support
ClickHouse/ClickHouse
2d2e738085f71731eab61571f592b3d4fcebfdc2
2019-10-25T12:52:41Z
mmm a / src / app / ui / status_bar . cpp <nl> ppp b / src / app / ui / status_bar . cpp <nl> StatusBar : : StatusBar ( ) <nl> m_commandsBox - > setVisible ( false ) ; <nl> } <nl> <nl> + / / Tooltips manager <nl> + TooltipManager * tooltipManager = new TooltipManager ( ) ; <nl> + addChild ( tooltipManager ) ; <nl> + tooltipManager - > addTooltipFor ( m_slider , " Cel Opacity " , JI_BOTTOM ) ; <nl> + <nl> App : : instance ( ) - > CurrentToolChange . connect ( & StatusBar : : onCurrentToolChange , this ) ; <nl> } <nl> <nl>
StatusBar : Add cel opacity tooltip
aseprite/aseprite
ae90e8089cb5344452287f7d1fc019fae7a547ca
2015-04-07T14:15:45Z
new file mode 100644 <nl> index 00000000000 . . 4abf5457fca <nl> mmm / dev / null <nl> ppp b / ports / cpp - taskflow / CONTROL <nl> <nl> + Source : cpp - taskflow <nl> + Version : 2018 - 11 - 30 <nl> + Description : Fast Parallel Tasking Programming Library using Modern C + + . <nl> new file mode 100644 <nl> index 00000000000 . . 1f596f0d491 <nl> mmm / dev / null <nl> ppp b / ports / cpp - taskflow / portfile . cmake <nl> <nl> + # header - only library <nl> + <nl> + include ( vcpkg_common_functions ) <nl> + <nl> + vcpkg_from_github ( <nl> + OUT_SOURCE_PATH SOURCE_PATH <nl> + REPO cpp - taskflow / cpp - taskflow <nl> + REF 97252f7d782c6e896122645175c08131ce10e649 <nl> + SHA512 df8ae9ea449663cb548f3c37346c2e0c785add2d86b9c618aea2741d81fe88c34b0d3d0e610a4b571973f9bc18631becedfe28e029ecf0c0cc87e4c35a280a29 <nl> + HEAD_REF master <nl> + ) <nl> + <nl> + vcpkg_configure_cmake ( <nl> + SOURCE_PATH $ { SOURCE_PATH } <nl> + PREFER_NINJA <nl> + OPTIONS <nl> + - DTF_BUILD_EXAMPLES = OFF <nl> + - DTF_BUILD_TESTS = OFF <nl> + - DTF_BUILD_BENCHMARKS = OFF <nl> + ) <nl> + <nl> + vcpkg_install_cmake ( ) <nl> + <nl> + vcpkg_fixup_cmake_targets ( CONFIG_PATH lib / cmake ) <nl> + <nl> + file ( REMOVE_RECURSE $ { CURRENT_PACKAGES_DIR } / debug $ { CURRENT_PACKAGES_DIR } / lib ) <nl> + <nl> + # Handle copyright <nl> + configure_file ( $ { SOURCE_PATH } / LICENSE $ { CURRENT_PACKAGES_DIR } / share / cpp - taskflow / copyright COPYONLY ) <nl>
[ cpp - taskflow ] Add new port
microsoft/vcpkg
724ed8cf4e2f6d6c23bd42e36ef5326b7e829248
2018-11-30T04:00:54Z
mmm a / vnpy / trader / database / database . py <nl> ppp b / vnpy / trader / database / database . py <nl> <nl> from abc import ABC , abstractmethod <nl> from datetime import datetime <nl> from enum import Enum <nl> - from typing import Optional , Sequence , TYPE_CHECKING <nl> + from typing import Optional , Sequence , List , Dict , TYPE_CHECKING <nl> <nl> if TYPE_CHECKING : <nl> from vnpy . trader . constant import Interval , Exchange # noqa <nl> def get_newest_bar_data ( <nl> " " " <nl> pass <nl> <nl> + @ abstractmethod <nl> + def get_oldest_bar_data ( <nl> + self , <nl> + symbol : str , <nl> + exchange : " Exchange " , <nl> + interval : " Interval " <nl> + ) - > Optional [ " BarData " ] : <nl> + " " " <nl> + If there is data in database , return the one with smallest datetime ( oldest one ) <nl> + otherwise , return None <nl> + " " " <nl> + pass <nl> + <nl> @ abstractmethod <nl> def get_newest_tick_data ( <nl> self , <nl> def get_newest_tick_data ( <nl> " " " <nl> pass <nl> <nl> + @ abstractmethod <nl> + def get_bar_data_statistics ( <nl> + self , <nl> + symbol : str , <nl> + exchange : " Exchange " , <nl> + ) - > List [ Dict ] : <nl> + " " " <nl> + Return data avaible in database with a list of symbol / exchange / interval / count . <nl> + " " " <nl> + pass <nl> + <nl> @ abstractmethod <nl> def clean ( self , symbol : str ) : <nl> " " " <nl> mmm a / vnpy / trader / database / database_sql . py <nl> ppp b / vnpy / trader / database / database_sql . py <nl> <nl> " " " " " " <nl> from datetime import datetime <nl> - from typing import List , Optional , Sequence , Type <nl> + from typing import List , Dict , Optional , Sequence , Type <nl> <nl> from peewee import ( <nl> AutoField , <nl> def get_newest_tick_data ( <nl> return s . to_tick ( ) <nl> return None <nl> <nl> - def get_bar_data_statistics ( self ) - > List : <nl> + def get_bar_data_statistics ( self ) - > List [ Dict ] : <nl> " " " " " " <nl> s = ( <nl> self . class_bar . select ( ) . group_by ( <nl>
[ Add ] new absctract method
vnpy/vnpy
c7ada129f13f6a519cc7af753a1988a8056c1fed
2020-03-09T02:35:20Z
mmm a / atom / browser / native_window . cc <nl> ppp b / atom / browser / native_window . cc <nl> <nl> # include " atom / browser / window_list . h " <nl> # include " atom / common / api / api_messages . h " <nl> # include " atom / common / atom_version . h " <nl> + # include " atom / common / native_mate_converters / image_converter . h " <nl> # include " atom / common / native_mate_converters / file_path_converter . h " <nl> # include " atom / common / options_switches . h " <nl> # include " base / command_line . h " <nl> <nl> # include " ipc / ipc_message_macros . h " <nl> # include " native_mate / dictionary . h " <nl> # include " ui / gfx / codec / png_codec . h " <nl> + # include " ui / gfx / image / image . h " <nl> + # include " ui / gfx / image / image_skia . h " <nl> # include " ui / gfx / point . h " <nl> # include " ui / gfx / rect . h " <nl> # include " ui / gfx / size . h " <nl> NativeWindow : : NativeWindow ( content : : WebContents * web_contents , <nl> # endif <nl> <nl> / / Read icon before window is created . <nl> - std : : string icon ; <nl> - if ( options . Get ( switches : : kIcon , & icon ) & & ! SetIcon ( icon ) ) <nl> - LOG ( ERROR ) < < " Failed to set icon to " < < icon ; <nl> + gfx : : ImageSkia icon ; <nl> + if ( options . Get ( switches : : kIcon , & icon ) ) <nl> + icon_ . reset ( new gfx : : Image ( icon ) ) ; <nl> <nl> / / Read iframe security before any navigation . <nl> options . Get ( switches : : kNodeIntegration , & node_integration_ ) ; <nl> bool NativeWindow : : IsWebViewFocused ( ) { <nl> return host_view & & host_view - > HasFocus ( ) ; <nl> } <nl> <nl> - bool NativeWindow : : SetIcon ( const std : : string & str_path ) { <nl> - base : : FilePath path = base : : FilePath : : FromUTF8Unsafe ( str_path ) ; <nl> - <nl> - / / Read the file from disk . <nl> - std : : string file_contents ; <nl> - if ( path . empty ( ) | | ! base : : ReadFileToString ( path , & file_contents ) ) <nl> - return false ; <nl> - <nl> - / / Decode the bitmap using WebKit ' s image decoder . <nl> - const unsigned char * data = <nl> - reinterpret_cast < const unsigned char * > ( file_contents . data ( ) ) ; <nl> - scoped_ptr < SkBitmap > decoded ( new SkBitmap ( ) ) ; <nl> - gfx : : PNGCodec : : Decode ( data , file_contents . length ( ) , decoded . get ( ) ) ; <nl> - if ( decoded - > empty ( ) ) <nl> - return false ; / / Unable to decode . <nl> - <nl> - icon_ = gfx : : Image : : CreateFrom1xBitmap ( * decoded . release ( ) ) ; <nl> - return true ; <nl> - } <nl> - <nl> base : : ProcessHandle NativeWindow : : GetRenderProcessHandle ( ) { <nl> return GetWebContents ( ) - > GetRenderProcessHost ( ) - > GetHandle ( ) ; <nl> } <nl> mmm a / atom / browser / native_window . h <nl> ppp b / atom / browser / native_window . h <nl> <nl> # include " atom / browser / native_window_observer . h " <nl> # include " content / public / browser / notification_registrar . h " <nl> # include " content / public / browser / notification_observer . h " <nl> - # include " ui / gfx / image / image . h " <nl> # include " vendor / brightray / browser / default_web_contents_delegate . h " <nl> # include " vendor / brightray / browser / inspectable_web_contents_delegate . h " <nl> # include " vendor / brightray / browser / inspectable_web_contents_impl . h " <nl> class WebContents ; <nl> } <nl> <nl> namespace gfx { <nl> + class Image ; <nl> class Point ; <nl> class Rect ; <nl> class Size ; <nl> class NativeWindow : public brightray : : DefaultWebContentsDelegate , <nl> virtual void BlurWebView ( ) ; <nl> virtual bool IsWebViewFocused ( ) ; <nl> <nl> - virtual bool SetIcon ( const std : : string & path ) ; <nl> - <nl> / / Returns the process handle of render process , useful for killing the <nl> / / render process manually <nl> virtual base : : ProcessHandle GetRenderProcessHandle ( ) ; <nl> class NativeWindow : public brightray : : DefaultWebContentsDelegate , <nl> bool has_frame_ ; <nl> <nl> / / Window icon . <nl> - gfx : : Image icon_ ; <nl> + scoped_ptr < gfx : : Image > icon_ ; <nl> <nl> private : <nl> / / Schedule a notification unresponsive event . <nl> mmm a / atom / browser / native_window_gtk . cc <nl> ppp b / atom / browser / native_window_gtk . cc <nl> <nl> # include " ui / base / x / x11_util . h " <nl> # include " ui / gfx / font_render_params_linux . h " <nl> # include " ui / gfx / gtk_util . h " <nl> + # include " ui / gfx / image . h " <nl> # include " ui / gfx / rect . h " <nl> # include " ui / gfx / skia_utils_gtk . h " <nl> <nl> NativeWindowGtk : : NativeWindowGtk ( content : : WebContents * web_contents , <nl> / / Create the underlying gdk window . <nl> gtk_widget_realize ( GTK_WIDGET ( window_ ) ) ; <nl> <nl> - if ( ! icon_ . IsEmpty ( ) ) <nl> - gtk_window_set_icon ( window_ , icon_ . ToGdkPixbuf ( ) ) ; <nl> + if ( icon_ ) <nl> + gtk_window_set_icon ( window_ , icon_ - > ToGdkPixbuf ( ) ) ; <nl> <nl> ui : : ActiveWindowWatcherX : : AddObserver ( this ) ; <nl> <nl> mmm a / atom / browser / native_window_win . cc <nl> ppp b / atom / browser / native_window_win . cc <nl> <nl> # include " content / public / browser / web_contents . h " <nl> # include " content / public / browser / web_contents_view . h " <nl> # include " native_mate / dictionary . h " <nl> + # include " ui / gfx / image . h " <nl> # include " ui / gfx / path . h " <nl> # include " ui / base / models / simple_menu_model . h " <nl> # include " ui / views / widget / widget . h " <nl> bool NativeWindowWin : : ShouldHandleSystemCommands ( ) const { <nl> } <nl> <nl> gfx : : ImageSkia NativeWindowWin : : GetWindowAppIcon ( ) { <nl> - if ( icon_ . IsEmpty ( ) ) <nl> - return gfx : : ImageSkia ( ) ; <nl> + if ( icon_ ) <nl> + return * ( icon_ - > ToImageSkia ( ) ) ; <nl> else <nl> - return * icon_ . ToImageSkia ( ) ; <nl> + return gfx : : ImageSkia ( ) ; <nl> } <nl> <nl> gfx : : ImageSkia NativeWindowWin : : GetWindowIcon ( ) { <nl>
Support high dpi icon as window icon .
electron/electron
ca1d2a32b0426ee3b133ea63a8729d1c1643bcf3
2014-06-23T14:26:01Z
mmm a / docker / build / installers / install_python_modules . sh <nl> ppp b / docker / build / installers / install_python_modules . sh <nl> <nl> set - e <nl> <nl> cd " $ ( dirname " $ { BASH_SOURCE [ 0 ] } " ) " <nl> - <nl> . / tmp / installers / installer_base . sh <nl> <nl> - apt update - y & & apt install - y \ <nl> - libgeos - dev \ <nl> - software - properties - common <nl> - <nl> + apt_get_update_and_install libgeos - dev <nl> pip3_install - r py3_requirements . txt <nl> <nl> # Clean up cache to reduce layer size . <nl>
Docker : replace apt with apt - get in installer scripts
ApolloAuto/apollo
bf3d251a34b377aedf98434a7f014ca139ea3cb6
2020-07-28T17:08:08Z
mmm a / doc / binary - logging . md <nl> ppp b / doc / binary - logging . md <nl> <nl> <nl> # # Format <nl> <nl> - The log format is described in [ this proto file ] ( src / proto / grpc / binary_log / v1alpha / log . proto ) . It is intended that multiple parts of the call will be logged in separate files , and then correlated by analysis tools using the rpc \ _id . <nl> + The log format is described in [ this proto file ] ( / src / proto / grpc / binary_log / v1alpha / log . proto ) . It is intended that multiple parts of the call will be logged in separate files , and then correlated by analysis tools using the rpc \ _id . <nl> <nl> # # API <nl> <nl> mmm a / test / cpp / microbenchmarks / bm_call_create . cc <nl> ppp b / test / cpp / microbenchmarks / bm_call_create . cc <nl> static void BM_LameChannelCallCreateCore ( benchmark : : State & state ) { <nl> cq , gpr_inf_future ( GPR_CLOCK_REALTIME ) , NULL ) ; <nl> GPR_ASSERT ( ev . type ! = GRPC_QUEUE_SHUTDOWN ) ; <nl> GPR_ASSERT ( ev . success ! = 0 ) ; <nl> - grpc_call_destroy ( call ) ; <nl> + grpc_call_unref ( call ) ; <nl> grpc_byte_buffer_destroy ( request_payload_send ) ; <nl> grpc_byte_buffer_destroy ( response_payload_recv ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> static void BM_LameChannelCallCreateCoreSeparateBatch ( benchmark : : State & state ) { <nl> NULL ) ; <nl> GPR_ASSERT ( ev . type ! = GRPC_QUEUE_SHUTDOWN ) ; <nl> GPR_ASSERT ( ev . success ! = 0 ) ; <nl> - grpc_call_destroy ( call ) ; <nl> + grpc_call_unref ( call ) ; <nl> grpc_byte_buffer_destroy ( request_payload_send ) ; <nl> grpc_byte_buffer_destroy ( response_payload_recv ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl>
Merge github . com : grpc / grpc into framing_costs
grpc/grpc
f414008fe9eeb08bcf87a827a72318ca58d72519
2017-04-20T21:28:28Z
mmm a / tensorflow / compiler / tf2tensorrt / convert / convert_nodes . cc <nl> ppp b / tensorflow / compiler / tf2tensorrt / convert / convert_nodes . cc <nl> Status ConvertBatchMatMul ( OpConverterParams * params ) { <nl> } <nl> <nl> TFAttrs attrs ( node_def ) ; <nl> - if ( attrs . get < bool > ( " adj_x " ) | | attrs . get < bool > ( " adj_y " ) ) { <nl> - return errors : : InvalidArgument ( " TensorRT cannot adjoint inputs . " ) ; <nl> - } <nl> + const bool transpose_a = attrs . get < bool > ( " adj_x " ) ; <nl> + const bool transpose_b = attrs . get < bool > ( " adj_y " ) ; <nl> <nl> / / Removes the batch dimension from weights . <nl> const auto remove_weights_batch_dim = <nl> Status ConvertBatchMatMul ( OpConverterParams * params ) { <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> - return ConvertMatMulHelper ( params , tensor_l , tensor_r , / * transpose_a = * / false , <nl> - / * transpose_b = * / false , node_def . name ( ) ) ; <nl> + return ConvertMatMulHelper ( params , tensor_l , tensor_r , transpose_a , <nl> + transpose_b , node_def . name ( ) ) ; <nl> } <nl> <nl> Status ConvertSoftmax ( OpConverterParams * params ) { <nl> mmm a / tensorflow / compiler / tf2tensorrt / convert / convert_nodes_test . cc <nl> ppp b / tensorflow / compiler / tf2tensorrt / convert / convert_nodes_test . cc <nl> void OpConverterTest : : TestMatMulHelper ( <nl> AddTestWeights < float > ( " weights " , { 2 , 2 } , { 0 , 1 , 2 , 3 } ) ; <nl> if ( is_batch_matmul ) { <nl> if ( transpose_a | | transpose_b ) { <nl> - RunValidationAndConversion ( node_def , error : : INVALID_ARGUMENT , <nl> - " TensorRT cannot adjoint inputs . " ) ; <nl> + RunValidationAndConversion ( <nl> + node_def , error : : INVALID_ARGUMENT , <nl> + " Input weight attempts to broadcast across batch dimension for " <nl> + " BatchMatMul , at my_matmul " ) ; <nl> } else { <nl> RunValidationAndConversion ( <nl> node_def , error : : INVALID_ARGUMENT , <nl> void OpConverterTest : : TestMatMulHelper ( <nl> AddTestWeights < float > ( " weights " , { 2 , 2 } , { 0 , 1 , 2 , 3 } ) ; <nl> if ( is_batch_matmul ) { <nl> if ( transpose_b ) { <nl> - RunValidationAndConversion ( node_def , error : : INVALID_ARGUMENT , <nl> - " TensorRT cannot adjoint inputs . " ) ; <nl> + RunValidationAndConversion ( <nl> + node_def , error : : INVALID_ARGUMENT , <nl> + " Input weight attempts to broadcast across batch dimension for " <nl> + " BatchMatMul , at my_matmul " ) ; <nl> } else { <nl> RunValidationAndConversion ( <nl> node_def , error : : INVALID_ARGUMENT , <nl> TEST_F ( OpConverterTest , ConvertBatchMatMul ) { <nl> return matmul . operation . node ( ) - > def ( ) ; <nl> } ; <nl> <nl> - { <nl> - Reset ( ) ; <nl> - NodeDef node_def = get_batch_matmul_nodedef ( DT_FLOAT , / * transpose_a = * / false , <nl> - / * transpose_b = * / false ) ; <nl> - AddTestTensor ( " input " , { 1 , 3 } , / * batch_size = * / 1 ) ; <nl> - AddTestWeights < float > ( " weights " , { 1 , 3 , 1 } , { 1 , 2 , 3 } ) ; <nl> + for ( bool transpose_a : { false , true } ) { <nl> + for ( bool transpose_b : { false , true } ) { <nl> + Reset ( ) ; <nl> + NodeDef node_def = <nl> + get_batch_matmul_nodedef ( DT_FLOAT , transpose_a , transpose_b ) ; <nl> + AddTestTensor ( " input " , { 2 , 2 } , / * batch_size = * / 1 ) ; <nl> + AddTestWeights < float > ( " weights " , { 1 , 2 , 2 } , { 1 , 2 , 3 , 4 } ) ; <nl> <nl> - RunValidationAndConversion ( node_def ) ; <nl> - TRT_TensorOrWeights output ; <nl> - TF_EXPECT_OK ( GetTensorOrWeights ( " my_matmul " , & output ) ) ; <nl> - ASSERT_TRUE ( output . is_tensor ( ) ) ; <nl> - ExpectTrtDimsEqualsArray ( { 1 , 1 } , output . tensor ( ) - > getDimensions ( ) ) ; <nl> - const DataVec input_data { { " input " , test : : AsTensor < float > ( { 0 , 1 , 2 } ) } } ; <nl> - DataVec output_data { { " my_matmul " , ConstructTensor < float > ( 1 , 1 ) } } ; <nl> - BuildAndRun ( input_data , & output_data ) ; <nl> - EXPECT_THAT ( GetSpanForData < float > ( output_data [ 0 ] ) , ElementsAre ( 8 ) ) ; <nl> + RunValidationAndConversion ( node_def ) ; <nl> + TRT_TensorOrWeights output ; <nl> + TF_EXPECT_OK ( GetTensorOrWeights ( " my_matmul " , & output ) ) ; <nl> + ASSERT_TRUE ( output . is_tensor ( ) ) ; <nl> + ExpectTrtDimsEqualsArray ( { 2 , 2 } , output . tensor ( ) - > getDimensions ( ) ) ; <nl> + const DataVec input_data { { " input " , test : : AsTensor < float > ( { 0 , 1 , 2 , 3 } ) } } ; <nl> + DataVec output_data { { " my_matmul " , ConstructTensor < float > ( 4 ) } } ; <nl> + BuildAndRun ( input_data , & output_data ) ; <nl> + if ( ! transpose_a & & ! transpose_b ) { <nl> + EXPECT_THAT ( GetSpanForData < float > ( output_data [ 0 ] ) , <nl> + ElementsAre ( 3 , 4 , 11 , 16 ) ) ; <nl> + } else if ( transpose_a & & transpose_b ) { <nl> + EXPECT_THAT ( GetSpanForData < float > ( output_data [ 0 ] ) , <nl> + ElementsAre ( 4 , 8 , 7 , 15 ) ) ; <nl> + } else if ( transpose_a ) { <nl> + EXPECT_THAT ( GetSpanForData < float > ( output_data [ 0 ] ) , <nl> + ElementsAre ( 6 , 8 , 10 , 14 ) ) ; <nl> + } else if ( transpose_b ) { <nl> + EXPECT_THAT ( GetSpanForData < float > ( output_data [ 0 ] ) , <nl> + ElementsAre ( 2 , 4 , 8 , 18 ) ) ; <nl> + } <nl> + } <nl> } <nl> <nl> TestMatMulHelper ( get_batch_matmul_nodedef , " BatchMatMul " ) ; <nl>
Reverts erroneous change that removed adj_x / adj_y support in BatchMatMul
tensorflow/tensorflow
f94c8482969c50c07f43063e01fd63747ef3a99f
2019-05-14T23:56:01Z
mmm a / Code / Sandbox / EditorQt / TerrainMiniMapTool . cpp <nl> ppp b / Code / Sandbox / EditorQt / TerrainMiniMapTool . cpp <nl> void CTerrainMiniMapTool : : Generate ( bool bHideProxy ) <nl> { <nl> XmlNodeRef ChildNode = root - > getChild ( i ) ; <nl> const char * pTagName = ChildNode - > getTag ( ) ; <nl> + if ( ! pTagName ) <nl> + { <nl> + CryWarning ( VALIDATOR_MODULE_EDITOR , VALIDATOR_ERROR , " [ MiniMap : % s ] Console variable has no tag name " , MAP_SCREENSHOT_SETTINGS ) ; <nl> + continue ; <nl> + } <nl> ICVar * pVar = gEnv - > pConsole - > GetCVar ( pTagName ) ; <nl> if ( pVar ) <nl> { <nl>
! B ( CE - 17895 ) ( Sandbox ) Fix terrain minimap generation crash on warning
CRYTEK/CRYENGINE
3098adc83db54c41f8d34556d1d8deb912c7f151
2018-11-08T15:18:07Z
mmm a / UnitTests / Makefile . unittests <nl> ppp b / UnitTests / Makefile . unittests <nl> SHELL_SERVER_AQL = @ top_srcdir @ / js / server / tests / aql - arithmetic . js \ <nl> @ top_srcdir @ / js / server / tests / aql - modify - noncluster . js \ <nl> @ top_srcdir @ / js / server / tests / aql - modify - noncluster - serializetest . js \ <nl> @ top_srcdir @ / js / server / tests / aql - operators . js \ <nl> + @ top_srcdir @ / js / server / tests / aql - optimizer - collect - into . js \ <nl> @ top_srcdir @ / js / server / tests / aql - optimizer - count . js \ <nl> @ top_srcdir @ / js / server / tests / aql - optimizer - dynamic - bounds . js \ <nl> @ top_srcdir @ / js / server / tests / aql - optimizer - filters . js \ <nl> mmm a / arangod / Aql / AqlValue . cpp <nl> ppp b / arangod / Aql / AqlValue . cpp <nl> AqlValue AqlValue : : CreateFromBlocks ( triagens : : arango : : AqlTransaction * trx , <nl> return AqlValue ( json . release ( ) ) ; <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief create an AqlValue from a vector of AqlItemBlock * s <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + AqlValue AqlValue : : CreateFromBlocks ( triagens : : arango : : AqlTransaction * trx , <nl> + std : : vector < AqlItemBlock * > const & src , <nl> + triagens : : aql : : RegisterId expressionRegister ) { <nl> + size_t totalSize = 0 ; <nl> + <nl> + for ( auto it = src . begin ( ) ; it ! = src . end ( ) ; + + it ) { <nl> + totalSize + = ( * it ) - > size ( ) ; <nl> + } <nl> + <nl> + std : : unique_ptr < Json > json ( new Json ( Json : : List , totalSize ) ) ; <nl> + <nl> + for ( auto it = src . begin ( ) ; it ! = src . end ( ) ; + + it ) { <nl> + auto current = ( * it ) ; <nl> + auto document = current - > getDocumentCollection ( expressionRegister ) ; <nl> + <nl> + for ( size_t i = 0 ; i < current - > size ( ) ; + + i ) { <nl> + json - > add ( current - > getValueReference ( i , expressionRegister ) . toJson ( trx , document ) ) ; <nl> + } <nl> + } <nl> + <nl> + return AqlValue ( json . release ( ) ) ; <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief 3 - way comparison for AqlValue objects <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / arangod / Aql / AqlValue . h <nl> ppp b / arangod / Aql / AqlValue . h <nl> <nl> <nl> # include " Basics / Common . h " <nl> # include " Aql / Range . h " <nl> + # include " Aql / types . h " <nl> # include " Basics / JsonHelper . h " <nl> # include " Utils / V8TransactionContext . h " <nl> # include " Utils / AqlTransaction . h " <nl> namespace triagens { <nl> std : : vector < AqlItemBlock * > const & , <nl> std : : vector < std : : string > const & ) ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief create an AqlValue from a vector of AqlItemBlock * s <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + static AqlValue CreateFromBlocks ( triagens : : arango : : AqlTransaction * , <nl> + std : : vector < AqlItemBlock * > const & , <nl> + triagens : : aql : : RegisterId ) ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief 3 - way comparison for AqlValue objects <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / arangod / Aql / Ast . cpp <nl> ppp b / arangod / Aql / Ast . cpp <nl> AstNode * Ast : : createNodeCollect ( AstNode const * list , <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief create an AST collect node , COUNT <nl> + / / / @ brief create an AST collect node , INTO var = expr <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - AstNode * Ast : : createNodeCollect ( AstNode const * list , <nl> - char const * name ) { <nl> + AstNode * Ast : : createNodeCollectExpression ( AstNode const * list , <nl> + char const * name , <nl> + AstNode const * expression ) { <nl> + AstNode * node = createNode ( NODE_TYPE_COLLECT_EXPRESSION ) ; <nl> + node - > addMember ( list ) ; <nl> + <nl> + AstNode * variable = createNodeVariable ( name , true ) ; <nl> + node - > addMember ( variable ) ; <nl> + <nl> + node - > addMember ( expression ) ; <nl> + <nl> + return node ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief create an AST collect node , COUNT INTO <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + AstNode * Ast : : createNodeCollectCount ( AstNode const * list , <nl> + char const * name ) { <nl> AstNode * node = createNode ( NODE_TYPE_COLLECT_COUNT ) ; <nl> node - > addMember ( list ) ; <nl> <nl> mmm a / arangod / Aql / Ast . h <nl> ppp b / arangod / Aql / Ast . h <nl> namespace triagens { <nl> AstNode const * ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief create an AST collect node , COUNT <nl> + / / / @ brief create an AST collect node <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - AstNode * createNodeCollect ( AstNode const * , <nl> - char const * ) ; <nl> + AstNode * createNodeCollectExpression ( AstNode const * , <nl> + char const * , <nl> + AstNode const * ) ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief create an AST collect node , COUNT INTO <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + AstNode * createNodeCollectCount ( AstNode const * , <nl> + char const * ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief create an AST sort node <nl> mmm a / arangod / Aql / AstNode . cpp <nl> ppp b / arangod / Aql / AstNode . cpp <nl> std : : unordered_map < int , std : : string const > const AstNode : : TypeNames { <nl> { static_cast < int > ( NODE_TYPE_FCALL_USER ) , " user function call " } , <nl> { static_cast < int > ( NODE_TYPE_RANGE ) , " range " } , <nl> { static_cast < int > ( NODE_TYPE_NOP ) , " no - op " } , <nl> - { static_cast < int > ( NODE_TYPE_COLLECT_COUNT ) , " collect count " } <nl> + { static_cast < int > ( NODE_TYPE_COLLECT_COUNT ) , " collect count " } , <nl> + { static_cast < int > ( NODE_TYPE_COLLECT_EXPRESSION ) , " collect expression " } <nl> } ; <nl> <nl> std : : unordered_map < int , std : : string const > const AstNode : : valueTypeNames { <nl> AstNode : : AstNode ( Ast * ast , <nl> case NODE_TYPE_REPLACE : <nl> case NODE_TYPE_COLLECT : <nl> case NODE_TYPE_COLLECT_COUNT : <nl> + case NODE_TYPE_COLLECT_EXPRESSION : <nl> case NODE_TYPE_SORT : <nl> case NODE_TYPE_SORT_ELEMENT : <nl> case NODE_TYPE_LIMIT : <nl> mmm a / arangod / Aql / AstNode . h <nl> ppp b / arangod / Aql / AstNode . h <nl> namespace triagens { <nl> NODE_TYPE_FCALL_USER = 48 , <nl> NODE_TYPE_RANGE = 49 , <nl> NODE_TYPE_NOP = 50 , <nl> - NODE_TYPE_COLLECT_COUNT = 51 <nl> + NODE_TYPE_COLLECT_COUNT = 51 , <nl> + NODE_TYPE_COLLECT_EXPRESSION = 52 <nl> } ; <nl> <nl> static_assert ( NODE_TYPE_VALUE < NODE_TYPE_LIST , " incorrect node types " ) ; <nl> mmm a / arangod / Aql / ExecutionBlock . cpp <nl> ppp b / arangod / Aql / ExecutionBlock . cpp <nl> AggregateBlock : : AggregateBlock ( ExecutionEngine * engine , <nl> : ExecutionBlock ( engine , en ) , <nl> _aggregateRegisters ( ) , <nl> _currentGroup ( en - > _countOnly ) , <nl> + _expressionRegister ( ExecutionNode : : MaxRegisterId ) , <nl> _groupRegister ( ExecutionNode : : MaxRegisterId ) , <nl> _variableNames ( ) { <nl> <nl> AggregateBlock : : AggregateBlock ( ExecutionEngine * engine , <nl> _groupRegister = ( * it ) . second . registerId ; <nl> TRI_ASSERT ( _groupRegister > 0 & & _groupRegister < ExecutionNode : : MaxRegisterId ) ; <nl> <nl> + if ( en - > _expressionVariable ! = nullptr ) { <nl> + auto it = registerPlan . find ( en - > _expressionVariable - > id ) ; <nl> + TRI_ASSERT ( it ! = registerPlan . end ( ) ) ; <nl> + _expressionRegister = ( * it ) . second . registerId ; <nl> + } <nl> + <nl> / / construct a mapping of all register ids to variable names <nl> / / we need this mapping to generate the grouped output <nl> <nl> void AggregateBlock : : emitGroup ( AqlItemBlock const * cur , <nl> _currentGroup . addValues ( cur , _groupRegister ) ; <nl> <nl> if ( static_cast < AggregateNode const * > ( _exeNode ) - > _countOnly ) { <nl> + / / only set group count in result register <nl> res - > setValue ( row , _groupRegister , AqlValue ( new Json ( static_cast < double > ( _currentGroup . groupLength ) ) ) ) ; <nl> } <nl> + else if ( static_cast < AggregateNode const * > ( _exeNode ) - > _expressionVariable ! = nullptr ) { <nl> + / / copy expression result into result register <nl> + res - > setValue ( row , _groupRegister , <nl> + AqlValue : : CreateFromBlocks ( _trx , <nl> + _currentGroup . groupBlocks , <nl> + _expressionRegister ) ) ; <nl> + } <nl> else { <nl> + / / copy variables / keep variables into result register <nl> res - > setValue ( row , _groupRegister , <nl> AqlValue : : CreateFromBlocks ( _trx , <nl> _currentGroup . groupBlocks , <nl> mmm a / arangod / Aql / ExecutionBlock . h <nl> ppp b / arangod / Aql / ExecutionBlock . h <nl> namespace triagens { <nl> <nl> AggregatorGroup _currentGroup ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief the optional register that contains the input expression values for <nl> + / / / each group <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + RegisterId _expressionRegister ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief the optional register that contains the values for each group <nl> / / / if no values should be returned , then this has a value of 0 <nl> mmm a / arangod / Aql / ExecutionNode . cpp <nl> ppp b / arangod / Aql / ExecutionNode . cpp <nl> ExecutionNode * ExecutionNode : : fromJsonFactory ( ExecutionPlan * plan , <nl> return new SortNode ( plan , oneNode , elements , stable ) ; <nl> } <nl> case AGGREGATE : { <nl> + Variable * expressionVariable = varFromJson ( plan - > getAst ( ) , oneNode , " expressionVariable " , Optional ) ; <nl> Variable * outVariable = varFromJson ( plan - > getAst ( ) , oneNode , " outVariable " , Optional ) ; <nl> <nl> triagens : : basics : : Json jsonAggregates = oneNode . get ( " aggregates " ) ; <nl> ExecutionNode * ExecutionNode : : fromJsonFactory ( ExecutionPlan * plan , <nl> aggregateVariables . reserve ( len ) ; <nl> for ( size_t i = 0 ; i < len ; i + + ) { <nl> triagens : : basics : : Json oneJsonAggregate = jsonAggregates . at ( static_cast < int > ( i ) ) ; <nl> - Variable * outVariable = varFromJson ( plan - > getAst ( ) , oneJsonAggregate , " outVariable " ) ; <nl> - Variable * inVariable = varFromJson ( plan - > getAst ( ) , oneJsonAggregate , " inVariable " ) ; <nl> + Variable * outVar = varFromJson ( plan - > getAst ( ) , oneJsonAggregate , " outVariable " ) ; <nl> + Variable * inVar = varFromJson ( plan - > getAst ( ) , oneJsonAggregate , " inVariable " ) ; <nl> <nl> - aggregateVariables . emplace_back ( std : : make_pair ( outVariable , inVariable ) ) ; <nl> + aggregateVariables . emplace_back ( std : : make_pair ( outVar , inVar ) ) ; <nl> } <nl> <nl> triagens : : basics : : Json jsonCount = oneNode . get ( " count " ) ; <nl> ExecutionNode * ExecutionNode : : fromJsonFactory ( ExecutionPlan * plan , <nl> <nl> return new AggregateNode ( plan , <nl> oneNode , <nl> + expressionVariable , <nl> outVariable , <nl> keepVariables , <nl> plan - > getAst ( ) - > variables ( ) - > variables ( false ) , <nl> double SortNode : : estimateCost ( size_t & nrItems ) const { <nl> <nl> AggregateNode : : AggregateNode ( ExecutionPlan * plan , <nl> triagens : : basics : : Json const & base , <nl> + Variable const * expressionVariable , <nl> Variable const * outVariable , <nl> std : : vector < Variable const * > const & keepVariables , <nl> std : : unordered_map < VariableId , std : : string const > const & variableMap , <nl> AggregateNode : : AggregateNode ( ExecutionPlan * plan , <nl> bool countOnly ) <nl> : ExecutionNode ( plan , base ) , <nl> _aggregateVariables ( aggregateVariables ) , <nl> + _expressionVariable ( expressionVariable ) , <nl> _outVariable ( outVariable ) , <nl> _keepVariables ( keepVariables ) , <nl> _variableMap ( variableMap ) , <nl> void AggregateNode : : toJsonHelper ( triagens : : basics : : Json & nodes , <nl> } <nl> json ( " aggregates " , values ) ; <nl> <nl> + / / expression variable might be empty <nl> + if ( _expressionVariable ! = nullptr ) { <nl> + json ( " expressionVariable " , _expressionVariable - > toJson ( ) ) ; <nl> + } <nl> + <nl> / / output variable might be empty <nl> if ( _outVariable ! = nullptr ) { <nl> json ( " outVariable " , _outVariable - > toJson ( ) ) ; <nl> ExecutionNode * AggregateNode : : clone ( ExecutionPlan * plan , <nl> bool withDependencies , <nl> bool withProperties ) const { <nl> auto outVariable = _outVariable ; <nl> + auto expressionVariable = _expressionVariable ; <nl> auto aggregateVariables = _aggregateVariables ; <nl> <nl> if ( withProperties ) { <nl> + if ( expressionVariable ! = nullptr ) { <nl> + expressionVariable = plan - > getAst ( ) - > variables ( ) - > createVariable ( expressionVariable ) ; <nl> + } <nl> + <nl> if ( outVariable ! = nullptr ) { <nl> outVariable = plan - > getAst ( ) - > variables ( ) - > createVariable ( outVariable ) ; <nl> } <nl> ExecutionNode * AggregateNode : : clone ( ExecutionPlan * plan , <nl> <nl> } <nl> <nl> - auto c = new AggregateNode ( plan , _id , aggregateVariables , outVariable , _keepVariables , _variableMap , _countOnly ) ; <nl> + auto c = new AggregateNode ( plan , <nl> + _id , <nl> + aggregateVariables , <nl> + expressionVariable , <nl> + outVariable , <nl> + _keepVariables , <nl> + _variableMap , <nl> + _countOnly ) ; <nl> <nl> CloneHelper ( c , plan , withDependencies , withProperties ) ; <nl> <nl> std : : vector < Variable const * > AggregateNode : : getVariablesUsedHere ( ) const { <nl> v . insert ( p . second ) ; <nl> } <nl> <nl> + if ( _expressionVariable ! = nullptr ) { <nl> + v . insert ( _expressionVariable ) ; <nl> + } <nl> + <nl> if ( _outVariable ! = nullptr & & ! _countOnly ) { <nl> if ( _keepVariables . empty ( ) ) { <nl> / / Here we have to find all user defined variables in this query <nl> mmm a / arangod / Aql / ExecutionNode . h <nl> ppp b / arangod / Aql / ExecutionNode . h <nl> namespace triagens { <nl> AggregateNode ( ExecutionPlan * plan , <nl> size_t id , <nl> std : : vector < std : : pair < Variable const * , Variable const * > > const & aggregateVariables , <nl> + Variable const * expressionVariable , <nl> Variable const * outVariable , <nl> std : : vector < Variable const * > const & keepVariables , <nl> std : : unordered_map < VariableId , std : : string const > const & variableMap , <nl> bool countOnly ) <nl> : ExecutionNode ( plan , id ) , <nl> _aggregateVariables ( aggregateVariables ) , <nl> + _expressionVariable ( expressionVariable ) , <nl> _outVariable ( outVariable ) , <nl> _keepVariables ( keepVariables ) , <nl> _variableMap ( variableMap ) , <nl> namespace triagens { <nl> <nl> AggregateNode ( ExecutionPlan * , <nl> triagens : : basics : : Json const & base , <nl> + Variable const * expressionVariable , <nl> Variable const * outVariable , <nl> std : : vector < Variable const * > const & keepVariables , <nl> std : : unordered_map < VariableId , std : : string const > const & variableMap , <nl> namespace triagens { <nl> <nl> std : : vector < std : : pair < Variable const * , Variable const * > > _aggregateVariables ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief input expression variable ( might be null ) <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + Variable const * _expressionVariable ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief output variable to write to ( might be null ) <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / arangod / Aql / ExecutionPlan . cpp <nl> ppp b / arangod / Aql / ExecutionPlan . cpp <nl> ExecutionNode * ExecutionPlan : : fromNodeSort ( ExecutionNode * previous , <nl> <nl> ExecutionNode * ExecutionPlan : : fromNodeCollect ( ExecutionNode * previous , <nl> AstNode const * node ) { <nl> - TRI_ASSERT ( node ! = nullptr & & node - > type = = NODE_TYPE_COLLECT ) ; <nl> + TRI_ASSERT ( node ! = nullptr & & <nl> + node - > type = = NODE_TYPE_COLLECT ) ; <nl> size_t const n = node - > numMembers ( ) ; <nl> <nl> TRI_ASSERT ( n > = 1 ) ; <nl> ExecutionNode * ExecutionPlan : : fromNodeCollect ( ExecutionNode * previous , <nl> } <nl> } <nl> <nl> - auto en = registerNode ( new AggregateNode ( this , nextId ( ) , aggregateVariables , <nl> + auto en = registerNode ( new AggregateNode ( this , nextId ( ) , aggregateVariables , nullptr , <nl> outVariable , keepVariables , _ast - > variables ( ) - > variables ( false ) , false ) ) ; <nl> <nl> return addDependency ( previous , en ) ; <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief create an execution plan element from an AST COLLECT node <nl> + / / / note that also a sort plan node will be added in front of the collect plan <nl> + / / / node <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + ExecutionNode * ExecutionPlan : : fromNodeCollectExpression ( ExecutionNode * previous , <nl> + AstNode const * node ) { <nl> + TRI_ASSERT ( node ! = nullptr & & <nl> + node - > type = = NODE_TYPE_COLLECT_EXPRESSION ) ; <nl> + size_t const n = node - > numMembers ( ) ; <nl> + <nl> + TRI_ASSERT ( n = = 3 ) ; <nl> + <nl> + auto list = node - > getMember ( 0 ) ; <nl> + size_t const numVars = list - > numMembers ( ) ; <nl> + <nl> + std : : vector < std : : pair < Variable const * , bool > > sortElements ; <nl> + <nl> + std : : vector < std : : pair < Variable const * , Variable const * > > aggregateVariables ; <nl> + aggregateVariables . reserve ( numVars ) ; <nl> + for ( size_t i = 0 ; i < numVars ; + + i ) { <nl> + auto assigner = list - > getMember ( i ) ; <nl> + <nl> + if ( assigner = = nullptr ) { <nl> + continue ; <nl> + } <nl> + <nl> + TRI_ASSERT ( assigner - > type = = NODE_TYPE_ASSIGN ) ; <nl> + auto out = assigner - > getMember ( 0 ) ; <nl> + TRI_ASSERT ( out ! = nullptr ) ; <nl> + auto v = static_cast < Variable * > ( out - > getData ( ) ) ; <nl> + TRI_ASSERT ( v ! = nullptr ) ; <nl> + <nl> + auto expression = assigner - > getMember ( 1 ) ; <nl> + <nl> + if ( expression - > type = = NODE_TYPE_REFERENCE ) { <nl> + / / operand is a variable <nl> + auto e = static_cast < Variable * > ( expression - > getData ( ) ) ; <nl> + aggregateVariables . push_back ( std : : make_pair ( v , e ) ) ; <nl> + sortElements . push_back ( std : : make_pair ( e , true ) ) ; <nl> + } <nl> + else { <nl> + / / operand is some misc expression <nl> + auto calc = createTemporaryCalculation ( expression ) ; <nl> + <nl> + calc - > addDependency ( previous ) ; <nl> + previous = calc ; <nl> + <nl> + aggregateVariables . emplace_back ( std : : make_pair ( v , calc - > outVariable ( ) ) ) ; <nl> + sortElements . emplace_back ( std : : make_pair ( calc - > outVariable ( ) , true ) ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + Variable const * expressionVariable = nullptr ; <nl> + auto expression = node - > getMember ( 2 ) ; <nl> + if ( expression - > type = = NODE_TYPE_REFERENCE ) { <nl> + / / expression is already a variable <nl> + auto variable = static_cast < Variable * > ( expression - > getData ( ) ) ; <nl> + TRI_ASSERT ( variable ! = nullptr ) ; <nl> + expressionVariable = variable ; <nl> + } <nl> + else { <nl> + / / expression is some misc expression <nl> + auto calc = createTemporaryCalculation ( expression ) ; <nl> + calc - > addDependency ( previous ) ; <nl> + previous = calc ; <nl> + expressionVariable = calc - > outVariable ( ) ; <nl> + } <nl> + <nl> + / / inject a sort node for all expressions / variables that we just picked up . . . <nl> + / / note that this sort is stable <nl> + auto sort = registerNode ( new SortNode ( this , nextId ( ) , sortElements , true ) ) ; <nl> + sort - > addDependency ( previous ) ; <nl> + previous = sort ; <nl> + <nl> + / / output variable <nl> + auto v = node - > getMember ( 1 ) ; <nl> + Variable * outVariable = static_cast < Variable * > ( v - > getData ( ) ) ; <nl> + <nl> + std : : unordered_map < VariableId , std : : string const > variableMap ; <nl> + <nl> + auto en = registerNode ( new AggregateNode ( this , nextId ( ) , aggregateVariables , <nl> + expressionVariable , outVariable , std : : vector < Variable const * > ( ) , variableMap , false ) ) ; <nl> + <nl> + return addDependency ( previous , en ) ; <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief create an execution plan element from an AST COLLECT node , COUNT <nl> / / / note that also a sort plan node will be added in front of the collect plan <nl> ExecutionNode * ExecutionPlan : : fromNodeCollect ( ExecutionNode * previous , <nl> <nl> ExecutionNode * ExecutionPlan : : fromNodeCollectCount ( ExecutionNode * previous , <nl> AstNode const * node ) { <nl> - TRI_ASSERT ( node ! = nullptr & & node - > type = = NODE_TYPE_COLLECT_COUNT ) ; <nl> + TRI_ASSERT ( node ! = nullptr & & <nl> + node - > type = = NODE_TYPE_COLLECT_COUNT ) ; <nl> size_t const n = node - > numMembers ( ) ; <nl> <nl> TRI_ASSERT ( n = = 2 ) ; <nl> ExecutionNode * ExecutionPlan : : fromNodeCollectCount ( ExecutionNode * previous , <nl> / / handle out variable <nl> Variable * outVariable = static_cast < Variable * > ( v - > getData ( ) ) ; <nl> <nl> - auto en = registerNode ( new AggregateNode ( this , nextId ( ) , aggregateVariables , <nl> + auto en = registerNode ( new AggregateNode ( this , nextId ( ) , aggregateVariables , nullptr , <nl> outVariable , std : : vector < Variable const * > ( ) , _ast - > variables ( ) - > variables ( false ) , true ) ) ; <nl> <nl> return addDependency ( previous , en ) ; <nl> ExecutionNode * ExecutionPlan : : fromNode ( AstNode const * node ) { <nl> break ; <nl> } <nl> <nl> + case NODE_TYPE_COLLECT_EXPRESSION : { <nl> + en = fromNodeCollectExpression ( en , member ) ; <nl> + break ; <nl> + } <nl> + <nl> case NODE_TYPE_COLLECT_COUNT : { <nl> en = fromNodeCollectCount ( en , member ) ; <nl> break ; <nl> mmm a / arangod / Aql / ExecutionPlan . h <nl> ppp b / arangod / Aql / ExecutionPlan . h <nl> namespace triagens { <nl> ExecutionNode * fromNodeCollect ( ExecutionNode * , <nl> AstNode const * ) ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief create an execution plan element from an AST COLLECT node , var = expr <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + ExecutionNode * fromNodeCollectExpression ( ExecutionNode * , <nl> + AstNode const * ) ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief create an execution plan element from an AST COLLECT node , COUNT <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / arangod / Aql / grammar . cpp <nl> ppp b / arangod / Aql / grammar . cpp <nl> union yyalloc <nl> / * YYFINAL - - State number of the termination state . * / <nl> # define YYFINAL 3 <nl> / * YYLAST - - Last index in YYTABLE . * / <nl> - # define YYLAST 642 <nl> + # define YYLAST 630 <nl> <nl> / * YYNTOKENS - - Number of terminals . * / <nl> # define YYNTOKENS 60 <nl> / * YYNNTS - - Number of nonterminals . * / <nl> # define YYNNTS 66 <nl> / * YYNRULES - - Number of rules . * / <nl> - # define YYNRULES 144 <nl> + # define YYNRULES 145 <nl> / * YYNSTATES - - Number of states . * / <nl> - # define YYNSTATES 237 <nl> + # define YYNSTATES 239 <nl> <nl> / * YYTRANSLATE [ YYX ] - - Symbol number corresponding to YYX as returned <nl> by yylex , with out - of - bounds checking . * / <nl> static const yytype_uint16 yyrline [ ] = <nl> { <nl> 0 , 200 , 200 , 202 , 204 , 206 , 208 , 213 , 215 , 220 , <nl> 222 , 224 , 226 , 228 , 230 , 235 , 244 , 252 , 257 , 259 , <nl> - 264 , 271 , 281 , 281 , 295 , 315 , 342 , 376 , 378 , 383 , <nl> - 390 , 393 , 399 , 413 , 430 , 433 , 433 , 447 , 447 , 458 , <nl> - 461 , 467 , 473 , 476 , 479 , 482 , 488 , 493 , 500 , 508 , <nl> - 511 , 517 , 528 , 539 , 547 , 558 , 566 , 577 , 580 , 580 , <nl> - 593 , 596 , 599 , 602 , 605 , 608 , 611 , 617 , 624 , 641 , <nl> - 641 , 653 , 656 , 659 , 665 , 668 , 671 , 674 , 677 , 680 , <nl> - 683 , 686 , 689 , 692 , 695 , 698 , 701 , 704 , 707 , 713 , <nl> - 719 , 721 , 726 , 729 , 729 , 745 , 748 , 754 , 757 , 763 , <nl> - 763 , 772 , 774 , 779 , 782 , 788 , 791 , 805 , 805 , 814 , <nl> - 816 , 821 , 823 , 828 , 834 , 838 , 838 , 866 , 879 , 886 , <nl> - 890 , 894 , 901 , 906 , 911 , 916 , 920 , 924 , 931 , 934 , <nl> - 940 , 943 , 960 , 963 , 966 , 969 , 972 , 978 , 985 , 992 , <nl> - 1006 , 1012 , 1019 , 1028 , 1034 <nl> + 264 , 271 , 281 , 281 , 295 , 315 , 342 , 373 , 403 , 405 , <nl> + 410 , 417 , 420 , 426 , 440 , 457 , 460 , 460 , 474 , 474 , <nl> + 485 , 488 , 494 , 500 , 503 , 506 , 509 , 515 , 520 , 527 , <nl> + 535 , 538 , 544 , 555 , 566 , 574 , 585 , 593 , 604 , 607 , <nl> + 607 , 620 , 623 , 626 , 629 , 632 , 635 , 638 , 644 , 651 , <nl> + 668 , 668 , 680 , 683 , 686 , 692 , 695 , 698 , 701 , 704 , <nl> + 707 , 710 , 713 , 716 , 719 , 722 , 725 , 728 , 731 , 734 , <nl> + 740 , 746 , 748 , 753 , 756 , 756 , 772 , 775 , 781 , 784 , <nl> + 790 , 790 , 799 , 801 , 806 , 809 , 815 , 818 , 832 , 832 , <nl> + 841 , 843 , 848 , 850 , 855 , 861 , 865 , 865 , 893 , 906 , <nl> + 913 , 917 , 921 , 928 , 933 , 938 , 943 , 947 , 951 , 958 , <nl> + 961 , 967 , 970 , 987 , 990 , 993 , 996 , 999 , 1005 , 1012 , <nl> + 1019 , 1033 , 1039 , 1046 , 1055 , 1061 <nl> } ; <nl> # endif <nl> <nl> static const yytype_uint16 yytoknum [ ] = <nl> } ; <nl> # endif <nl> <nl> - # define YYPACT_NINF - 104 <nl> + # define YYPACT_NINF - 103 <nl> <nl> # define yypact_value_is_default ( Yystate ) \ <nl> - ( ! ! ( ( Yystate ) = = ( - 104 ) ) ) <nl> + ( ! ! ( ( Yystate ) = = ( - 103 ) ) ) <nl> <nl> - # define YYTABLE_NINF - 140 <nl> + # define YYTABLE_NINF - 141 <nl> <nl> # define yytable_value_is_error ( Yytable_value ) \ <nl> 0 <nl> static const yytype_uint16 yytoknum [ ] = <nl> STATE - NUM . * / <nl> static const yytype_int16 yypact [ ] = <nl> { <nl> - - 104 , 7 , 561 , - 104 , - 7 , - 7 , 569 , 569 , 16 , - 104 , <nl> - 121 , 569 , 569 , 569 , 569 , - 104 , - 104 , - 104 , - 104 , 65 , <nl> - - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , 15 , <nl> - - 5 , - 104 , 17 , - 104 , - 104 , - 104 , 57 , - 104 , - 104 , - 104 , <nl> - - 104 , 569 , 569 , 569 , 569 , - 104 , - 104 , 433 , 5 , - 104 , <nl> - - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , 42 , - 35 , - 104 , - 104 , <nl> - - 104 , - 104 , - 104 , 433 , 34 , - 104 , - 7 , 569 , 53 , 373 , <nl> - 373 , 308 , 343 , - 7 , - 104 , 82 , 569 , - 7 , 569 , 83 , <nl> - 83 , 83 , 233 , - 104 , 14 , 569 , 569 , 98 , 569 , 569 , <nl> - 569 , 569 , 569 , 569 , 569 , 569 , 569 , 569 , 569 , 569 , <nl> - 569 , 569 , 569 , 90 , 66 , 73 , 569 , 45 , 102 , 74 , <nl> - - 104 , 93 , 75 , - 104 , 273 , 121 , 590 , 23 , 101 , 101 , <nl> - 569 , 101 , 569 , 101 , - 104 , - 104 , - 104 , 433 , - 104 , 433 , <nl> - - 104 , 78 , - 104 , - 104 , 99 , 104 , - 104 , 85 , 433 , 95 , <nl> - 105 , 97 , 569 , 493 , 463 , 507 , 507 , 20 , 20 , 20 , <nl> - 20 , 24 , 24 , 83 , 83 , 83 , 403 , - 6 , - 104 , 535 , <nl> - - 33 , 137 , - 104 , - 104 , - 7 , - 7 , 569 , 569 , - 104 , - 104 , <nl> - - 104 , - 104 , - 104 , 6 , 21 , 25 , - 104 , - 104 , - 104 , - 104 , <nl> - - 104 , 103 , - 104 , - 104 , 373 , - 104 , 373 , - 104 , - 7 , - 104 , <nl> - - 104 , 14 , 569 , - 104 , 569 , 97 , 569 , 433 , 106 , - 104 , <nl> - - 104 , 107 , 569 , 54 , - 29 , - 104 , - 104 , - 104 , 433 , - 104 , <nl> - - 104 , 101 , 101 , 110 , - 104 , - 104 , 433 , 433 , 433 , - 104 , <nl> - - 104 , 569 , 173 , - 104 , - 104 , 569 , 55 , - 104 , - 104 , - 7 , <nl> - - 104 , - 104 , 203 , - 104 , - 104 , - 104 , - 104 <nl> + - 103 , 18 , 28 , - 103 , 5 , 5 , 542 , 542 , 25 , - 103 , <nl> + 112 , 542 , 542 , 542 , 542 , - 103 , - 103 , - 103 , - 103 , 53 , <nl> + - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , 63 , <nl> + 54 , - 103 , 75 , - 103 , - 103 , - 103 , 37 , - 103 , - 103 , - 103 , <nl> + - 103 , 542 , 542 , 542 , 542 , - 103 , - 103 , 436 , 60 , - 103 , <nl> + - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , 66 , - 39 , - 103 , - 103 , <nl> + - 103 , - 103 , - 103 , 436 , 87 , - 103 , 5 , 542 , 65 , 376 , <nl> + 376 , 311 , 346 , 5 , - 103 , 91 , 542 , 5 , 542 , 88 , <nl> + 88 , 88 , 236 , - 103 , 50 , 542 , 542 , 103 , 542 , 542 , <nl> + 542 , 542 , 542 , 542 , 542 , 542 , 542 , 542 , 542 , 542 , <nl> + 542 , 542 , 542 , 95 , 73 , 80 , 542 , 2 , 109 , 77 , <nl> + - 103 , 99 , 82 , - 103 , 276 , 112 , 563 , 0 , 117 , 117 , <nl> + 542 , 117 , 542 , 117 , 107 , - 103 , - 103 , 436 , - 103 , 436 , <nl> + - 103 , 114 , - 103 , - 103 , 111 , 118 , - 103 , 123 , 436 , 105 , <nl> + 121 , 584 , 542 , 466 , 143 , 480 , 480 , 252 , 252 , 252 , <nl> + 252 , 19 , 19 , 88 , 88 , 88 , 406 , 40 , - 103 , 508 , <nl> + 11 , 113 , - 103 , - 103 , 5 , 5 , 542 , 542 , - 103 , - 103 , <nl> + - 103 , - 103 , - 103 , 3 , 7 , 8 , - 103 , - 103 , - 103 , - 103 , <nl> + - 103 , 119 , - 103 , - 103 , 376 , - 103 , 376 , - 103 , 542 , 5 , <nl> + - 103 , - 103 , 50 , 542 , - 103 , 542 , 584 , 542 , 436 , 124 , <nl> + - 103 , - 103 , 140 , 542 , 27 , 12 , - 103 , - 103 , - 103 , 436 , <nl> + - 103 , - 103 , 117 , 117 , 436 , 145 , - 103 , - 103 , 436 , 436 , <nl> + 436 , - 103 , - 103 , 542 , 176 , - 103 , - 103 , 542 , 39 , - 103 , <nl> + - 103 , 5 , - 103 , - 103 , 206 , - 103 , - 103 , - 103 , - 103 <nl> } ; <nl> <nl> / * YYDEFACT [ STATE - NUM ] - - Default reduction number in state STATE - NUM . <nl> static const yytype_int16 yypact [ ] = <nl> means the default is an error . * / <nl> static const yytype_uint8 yydefact [ ] = <nl> { <nl> - 7 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 22 , 37 , <nl> - 0 , 0 , 0 , 0 , 0 , 8 , 9 , 11 , 10 , 30 , <nl> - 12 , 13 , 14 , 2 , 3 , 4 , 5 , 6 , 143 , 0 , <nl> - 17 , 18 , 0 , 134 , 135 , 136 , 117 , 132 , 144 , 131 , <nl> - 140 , 0 , 0 , 0 , 58 , 107 , 99 , 16 , 69 , 118 , <nl> - 60 , 61 , 62 , 63 , 97 , 98 , 65 , 114 , 64 , 133 , <nl> - 128 , 129 , 130 , 48 , 0 , 24 , 0 , 0 , 46 , 0 , <nl> - 0 , 0 , 0 , 0 , 25 , 34 , 0 , 0 , 0 , 73 , <nl> - 71 , 72 , 0 , 7 , 109 , 101 , 0 , 0 , 0 , 0 , <nl> + 7 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 22 , 38 , <nl> + 0 , 0 , 0 , 0 , 0 , 8 , 9 , 11 , 10 , 31 , <nl> + 12 , 13 , 14 , 2 , 3 , 4 , 5 , 6 , 144 , 0 , <nl> + 17 , 18 , 0 , 135 , 136 , 137 , 118 , 133 , 145 , 132 , <nl> + 141 , 0 , 0 , 0 , 59 , 108 , 100 , 16 , 70 , 119 , <nl> + 61 , 62 , 63 , 64 , 98 , 99 , 66 , 115 , 65 , 134 , <nl> + 129 , 130 , 131 , 49 , 0 , 24 , 0 , 0 , 47 , 0 , <nl> + 0 , 0 , 0 , 0 , 25 , 35 , 0 , 0 , 0 , 74 , <nl> + 72 , 73 , 0 , 7 , 110 , 102 , 0 , 0 , 0 , 0 , <nl> 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 23 , <nl> - 27 , 0 , 38 , 39 , 42 , 0 , 0 , 0 , 105 , 105 , <nl> - 0 , 105 , 0 , 105 , 31 , 35 , 26 , 15 , 19 , 20 , <nl> - 57 , 0 , 141 , 142 , 0 , 110 , 111 , 0 , 103 , 0 , <nl> - 102 , 87 , 0 , 75 , 74 , 81 , 82 , 83 , 84 , 85 , <nl> - 86 , 76 , 77 , 78 , 79 , 80 , 0 , 66 , 68 , 93 , <nl> - 0 , 0 , 119 , 120 , 0 , 0 , 0 , 0 , 43 , 44 , <nl> - 41 , 45 , 47 , 117 , 132 , 140 , 49 , 137 , 138 , 139 , <nl> - 50 , 0 , 51 , 52 , 0 , 53 , 0 , 55 , 0 , 59 , <nl> - 108 , 0 , 0 , 100 , 0 , 88 , 0 , 92 , 0 , 95 , <nl> - 7 , 91 , 0 , 0 , 116 , 121 , 21 , 28 , 29 , 40 , <nl> - 106 , 105 , 105 , 36 , 32 , 112 , 113 , 104 , 89 , 70 , <nl> - 94 , 93 , 0 , 122 , 123 , 0 , 0 , 54 , 56 , 0 , <nl> - 96 , 124 , 0 , 125 , 126 , 33 , 127 <nl> + 28 , 0 , 39 , 40 , 43 , 0 , 0 , 0 , 106 , 106 , <nl> + 0 , 106 , 0 , 106 , 32 , 36 , 26 , 15 , 19 , 20 , <nl> + 58 , 0 , 142 , 143 , 0 , 111 , 112 , 0 , 104 , 0 , <nl> + 103 , 88 , 0 , 76 , 75 , 82 , 83 , 84 , 85 , 86 , <nl> + 87 , 77 , 78 , 79 , 80 , 81 , 0 , 67 , 69 , 94 , <nl> + 0 , 0 , 120 , 121 , 0 , 0 , 0 , 0 , 44 , 45 , <nl> + 42 , 46 , 48 , 118 , 133 , 141 , 50 , 138 , 139 , 140 , <nl> + 51 , 0 , 52 , 53 , 0 , 54 , 0 , 56 , 0 , 0 , <nl> + 60 , 109 , 0 , 0 , 101 , 0 , 89 , 0 , 93 , 0 , <nl> + 96 , 7 , 92 , 0 , 0 , 117 , 122 , 21 , 29 , 30 , <nl> + 41 , 107 , 106 , 106 , 27 , 37 , 33 , 113 , 114 , 105 , <nl> + 90 , 71 , 95 , 94 , 0 , 123 , 124 , 0 , 0 , 55 , <nl> + 57 , 0 , 97 , 125 , 0 , 126 , 127 , 34 , 128 <nl> } ; <nl> <nl> / * YYPGOTO [ NTERM - NUM ] . * / <nl> static const yytype_int16 yypgoto [ ] = <nl> { <nl> - - 104 , - 82 , - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , 81 , 140 , <nl> - - 104 , - 104 , - 104 , - 104 , - 1 , - 104 , - 104 , - 104 , - 104 , - 104 , <nl> - - 104 , - 104 , 12 , - 104 , - 104 , - 104 , - 58 , - 104 , - 104 , - 104 , <nl> - - 104 , - 3 , - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , <nl> - - 59 , - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , - 104 , - 103 , 0 , <nl> - - 104 , - 104 , - 104 , - 9 , - 104 , - 104 , - 104 , - 104 , - 8 , - 104 , <nl> - - 104 , 69 , - 102 , - 104 , - 4 , - 104 <nl> + - 103 , - 82 , - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , 93 , 171 , <nl> + - 103 , - 103 , - 103 , - 103 , 29 , - 103 , - 103 , - 103 , - 103 , - 103 , <nl> + - 103 , - 103 , 30 , - 103 , - 103 , - 103 , - 56 , - 103 , - 103 , - 103 , <nl> + - 103 , - 2 , - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , <nl> + - 27 , - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , - 103 , - 102 , 17 , <nl> + - 103 , - 103 , - 103 , 10 , - 103 , - 103 , - 103 , - 103 , - 8 , - 103 , <nl> + - 103 , 83 , - 101 , - 103 , - 4 , - 103 <nl> } ; <nl> <nl> / * YYDEFGOTO [ NTERM - NUM ] . * / <nl> static const yytype_int16 yydefgoto [ ] = <nl> { <nl> - 1 , 1 , 2 , 15 , 16 , 17 , 18 , 30 , 31 , 65 , <nl> - 19 , 66 , 20 , 109 , 110 , 75 , 213 , 126 , 188 , 21 , <nl> + 19 , 66 , 20 , 109 , 110 , 75 , 215 , 126 , 189 , 21 , <nl> 67 , 112 , 113 , 170 , 22 , 23 , 118 , 24 , 25 , 26 , <nl> - 27 , 114 , 83 , 48 , 49 , 104 , 50 , 51 , 52 , 198 , <nl> - 199 , 200 , 201 , 53 , 54 , 85 , 139 , 140 , 182 , 55 , <nl> - 84 , 134 , 135 , 136 , 56 , 105 , 57 , 204 , 58 , 59 , <nl> + 27 , 114 , 83 , 48 , 49 , 104 , 50 , 51 , 52 , 199 , <nl> + 200 , 201 , 202 , 53 , 54 , 85 , 139 , 140 , 182 , 55 , <nl> + 84 , 134 , 135 , 136 , 56 , 105 , 57 , 205 , 58 , 59 , <nl> 60 , 176 , 61 , 137 , 32 , 62 <nl> } ; <nl> <nl> static const yytype_int16 yydefgoto [ ] = <nl> number is the opposite . If YYTABLE_NINF , syntax error . * / <nl> static const yytype_int16 yytable [ ] = <nl> { <nl> - 29 , 131 , 68 , 47 , 63 , 163 , - 137 , 3 , 69 , 70 , <nl> - 71 , 72 , 119 , 121 , 123 , 28 , 183 , 106 , 185 , 202 , <nl> - 187 , - 138 , 87 , 225 , 107 , - 139 , 203 , 76 , - 137 , 64 , <nl> - 226 , 96 , 97 , 98 , 99 , 100 , 132 , 133 , 79 , 80 , <nl> - 81 , 82 , 77 , - 138 , 78 , 177 , 178 , - 139 , 87 , 179 , <nl> - 103 , - 67 , 87 , - 137 , - 67 , - 137 , 108 , 96 , 97 , 98 , <nl> - 99 , 100 , 111 , 98 , 99 , 100 , 102 , 162 , - 138 , 124 , <nl> - - 138 , 40 , - 139 , 127 , - 139 , 129 , 223 , 233 , 64 , 73 , <nl> - 40 , 40 , 138 , 141 , - 115 , 143 , 144 , 145 , 146 , 147 , <nl> - 148 , 149 , 150 , 151 , 152 , 153 , 154 , 155 , 156 , 157 , <nl> - 115 , 224 , - 67 , 161 , 125 , - 67 , 171 , 172 , 227 , 228 , <nl> - 142 , 87 , 158 , 141 , 159 , 160 , 164 , 184 , 220 , 186 , <nl> - 166 , 165 , 167 , 181 , 234 , 87 , 211 , 189 , 212 , 192 , <nl> - 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 195 , <nl> - 33 , 34 , 35 , 102 , 37 , 38 , 39 , 40 , 193 , 86 , <nl> - 190 , 191 , 194 , 45 , 221 , 219 , 197 , 229 , 128 , 74 , <nl> - 206 , 111 , 230 , 208 , 207 , 87 , 88 , 89 , 90 , 91 , <nl> - 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 209 , <nl> - 101 , 210 , 215 , 102 , 214 , 86 , 180 , 0 , 0 , 216 , <nl> - 205 , 217 , 0 , 218 , 0 , 0 , 0 , 0 , 0 , 222 , <nl> - 0 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> - 96 , 97 , 98 , 99 , 100 , 86 , 101 , 0 , 197 , 102 , <nl> - 0 , 0 , 232 , 0 , 0 , 235 , 231 , 0 , 0 , 0 , <nl> - 0 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> - 96 , 97 , 98 , 99 , 100 , 86 , 101 , 0 , 0 , 102 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 236 , 0 , 0 , 0 , <nl> - 0 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> - 96 , 97 , 98 , 99 , 100 , 0 , 101 , 0 , 0 , 102 , <nl> - 0 , 0 , 130 , 168 , 169 , 86 , 0 , 0 , 0 , 0 , <nl> - 0 , 0 , 33 , 34 , 35 , 0 , 37 , 38 , 39 , 40 , <nl> - 0 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> - 96 , 97 , 98 , 99 , 100 , 0 , 101 , 0 , 0 , 102 , <nl> - 116 , 120 , 117 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 87 , 88 , 89 , 90 , <nl> - 91 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , <nl> - 0 , 101 , 0 , 0 , 102 , 116 , 122 , 117 , 0 , 0 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> - 0 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> - 96 , 97 , 98 , 99 , 100 , 116 , 101 , 117 , 0 , 102 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> - 0 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> - 96 , 97 , 98 , 99 , 100 , 86 , 101 , 0 , 0 , 102 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> - 0 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> - 96 , 97 , 98 , 99 , 100 , 86 , 101 , 196 , 0 , 102 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> - 0 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> - 96 , 97 , 98 , 99 , 100 , 86 , 101 , 0 , 0 , 102 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> - 0 , 87 , 88 , 0 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> - 96 , 97 , 98 , 99 , 100 , 86 , 0 , 0 , 0 , 102 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 86 , <nl> - 0 , 87 , 0 , 0 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> - 96 , 97 , 98 , 99 , 100 , 87 , 0 , 0 , 0 , 102 , <nl> - 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 0 , <nl> - 0 , 0 , 0 , 102 , 33 , 34 , 35 , 36 , 37 , 38 , <nl> - 39 , 40 , 0 , 41 , 4 , 5 , 6 , 7 , 8 , 9 , <nl> - 10 , 0 , 42 , 43 , 0 , 0 , 11 , 12 , 13 , 14 , <nl> - 0 , 0 , 0 , 44 , - 90 , 45 , 0 , 46 , 33 , 34 , <nl> - 35 , 36 , 37 , 38 , 39 , 40 , 0 , 41 , 0 , 0 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 42 , 43 , 0 , 33 , <nl> - 34 , 35 , 173 , 174 , 38 , 39 , 175 , 44 , 41 , 45 , <nl> - 0 , 46 , 0 , 0 , 0 , 0 , 0 , 42 , 43 , 0 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 44 , 0 , <nl> - 45 , 0 , 46 <nl> + 29 , 131 , 68 , - 138 , 47 , 63 , 163 , - 139 , - 140 , 69 , <nl> + 70 , 71 , 72 , 106 , 119 , 121 , 123 , 183 , 3 , 185 , <nl> + 107 , 187 , 177 , 178 , 162 , - 138 , 179 , 28 , 40 , - 139 , <nl> + - 140 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 64 , 79 , <nl> + 80 , 81 , 82 , 11 , 12 , 13 , 14 , 87 , - 68 , 225 , <nl> + - 138 , - 68 , - 138 , 40 , - 139 , - 140 , - 139 , - 140 , 98 , 99 , <nl> + 100 , 235 , 111 , 203 , 227 , 40 , 64 , 73 , 87 , 124 , <nl> + 204 , 228 , 132 , 133 , 127 , 76 , 129 , 96 , 97 , 98 , <nl> + 99 , 100 , - 68 , 138 , 141 , - 68 , 143 , 144 , 145 , 146 , <nl> + 147 , 148 , 149 , 150 , 151 , 152 , 153 , 154 , 155 , 156 , <nl> + 157 , 77 , 78 , 226 , 161 , 103 , 171 , 172 , - 116 , 108 , <nl> + 229 , 230 , 115 , 125 , 141 , 142 , 87 , 158 , 184 , 222 , <nl> + 186 , 159 , 160 , 164 , 165 , 86 , 166 , 236 , 212 , 167 , <nl> + 213 , 33 , 34 , 35 , 188 , 37 , 38 , 39 , 40 , 181 , <nl> + 196 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> + 96 , 97 , 98 , 99 , 100 , 86 , 101 , 198 , 194 , 102 , <nl> + 207 , 111 , 191 , 190 , 209 , 192 , 206 , 193 , 195 , 45 , <nl> + 128 , 87 , 88 , 221 , 90 , 91 , 92 , 93 , 94 , 95 , <nl> + 96 , 97 , 98 , 99 , 100 , 216 , 214 , 223 , 86 , 102 , <nl> + 74 , 218 , 231 , 219 , 208 , 220 , 232 , 210 , 211 , 0 , <nl> + 180 , 224 , 217 , 0 , 87 , 88 , 89 , 90 , 91 , 92 , <nl> + 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 86 , 101 , <nl> + 0 , 198 , 102 , 0 , 0 , 234 , 0 , 237 , 0 , 233 , <nl> + 0 , 0 , 0 , 0 , 87 , 88 , 89 , 90 , 91 , 92 , <nl> + 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 86 , 101 , <nl> + 0 , 0 , 102 , 0 , 0 , 0 , 0 , 0 , 0 , 238 , <nl> + 0 , 0 , 0 , 0 , 87 , 88 , 89 , 90 , 91 , 92 , <nl> + 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 0 , 101 , <nl> + 87 , 0 , 102 , 0 , 0 , 130 , 168 , 169 , 86 , 96 , <nl> + 97 , 98 , 99 , 100 , 0 , 33 , 34 , 35 , 102 , 37 , <nl> + 38 , 39 , 40 , 0 , 87 , 88 , 89 , 90 , 91 , 92 , <nl> + 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 0 , 101 , <nl> + 0 , 0 , 102 , 116 , 120 , 117 , 0 , 0 , 0 , 0 , <nl> + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 87 , <nl> + 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , 97 , <nl> + 98 , 99 , 100 , 0 , 101 , 0 , 0 , 102 , 116 , 122 , <nl> + 117 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> + 0 , 0 , 0 , 0 , 87 , 88 , 89 , 90 , 91 , 92 , <nl> + 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 116 , 101 , <nl> + 117 , 0 , 102 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> + 0 , 0 , 0 , 0 , 87 , 88 , 89 , 90 , 91 , 92 , <nl> + 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 86 , 101 , <nl> + 0 , 0 , 102 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> + 0 , 0 , 0 , 0 , 87 , 88 , 89 , 90 , 91 , 92 , <nl> + 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 86 , 101 , <nl> + 197 , 0 , 102 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> + 0 , 0 , 0 , 0 , 87 , 88 , 89 , 90 , 91 , 92 , <nl> + 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 86 , 101 , <nl> + 0 , 0 , 102 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> + 0 , 0 , 86 , 0 , 87 , 0 , 0 , 90 , 91 , 92 , <nl> + 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 87 , 0 , <nl> + 0 , 0 , 102 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , <nl> + 99 , 100 , 0 , 0 , 0 , 0 , 102 , 33 , 34 , 35 , <nl> + 36 , 37 , 38 , 39 , 40 , 0 , 41 , 0 , 0 , 0 , <nl> + 0 , 0 , 0 , 0 , 0 , 42 , 43 , 0 , 0 , 0 , <nl> + 0 , 0 , 0 , 0 , 0 , 0 , 44 , - 91 , 45 , 0 , <nl> + 46 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 0 , <nl> + 41 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 42 , <nl> + 43 , 0 , 33 , 34 , 35 , 173 , 174 , 38 , 39 , 175 , <nl> + 44 , 41 , 45 , 0 , 46 , 0 , 0 , 0 , 0 , 0 , <nl> + 42 , 43 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> + 0 , 44 , 87 , 45 , 0 , 46 , 0 , 92 , 93 , 94 , <nl> + 95 , 96 , 97 , 98 , 99 , 100 , 0 , 0 , 0 , 0 , <nl> + 102 <nl> } ; <nl> <nl> static const yytype_int16 yycheck [ ] = <nl> { <nl> - 4 , 83 , 10 , 6 , 7 , 107 , 0 , 0 , 11 , 12 , <nl> - 13 , 14 , 70 , 71 , 72 , 22 , 119 , 52 , 121 , 52 , <nl> - 123 , 0 , 28 , 52 , 59 , 0 , 59 , 12 , 22 , 13 , <nl> - 59 , 37 , 38 , 39 , 40 , 41 , 22 , 23 , 41 , 42 , <nl> - 43 , 44 , 47 , 22 , 27 , 22 , 23 , 22 , 28 , 26 , <nl> - 45 , 45 , 28 , 47 , 48 , 49 , 22 , 37 , 38 , 39 , <nl> - 40 , 41 , 66 , 39 , 40 , 41 , 46 , 22 , 47 , 73 , <nl> - 49 , 26 , 47 , 76 , 49 , 78 , 22 , 22 , 13 , 14 , <nl> - 26 , 26 , 85 , 86 , 42 , 88 , 89 , 90 , 91 , 92 , <nl> - 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 101 , 102 , <nl> - 47 , 203 , 45 , 106 , 22 , 48 , 114 , 115 , 211 , 212 , <nl> - 12 , 28 , 22 , 116 , 48 , 42 , 14 , 120 , 200 , 122 , <nl> - 27 , 47 , 47 , 22 , 226 , 28 , 184 , 49 , 186 , 44 , <nl> - 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 142 , <nl> - 19 , 20 , 21 , 46 , 23 , 24 , 25 , 26 , 53 , 12 , <nl> - 51 , 47 , 47 , 50 , 47 , 49 , 159 , 47 , 77 , 19 , <nl> - 164 , 165 , 221 , 166 , 165 , 28 , 29 , 30 , 31 , 32 , <nl> - 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 167 , <nl> - 43 , 181 , 191 , 46 , 188 , 12 , 117 , - 1 , - 1 , 192 , <nl> - 53 , 194 , - 1 , 196 , - 1 , - 1 , - 1 , - 1 , - 1 , 202 , <nl> - - 1 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 37 , 38 , 39 , 40 , 41 , 12 , 43 , - 1 , 221 , 46 , <nl> - - 1 , - 1 , 225 , - 1 , - 1 , 229 , 53 , - 1 , - 1 , - 1 , <nl> - - 1 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 37 , 38 , 39 , 40 , 41 , 12 , 43 , - 1 , - 1 , 46 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 53 , - 1 , - 1 , - 1 , <nl> - - 1 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 37 , 38 , 39 , 40 , 41 , - 1 , 43 , - 1 , - 1 , 46 , <nl> - - 1 , - 1 , 49 , 10 , 11 , 12 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , - 1 , 19 , 20 , 21 , - 1 , 23 , 24 , 25 , 26 , <nl> - - 1 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 37 , 38 , 39 , 40 , 41 , - 1 , 43 , - 1 , - 1 , 46 , <nl> - 12 , 13 , 14 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 28 , 29 , 30 , 31 , <nl> - 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , <nl> - - 1 , 43 , - 1 , - 1 , 46 , 12 , 13 , 14 , - 1 , - 1 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 37 , 38 , 39 , 40 , 41 , 12 , 43 , 14 , - 1 , 46 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 37 , 38 , 39 , 40 , 41 , 12 , 43 , - 1 , - 1 , 46 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 37 , 38 , 39 , 40 , 41 , 12 , 43 , 44 , - 1 , 46 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 37 , 38 , 39 , 40 , 41 , 12 , 43 , - 1 , - 1 , 46 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , 28 , 29 , - 1 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 37 , 38 , 39 , 40 , 41 , 12 , - 1 , - 1 , - 1 , 46 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 12 , <nl> - - 1 , 28 , - 1 , - 1 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 37 , 38 , 39 , 40 , 41 , 28 , - 1 , - 1 , - 1 , 46 , <nl> - 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , - 1 , <nl> - - 1 , - 1 , - 1 , 46 , 19 , 20 , 21 , 22 , 23 , 24 , <nl> - 25 , 26 , - 1 , 28 , 3 , 4 , 5 , 6 , 7 , 8 , <nl> - 9 , - 1 , 37 , 38 , - 1 , - 1 , 15 , 16 , 17 , 18 , <nl> - - 1 , - 1 , - 1 , 48 , 49 , 50 , - 1 , 52 , 19 , 20 , <nl> - 21 , 22 , 23 , 24 , 25 , 26 , - 1 , 28 , - 1 , - 1 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 37 , 38 , - 1 , 19 , <nl> - 20 , 21 , 22 , 23 , 24 , 25 , 26 , 48 , 28 , 50 , <nl> - - 1 , 52 , - 1 , - 1 , - 1 , - 1 , - 1 , 37 , 38 , - 1 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 48 , - 1 , <nl> - 50 , - 1 , 52 <nl> + 4 , 83 , 10 , 0 , 6 , 7 , 107 , 0 , 0 , 11 , <nl> + 12 , 13 , 14 , 52 , 70 , 71 , 72 , 119 , 0 , 121 , <nl> + 59 , 123 , 22 , 23 , 22 , 22 , 26 , 22 , 26 , 22 , <nl> + 22 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 13 , 41 , <nl> + 42 , 43 , 44 , 15 , 16 , 17 , 18 , 28 , 45 , 22 , <nl> + 47 , 48 , 49 , 26 , 47 , 47 , 49 , 49 , 39 , 40 , <nl> + 41 , 22 , 66 , 52 , 52 , 26 , 13 , 14 , 28 , 73 , <nl> + 59 , 59 , 22 , 23 , 76 , 12 , 78 , 37 , 38 , 39 , <nl> + 40 , 41 , 45 , 85 , 86 , 48 , 88 , 89 , 90 , 91 , <nl> + 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 101 , <nl> + 102 , 47 , 27 , 204 , 106 , 45 , 114 , 115 , 42 , 22 , <nl> + 212 , 213 , 47 , 22 , 116 , 12 , 28 , 22 , 120 , 201 , <nl> + 122 , 48 , 42 , 14 , 47 , 12 , 27 , 228 , 184 , 47 , <nl> + 186 , 19 , 20 , 21 , 27 , 23 , 24 , 25 , 26 , 22 , <nl> + 142 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> + 37 , 38 , 39 , 40 , 41 , 12 , 43 , 159 , 53 , 46 , <nl> + 164 , 165 , 51 , 49 , 166 , 47 , 53 , 44 , 47 , 50 , <nl> + 77 , 28 , 29 , 49 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> + 37 , 38 , 39 , 40 , 41 , 189 , 188 , 47 , 12 , 46 , <nl> + 19 , 193 , 47 , 195 , 165 , 197 , 223 , 167 , 181 , - 1 , <nl> + 117 , 203 , 192 , - 1 , 28 , 29 , 30 , 31 , 32 , 33 , <nl> + 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 12 , 43 , <nl> + - 1 , 223 , 46 , - 1 , - 1 , 227 , - 1 , 231 , - 1 , 53 , <nl> + - 1 , - 1 , - 1 , - 1 , 28 , 29 , 30 , 31 , 32 , 33 , <nl> + 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 12 , 43 , <nl> + - 1 , - 1 , 46 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 53 , <nl> + - 1 , - 1 , - 1 , - 1 , 28 , 29 , 30 , 31 , 32 , 33 , <nl> + 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , - 1 , 43 , <nl> + 28 , - 1 , 46 , - 1 , - 1 , 49 , 10 , 11 , 12 , 37 , <nl> + 38 , 39 , 40 , 41 , - 1 , 19 , 20 , 21 , 46 , 23 , <nl> + 24 , 25 , 26 , - 1 , 28 , 29 , 30 , 31 , 32 , 33 , <nl> + 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , - 1 , 43 , <nl> + - 1 , - 1 , 46 , 12 , 13 , 14 , - 1 , - 1 , - 1 , - 1 , <nl> + - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 28 , <nl> + 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , <nl> + 39 , 40 , 41 , - 1 , 43 , - 1 , - 1 , 46 , 12 , 13 , <nl> + 14 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> + - 1 , - 1 , - 1 , - 1 , 28 , 29 , 30 , 31 , 32 , 33 , <nl> + 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 12 , 43 , <nl> + 14 , - 1 , 46 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> + - 1 , - 1 , - 1 , - 1 , 28 , 29 , 30 , 31 , 32 , 33 , <nl> + 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 12 , 43 , <nl> + - 1 , - 1 , 46 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> + - 1 , - 1 , - 1 , - 1 , 28 , 29 , 30 , 31 , 32 , 33 , <nl> + 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 12 , 43 , <nl> + 44 , - 1 , 46 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> + - 1 , - 1 , - 1 , - 1 , 28 , 29 , 30 , 31 , 32 , 33 , <nl> + 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 12 , 43 , <nl> + - 1 , - 1 , 46 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> + - 1 , - 1 , 12 , - 1 , 28 , - 1 , - 1 , 31 , 32 , 33 , <nl> + 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 28 , - 1 , <nl> + - 1 , - 1 , 46 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , <nl> + 40 , 41 , - 1 , - 1 , - 1 , - 1 , 46 , 19 , 20 , 21 , <nl> + 22 , 23 , 24 , 25 , 26 , - 1 , 28 , - 1 , - 1 , - 1 , <nl> + - 1 , - 1 , - 1 , - 1 , - 1 , 37 , 38 , - 1 , - 1 , - 1 , <nl> + - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 48 , 49 , 50 , - 1 , <nl> + 52 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , - 1 , <nl> + 28 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 37 , <nl> + 38 , - 1 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , <nl> + 48 , 28 , 50 , - 1 , 52 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> + 37 , 38 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> + - 1 , 48 , 28 , 50 , - 1 , 52 , - 1 , 33 , 34 , 35 , <nl> + 36 , 37 , 38 , 39 , 40 , 41 , - 1 , - 1 , - 1 , - 1 , <nl> + 46 <nl> } ; <nl> <nl> / * YYSTOS [ STATE - NUM ] - - The ( internal number of the ) accessing <nl> static const yytype_uint8 yystos [ ] = <nl> 91 , 91 , 91 , 91 , 91 , 91 , 91 , 91 , 22 , 48 , <nl> 42 , 91 , 22 , 122 , 14 , 47 , 27 , 47 , 10 , 11 , <nl> 83 , 118 , 118 , 22 , 23 , 26 , 121 , 22 , 23 , 26 , <nl> - 121 , 22 , 108 , 108 , 91 , 108 , 91 , 108 , 78 , 49 , <nl> - 51 , 47 , 44 , 53 , 47 , 91 , 44 , 91 , 99 , 100 , <nl> - 101 , 102 , 52 , 59 , 117 , 53 , 124 , 74 , 91 , 82 , <nl> - 109 , 86 , 86 , 76 , 124 , 113 , 91 , 91 , 91 , 49 , <nl> - 61 , 47 , 91 , 22 , 122 , 52 , 59 , 108 , 108 , 47 , <nl> - 100 , 53 , 91 , 22 , 122 , 124 , 53 <nl> + 121 , 22 , 108 , 108 , 91 , 108 , 91 , 108 , 27 , 78 , <nl> + 49 , 51 , 47 , 44 , 53 , 47 , 91 , 44 , 91 , 99 , <nl> + 100 , 101 , 102 , 52 , 59 , 117 , 53 , 124 , 74 , 91 , <nl> + 82 , 109 , 86 , 86 , 91 , 76 , 124 , 113 , 91 , 91 , <nl> + 91 , 49 , 61 , 47 , 91 , 22 , 122 , 52 , 59 , 108 , <nl> + 108 , 47 , 100 , 53 , 91 , 22 , 122 , 124 , 53 <nl> } ; <nl> <nl> / * YYR1 [ YYN ] - - Symbol number of symbol that rule YYN derives . * / <nl> static const yytype_uint8 yyr1 [ ] = <nl> { <nl> 0 , 60 , 61 , 61 , 61 , 61 , 61 , 62 , 62 , 63 , <nl> 63 , 63 , 63 , 63 , 63 , 64 , 65 , 66 , 67 , 67 , <nl> - 68 , 69 , 71 , 70 , 72 , 72 , 72 , 73 , 73 , 74 , <nl> - 75 , 75 , 76 , 76 , 77 , 78 , 77 , 80 , 79 , 81 , <nl> - 81 , 82 , 83 , 83 , 83 , 83 , 84 , 84 , 85 , 86 , <nl> - 86 , 87 , 88 , 89 , 89 , 90 , 90 , 91 , 92 , 91 , <nl> - 91 , 91 , 91 , 91 , 91 , 91 , 91 , 93 , 93 , 95 , <nl> - 94 , 96 , 96 , 96 , 97 , 97 , 97 , 97 , 97 , 97 , <nl> - 97 , 97 , 97 , 97 , 97 , 97 , 97 , 97 , 97 , 98 , <nl> - 99 , 99 , 100 , 101 , 100 , 102 , 102 , 103 , 103 , 105 , <nl> - 104 , 106 , 106 , 107 , 107 , 108 , 108 , 110 , 109 , 111 , <nl> - 111 , 112 , 112 , 113 , 114 , 115 , 114 , 116 , 116 , 116 , <nl> - 116 , 116 , 117 , 117 , 117 , 117 , 117 , 117 , 118 , 118 , <nl> - 119 , 119 , 120 , 120 , 120 , 120 , 120 , 121 , 121 , 121 , <nl> - 122 , 123 , 123 , 124 , 125 <nl> + 68 , 69 , 71 , 70 , 72 , 72 , 72 , 72 , 73 , 73 , <nl> + 74 , 75 , 75 , 76 , 76 , 77 , 78 , 77 , 80 , 79 , <nl> + 81 , 81 , 82 , 83 , 83 , 83 , 83 , 84 , 84 , 85 , <nl> + 86 , 86 , 87 , 88 , 89 , 89 , 90 , 90 , 91 , 92 , <nl> + 91 , 91 , 91 , 91 , 91 , 91 , 91 , 91 , 93 , 93 , <nl> + 95 , 94 , 96 , 96 , 96 , 97 , 97 , 97 , 97 , 97 , <nl> + 97 , 97 , 97 , 97 , 97 , 97 , 97 , 97 , 97 , 97 , <nl> + 98 , 99 , 99 , 100 , 101 , 100 , 102 , 102 , 103 , 103 , <nl> + 105 , 104 , 106 , 106 , 107 , 107 , 108 , 108 , 110 , 109 , <nl> + 111 , 111 , 112 , 112 , 113 , 114 , 115 , 114 , 116 , 116 , <nl> + 116 , 116 , 116 , 117 , 117 , 117 , 117 , 117 , 117 , 118 , <nl> + 118 , 119 , 119 , 120 , 120 , 120 , 120 , 120 , 121 , 121 , <nl> + 121 , 122 , 123 , 123 , 124 , 125 <nl> } ; <nl> <nl> / * YYR2 [ YYN ] - - Number of symbols on the right hand side of rule YYN . * / <nl> static const yytype_uint8 yyr2 [ ] = <nl> { <nl> 0 , 2 , 2 , 2 , 2 , 2 , 2 , 0 , 2 , 1 , <nl> 1 , 1 , 1 , 1 , 1 , 4 , 2 , 2 , 1 , 3 , <nl> - 3 , 4 , 0 , 3 , 2 , 2 , 3 , 1 , 3 , 3 , <nl> - 0 , 2 , 1 , 3 , 0 , 0 , 3 , 0 , 3 , 1 , <nl> - 3 , 2 , 0 , 1 , 1 , 1 , 2 , 4 , 2 , 2 , <nl> - 2 , 4 , 4 , 4 , 6 , 4 , 6 , 3 , 0 , 4 , <nl> - 1 , 1 , 1 , 1 , 1 , 1 , 3 , 1 , 3 , 0 , <nl> - 5 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , <nl> - 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 4 , 5 , <nl> - 0 , 1 , 1 , 0 , 2 , 1 , 3 , 1 , 1 , 0 , <nl> - 4 , 0 , 1 , 1 , 3 , 0 , 2 , 0 , 4 , 0 , <nl> - 1 , 1 , 3 , 3 , 1 , 0 , 4 , 1 , 1 , 3 , <nl> - 3 , 4 , 2 , 2 , 3 , 3 , 3 , 4 , 1 , 1 , <nl> + 3 , 4 , 0 , 3 , 2 , 2 , 3 , 5 , 1 , 3 , <nl> + 3 , 0 , 2 , 1 , 3 , 0 , 0 , 3 , 0 , 3 , <nl> + 1 , 3 , 2 , 0 , 1 , 1 , 1 , 2 , 4 , 2 , <nl> + 2 , 2 , 4 , 4 , 4 , 6 , 4 , 6 , 3 , 0 , <nl> + 4 , 1 , 1 , 1 , 1 , 1 , 1 , 3 , 1 , 3 , <nl> + 0 , 5 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 3 , <nl> + 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 4 , <nl> + 5 , 0 , 1 , 1 , 0 , 2 , 1 , 3 , 1 , 1 , <nl> + 0 , 4 , 0 , 1 , 1 , 3 , 0 , 2 , 0 , 4 , <nl> + 0 , 1 , 1 , 3 , 3 , 1 , 0 , 4 , 1 , 1 , <nl> + 3 , 3 , 4 , 2 , 2 , 3 , 3 , 3 , 4 , 1 , <nl> 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , <nl> - 1 , 1 , 1 , 1 , 1 <nl> + 1 , 1 , 1 , 1 , 1 , 1 <nl> } ; <nl> <nl> <nl> YYLTYPE yylloc = yyloc_default ; <nl> # line 200 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1714 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1712 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 3 : <nl> # line 202 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1721 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1719 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 4 : <nl> # line 204 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1728 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1726 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 5 : <nl> # line 206 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1735 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1733 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 6 : <nl> # line 208 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1742 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1740 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 7 : <nl> # line 213 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1749 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1747 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 8 : <nl> # line 215 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1756 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1754 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 9 : <nl> # line 220 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1763 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1761 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 10 : <nl> # line 222 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1770 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1768 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 11 : <nl> # line 224 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1777 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1775 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 12 : <nl> # line 226 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1784 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1782 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 13 : <nl> # line 228 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1791 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1789 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 14 : <nl> # line 230 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1798 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1796 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 15 : <nl> YYLTYPE yylloc = yyloc_default ; <nl> auto node = parser - > ast ( ) - > createNodeFor ( ( yyvsp [ - 2 ] . strval ) , ( yyvsp [ 0 ] . node ) ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> - # line 1809 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1807 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 16 : <nl> YYLTYPE yylloc = yyloc_default ; <nl> auto node = parser - > ast ( ) - > createNodeFilter ( ( yyvsp [ 0 ] . node ) ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> - # line 1819 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1817 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 17 : <nl> # line 252 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1826 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1824 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 18 : <nl> # line 257 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1833 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1831 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 19 : <nl> # line 259 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1840 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1838 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 20 : <nl> YYLTYPE yylloc = yyloc_default ; <nl> auto node = parser - > ast ( ) - > createNodeLet ( ( yyvsp [ - 2 ] . strval ) , ( yyvsp [ 0 ] . node ) , true ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> - # line 1849 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1847 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 21 : <nl> YYLTYPE yylloc = yyloc_default ; <nl> <nl> ( yyval . strval ) = ( yyvsp [ 0 ] . strval ) ; <nl> } <nl> - # line 1861 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1859 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 22 : <nl> YYLTYPE yylloc = yyloc_default ; <nl> auto node = parser - > ast ( ) - > createNodeList ( ) ; <nl> parser - > pushStack ( node ) ; <nl> } <nl> - # line 1870 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1868 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 23 : <nl> YYLTYPE yylloc = yyloc_default ; <nl> } <nl> ( yyval . node ) = list ; <nl> } <nl> - # line 1883 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1881 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 24 : <nl> YYLTYPE yylloc = yyloc_default ; <nl> scopes - > start ( triagens : : aql : : AQL_SCOPE_COLLECT ) ; <nl> } <nl> <nl> - auto node = parser - > ast ( ) - > createNodeCollect ( parser - > ast ( ) - > createNodeList ( ) , ( yyvsp [ 0 ] . strval ) ) ; <nl> + auto node = parser - > ast ( ) - > createNodeCollectCount ( parser - > ast ( ) - > createNodeList ( ) , ( yyvsp [ 0 ] . strval ) ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> - # line 1908 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1906 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 25 : <nl> YYLTYPE yylloc = yyloc_default ; <nl> } <nl> } <nl> <nl> - auto node = parser - > ast ( ) - > createNodeCollect ( ( yyvsp [ - 1 ] . node ) , ( yyvsp [ 0 ] . strval ) ) ; <nl> + auto node = parser - > ast ( ) - > createNodeCollectCount ( ( yyvsp [ - 1 ] . node ) , ( yyvsp [ 0 ] . strval ) ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> - # line 1940 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1938 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 26 : <nl> YYLTYPE yylloc = yyloc_default ; <nl> auto node = parser - > ast ( ) - > createNodeCollect ( ( yyvsp [ - 2 ] . node ) , ( yyvsp [ - 1 ] . strval ) , ( yyvsp [ 0 ] . node ) ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> - # line 1976 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 1974 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 27 : <nl> - # line 376 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 373 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> + auto scopes = parser - > ast ( ) - > scopes ( ) ; <nl> + <nl> + / / check if we are in the main scope <nl> + bool reRegisterVariables = ( scopes - > type ( ) ! = triagens : : aql : : AQL_SCOPE_MAIN ) ; <nl> + <nl> + if ( reRegisterVariables ) { <nl> + / / end the active scopes <nl> + scopes - > endNested ( ) ; <nl> + / / start a new scope <nl> + scopes - > start ( triagens : : aql : : AQL_SCOPE_COLLECT ) ; <nl> + <nl> + size_t const n = ( yyvsp [ - 4 ] . node ) - > numMembers ( ) ; <nl> + for ( size_t i = 0 ; i < n ; + + i ) { <nl> + auto member = ( yyvsp [ - 4 ] . node ) - > getMember ( i ) ; <nl> + <nl> + if ( member ! = nullptr ) { <nl> + TRI_ASSERT ( member - > type = = NODE_TYPE_ASSIGN ) ; <nl> + auto v = static_cast < Variable * > ( member - > getMember ( 0 ) - > getData ( ) ) ; <nl> + scopes - > addVariable ( v ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + auto node = parser - > ast ( ) - > createNodeCollectExpression ( ( yyvsp [ - 4 ] . node ) , ( yyvsp [ - 2 ] . strval ) , ( yyvsp [ 0 ] . node ) ) ; <nl> + parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> - # line 1983 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2006 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 28 : <nl> - # line 378 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 403 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 1990 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2013 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 29 : <nl> - # line 383 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 405 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + { <nl> + } <nl> + # line 2020 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + break ; <nl> + <nl> + case 30 : <nl> + # line 410 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> auto node = parser - > ast ( ) - > createNodeAssign ( ( yyvsp [ - 2 ] . strval ) , ( yyvsp [ 0 ] . node ) ) ; <nl> parser - > pushList ( node ) ; <nl> } <nl> - # line 1999 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2029 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 30 : <nl> - # line 390 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 31 : <nl> + # line 417 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . strval ) = nullptr ; <nl> } <nl> - # line 2007 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2037 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 31 : <nl> - # line 393 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 32 : <nl> + # line 420 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . strval ) = ( yyvsp [ 0 ] . strval ) ; <nl> } <nl> - # line 2015 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2045 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 32 : <nl> - # line 399 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 33 : <nl> + # line 426 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ! parser - > ast ( ) - > scopes ( ) - > existsVariable ( ( yyvsp [ 0 ] . strval ) ) ) { <nl> parser - > registerParseError ( TRI_ERROR_QUERY_PARSE , " use of unknown variable ' % s ' for KEEP " , ( yyvsp [ 0 ] . strval ) , yylloc . first_line , yylloc . first_column ) ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> node - > setFlag ( FLAG_KEEP_VARIABLENAME ) ; <nl> parser - > pushList ( node ) ; <nl> } <nl> - # line 2034 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2064 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 33 : <nl> - # line 413 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 34 : <nl> + # line 440 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ! parser - > ast ( ) - > scopes ( ) - > existsVariable ( ( yyvsp [ 0 ] . strval ) ) ) { <nl> parser - > registerParseError ( TRI_ERROR_QUERY_PARSE , " use of unknown variable ' % s ' for KEEP " , ( yyvsp [ 0 ] . strval ) , yylloc . first_line , yylloc . first_column ) ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> node - > setFlag ( FLAG_KEEP_VARIABLENAME ) ; <nl> parser - > pushList ( node ) ; <nl> } <nl> - # line 2053 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2083 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 34 : <nl> - # line 430 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 35 : <nl> + # line 457 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = nullptr ; <nl> } <nl> - # line 2061 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2091 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 35 : <nl> - # line 433 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 36 : <nl> + # line 460 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ! TRI_CaseEqualString ( ( yyvsp [ 0 ] . strval ) , " KEEP " ) ) { <nl> parser - > registerParseError ( TRI_ERROR_QUERY_PARSE , " unexpected qualifier ' % s ' , expecting ' KEEP ' " , ( yyvsp [ 0 ] . strval ) , yylloc . first_line , yylloc . first_column ) ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> auto node = parser - > ast ( ) - > createNodeList ( ) ; <nl> parser - > pushStack ( node ) ; <nl> } <nl> - # line 2074 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2104 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 36 : <nl> - # line 440 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 37 : <nl> + # line 467 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> auto list = static_cast < AstNode * > ( parser - > popStack ( ) ) ; <nl> ( yyval . node ) = list ; <nl> } <nl> - # line 2083 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2113 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 37 : <nl> - # line 447 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 38 : <nl> + # line 474 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> auto node = parser - > ast ( ) - > createNodeList ( ) ; <nl> parser - > pushStack ( node ) ; <nl> } <nl> - # line 2092 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2122 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 38 : <nl> - # line 450 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 39 : <nl> + # line 477 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> auto list = static_cast < AstNode const * > ( parser - > popStack ( ) ) ; <nl> auto node = parser - > ast ( ) - > createNodeSort ( list ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> - # line 2102 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2132 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 39 : <nl> - # line 458 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 40 : <nl> + # line 485 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> parser - > pushList ( ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2110 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2140 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 40 : <nl> - # line 461 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 41 : <nl> + # line 488 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> parser - > pushList ( ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2118 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2148 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 41 : <nl> - # line 467 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 42 : <nl> + # line 494 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeSortElement ( ( yyvsp [ - 1 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2126 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2156 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 42 : <nl> - # line 473 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 43 : <nl> + # line 500 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeValueBool ( true ) ; <nl> } <nl> - # line 2134 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2164 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 43 : <nl> - # line 476 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 44 : <nl> + # line 503 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeValueBool ( true ) ; <nl> } <nl> - # line 2142 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2172 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 44 : <nl> - # line 479 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 45 : <nl> + # line 506 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeValueBool ( false ) ; <nl> } <nl> - # line 2150 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2180 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 45 : <nl> - # line 482 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 46 : <nl> + # line 509 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2158 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2188 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 46 : <nl> - # line 488 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 47 : <nl> + # line 515 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> auto offset = parser - > ast ( ) - > createNodeValueInt ( 0 ) ; <nl> auto node = parser - > ast ( ) - > createNodeLimit ( offset , ( yyvsp [ 0 ] . node ) ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> - # line 2168 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2198 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 47 : <nl> - # line 493 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 48 : <nl> + # line 520 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> auto node = parser - > ast ( ) - > createNodeLimit ( ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> - # line 2177 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2207 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 48 : <nl> - # line 500 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 49 : <nl> + # line 527 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> auto node = parser - > ast ( ) - > createNodeReturn ( ( yyvsp [ 0 ] . node ) ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> parser - > ast ( ) - > scopes ( ) - > endNested ( ) ; <nl> } <nl> - # line 2187 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2217 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 49 : <nl> - # line 508 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 50 : <nl> + # line 535 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2195 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2225 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 50 : <nl> - # line 511 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 51 : <nl> + # line 538 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2203 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2233 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 51 : <nl> - # line 517 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 52 : <nl> + # line 544 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ! parser - > configureWriteQuery ( AQL_QUERY_REMOVE , ( yyvsp [ - 1 ] . node ) , ( yyvsp [ 0 ] . node ) ) ) { <nl> YYABORT ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> parser - > ast ( ) - > scopes ( ) - > endNested ( ) ; <nl> } <nl> - # line 2216 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2246 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 52 : <nl> - # line 528 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 53 : <nl> + # line 555 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ! parser - > configureWriteQuery ( AQL_QUERY_INSERT , ( yyvsp [ - 1 ] . node ) , ( yyvsp [ 0 ] . node ) ) ) { <nl> YYABORT ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> parser - > ast ( ) - > scopes ( ) - > endNested ( ) ; <nl> } <nl> - # line 2229 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2259 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 53 : <nl> - # line 539 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 54 : <nl> + # line 566 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ! parser - > configureWriteQuery ( AQL_QUERY_UPDATE , ( yyvsp [ - 1 ] . node ) , ( yyvsp [ 0 ] . node ) ) ) { <nl> YYABORT ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> parser - > ast ( ) - > scopes ( ) - > endNested ( ) ; <nl> } <nl> - # line 2242 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2272 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 54 : <nl> - # line 547 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 55 : <nl> + # line 574 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ! parser - > configureWriteQuery ( AQL_QUERY_UPDATE , ( yyvsp [ - 1 ] . node ) , ( yyvsp [ 0 ] . node ) ) ) { <nl> YYABORT ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> parser - > ast ( ) - > scopes ( ) - > endNested ( ) ; <nl> } <nl> - # line 2255 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2285 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 55 : <nl> - # line 558 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 56 : <nl> + # line 585 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ! parser - > configureWriteQuery ( AQL_QUERY_REPLACE , ( yyvsp [ - 1 ] . node ) , ( yyvsp [ 0 ] . node ) ) ) { <nl> YYABORT ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> parser - > ast ( ) - > scopes ( ) - > endNested ( ) ; <nl> } <nl> - # line 2268 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2298 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 56 : <nl> - # line 566 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 57 : <nl> + # line 593 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ! parser - > configureWriteQuery ( AQL_QUERY_REPLACE , ( yyvsp [ - 1 ] . node ) , ( yyvsp [ 0 ] . node ) ) ) { <nl> YYABORT ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> parser - > ast ( ) - > scopes ( ) - > endNested ( ) ; <nl> } <nl> - # line 2281 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2311 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 57 : <nl> - # line 577 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 58 : <nl> + # line 604 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ - 1 ] . node ) ; <nl> } <nl> - # line 2289 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2319 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 58 : <nl> - # line 580 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 59 : <nl> + # line 607 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> parser - > ast ( ) - > scopes ( ) - > start ( triagens : : aql : : AQL_SCOPE_SUBQUERY ) ; <nl> parser - > ast ( ) - > startSubQuery ( ) ; <nl> } <nl> - # line 2298 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2328 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 59 : <nl> - # line 583 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 60 : <nl> + # line 610 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> AstNode * node = parser - > ast ( ) - > endSubQuery ( ) ; <nl> parser - > ast ( ) - > scopes ( ) - > endCurrent ( ) ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeReference ( variableName . c_str ( ) ) ; <nl> } <nl> - # line 2313 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> - break ; <nl> - <nl> - case 60 : <nl> - # line 593 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> - { <nl> - ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> - } <nl> - # line 2321 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2343 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 61 : <nl> - # line 596 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 620 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2329 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2351 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 62 : <nl> - # line 599 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 623 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2337 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2359 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 63 : <nl> - # line 602 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 626 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2345 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2367 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 64 : <nl> - # line 605 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 629 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2353 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2375 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 65 : <nl> - # line 608 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 632 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2361 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2383 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 66 : <nl> - # line 611 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 635 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> - ( yyval . node ) = parser - > ast ( ) - > createNodeRange ( ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> + ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2369 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2391 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 67 : <nl> - # line 617 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 638 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + { <nl> + ( yyval . node ) = parser - > ast ( ) - > createNodeRange ( ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> + } <nl> + # line 2399 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + break ; <nl> + <nl> + case 68 : <nl> + # line 644 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . strval ) = ( yyvsp [ 0 ] . strval ) ; <nl> <nl> YYLTYPE yylloc = yyloc_default ; <nl> ABORT_OOM <nl> } <nl> } <nl> - # line 2381 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2411 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 68 : <nl> - # line 624 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 69 : <nl> + # line 651 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ( yyvsp [ - 2 ] . strval ) = = nullptr | | ( yyvsp [ 0 ] . strval ) = = nullptr ) { <nl> ABORT_OOM <nl> YYLTYPE yylloc = yyloc_default ; <nl> ABORT_OOM <nl> } <nl> } <nl> - # line 2400 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2430 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 69 : <nl> - # line 641 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 70 : <nl> + # line 668 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> parser - > pushStack ( ( yyvsp [ 0 ] . strval ) ) ; <nl> <nl> auto node = parser - > ast ( ) - > createNodeList ( ) ; <nl> parser - > pushStack ( node ) ; <nl> } <nl> - # line 2411 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2441 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 70 : <nl> - # line 646 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 71 : <nl> + # line 673 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> auto list = static_cast < AstNode const * > ( parser - > popStack ( ) ) ; <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeFunctionCall ( static_cast < char const * > ( parser - > popStack ( ) ) , list ) ; <nl> } <nl> - # line 2420 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2450 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 71 : <nl> - # line 653 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 72 : <nl> + # line 680 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeUnaryOperator ( NODE_TYPE_OPERATOR_UNARY_PLUS , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2428 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2458 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 72 : <nl> - # line 656 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 73 : <nl> + # line 683 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeUnaryOperator ( NODE_TYPE_OPERATOR_UNARY_MINUS , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2436 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2466 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 73 : <nl> - # line 659 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 74 : <nl> + # line 686 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeUnaryOperator ( NODE_TYPE_OPERATOR_UNARY_NOT , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2444 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2474 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 74 : <nl> - # line 665 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 75 : <nl> + # line 692 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_OR , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2452 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2482 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 75 : <nl> - # line 668 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 76 : <nl> + # line 695 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_AND , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2460 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2490 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 76 : <nl> - # line 671 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 77 : <nl> + # line 698 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_PLUS , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2468 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2498 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 77 : <nl> - # line 674 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 78 : <nl> + # line 701 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_MINUS , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2476 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2506 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 78 : <nl> - # line 677 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 79 : <nl> + # line 704 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_TIMES , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2484 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2514 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 79 : <nl> - # line 680 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 80 : <nl> + # line 707 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_DIV , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2492 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2522 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 80 : <nl> - # line 683 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 81 : <nl> + # line 710 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_MOD , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2500 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2530 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 81 : <nl> - # line 686 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 82 : <nl> + # line 713 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_EQ , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2508 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2538 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 82 : <nl> - # line 689 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 83 : <nl> + # line 716 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_NE , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2516 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2546 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 83 : <nl> - # line 692 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 84 : <nl> + # line 719 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_LT , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2524 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2554 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 84 : <nl> - # line 695 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 85 : <nl> + # line 722 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_GT , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2532 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2562 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 85 : <nl> - # line 698 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 86 : <nl> + # line 725 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_LE , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2540 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2570 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 86 : <nl> - # line 701 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 87 : <nl> + # line 728 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_GE , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2548 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2578 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 87 : <nl> - # line 704 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 88 : <nl> + # line 731 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_IN , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2556 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2586 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 88 : <nl> - # line 707 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 89 : <nl> + # line 734 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBinaryOperator ( NODE_TYPE_OPERATOR_BINARY_NIN , ( yyvsp [ - 3 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2564 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2594 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 89 : <nl> - # line 713 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 90 : <nl> + # line 740 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeTernaryOperator ( ( yyvsp [ - 4 ] . node ) , ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2572 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2602 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 90 : <nl> - # line 719 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 91 : <nl> + # line 746 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 2579 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2609 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 91 : <nl> - # line 721 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 92 : <nl> + # line 748 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 2586 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2616 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 92 : <nl> - # line 726 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 93 : <nl> + # line 753 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2594 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2624 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 93 : <nl> - # line 729 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 94 : <nl> + # line 756 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> parser - > ast ( ) - > scopes ( ) - > start ( triagens : : aql : : AQL_SCOPE_SUBQUERY ) ; <nl> parser - > ast ( ) - > startSubQuery ( ) ; <nl> } <nl> - # line 2603 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2633 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 94 : <nl> - # line 732 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 95 : <nl> + # line 759 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> AstNode * node = parser - > ast ( ) - > endSubQuery ( ) ; <nl> parser - > ast ( ) - > scopes ( ) - > endCurrent ( ) ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeReference ( variableName . c_str ( ) ) ; <nl> } <nl> - # line 2618 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> - break ; <nl> - <nl> - case 95 : <nl> - # line 745 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> - { <nl> - parser - > pushList ( ( yyvsp [ 0 ] . node ) ) ; <nl> - } <nl> - # line 2626 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2648 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 96 : <nl> - # line 748 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 772 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> parser - > pushList ( ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2634 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2656 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 97 : <nl> - # line 754 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 775 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> - ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> + parser - > pushList ( ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2642 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2664 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 98 : <nl> - # line 757 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 781 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2650 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2672 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 99 : <nl> - # line 763 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 784 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> - auto node = parser - > ast ( ) - > createNodeList ( ) ; <nl> - parser - > pushStack ( node ) ; <nl> + ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2659 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2680 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 100 : <nl> - # line 766 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 790 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> - ( yyval . node ) = static_cast < AstNode * > ( parser - > popStack ( ) ) ; <nl> + auto node = parser - > ast ( ) - > createNodeList ( ) ; <nl> + parser - > pushStack ( node ) ; <nl> } <nl> - # line 2667 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2689 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 101 : <nl> - # line 772 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 793 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> + ( yyval . node ) = static_cast < AstNode * > ( parser - > popStack ( ) ) ; <nl> } <nl> - # line 2674 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2697 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 102 : <nl> - # line 774 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 799 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 2681 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2704 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 103 : <nl> - # line 779 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 801 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> - parser - > pushList ( ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2689 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2711 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 104 : <nl> - # line 782 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 806 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> parser - > pushList ( ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2697 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2719 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 105 : <nl> - # line 788 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 809 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> - ( yyval . node ) = nullptr ; <nl> + parser - > pushList ( ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2705 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2727 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 106 : <nl> - # line 791 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 815 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + { <nl> + ( yyval . node ) = nullptr ; <nl> + } <nl> + # line 2735 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + break ; <nl> + <nl> + case 107 : <nl> + # line 818 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ( yyvsp [ - 1 ] . strval ) = = nullptr | | ( yyvsp [ 0 ] . node ) = = nullptr ) { <nl> ABORT_OOM <nl> YYLTYPE yylloc = yyloc_default ; <nl> <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2721 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2751 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 107 : <nl> - # line 805 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 108 : <nl> + # line 832 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> auto node = parser - > ast ( ) - > createNodeArray ( ) ; <nl> parser - > pushStack ( node ) ; <nl> } <nl> - # line 2730 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> - break ; <nl> - <nl> - case 108 : <nl> - # line 808 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> - { <nl> - ( yyval . node ) = static_cast < AstNode * > ( parser - > popStack ( ) ) ; <nl> - } <nl> - # line 2738 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2760 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 109 : <nl> - # line 814 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 835 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> + ( yyval . node ) = static_cast < AstNode * > ( parser - > popStack ( ) ) ; <nl> } <nl> - # line 2745 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2768 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 110 : <nl> - # line 816 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 841 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 2752 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2775 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 111 : <nl> - # line 821 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 843 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 2759 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2782 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 112 : <nl> - # line 823 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 848 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> } <nl> - # line 2766 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2789 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 113 : <nl> - # line 828 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 850 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> - parser - > pushArray ( ( yyvsp [ - 2 ] . strval ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2774 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2796 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> case 114 : <nl> - # line 834 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + # line 855 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + { <nl> + parser - > pushArray ( ( yyvsp [ - 2 ] . strval ) , ( yyvsp [ 0 ] . node ) ) ; <nl> + } <nl> + # line 2804 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + break ; <nl> + <nl> + case 115 : <nl> + # line 861 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / start of reference ( collection or variable name ) <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2783 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2813 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 115 : <nl> - # line 838 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 116 : <nl> + # line 865 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / expanded variable access , e . g . variable [ * ] <nl> <nl> YYLTYPE yylloc = yyloc_default ; <nl> parser - > pushStack ( iterator ) ; <nl> parser - > pushStack ( parser - > ast ( ) - > createNodeReference ( iteratorName ) ) ; <nl> } <nl> - # line 2799 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2829 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 116 : <nl> - # line 848 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 117 : <nl> + # line 875 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / return from the " expansion " subrule <nl> <nl> YYLTYPE yylloc = yyloc_default ; <nl> / / return a reference only <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeReference ( variableName ) ; <nl> } <nl> - # line 2819 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2849 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 117 : <nl> - # line 866 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 118 : <nl> + # line 893 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / variable or collection <nl> AstNode * node ; <nl> YYLTYPE yylloc = yyloc_default ; <nl> <nl> ( yyval . node ) = node ; <nl> } <nl> - # line 2837 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2867 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 118 : <nl> - # line 879 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 119 : <nl> + # line 906 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> <nl> YYLTYPE yylloc = yyloc_default ; <nl> ABORT_OOM <nl> } <nl> } <nl> - # line 2849 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2879 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 119 : <nl> - # line 886 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 120 : <nl> + # line 913 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / named variable access , e . g . variable . reference <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeAttributeAccess ( ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . strval ) ) ; <nl> } <nl> - # line 2858 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2888 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 120 : <nl> - # line 890 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 121 : <nl> + # line 917 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / named variable access , e . g . variable . @ reference <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBoundAttributeAccess ( ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2867 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2897 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 121 : <nl> - # line 894 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 122 : <nl> + # line 921 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / indexed variable access , e . g . variable [ index ] <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeIndexedAccess ( ( yyvsp [ - 3 ] . node ) , ( yyvsp [ - 1 ] . node ) ) ; <nl> } <nl> - # line 2876 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2906 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 122 : <nl> - # line 901 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 123 : <nl> + # line 928 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / named variable access , continuation from * expansion , e . g . [ * ] . variable . reference <nl> auto node = static_cast < AstNode * > ( parser - > popStack ( ) ) ; <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeAttributeAccess ( node , ( yyvsp [ 0 ] . strval ) ) ; <nl> } <nl> - # line 2886 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2916 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 123 : <nl> - # line 906 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 124 : <nl> + # line 933 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / named variable access w / bind parameter , continuation from * expansion , e . g . [ * ] . variable . @ reference <nl> auto node = static_cast < AstNode * > ( parser - > popStack ( ) ) ; <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBoundAttributeAccess ( node , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2896 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2926 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 124 : <nl> - # line 911 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 125 : <nl> + # line 938 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / indexed variable access , continuation from * expansion , e . g . [ * ] . variable [ index ] <nl> auto node = static_cast < AstNode * > ( parser - > popStack ( ) ) ; <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeIndexedAccess ( node , ( yyvsp [ - 1 ] . node ) ) ; <nl> } <nl> - # line 2906 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2936 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 125 : <nl> - # line 916 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 126 : <nl> + # line 943 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / named variable access , continuation from * expansion , e . g . [ * ] . variable . xx . reference <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeAttributeAccess ( ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . strval ) ) ; <nl> } <nl> - # line 2915 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2945 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 126 : <nl> - # line 920 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 127 : <nl> + # line 947 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / named variable access w / bind parameter , continuation from * expansion , e . g . [ * ] . variable . xx . @ reference <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeBoundAttributeAccess ( ( yyvsp [ - 2 ] . node ) , ( yyvsp [ 0 ] . node ) ) ; <nl> } <nl> - # line 2924 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2954 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 127 : <nl> - # line 924 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 128 : <nl> + # line 951 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> / / indexed variable access , continuation from * expansion , e . g . [ * ] . variable . xx . [ index ] <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeIndexedAccess ( ( yyvsp [ - 3 ] . node ) , ( yyvsp [ - 1 ] . node ) ) ; <nl> } <nl> - # line 2933 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2963 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 128 : <nl> - # line 931 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 129 : <nl> + # line 958 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2941 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2971 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 129 : <nl> - # line 934 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 130 : <nl> + # line 961 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2949 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2979 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 130 : <nl> - # line 940 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 131 : <nl> + # line 967 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2957 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 2987 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 131 : <nl> - # line 943 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 132 : <nl> + # line 970 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ( yyvsp [ 0 ] . strval ) = = nullptr ) { <nl> ABORT_OOM <nl> YYLTYPE yylloc = yyloc_default ; <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeValueDouble ( value ) ; <nl> } <nl> } <nl> - # line 2977 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3007 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 132 : <nl> - # line 960 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 133 : <nl> + # line 987 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeValueString ( ( yyvsp [ 0 ] . strval ) ) ; <nl> } <nl> - # line 2985 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3015 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 133 : <nl> - # line 963 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 134 : <nl> + # line 990 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = ( yyvsp [ 0 ] . node ) ; <nl> } <nl> - # line 2993 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3023 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 134 : <nl> - # line 966 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 135 : <nl> + # line 993 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeValueNull ( ) ; <nl> } <nl> - # line 3001 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3031 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 135 : <nl> - # line 969 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 136 : <nl> + # line 996 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeValueBool ( true ) ; <nl> } <nl> - # line 3009 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3039 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 136 : <nl> - # line 972 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 137 : <nl> + # line 999 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeValueBool ( false ) ; <nl> } <nl> - # line 3017 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3047 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 137 : <nl> - # line 978 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 138 : <nl> + # line 1005 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ( yyvsp [ 0 ] . strval ) = = nullptr ) { <nl> ABORT_OOM <nl> YYLTYPE yylloc = yyloc_default ; <nl> <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeCollection ( ( yyvsp [ 0 ] . strval ) ) ; <nl> } <nl> - # line 3029 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3059 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 138 : <nl> - # line 985 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 139 : <nl> + # line 1012 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ( yyvsp [ 0 ] . strval ) = = nullptr ) { <nl> ABORT_OOM <nl> YYLTYPE yylloc = yyloc_default ; <nl> <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeCollection ( ( yyvsp [ 0 ] . strval ) ) ; <nl> } <nl> - # line 3041 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3071 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 139 : <nl> - # line 992 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 140 : <nl> + # line 1019 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ( yyvsp [ 0 ] . strval ) = = nullptr ) { <nl> ABORT_OOM <nl> YYLTYPE yylloc = yyloc_default ; <nl> <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeParameter ( ( yyvsp [ 0 ] . strval ) ) ; <nl> } <nl> - # line 3057 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3087 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 140 : <nl> - # line 1006 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 141 : <nl> + # line 1033 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . node ) = parser - > ast ( ) - > createNodeParameter ( ( yyvsp [ 0 ] . strval ) ) ; <nl> } <nl> - # line 3065 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3095 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 141 : <nl> - # line 1012 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 142 : <nl> + # line 1039 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ( yyvsp [ 0 ] . strval ) = = nullptr ) { <nl> ABORT_OOM <nl> YYLTYPE yylloc = yyloc_default ; <nl> <nl> ( yyval . strval ) = ( yyvsp [ 0 ] . strval ) ; <nl> } <nl> - # line 3077 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3107 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 142 : <nl> - # line 1019 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 143 : <nl> + # line 1046 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ( yyvsp [ 0 ] . strval ) = = nullptr ) { <nl> ABORT_OOM <nl> YYLTYPE yylloc = yyloc_default ; <nl> <nl> ( yyval . strval ) = ( yyvsp [ 0 ] . strval ) ; <nl> } <nl> - # line 3089 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3119 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 143 : <nl> - # line 1028 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 144 : <nl> + # line 1055 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> ( yyval . strval ) = ( yyvsp [ 0 ] . strval ) ; <nl> } <nl> - # line 3097 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3127 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> - case 144 : <nl> - # line 1034 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> + case 145 : <nl> + # line 1061 " arangod / Aql / grammar . y " / * yacc . c : 1646 * / <nl> { <nl> if ( ( yyvsp [ 0 ] . strval ) = = nullptr ) { <nl> ABORT_OOM <nl> YYLTYPE yylloc = yyloc_default ; <nl> } <nl> } <nl> } <nl> - # line 3122 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3152 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> break ; <nl> <nl> <nl> - # line 3126 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> + # line 3156 " arangod / Aql / grammar . cpp " / * yacc . c : 1646 * / <nl> default : break ; <nl> } <nl> / * User semantic actions sometimes alter yychar , and that requires <nl> mmm a / arangod / Aql / grammar . y <nl> ppp b / arangod / Aql / grammar . y <nl> collect_statement : <nl> scopes - > start ( triagens : : aql : : AQL_SCOPE_COLLECT ) ; <nl> } <nl> <nl> - auto node = parser - > ast ( ) - > createNodeCollect ( parser - > ast ( ) - > createNodeList ( ) , $ 2 ) ; <nl> + auto node = parser - > ast ( ) - > createNodeCollectCount ( parser - > ast ( ) - > createNodeList ( ) , $ 2 ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> | collect_variable_list count_into { <nl> collect_statement : <nl> } <nl> } <nl> <nl> - auto node = parser - > ast ( ) - > createNodeCollect ( $ 1 , $ 2 ) ; <nl> + auto node = parser - > ast ( ) - > createNodeCollectCount ( $ 1 , $ 2 ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> | collect_variable_list optional_into optional_keep { <nl> collect_statement : <nl> auto node = parser - > ast ( ) - > createNodeCollect ( $ 1 , $ 2 , $ 3 ) ; <nl> parser - > ast ( ) - > addOperation ( node ) ; <nl> } <nl> + | collect_variable_list T_INTO variable_name T_ASSIGN expression { <nl> + auto scopes = parser - > ast ( ) - > scopes ( ) ; <nl> + <nl> + / / check if we are in the main scope <nl> + bool reRegisterVariables = ( scopes - > type ( ) ! = triagens : : aql : : AQL_SCOPE_MAIN ) ; <nl> + <nl> + if ( reRegisterVariables ) { <nl> + / / end the active scopes <nl> + scopes - > endNested ( ) ; <nl> + / / start a new scope <nl> + scopes - > start ( triagens : : aql : : AQL_SCOPE_COLLECT ) ; <nl> + <nl> + size_t const n = $ 1 - > numMembers ( ) ; <nl> + for ( size_t i = 0 ; i < n ; + + i ) { <nl> + auto member = $ 1 - > getMember ( i ) ; <nl> + <nl> + if ( member ! = nullptr ) { <nl> + TRI_ASSERT ( member - > type = = NODE_TYPE_ASSIGN ) ; <nl> + auto v = static_cast < Variable * > ( member - > getMember ( 0 ) - > getData ( ) ) ; <nl> + scopes - > addVariable ( v ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + auto node = parser - > ast ( ) - > createNodeCollectExpression ( $ 1 , $ 3 , $ 5 ) ; <nl> + parser - > ast ( ) - > addOperation ( node ) ; <nl> + } <nl> ; <nl> <nl> collect_list : <nl> new file mode 100644 <nl> index 00000000000 . . 3e5d3c50999 <nl> mmm / dev / null <nl> ppp b / js / server / tests / aql - optimizer - collect - into . js <nl> <nl> + / * jshint strict : false , maxlen : 500 * / <nl> + / * global require , assertTrue , assertFalse , assertEqual , AQL_EXECUTE * / <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief tests for COLLECT w / INTO var = expr <nl> + / / / <nl> + / / / @ file <nl> + / / / <nl> + / / / DISCLAIMER <nl> + / / / <nl> + / / / Copyright 2010 - 2012 triagens GmbH , Cologne , Germany <nl> + / / / <nl> + / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + / / / you may not use this file except in compliance with the License . <nl> + / / / 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 Jan Steemann <nl> + / / / @ author Copyright 2012 , triAGENS GmbH , Cologne , Germany <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + var jsunity = require ( " jsunity " ) ; <nl> + var internal = require ( " internal " ) ; <nl> + var errors = internal . errors ; <nl> + var db = require ( " org / arangodb " ) . db ; <nl> + var helper = require ( " org / arangodb / aql - helper " ) ; <nl> + var assertQueryError = helper . assertQueryError ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief test suite <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + function optimizerCollectExpressionTestSuite ( ) { <nl> + var c ; <nl> + <nl> + return { <nl> + setUp : function ( ) { <nl> + db . _drop ( " UnitTestsCollection " ) ; <nl> + c = db . _create ( " UnitTestsCollection " ) ; <nl> + <nl> + for ( var i = 0 ; i < 1000 ; + + i ) { <nl> + c . save ( { gender : ( i % 2 = = 0 ? " m " : " f " ) , age : 11 + ( i % 71 ) , value : i } ) ; <nl> + } <nl> + } , <nl> + <nl> + tearDown : function ( ) { <nl> + db . _drop ( " UnitTestsCollection " ) ; <nl> + } , <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief test expression <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + testReference : function ( ) { <nl> + var query = " FOR i IN " + c . name ( ) + " COLLECT gender = i . gender INTO docs = i RETURN { gender : gender , age : MIN ( docs [ * ] . age ) } " ; <nl> + <nl> + var results = AQL_EXECUTE ( query ) ; <nl> + assertEqual ( 2 , results . json . length ) ; <nl> + assertEqual ( " f " , results . json [ 0 ] . gender ) ; <nl> + assertEqual ( 11 , results . json [ 0 ] . age ) ; <nl> + assertEqual ( " m " , results . json [ 1 ] . gender ) ; <nl> + assertEqual ( 11 , results . json [ 1 ] . age ) ; <nl> + } , <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief test expression <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + testSubAttribute : function ( ) { <nl> + var query = " FOR i IN " + c . name ( ) + " COLLECT gender = i . gender INTO ages = i . age RETURN { gender : gender , age : MIN ( ages ) } " ; <nl> + <nl> + var results = AQL_EXECUTE ( query ) ; <nl> + assertEqual ( 2 , results . json . length ) ; <nl> + assertEqual ( " f " , results . json [ 0 ] . gender ) ; <nl> + assertEqual ( 11 , results . json [ 0 ] . age ) ; <nl> + assertEqual ( " m " , results . json [ 1 ] . gender ) ; <nl> + assertEqual ( 11 , results . json [ 1 ] . age ) ; <nl> + } , <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief test expression <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + testConst : function ( ) { <nl> + var query = " FOR i IN " + c . name ( ) + " COLLECT gender = i . gender INTO values = 1 RETURN { gender : gender , values : values } " ; <nl> + <nl> + var values = [ ] ; <nl> + for ( var i = 0 ; i < 500 ; + + i ) { <nl> + values . push ( 1 ) ; <nl> + } <nl> + <nl> + var results = AQL_EXECUTE ( query ) ; <nl> + assertEqual ( 2 , results . json . length ) ; <nl> + assertEqual ( " f " , results . json [ 0 ] . gender ) ; <nl> + assertEqual ( values , results . json [ 0 ] . values ) ; <nl> + assertEqual ( " m " , results . json [ 1 ] . gender ) ; <nl> + assertEqual ( values , results . json [ 1 ] . values ) ; <nl> + } , <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief test expression <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + testDocAttribute : function ( ) { <nl> + var query = " FOR i IN " + c . name ( ) + " COLLECT gender = i . gender INTO values = i . value RETURN { gender : gender , values : values } " ; <nl> + <nl> + var f = [ ] , m = [ ] ; <nl> + for ( var i = 0 ; i < 500 ; + + i ) { <nl> + m . push ( i * 2 ) ; <nl> + f . push ( ( i * 2 ) + 1 ) ; <nl> + } <nl> + <nl> + var results = AQL_EXECUTE ( query ) ; <nl> + assertEqual ( 2 , results . json . length ) ; <nl> + assertEqual ( " f " , results . json [ 0 ] . gender ) ; <nl> + assertEqual ( f , results . json [ 0 ] . values . sort ( function ( l , r ) { return l - r ; } ) ) ; <nl> + assertEqual ( " m " , results . json [ 1 ] . gender ) ; <nl> + assertEqual ( m , results . json [ 1 ] . values . sort ( function ( l , r ) { return l - r ; } ) ) ; <nl> + } , <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief test expression <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + testCalculation : function ( ) { <nl> + var query = " FOR i IN " + c . name ( ) + " COLLECT gender = i . gender INTO names = ( i . gender = = ' f ' ? ' female ' : ' male ' ) RETURN { gender : gender , names : names } " ; <nl> + <nl> + var m = [ ] , f = [ ] ; <nl> + for ( var i = 0 ; i < 500 ; + + i ) { <nl> + m . push ( ' male ' ) ; <nl> + f . push ( ' female ' ) ; <nl> + } <nl> + <nl> + var results = AQL_EXECUTE ( query ) ; <nl> + assertEqual ( 2 , results . json . length ) ; <nl> + assertEqual ( " f " , results . json [ 0 ] . gender ) ; <nl> + assertEqual ( f , results . json [ 0 ] . names ) ; <nl> + assertEqual ( " m " , results . json [ 1 ] . gender ) ; <nl> + assertEqual ( m , results . json [ 1 ] . names ) ; <nl> + } <nl> + <nl> + } ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief executes the test suite <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + jsunity . run ( optimizerCollectExpressionTestSuite ) ; <nl> + <nl> + return jsunity . done ( ) ; <nl> + <nl> + / / Local Variables : <nl> + / / mode : outline - minor <nl> + / / outline - regexp : " ^ \ \ ( / / / @ brief \ \ | / / / @ addtogroup \ \ | / / - - SECTION - - \ \ | / / / @ page \ \ | / / / @ } \ \ ) " <nl> + / / End : <nl>
added more collect special cases
arangodb/arangodb
dd60e53ce3d98c26eba471254beaf76717ac4616
2014-12-16T21:52:33Z
mmm a / benchmark / CMakeLists . txt <nl> ppp b / benchmark / CMakeLists . txt <nl> <nl> include_directories ( . linux ) <nl> - link_libraries ( simdjson simdjson - flags simdjson - windows - headers test - data ) <nl> + link_libraries ( simdjson - windows - headers test - data ) <nl> + <nl> + <nl> + if ( TARGET benchmark : : benchmark ) <nl> + add_executable ( bench_sax bench_sax . cpp ) <nl> + target_link_libraries ( bench_sax simdjson - internal - flags simdjson - include - source benchmark : : benchmark ) <nl> + endif ( TARGET benchmark : : benchmark ) <nl> + <nl> + link_libraries ( simdjson simdjson - flags ) <nl> add_executable ( benchfeatures benchfeatures . cpp ) <nl> add_executable ( get_corpus_benchmark get_corpus_benchmark . cpp ) <nl> add_executable ( perfdiff perfdiff . cpp ) <nl> target_compile_definitions ( parse_nonumberparsing PRIVATE SIMDJSON_SKIPNUMBERPARS <nl> add_executable ( parse_nostringparsing parse . cpp ) <nl> target_compile_definitions ( parse_nostringparsing PRIVATE SIMDJSON_SKIPSTRINGPARSING ) <nl> <nl> - if ( TARGET benchmark : : benchmark ) <nl> - link_libraries ( benchmark : : benchmark ) <nl> - add_executable ( bench_parse_call bench_parse_call . cpp ) <nl> - add_executable ( bench_dom_api bench_dom_api . cpp ) <nl> - endif ( ) <nl> - <nl> if ( TARGET competition - all ) <nl> add_executable ( distinctuseridcompetition distinctuseridcompetition . cpp ) <nl> target_link_libraries ( distinctuseridcompetition competition - core ) <nl> if ( TARGET competition - all ) <nl> target_compile_definitions ( allparsingcompetition PRIVATE ALLPARSER ) <nl> endif ( ) <nl> <nl> + if ( TARGET benchmark : : benchmark ) <nl> + link_libraries ( benchmark : : benchmark ) <nl> + add_executable ( bench_parse_call bench_parse_call . cpp ) <nl> + add_executable ( bench_dom_api bench_dom_api . cpp ) <nl> + endif ( ) <nl> + <nl> include ( checkperf . cmake ) <nl> mmm a / benchmark / bench_dom_api . cpp <nl> ppp b / benchmark / bench_dom_api . cpp <nl> static void recover_one_string ( State & state ) { <nl> return ; <nl> } <nl> dom : : element doc ; <nl> - if ( error = parser . parse ( docdata ) . get ( doc ) ) { <nl> + if ( ( error = parser . parse ( docdata ) . get ( doc ) ) ) { <nl> cerr < < " could not parse string " < < error < < endl ; <nl> return ; <nl> } <nl> static void serialize_twitter ( State & state ) { <nl> return ; <nl> } <nl> / / we do not want mem . alloc . in the loop . <nl> - error = parser . allocate ( docdata . size ( ) ) ; <nl> - if ( error ) { <nl> + if ( ( error = parser . allocate ( docdata . size ( ) ) ) ) { <nl> cout < < error < < endl ; <nl> return ; <nl> } <nl> new file mode 100644 <nl> index 000000000 . . 0965aeb68 <nl> mmm / dev / null <nl> ppp b / benchmark / bench_sax . cpp <nl> <nl> + # define SIMDJSON_IMPLEMENTATION_FALLBACK 0 <nl> + # define SIMDJSON_IMPLEMENTATION_WESTMERE 0 <nl> + # define SIMDJSON_IMPLEMENTATION_AMD64 0 <nl> + <nl> + # include < iostream > <nl> + # include < sstream > <nl> + # include < random > <nl> + <nl> + # include " simdjson . h " <nl> + <nl> + SIMDJSON_PUSH_DISABLE_ALL_WARNINGS <nl> + # include < benchmark / benchmark . h > <nl> + SIMDJSON_POP_DISABLE_WARNINGS <nl> + <nl> + # include " simdjson . cpp " <nl> + <nl> + # if SIMDJSON_EXCEPTIONS <nl> + <nl> + using namespace benchmark ; <nl> + using namespace simdjson ; <nl> + using std : : cerr ; <nl> + using std : : endl ; <nl> + <nl> + const char * TWITTER_JSON = SIMDJSON_BENCHMARK_DATA_DIR " twitter . json " ; <nl> + const int REPETITIONS = 10 ; <nl> + <nl> + # if SIMDJSON_IMPLEMENTATION_HASWELL <nl> + <nl> + # include " twitter / sax_tweet_reader . h " <nl> + <nl> + static void sax_tweets ( State & state ) { <nl> + / / Load twitter . json to a buffer <nl> + padded_string json ; <nl> + if ( auto error = padded_string : : load ( TWITTER_JSON ) . get ( json ) ) { cerr < < error < < endl ; return ; } <nl> + <nl> + / / Allocate <nl> + twitter : : sax_tweet_reader reader ; <nl> + if ( auto error = reader . set_capacity ( json . size ( ) ) ) { cerr < < error < < endl ; return ; } <nl> + <nl> + / / Warm the vector <nl> + if ( auto error = reader . read_tweets ( json ) ) { throw error ; } <nl> + <nl> + / / Read tweets <nl> + size_t bytes = 0 ; <nl> + size_t tweets = 0 ; <nl> + for ( SIMDJSON_UNUSED auto _ : state ) { <nl> + if ( auto error = reader . read_tweets ( json ) ) { throw error ; } <nl> + bytes + = json . size ( ) ; <nl> + tweets + = reader . tweets . size ( ) ; <nl> + } <nl> + / / Gigabyte : https : / / en . wikipedia . org / wiki / Gigabyte <nl> + state . counters [ " Gigabytes " ] = benchmark : : Counter ( <nl> + double ( bytes ) , benchmark : : Counter : : kIsRate , <nl> + benchmark : : Counter : : OneK : : kIs1000 ) ; / / For GiB : kIs1024 <nl> + state . counters [ " docs " ] = Counter ( double ( state . iterations ( ) ) , benchmark : : Counter : : kIsRate ) ; <nl> + state . counters [ " tweets " ] = Counter ( double ( tweets ) , benchmark : : Counter : : kIsRate ) ; <nl> + } <nl> + BENCHMARK ( sax_tweets ) - > Repetitions ( REPETITIONS ) - > ComputeStatistics ( " max " , [ ] ( const std : : vector < double > & v ) - > double { <nl> + return * ( std : : max_element ( std : : begin ( v ) , std : : end ( v ) ) ) ; <nl> + } ) - > DisplayAggregatesOnly ( true ) ; <nl> + <nl> + # endif / / SIMDJSON_IMPLEMENTATION_HASWELL <nl> + <nl> + # include " twitter / tweet . h " <nl> + <nl> + simdjson_really_inline uint64_t nullable_int ( dom : : element element ) { <nl> + if ( element . is_null ( ) ) { return 0 ; } <nl> + return element ; <nl> + } <nl> + simdjson_really_inline void read_dom_tweets ( dom : : parser & parser , padded_string & json , std : : vector < twitter : : tweet > & tweets ) { <nl> + for ( dom : : element tweet : parser . parse ( json ) [ " statuses " ] ) { <nl> + auto user = tweet [ " user " ] ; <nl> + tweets . push_back ( <nl> + { <nl> + tweet [ " id " ] , <nl> + tweet [ " text " ] , <nl> + tweet [ " created_at " ] , <nl> + nullable_int ( tweet [ " in_reply_to_status_id " ] ) , <nl> + tweet [ " retweet_count " ] , <nl> + tweet [ " favorite_count " ] , <nl> + { user [ " id " ] , user [ " screen_name " ] } <nl> + } <nl> + ) ; <nl> + } <nl> + } <nl> + <nl> + static void dom_tweets ( State & state ) { <nl> + / / Load twitter . json to a buffer <nl> + padded_string json ; <nl> + if ( auto error = padded_string : : load ( TWITTER_JSON ) . get ( json ) ) { cerr < < error < < endl ; return ; } <nl> + <nl> + / / Allocate <nl> + dom : : parser parser ; <nl> + if ( auto error = parser . allocate ( json . size ( ) ) ) { cerr < < error < < endl ; return ; } ; <nl> + <nl> + / / Warm the vector <nl> + std : : vector < twitter : : tweet > tweets ; <nl> + read_dom_tweets ( parser , json , tweets ) ; <nl> + <nl> + / / Read tweets <nl> + size_t bytes = 0 ; <nl> + size_t num_tweets = 0 ; <nl> + for ( SIMDJSON_UNUSED auto _ : state ) { <nl> + tweets . clear ( ) ; <nl> + read_dom_tweets ( parser , json , tweets ) ; <nl> + bytes + = json . size ( ) ; <nl> + num_tweets + = tweets . size ( ) ; <nl> + } <nl> + / / Gigabyte : https : / / en . wikipedia . org / wiki / Gigabyte <nl> + state . counters [ " Gigabytes " ] = benchmark : : Counter ( <nl> + double ( bytes ) , benchmark : : Counter : : kIsRate , <nl> + benchmark : : Counter : : OneK : : kIs1000 ) ; / / For GiB : kIs1024 <nl> + state . counters [ " docs " ] = Counter ( double ( state . iterations ( ) ) , benchmark : : Counter : : kIsRate ) ; <nl> + state . counters [ " tweets " ] = Counter ( double ( num_tweets ) , benchmark : : Counter : : kIsRate ) ; <nl> + } <nl> + BENCHMARK ( dom_tweets ) - > Repetitions ( REPETITIONS ) - > ComputeStatistics ( " max " , [ ] ( const std : : vector < double > & v ) - > double { <nl> + return * ( std : : max_element ( std : : begin ( v ) , std : : end ( v ) ) ) ; <nl> + } ) - > DisplayAggregatesOnly ( true ) ; <nl> + <nl> + static void dom_parse ( State & state ) { <nl> + / / Load twitter . json to a buffer <nl> + padded_string json ; <nl> + if ( auto error = padded_string : : load ( TWITTER_JSON ) . get ( json ) ) { cerr < < error < < endl ; return ; } <nl> + <nl> + / / Allocate <nl> + dom : : parser parser ; <nl> + if ( auto error = parser . allocate ( json . size ( ) ) ) { cerr < < error < < endl ; return ; } ; <nl> + <nl> + / / Read tweets <nl> + size_t bytes = 0 ; <nl> + for ( SIMDJSON_UNUSED auto _ : state ) { <nl> + if ( parser . parse ( json ) . error ( ) ) { throw " Parsing failed " ; } ; <nl> + bytes + = json . size ( ) ; <nl> + } <nl> + / / Gigabyte : https : / / en . wikipedia . org / wiki / Gigabyte <nl> + state . counters [ " Gigabytes " ] = benchmark : : Counter ( <nl> + double ( bytes ) , benchmark : : Counter : : kIsRate , <nl> + benchmark : : Counter : : OneK : : kIs1000 ) ; / / For GiB : kIs1024 <nl> + state . counters [ " docs " ] = Counter ( double ( state . iterations ( ) ) , benchmark : : Counter : : kIsRate ) ; <nl> + } <nl> + BENCHMARK ( dom_parse ) - > Repetitions ( REPETITIONS ) - > ComputeStatistics ( " max " , [ ] ( const std : : vector < double > & v ) - > double { <nl> + return * ( std : : max_element ( std : : begin ( v ) , std : : end ( v ) ) ) ; <nl> + } ) - > DisplayAggregatesOnly ( true ) ; <nl> + <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * <nl> + * Large file parsing benchmarks : <nl> + * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + static std : : string build_json_array ( size_t N ) { <nl> + std : : default_random_engine e ; <nl> + std : : uniform_real_distribution < > dis ( 0 , 1 ) ; <nl> + std : : stringstream myss ; <nl> + myss < < " [ " < < std : : endl ; <nl> + if ( N > 0 ) { <nl> + myss < < " { \ " x \ " : " < < dis ( e ) < < " , \ " y \ " : " < < dis ( e ) < < " , \ " z \ " : " < < dis ( e ) < < " } " < < std : : endl ; <nl> + } <nl> + for ( size_t i = 1 ; i < N ; i + + ) { <nl> + myss < < " , " < < std : : endl ; <nl> + myss < < " { \ " x \ " : " < < dis ( e ) < < " , \ " y \ " : " < < dis ( e ) < < " , \ " z \ " : " < < dis ( e ) < < " } " ; <nl> + } <nl> + myss < < std : : endl ; <nl> + myss < < " ] " < < std : : endl ; <nl> + std : : string answer = myss . str ( ) ; <nl> + std : : cout < < " Creating a source file spanning " < < ( answer . size ( ) + 512 ) / 1024 < < " KB " < < std : : endl ; <nl> + return answer ; <nl> + } <nl> + <nl> + static const simdjson : : padded_string & get_my_json_str ( ) { <nl> + static simdjson : : padded_string s = build_json_array ( 1000000 ) ; <nl> + return s ; <nl> + } <nl> + <nl> + struct my_point { <nl> + double x ; <nl> + double y ; <nl> + double z ; <nl> + } ; <nl> + <nl> + / / . / benchmark / bench_sax - - benchmark_filter = largerandom <nl> + <nl> + <nl> + / * * * <nl> + * We start with the naive DOM - based approach . <nl> + * * / <nl> + static void dom_parse_largerandom ( State & state ) { <nl> + / / Load twitter . json to a buffer <nl> + const padded_string & json = get_my_json_str ( ) ; <nl> + <nl> + / / Allocate <nl> + dom : : parser parser ; <nl> + if ( auto error = parser . allocate ( json . size ( ) ) ) { cerr < < error < < endl ; return ; } ; <nl> + <nl> + / / Read <nl> + size_t bytes = 0 ; <nl> + simdjson : : error_code error ; <nl> + for ( SIMDJSON_UNUSED auto _ : state ) { <nl> + std : : vector < my_point > container ; <nl> + dom : : element doc ; <nl> + if ( ( error = parser . parse ( json ) . get ( doc ) ) ) { <nl> + std : : cerr < < " failure : " < < error < < std : : endl ; <nl> + throw " Parsing failed " ; <nl> + } ; <nl> + for ( auto p : doc ) { <nl> + container . emplace_back ( my_point { p [ " x " ] , p [ " y " ] , p [ " z " ] } ) ; <nl> + } <nl> + bytes + = json . size ( ) ; <nl> + benchmark : : DoNotOptimize ( container . data ( ) ) ; <nl> + <nl> + } <nl> + / / Gigabyte : https : / / en . wikipedia . org / wiki / Gigabyte <nl> + state . counters [ " Gigabytes " ] = benchmark : : Counter ( <nl> + double ( bytes ) , benchmark : : Counter : : kIsRate , <nl> + benchmark : : Counter : : OneK : : kIs1000 ) ; / / For GiB : kIs1024 <nl> + state . counters [ " docs " ] = Counter ( double ( state . iterations ( ) ) , benchmark : : Counter : : kIsRate ) ; <nl> + } <nl> + <nl> + BENCHMARK ( dom_parse_largerandom ) - > Repetitions ( REPETITIONS ) - > ComputeStatistics ( " max " , [ ] ( const std : : vector < double > & v ) - > double { <nl> + return * ( std : : max_element ( std : : begin ( v ) , std : : end ( v ) ) ) ; <nl> + } ) - > DisplayAggregatesOnly ( true ) ; <nl> + <nl> + # if SIMDJSON_IMPLEMENTATION_HASWELL <nl> + <nl> + / * * * <nl> + * Next we are going to code the SAX approach . <nl> + * * / <nl> + <nl> + SIMDJSON_TARGET_HASWELL <nl> + <nl> + namespace largerandom { <nl> + namespace { <nl> + <nl> + using namespace simdjson ; <nl> + using namespace haswell ; <nl> + using namespace haswell : : stage2 ; <nl> + struct sax_point_reader_visitor { <nl> + public : <nl> + sax_point_reader_visitor ( std : : vector < my_point > & _points ) : points ( _points ) { <nl> + } <nl> + <nl> + simdjson_really_inline error_code visit_document_start ( json_iterator & ) { return SUCCESS ; } <nl> + simdjson_really_inline error_code visit_object_start ( json_iterator & ) { return SUCCESS ; } <nl> + simdjson_really_inline error_code visit_key ( json_iterator & , const uint8_t * key ) { <nl> + switch ( key [ 0 ] ) { <nl> + case ' x ' : <nl> + idx = 0 ; <nl> + break ; <nl> + case ' y ' : <nl> + idx = 2 ; <nl> + break ; <nl> + case ' z ' : <nl> + idx = 3 ; <nl> + break ; <nl> + } <nl> + return SUCCESS ; <nl> + } <nl> + simdjson_really_inline error_code visit_primitive ( json_iterator & , const uint8_t * value ) { <nl> + return numberparsing : : parse_double ( value ) . get ( buffer [ idx ] ) ; <nl> + } <nl> + simdjson_really_inline error_code visit_array_start ( json_iterator & ) { return SUCCESS ; } <nl> + simdjson_really_inline error_code visit_array_end ( json_iterator & ) { return SUCCESS ; } <nl> + simdjson_really_inline error_code visit_object_end ( json_iterator & ) { return SUCCESS ; } <nl> + simdjson_really_inline error_code visit_document_end ( json_iterator & ) { return SUCCESS ; } <nl> + simdjson_really_inline error_code visit_empty_array ( json_iterator & ) { return SUCCESS ; } <nl> + simdjson_really_inline error_code visit_empty_object ( json_iterator & ) { return SUCCESS ; } <nl> + simdjson_really_inline error_code visit_root_primitive ( json_iterator & , const uint8_t * ) { return SUCCESS ; } <nl> + simdjson_really_inline error_code increment_count ( json_iterator & ) { return SUCCESS ; } <nl> + std : : vector < my_point > & points ; <nl> + size_t idx { 0 } ; <nl> + double buffer [ 3 ] ; <nl> + } ; <nl> + <nl> + struct sax_point_reader { <nl> + std : : vector < my_point > points ; <nl> + std : : unique_ptr < uint8_t [ ] > string_buf ; <nl> + size_t capacity ; <nl> + dom_parser_implementation dom_parser ; <nl> + <nl> + sax_point_reader ( ) ; <nl> + error_code set_capacity ( size_t new_capacity ) ; <nl> + error_code read_points ( const padded_string & json ) ; <nl> + } ; / / struct sax_point_reader <nl> + <nl> + sax_point_reader : : sax_point_reader ( ) : points { } , string_buf { } , capacity { 0 } , dom_parser ( ) { <nl> + } <nl> + <nl> + error_code sax_point_reader : : set_capacity ( size_t new_capacity ) { <nl> + / / string_capacity copied from document : : allocate <nl> + size_t string_capacity = SIMDJSON_ROUNDUP_N ( 5 * new_capacity / 3 + 32 , 64 ) ; <nl> + string_buf . reset ( new ( std : : nothrow ) uint8_t [ string_capacity ] ) ; <nl> + if ( auto error = dom_parser . set_capacity ( new_capacity ) ) { return error ; } <nl> + if ( capacity = = 0 ) { / / set max depth the first time only <nl> + if ( auto error = dom_parser . set_max_depth ( DEFAULT_MAX_DEPTH ) ) { return error ; } <nl> + } <nl> + capacity = new_capacity ; <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + error_code sax_point_reader : : read_points ( const padded_string & json ) { <nl> + / / Allocate capacity if needed <nl> + points . clear ( ) ; <nl> + if ( capacity < json . size ( ) ) { <nl> + if ( auto error = set_capacity ( capacity ) ) { return error ; } <nl> + } <nl> + <nl> + / / Run stage 1 first . <nl> + if ( auto error = dom_parser . stage1 ( ( uint8_t * ) json . data ( ) , json . size ( ) , false ) ) { return error ; } <nl> + <nl> + / / Then walk the document , parsing the tweets as we go <nl> + json_iterator iter ( dom_parser , 0 ) ; <nl> + sax_point_reader_visitor visitor ( points ) ; <nl> + if ( auto error = iter . walk_document < false > ( visitor ) ) { return error ; } <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + } / / unnamed namespace <nl> + } / / namespace largerandom <nl> + <nl> + SIMDJSON_UNTARGET_REGION <nl> + <nl> + <nl> + <nl> + <nl> + <nl> + / / . / benchmark / bench_sax - - benchmark_filter = largerandom <nl> + static void sax_parse_largerandom ( State & state ) { <nl> + / / Load twitter . json to a buffer <nl> + const padded_string & json = get_my_json_str ( ) ; <nl> + <nl> + / / Allocate <nl> + largerandom : : sax_point_reader reader ; <nl> + if ( auto error = reader . set_capacity ( json . size ( ) ) ) { throw error ; } <nl> + / / warming <nl> + for ( size_t i = 0 ; i < 10 ; i + + ) { <nl> + if ( auto error = reader . read_points ( json ) ) { throw error ; } <nl> + } <nl> + <nl> + / / Read <nl> + size_t bytes = 0 ; <nl> + for ( SIMDJSON_UNUSED auto _ : state ) { <nl> + if ( auto error = reader . read_points ( json ) ) { throw error ; } <nl> + bytes + = json . size ( ) ; <nl> + benchmark : : DoNotOptimize ( reader . points . data ( ) ) ; <nl> + } <nl> + / / Gigabyte : https : / / en . wikipedia . org / wiki / Gigabyte <nl> + state . counters [ " Gigabytes " ] = benchmark : : Counter ( <nl> + double ( bytes ) , benchmark : : Counter : : kIsRate , <nl> + benchmark : : Counter : : OneK : : kIs1000 ) ; / / For GiB : kIs1024 <nl> + state . counters [ " docs " ] = Counter ( double ( state . iterations ( ) ) , benchmark : : Counter : : kIsRate ) ; <nl> + } <nl> + BENCHMARK ( sax_parse_largerandom ) - > Repetitions ( REPETITIONS ) - > ComputeStatistics ( " max " , [ ] ( const std : : vector < double > & v ) - > double { <nl> + return * ( std : : max_element ( std : : begin ( v ) , std : : end ( v ) ) ) ; <nl> + } ) - > DisplayAggregatesOnly ( true ) ; <nl> + <nl> + # endif / / SIMDJSON_IMPLEMENTATION_HASWELL <nl> + <nl> + # endif / / SIMDJSON_EXCEPTIONS <nl> + <nl> + BENCHMARK_MAIN ( ) ; <nl> new file mode 100644 <nl> index 000000000 . . cbdc468fc <nl> mmm / dev / null <nl> ppp b / benchmark / twitter / sax_tweet_reader . h <nl> <nl> + # ifndef TWITTER_SAX_TWEET_READER_H <nl> + # define TWITTER_SAX_TWEET_READER_H <nl> + <nl> + # include " simdjson . h " <nl> + # include " sax_tweet_reader_visitor . h " <nl> + # include " tweet . h " <nl> + # include < vector > <nl> + <nl> + SIMDJSON_TARGET_HASWELL <nl> + <nl> + namespace twitter { <nl> + namespace { <nl> + <nl> + using namespace simdjson ; <nl> + using namespace haswell ; <nl> + using namespace haswell : : stage2 ; <nl> + <nl> + struct sax_tweet_reader { <nl> + std : : vector < tweet > tweets ; <nl> + std : : unique_ptr < uint8_t [ ] > string_buf ; <nl> + size_t capacity ; <nl> + dom_parser_implementation dom_parser ; <nl> + <nl> + sax_tweet_reader ( ) ; <nl> + error_code set_capacity ( size_t new_capacity ) ; <nl> + error_code read_tweets ( padded_string & json ) ; <nl> + } ; / / struct tweet_reader <nl> + <nl> + sax_tweet_reader : : sax_tweet_reader ( ) : tweets { } , string_buf { } , capacity { 0 } , dom_parser ( ) { <nl> + } <nl> + <nl> + error_code sax_tweet_reader : : set_capacity ( size_t new_capacity ) { <nl> + / / string_capacity copied from document : : allocate <nl> + size_t string_capacity = SIMDJSON_ROUNDUP_N ( 5 * new_capacity / 3 + 32 , 64 ) ; <nl> + string_buf . reset ( new ( std : : nothrow ) uint8_t [ string_capacity ] ) ; <nl> + if ( auto error = dom_parser . set_capacity ( new_capacity ) ) { return error ; } <nl> + if ( capacity = = 0 ) { / / set max depth the first time only <nl> + if ( auto error = dom_parser . set_max_depth ( DEFAULT_MAX_DEPTH ) ) { return error ; } <nl> + } <nl> + capacity = new_capacity ; <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + / / NOTE : this assumes the dom_parser is already allocated <nl> + error_code sax_tweet_reader : : read_tweets ( padded_string & json ) { <nl> + / / Allocate capacity if needed <nl> + tweets . clear ( ) ; <nl> + if ( capacity < json . size ( ) ) { <nl> + if ( auto error = set_capacity ( capacity ) ) { return error ; } <nl> + } <nl> + <nl> + / / Run stage 1 first . <nl> + if ( auto error = dom_parser . stage1 ( ( uint8_t * ) json . data ( ) , json . size ( ) , false ) ) { return error ; } <nl> + <nl> + / / Then walk the document , parsing the tweets as we go <nl> + json_iterator iter ( dom_parser , 0 ) ; <nl> + sax_tweet_reader_visitor visitor ( tweets , string_buf . get ( ) ) ; <nl> + if ( auto error = iter . walk_document < false > ( visitor ) ) { return error ; } <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + } / / unnamed namespace <nl> + } / / namespace twitter <nl> + <nl> + SIMDJSON_UNTARGET_REGION <nl> + <nl> + # endif / / TWITTER_SAX_TWEET_READER_H <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000 . . 330f07432 <nl> mmm / dev / null <nl> ppp b / benchmark / twitter / sax_tweet_reader_visitor . h <nl> <nl> + # ifndef TWITTER_SAX_TWEET_READER_VISITOR_H <nl> + # define TWITTER_SAX_TWEET_READER_VISITOR_H <nl> + <nl> + # include " simdjson . h " <nl> + # include " tweet . h " <nl> + # include < vector > <nl> + <nl> + SIMDJSON_TARGET_HASWELL <nl> + <nl> + namespace twitter { <nl> + <nl> + using namespace simdjson ; <nl> + using namespace haswell ; <nl> + using namespace haswell : : stage2 ; <nl> + <nl> + struct sax_tweet_reader_visitor { <nl> + public : <nl> + sax_tweet_reader_visitor ( std : : vector < tweet > & _tweets , uint8_t * string_buf ) ; <nl> + <nl> + simdjson_really_inline error_code visit_document_start ( json_iterator & iter ) ; <nl> + simdjson_really_inline error_code visit_object_start ( json_iterator & iter ) ; <nl> + simdjson_really_inline error_code visit_key ( json_iterator & iter , const uint8_t * key ) ; <nl> + simdjson_really_inline error_code visit_primitive ( json_iterator & iter , const uint8_t * value ) ; <nl> + simdjson_really_inline error_code visit_array_start ( json_iterator & iter ) ; <nl> + simdjson_really_inline error_code visit_array_end ( json_iterator & iter ) ; <nl> + simdjson_really_inline error_code visit_object_end ( json_iterator & iter ) ; <nl> + simdjson_really_inline error_code visit_document_end ( json_iterator & iter ) ; <nl> + simdjson_really_inline error_code visit_empty_array ( json_iterator & iter ) ; <nl> + simdjson_really_inline error_code visit_empty_object ( json_iterator & iter ) ; <nl> + simdjson_really_inline error_code visit_root_primitive ( json_iterator & iter , const uint8_t * value ) ; <nl> + simdjson_really_inline error_code increment_count ( json_iterator & iter ) ; <nl> + <nl> + private : <nl> + / / Since we only care about one thing at each level , we just use depth as the marker for what <nl> + / / object / array we ' re nested inside . <nl> + enum class containers { <nl> + document = 0 , / / <nl> + top_object = 1 , / / { <nl> + statuses = 2 , / / { " statuses " : [ <nl> + tweet = 3 , / / { " statuses " : [ { <nl> + user = 4 / / { " statuses " : [ { " user " : { <nl> + } ; <nl> + / * * <nl> + * The largest depth we care about . <nl> + * There can be things at lower depths . <nl> + * / <nl> + static constexpr uint32_t MAX_SUPPORTED_DEPTH = uint32_t ( containers : : user ) ; <nl> + static constexpr const char * STATE_NAMES [ ] = { <nl> + " document " , <nl> + " top object " , <nl> + " statuses " , <nl> + " tweet " , <nl> + " user " <nl> + } ; <nl> + enum class field_type { <nl> + any , <nl> + unsigned_integer , <nl> + string , <nl> + nullable_unsigned_integer , <nl> + object , <nl> + array <nl> + } ; <nl> + struct field { <nl> + const char * key { } ; <nl> + size_t len { 0 } ; <nl> + size_t offset ; <nl> + containers container { containers : : document } ; <nl> + field_type type { field_type : : any } ; <nl> + } ; <nl> + <nl> + containers container { containers : : document } ; <nl> + std : : vector < tweet > & tweets ; <nl> + uint8_t * current_string_buf_loc ; <nl> + const uint8_t * current_key { } ; <nl> + <nl> + simdjson_really_inline bool in_container ( json_iterator & iter ) ; <nl> + simdjson_really_inline bool in_container_child ( json_iterator & iter ) ; <nl> + simdjson_really_inline void start_container ( json_iterator & iter ) ; <nl> + simdjson_really_inline void end_container ( json_iterator & iter ) ; <nl> + simdjson_really_inline error_code parse_nullable_unsigned ( json_iterator & iter , const uint8_t * value , const field & f ) ; <nl> + simdjson_really_inline error_code parse_unsigned ( json_iterator & iter , const uint8_t * value , const field & f ) ; <nl> + simdjson_really_inline error_code parse_string ( json_iterator & iter , const uint8_t * value , const field & f ) ; <nl> + <nl> + struct field_lookup { <nl> + field entries [ 256 ] { } ; <nl> + <nl> + field_lookup ( ) ; <nl> + simdjson_really_inline field get ( const uint8_t * key , containers container ) ; <nl> + private : <nl> + simdjson_really_inline uint8_t hash ( const char * key , uint32_t depth ) ; <nl> + simdjson_really_inline void add ( const char * key , size_t len , containers container , field_type type , size_t offset ) ; <nl> + simdjson_really_inline void neg ( const char * const key , uint32_t depth ) ; <nl> + } ; <nl> + static field_lookup fields ; <nl> + } ; / / sax_tweet_reader_visitor <nl> + <nl> + sax_tweet_reader_visitor : : sax_tweet_reader_visitor ( std : : vector < tweet > & _tweets , uint8_t * string_buf ) <nl> + : tweets { _tweets } , <nl> + current_string_buf_loc { string_buf } { <nl> + } <nl> + <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_document_start ( json_iterator & iter ) { <nl> + start_container ( iter ) ; <nl> + return SUCCESS ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_array_start ( json_iterator & iter ) { <nl> + / / If we ' re not in a container we care about , don ' t bother with the rest <nl> + if ( ! in_container_child ( iter ) ) { return SUCCESS ; } <nl> + <nl> + / / Handle fields first <nl> + if ( current_key ) { <nl> + switch ( fields . get ( current_key , container ) . type ) { <nl> + case field_type : : array : / / { " statuses " : [ <nl> + start_container ( iter ) ; <nl> + return SUCCESS ; <nl> + case field_type : : any : <nl> + return SUCCESS ; <nl> + case field_type : : object : <nl> + case field_type : : unsigned_integer : <nl> + case field_type : : nullable_unsigned_integer : <nl> + case field_type : : string : <nl> + iter . log_error ( " unexpected array field " ) ; <nl> + return INCORRECT_TYPE ; <nl> + } <nl> + } <nl> + <nl> + / / We ' re not in a field , so it must be a child of an array . We support any of those . <nl> + iter . log_error ( " unexpected array " ) ; <nl> + return INCORRECT_TYPE ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_object_start ( json_iterator & iter ) { <nl> + / / If we ' re not in a container we care about , don ' t bother with the rest <nl> + if ( ! in_container_child ( iter ) ) { return SUCCESS ; } <nl> + <nl> + / / Handle known fields <nl> + if ( current_key ) { <nl> + auto f = fields . get ( current_key , container ) ; <nl> + switch ( f . type ) { <nl> + case field_type : : object : / / { " statuses " : [ { " user " : { <nl> + start_container ( iter ) ; <nl> + return SUCCESS ; <nl> + case field_type : : any : <nl> + return SUCCESS ; <nl> + case field_type : : array : <nl> + case field_type : : unsigned_integer : <nl> + case field_type : : nullable_unsigned_integer : <nl> + case field_type : : string : <nl> + iter . log_error ( " unexpected object field " ) ; <nl> + return INCORRECT_TYPE ; <nl> + } <nl> + } <nl> + <nl> + / / It ' s not a field , so it ' s a child of an array or document <nl> + switch ( container ) { <nl> + case containers : : document : / / top_object : { <nl> + case containers : : statuses : / / tweet : { " statuses " : [ { <nl> + start_container ( iter ) ; <nl> + return SUCCESS ; <nl> + case containers : : top_object : <nl> + case containers : : tweet : <nl> + case containers : : user : <nl> + iter . log_error ( " unexpected object " ) ; <nl> + return INCORRECT_TYPE ; <nl> + } <nl> + SIMDJSON_UNREACHABLE ( ) ; <nl> + return UNINITIALIZED ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_key ( json_iterator & , const uint8_t * key ) { <nl> + current_key = key ; <nl> + return SUCCESS ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_primitive ( json_iterator & iter , const uint8_t * value ) { <nl> + / / Don ' t bother unless we ' re in a container we care about <nl> + if ( ! in_container ( iter ) ) { return SUCCESS ; } <nl> + <nl> + / / Handle fields first <nl> + if ( current_key ) { <nl> + auto f = fields . get ( current_key , container ) ; <nl> + switch ( f . type ) { <nl> + case field_type : : unsigned_integer : <nl> + return parse_unsigned ( iter , value , f ) ; <nl> + case field_type : : nullable_unsigned_integer : <nl> + return parse_nullable_unsigned ( iter , value , f ) ; <nl> + case field_type : : string : <nl> + return parse_string ( iter , value , f ) ; <nl> + case field_type : : any : <nl> + return SUCCESS ; <nl> + case field_type : : array : <nl> + case field_type : : object : <nl> + iter . log_error ( " unexpected primitive " ) ; <nl> + return INCORRECT_TYPE ; <nl> + } <nl> + } <nl> + <nl> + / / If it ' s not a field , it ' s a child of an array . <nl> + / / The only array we support is statuses , which must contain objects . <nl> + iter . log_error ( " unexpected primitive " ) ; <nl> + return INCORRECT_TYPE ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_array_end ( json_iterator & iter ) { <nl> + if ( in_container ( iter ) ) { end_container ( iter ) ; } <nl> + return SUCCESS ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_object_end ( json_iterator & iter ) { <nl> + if ( in_container ( iter ) ) { end_container ( iter ) ; } <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_document_end ( json_iterator & iter ) { <nl> + iter . log_end_value ( " document " ) ; <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_empty_array ( json_iterator & ) { <nl> + return SUCCESS ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_empty_object ( json_iterator & ) { <nl> + return SUCCESS ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : visit_root_primitive ( json_iterator & iter , const uint8_t * ) { <nl> + iter . log_error ( " unexpected root primitive " ) ; <nl> + return INCORRECT_TYPE ; <nl> + } <nl> + <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : increment_count ( json_iterator & ) { return SUCCESS ; } <nl> + <nl> + simdjson_really_inline bool sax_tweet_reader_visitor : : in_container ( json_iterator & iter ) { <nl> + return iter . depth = = uint32_t ( container ) ; <nl> + } <nl> + simdjson_really_inline bool sax_tweet_reader_visitor : : in_container_child ( json_iterator & iter ) { <nl> + return iter . depth = = uint32_t ( container ) + 1 ; <nl> + } <nl> + simdjson_really_inline void sax_tweet_reader_visitor : : start_container ( json_iterator & iter ) { <nl> + SIMDJSON_ASSUME ( iter . depth < = MAX_SUPPORTED_DEPTH ) ; / / Asserts in debug mode <nl> + container = containers ( iter . depth ) ; <nl> + if ( logger : : LOG_ENABLED ) { iter . log_start_value ( STATE_NAMES [ iter . depth ] ) ; } <nl> + } <nl> + simdjson_really_inline void sax_tweet_reader_visitor : : end_container ( json_iterator & iter ) { <nl> + if ( logger : : LOG_ENABLED ) { iter . log_end_value ( STATE_NAMES [ int ( container ) ] ) ; } <nl> + container = containers ( int ( container ) - 1 ) ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : parse_nullable_unsigned ( json_iterator & iter , const uint8_t * value , const field & f ) { <nl> + iter . log_value ( f . key ) ; <nl> + auto i = reinterpret_cast < uint64_t * > ( reinterpret_cast < char * > ( & tweets . back ( ) + f . offset ) ) ; <nl> + if ( auto error = numberparsing : : parse_unsigned ( value ) . get ( * i ) ) { <nl> + / / If number parsing failed , check if it ' s null before returning the error <nl> + if ( ! atomparsing : : is_valid_null_atom ( value ) ) { iter . log_error ( " expected number or null " ) ; return error ; } <nl> + i = 0 ; <nl> + } <nl> + return SUCCESS ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : parse_unsigned ( json_iterator & iter , const uint8_t * value , const field & f ) { <nl> + iter . log_value ( f . key ) ; <nl> + auto i = reinterpret_cast < uint64_t * > ( reinterpret_cast < char * > ( & tweets . back ( ) + f . offset ) ) ; <nl> + return numberparsing : : parse_unsigned ( value ) . get ( * i ) ; <nl> + } <nl> + simdjson_really_inline error_code sax_tweet_reader_visitor : : parse_string ( json_iterator & iter , const uint8_t * value , const field & f ) { <nl> + iter . log_value ( f . key ) ; <nl> + auto s = reinterpret_cast < std : : string_view * > ( reinterpret_cast < char * > ( & tweets . back ( ) + f . offset ) ) ; <nl> + return stringparsing : : parse_string_to_buffer ( value , current_string_buf_loc , * s ) ; <nl> + } <nl> + <nl> + sax_tweet_reader_visitor : : field_lookup sax_tweet_reader_visitor : : fields { } ; <nl> + <nl> + simdjson_really_inline uint8_t sax_tweet_reader_visitor : : field_lookup : : hash ( const char * key , uint32_t depth ) { <nl> + / / These shift numbers were chosen specifically because this yields only 2 collisions between <nl> + / / keys in twitter . json , leaves 0 as a distinct value , and has 0 collisions between keys we <nl> + / / actually care about . <nl> + return uint8_t ( ( key [ 0 ] < < 0 ) ^ ( key [ 1 ] < < 3 ) ^ ( key [ 2 ] < < 3 ) ^ ( key [ 3 ] < < 1 ) ^ depth ) ; <nl> + } <nl> + simdjson_really_inline sax_tweet_reader_visitor : : field sax_tweet_reader_visitor : : field_lookup : : get ( const uint8_t * key , containers c ) { <nl> + auto index = hash ( ( const char * ) key , uint32_t ( c ) ) ; <nl> + auto entry = entries [ index ] ; <nl> + / / TODO if any key is > SIMDJSON_PADDING , this will access inaccessible memory ! <nl> + if ( c ! = entry . container | | memcmp ( key , entry . key , entry . len ) ) { return entries [ 0 ] ; } <nl> + return entry ; <nl> + } <nl> + simdjson_really_inline void sax_tweet_reader_visitor : : field_lookup : : add ( const char * key , size_t len , containers c , field_type type , size_t offset ) { <nl> + auto index = hash ( key , uint32_t ( c ) ) ; <nl> + if ( index = = 0 ) { <nl> + fprintf ( stderr , " % s ( depth % d ) hashes to zero , which is used as ' missing value ' \ n " , key , int ( c ) ) ; <nl> + assert ( false ) ; <nl> + } <nl> + if ( entries [ index ] . key ) { <nl> + fprintf ( stderr , " % s ( depth % d ) collides with % s ( depth % d ) ! \ n " , key , int ( c ) , entries [ index ] . key , int ( entries [ index ] . container ) ) ; <nl> + assert ( false ) ; <nl> + } <nl> + entries [ index ] = { key , len , offset , c , type } ; <nl> + } <nl> + simdjson_really_inline void sax_tweet_reader_visitor : : field_lookup : : neg ( const char * const key , uint32_t depth ) { <nl> + auto index = hash ( key , depth ) ; <nl> + if ( entries [ index ] . key ) { <nl> + fprintf ( stderr , " % s ( depth % d ) conflicts with % s ( depth % d ) ! \ n " , key , depth , entries [ index ] . key , int ( entries [ index ] . container ) ) ; <nl> + assert ( false ) ; <nl> + } <nl> + } <nl> + <nl> + sax_tweet_reader_visitor : : field_lookup : : field_lookup ( ) { <nl> + add ( " \ " statuses \ " " , strlen ( " \ " statuses \ " " ) , containers : : top_object , field_type : : array , 0 ) ; / / { " statuses " : [ . . . ] <nl> + # define TWEET_FIELD ( KEY , TYPE ) add ( " \ " " # KEY " \ " " , strlen ( " \ " " # KEY " \ " " ) , containers : : tweet , TYPE , offsetof ( tweet , KEY ) ) ; <nl> + TWEET_FIELD ( id , field_type : : unsigned_integer ) ; <nl> + TWEET_FIELD ( in_reply_to_status_id , field_type : : nullable_unsigned_integer ) ; <nl> + TWEET_FIELD ( retweet_count , field_type : : unsigned_integer ) ; <nl> + TWEET_FIELD ( favorite_count , field_type : : unsigned_integer ) ; <nl> + TWEET_FIELD ( text , field_type : : string ) ; <nl> + TWEET_FIELD ( created_at , field_type : : string ) ; <nl> + TWEET_FIELD ( user , field_type : : object ) <nl> + # undef TWEET_FIELD <nl> + # define USER_FIELD ( KEY , TYPE ) add ( " \ " " # KEY " \ " " , strlen ( " \ " " # KEY " \ " " ) , containers : : user , TYPE , offsetof ( tweet , user ) + offsetof ( twitter_user , KEY ) ) ; <nl> + USER_FIELD ( id , field_type : : unsigned_integer ) ; <nl> + USER_FIELD ( screen_name , field_type : : string ) ; <nl> + # undef USER_FIELD <nl> + <nl> + / / Check for collisions with other ( unused ) hash keys in typical twitter JSON <nl> + # define NEG ( key , depth ) neg ( " \ " " # key " \ " " , depth ) ; <nl> + NEG ( display_url , 9 ) ; <nl> + NEG ( expanded_url , 9 ) ; <nl> + neg ( " \ " h \ " : " , 9 ) ; <nl> + NEG ( indices , 9 ) ; <nl> + NEG ( resize , 9 ) ; <nl> + NEG ( url , 9 ) ; <nl> + neg ( " \ " w \ " : " , 9 ) ; <nl> + NEG ( display_url , 8 ) ; <nl> + NEG ( expanded_url , 8 ) ; <nl> + neg ( " \ " h \ " : " , 8 ) ; <nl> + NEG ( indices , 8 ) ; <nl> + NEG ( large , 8 ) ; <nl> + NEG ( medium , 8 ) ; <nl> + NEG ( resize , 8 ) ; <nl> + NEG ( small , 8 ) ; <nl> + NEG ( thumb , 8 ) ; <nl> + NEG ( url , 8 ) ; <nl> + neg ( " \ " w \ " : " , 8 ) ; <nl> + NEG ( display_url , 7 ) ; <nl> + NEG ( expanded_url , 7 ) ; <nl> + NEG ( id_str , 7 ) ; <nl> + NEG ( id , 7 ) ; <nl> + NEG ( indices , 7 ) ; <nl> + NEG ( large , 7 ) ; <nl> + NEG ( media_url_https , 7 ) ; <nl> + NEG ( media_url , 7 ) ; <nl> + NEG ( medium , 7 ) ; <nl> + NEG ( name , 7 ) ; <nl> + NEG ( sizes , 7 ) ; <nl> + NEG ( small , 7 ) ; <nl> + NEG ( source_status_id_str , 7 ) ; <nl> + NEG ( source_status_id , 7 ) ; <nl> + NEG ( thumb , 7 ) ; <nl> + NEG ( type , 7 ) ; <nl> + NEG ( url , 7 ) ; <nl> + NEG ( urls , 7 ) ; <nl> + NEG ( description , 6 ) ; <nl> + NEG ( display_url , 6 ) ; <nl> + NEG ( expanded_url , 6 ) ; <nl> + NEG ( id_str , 6 ) ; <nl> + NEG ( id , 6 ) ; <nl> + NEG ( indices , 6 ) ; <nl> + NEG ( media_url_https , 6 ) ; <nl> + NEG ( media_url , 6 ) ; <nl> + NEG ( name , 6 ) ; <nl> + NEG ( sizes , 6 ) ; <nl> + NEG ( source_status_id_str , 6 ) ; <nl> + NEG ( source_status_id , 6 ) ; <nl> + NEG ( type , 6 ) ; <nl> + NEG ( url , 6 ) ; <nl> + NEG ( urls , 6 ) ; <nl> + NEG ( contributors_enabled , 5 ) ; <nl> + NEG ( default_profile_image , 5 ) ; <nl> + NEG ( default_profile , 5 ) ; <nl> + NEG ( description , 5 ) ; <nl> + NEG ( entities , 5 ) ; <nl> + NEG ( favourites_count , 5 ) ; <nl> + NEG ( follow_request_sent , 5 ) ; <nl> + NEG ( followers_count , 5 ) ; <nl> + NEG ( following , 5 ) ; <nl> + NEG ( friends_count , 5 ) ; <nl> + NEG ( geo_enabled , 5 ) ; <nl> + NEG ( hashtags , 5 ) ; <nl> + NEG ( id_str , 5 ) ; <nl> + NEG ( id , 5 ) ; <nl> + NEG ( is_translation_enabled , 5 ) ; <nl> + NEG ( is_translator , 5 ) ; <nl> + NEG ( iso_language_code , 5 ) ; <nl> + NEG ( lang , 5 ) ; <nl> + NEG ( listed_count , 5 ) ; <nl> + NEG ( location , 5 ) ; <nl> + NEG ( media , 5 ) ; <nl> + NEG ( name , 5 ) ; <nl> + NEG ( notifications , 5 ) ; <nl> + NEG ( profile_background_color , 5 ) ; <nl> + NEG ( profile_background_image_url_https , 5 ) ; <nl> + NEG ( profile_background_image_url , 5 ) ; <nl> + NEG ( profile_background_tile , 5 ) ; <nl> + NEG ( profile_banner_url , 5 ) ; <nl> + NEG ( profile_image_url_https , 5 ) ; <nl> + NEG ( profile_image_url , 5 ) ; <nl> + NEG ( profile_link_color , 5 ) ; <nl> + NEG ( profile_sidebar_border_color , 5 ) ; <nl> + NEG ( profile_sidebar_fill_color , 5 ) ; <nl> + NEG ( profile_text_color , 5 ) ; <nl> + NEG ( profile_use_background_image , 5 ) ; <nl> + NEG ( protected , 5 ) ; <nl> + NEG ( result_type , 5 ) ; <nl> + NEG ( statuses_count , 5 ) ; <nl> + NEG ( symbols , 5 ) ; <nl> + NEG ( time_zone , 5 ) ; <nl> + NEG ( url , 5 ) ; <nl> + NEG ( urls , 5 ) ; <nl> + NEG ( user_mentions , 5 ) ; <nl> + NEG ( utc_offset , 5 ) ; <nl> + NEG ( verified , 5 ) ; <nl> + NEG ( contributors_enabled , 4 ) ; <nl> + NEG ( contributors , 4 ) ; <nl> + NEG ( coordinates , 4 ) ; <nl> + NEG ( default_profile_image , 4 ) ; <nl> + NEG ( default_profile , 4 ) ; <nl> + NEG ( description , 4 ) ; <nl> + NEG ( entities , 4 ) ; <nl> + NEG ( favorited , 4 ) ; <nl> + NEG ( favourites_count , 4 ) ; <nl> + NEG ( follow_request_sent , 4 ) ; <nl> + NEG ( followers_count , 4 ) ; <nl> + NEG ( following , 4 ) ; <nl> + NEG ( friends_count , 4 ) ; <nl> + NEG ( geo_enabled , 4 ) ; <nl> + NEG ( geo , 4 ) ; <nl> + NEG ( hashtags , 4 ) ; <nl> + NEG ( id_str , 4 ) ; <nl> + NEG ( in_reply_to_screen_name , 4 ) ; <nl> + NEG ( in_reply_to_status_id_str , 4 ) ; <nl> + NEG ( in_reply_to_user_id_str , 4 ) ; <nl> + NEG ( in_reply_to_user_id , 4 ) ; <nl> + NEG ( is_translation_enabled , 4 ) ; <nl> + NEG ( is_translator , 4 ) ; <nl> + NEG ( iso_language_code , 4 ) ; <nl> + NEG ( lang , 4 ) ; <nl> + NEG ( listed_count , 4 ) ; <nl> + NEG ( location , 4 ) ; <nl> + NEG ( media , 4 ) ; <nl> + NEG ( metadata , 4 ) ; <nl> + NEG ( name , 4 ) ; <nl> + NEG ( notifications , 4 ) ; <nl> + NEG ( place , 4 ) ; <nl> + NEG ( possibly_sensitive , 4 ) ; <nl> + NEG ( profile_background_color , 4 ) ; <nl> + NEG ( profile_background_image_url_https , 4 ) ; <nl> + NEG ( profile_background_image_url , 4 ) ; <nl> + NEG ( profile_background_tile , 4 ) ; <nl> + NEG ( profile_banner_url , 4 ) ; <nl> + NEG ( profile_image_url_https , 4 ) ; <nl> + NEG ( profile_image_url , 4 ) ; <nl> + NEG ( profile_link_color , 4 ) ; <nl> + NEG ( profile_sidebar_border_color , 4 ) ; <nl> + NEG ( profile_sidebar_fill_color , 4 ) ; <nl> + NEG ( profile_text_color , 4 ) ; <nl> + NEG ( profile_use_background_image , 4 ) ; <nl> + NEG ( protected , 4 ) ; <nl> + NEG ( result_type , 4 ) ; <nl> + NEG ( retweeted , 4 ) ; <nl> + NEG ( source , 4 ) ; <nl> + NEG ( statuses_count , 4 ) ; <nl> + NEG ( symbols , 4 ) ; <nl> + NEG ( time_zone , 4 ) ; <nl> + NEG ( truncated , 4 ) ; <nl> + NEG ( url , 4 ) ; <nl> + NEG ( urls , 4 ) ; <nl> + NEG ( user_mentions , 4 ) ; <nl> + NEG ( utc_offset , 4 ) ; <nl> + NEG ( verified , 4 ) ; <nl> + NEG ( contributors , 3 ) ; <nl> + NEG ( coordinates , 3 ) ; <nl> + NEG ( entities , 3 ) ; <nl> + NEG ( favorited , 3 ) ; <nl> + NEG ( geo , 3 ) ; <nl> + NEG ( id_str , 3 ) ; <nl> + NEG ( in_reply_to_screen_name , 3 ) ; <nl> + NEG ( in_reply_to_status_id_str , 3 ) ; <nl> + NEG ( in_reply_to_user_id_str , 3 ) ; <nl> + NEG ( in_reply_to_user_id , 3 ) ; <nl> + NEG ( lang , 3 ) ; <nl> + NEG ( metadata , 3 ) ; <nl> + NEG ( place , 3 ) ; <nl> + NEG ( possibly_sensitive , 3 ) ; <nl> + NEG ( retweeted_status , 3 ) ; <nl> + NEG ( retweeted , 3 ) ; <nl> + NEG ( source , 3 ) ; <nl> + NEG ( truncated , 3 ) ; <nl> + NEG ( completed_in , 2 ) ; <nl> + NEG ( count , 2 ) ; <nl> + NEG ( max_id_str , 2 ) ; <nl> + NEG ( max_id , 2 ) ; <nl> + NEG ( next_results , 2 ) ; <nl> + NEG ( query , 2 ) ; <nl> + NEG ( refresh_url , 2 ) ; <nl> + NEG ( since_id_str , 2 ) ; <nl> + NEG ( since_id , 2 ) ; <nl> + NEG ( search_metadata , 1 ) ; <nl> + # undef NEG <nl> + } <nl> + <nl> + / / sax_tweet_reader_visitor : : field_lookup : : find_min ( ) { <nl> + / / int min_count = 100000 ; <nl> + / / for ( int a = 0 ; a < 4 ; a + + ) { <nl> + / / for ( int b = 0 ; b < 4 ; b + + ) { <nl> + / / for ( int c = 0 ; c < 4 ; c + + ) { <nl> + / / twitter : : sax_tweet_reader_visitor : : field_lookup fields ( a , b , c ) ; <nl> + / / if ( fields . collision_count ) { continue ; } <nl> + / / if ( fields . zero_emission ) { continue ; } <nl> + / / if ( fields . conflict_count < min_count ) { printf ( " min = % d , % d , % d ( % d ) " , a , b , c , fields . conflict_count ) ; } <nl> + / / } <nl> + / / } <nl> + / / } <nl> + / / } <nl> + <nl> + } / / namespace twitter <nl> + <nl> + SIMDJSON_UNTARGET_REGION <nl> + <nl> + # endif / / TWITTER_SAX_TWEET_READER_VISITOR_H <nl> new file mode 100644 <nl> index 000000000 . . a7b11896e <nl> mmm / dev / null <nl> ppp b / benchmark / twitter / tweet . h <nl> <nl> + # ifndef TWEET_H <nl> + # define TWEET_H <nl> + <nl> + # include " simdjson . h " <nl> + # include " twitter_user . h " <nl> + <nl> + namespace twitter { <nl> + <nl> + struct tweet { <nl> + uint64_t id { } ; <nl> + std : : string_view text { } ; <nl> + std : : string_view created_at { } ; <nl> + uint64_t in_reply_to_status_id { } ; <nl> + uint64_t retweet_count { } ; <nl> + uint64_t favorite_count { } ; <nl> + twitter_user user { } ; <nl> + } ; <nl> + <nl> + } / / namespace twitter <nl> + <nl> + # endif / / TWEET_H <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000 . . d371eeb22 <nl> mmm / dev / null <nl> ppp b / benchmark / twitter / twitter_user . h <nl> <nl> + # ifndef TWITTER_USER_H <nl> + # define TWITTER_USER_H <nl> + <nl> + # include " simdjson . h " <nl> + <nl> + namespace twitter { <nl> + <nl> + struct twitter_user { <nl> + uint64_t id { } ; <nl> + std : : string_view screen_name { } ; <nl> + } ; <nl> + <nl> + } / / namespace twitter <nl> + <nl> + # endif / / TWITTER_USER_H <nl> \ No newline at end of file <nl> mmm a / src / arm64 / dom_parser_implementation . cpp <nl> ppp b / src / arm64 / dom_parser_implementation . cpp <nl> simdjson_really_inline simd8 < bool > must_be_2_3_continuation ( const simd8 < uint8_t > <nl> <nl> # include " arm64 / stringparsing . h " <nl> # include " arm64 / numberparsing . h " <nl> - # include " generic / stage2 / structural_parser . h " <nl> # include " generic / stage2 / tape_builder . h " <nl> <nl> / / <nl> SIMDJSON_WARN_UNUSED bool implementation : : validate_utf8 ( const char * buf , size_t <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : stage2 ( dom : : document & _doc ) noexcept { <nl> - doc = & _doc ; <nl> - stage2 : : tape_builder builder ( * doc ) ; <nl> - return stage2 : : structural_parser : : parse < false > ( * this , builder ) ; <nl> + return stage2 : : tape_builder : : parse_document < false > ( * this , _doc ) ; <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : stage2_next ( dom : : document & _doc ) noexcept { <nl> - doc = & _doc ; <nl> - stage2 : : tape_builder builder ( _doc ) ; <nl> - return stage2 : : structural_parser : : parse < true > ( * this , builder ) ; <nl> + return stage2 : : tape_builder : : parse_document < true > ( * this , _doc ) ; <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : parse ( const uint8_t * _buf , size_t _len , dom : : document & _doc ) noexcept { <nl> mmm a / src / fallback / dom_parser_implementation . cpp <nl> ppp b / src / fallback / dom_parser_implementation . cpp <nl> SIMDJSON_WARN_UNUSED bool implementation : : validate_utf8 ( const char * buf , size_t <nl> / / <nl> # include " fallback / stringparsing . h " <nl> # include " fallback / numberparsing . h " <nl> - # include " generic / stage2 / structural_parser . h " <nl> # include " generic / stage2 / tape_builder . h " <nl> <nl> namespace { <nl> namespace SIMDJSON_IMPLEMENTATION { <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : stage2 ( dom : : document & _doc ) noexcept { <nl> - doc = & _doc ; <nl> - stage2 : : tape_builder builder ( * doc ) ; <nl> - return stage2 : : structural_parser : : parse < false > ( * this , builder ) ; <nl> + return stage2 : : tape_builder : : parse_document < false > ( * this , _doc ) ; <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : stage2_next ( dom : : document & _doc ) noexcept { <nl> - doc = & _doc ; <nl> - stage2 : : tape_builder builder ( _doc ) ; <nl> - return stage2 : : structural_parser : : parse < true > ( * this , builder ) ; <nl> + return stage2 : : tape_builder : : parse_document < true > ( * this , _doc ) ; <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : parse ( const uint8_t * _buf , size_t _len , dom : : document & _doc ) noexcept { <nl> mmm a / src / generic / dom_parser_implementation . h <nl> ppp b / src / generic / dom_parser_implementation . h <nl> <nl> namespace { <nl> namespace SIMDJSON_IMPLEMENTATION { <nl> <nl> - / / expectation : sizeof ( scope_descriptor ) = 64 / 8 . <nl> - struct scope_descriptor { <nl> + / / expectation : sizeof ( open_container ) = 64 / 8 . <nl> + struct open_container { <nl> uint32_t tape_index ; / / where , on the tape , does the scope ( [ , { ) begins <nl> uint32_t count ; / / how many elements in the scope <nl> - } ; / / struct scope_descriptor <nl> + } ; / / struct open_container <nl> + <nl> + static_assert ( sizeof ( open_container ) = = 64 / 8 , " Open container must be 64 bits " ) ; <nl> <nl> class dom_parser_implementation final : public internal : : dom_parser_implementation { <nl> public : <nl> / * * Tape location of each open { or [ * / <nl> - std : : unique_ptr < scope_descriptor [ ] > containing_scope { } ; <nl> + std : : unique_ptr < open_container [ ] > open_containers { } ; <nl> / * * Whether each open container is a [ or { * / <nl> std : : unique_ptr < bool [ ] > is_array { } ; <nl> / * * Buffer passed to stage 1 * / <nl> mmm a / src / generic / stage2 / allocate . h <nl> ppp b / src / generic / stage2 / allocate . h <nl> namespace allocate { <nl> / / Allocates stage 2 internal state and outputs in the parser <nl> / / <nl> simdjson_really_inline error_code set_max_depth ( dom_parser_implementation & parser , size_t max_depth ) { <nl> - parser . containing_scope . reset ( new ( std : : nothrow ) scope_descriptor [ max_depth ] ) ; <nl> + parser . open_containers . reset ( new ( std : : nothrow ) open_container [ max_depth ] ) ; <nl> parser . is_array . reset ( new ( std : : nothrow ) bool [ max_depth ] ) ; <nl> <nl> - if ( ! parser . is_array | | ! parser . containing_scope ) { <nl> + if ( ! parser . is_array | | ! parser . open_containers ) { <nl> return MEMALLOC ; <nl> } <nl> return SUCCESS ; <nl> new file mode 100644 <nl> index 000000000 . . 634c50185 <nl> mmm / dev / null <nl> ppp b / src / generic / stage2 / json_iterator . h <nl> <nl> + # include " generic / stage2 / logger . h " <nl> + <nl> + namespace { <nl> + namespace SIMDJSON_IMPLEMENTATION { <nl> + namespace stage2 { <nl> + <nl> + class json_iterator { <nl> + public : <nl> + const uint8_t * const buf ; <nl> + uint32_t * next_structural ; <nl> + dom_parser_implementation & dom_parser ; <nl> + uint32_t depth { 0 } ; <nl> + <nl> + / * * <nl> + * Walk the JSON document . <nl> + * <nl> + * The visitor receives callbacks when values are encountered . All callbacks pass the iterator as <nl> + * the first parameter ; some callbacks have other parameters as well : <nl> + * <nl> + * - visit_document_start ( ) - at the beginning . <nl> + * - visit_document_end ( ) - at the end ( if things were successful ) . <nl> + * <nl> + * - visit_array_start ( ) - at the start ` [ ` of a non - empty array . <nl> + * - visit_array_end ( ) - at the end ` ] ` of a non - empty array . <nl> + * - visit_empty_array ( ) - when an empty array is encountered . <nl> + * <nl> + * - visit_object_end ( ) - at the start ` ] ` of a non - empty object . <nl> + * - visit_object_start ( ) - at the end ` ] ` of a non - empty object . <nl> + * - visit_empty_object ( ) - when an empty object is encountered . <nl> + * - visit_key ( const uint8_t * key ) - when a key in an object field is encountered . key is <nl> + * guaranteed to point at the first quote of the string ( ` " key " ` ) . <nl> + * - visit_primitive ( const uint8_t * value ) - when a value is a string , number , boolean or null . <nl> + * - visit_root_primitive ( iter , uint8_t * value ) - when the top - level value is a string , number , boolean or null . <nl> + * <nl> + * - increment_count ( iter ) - each time a value is found in an array or object . <nl> + * / <nl> + template < bool STREAMING , typename V > <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code walk_document ( V & visitor ) noexcept ; <nl> + <nl> + / * * <nl> + * Create an iterator capable of walking a JSON document . <nl> + * <nl> + * The document must have already passed through stage 1 . <nl> + * / <nl> + simdjson_really_inline json_iterator ( dom_parser_implementation & _dom_parser , size_t start_structural_index ) ; <nl> + <nl> + / * * <nl> + * Look at the next token . <nl> + * <nl> + * Tokens can be strings , numbers , booleans , null , or operators ( ` [ { ] } , : ` ) ) . <nl> + * <nl> + * They may include invalid JSON as well ( such as ` 1 . 2 . 3 ` or ` ture ` ) . <nl> + * / <nl> + simdjson_really_inline const uint8_t * peek ( ) const noexcept ; <nl> + / * * <nl> + * Advance to the next token . <nl> + * <nl> + * Tokens can be strings , numbers , booleans , null , or operators ( ` [ { ] } , : ` ) ) . <nl> + * <nl> + * They may include invalid JSON as well ( such as ` 1 . 2 . 3 ` or ` ture ` ) . <nl> + * / <nl> + simdjson_really_inline const uint8_t * advance ( ) noexcept ; <nl> + / * * <nl> + * Get the remaining length of the document , from the start of the current token . <nl> + * / <nl> + simdjson_really_inline size_t remaining_len ( ) const noexcept ; <nl> + / * * <nl> + * Check if we are at the end of the document . <nl> + * <nl> + * If this is true , there are no more tokens . <nl> + * / <nl> + simdjson_really_inline bool at_eof ( ) const noexcept ; <nl> + / * * <nl> + * Check if we are at the beginning of the document . <nl> + * / <nl> + simdjson_really_inline bool at_beginning ( ) const noexcept ; <nl> + simdjson_really_inline uint8_t last_structural ( ) const noexcept ; <nl> + <nl> + / * * <nl> + * Log that a value has been found . <nl> + * <nl> + * Set ENABLE_LOGGING = true in logger . h to see logging . <nl> + * / <nl> + simdjson_really_inline void log_value ( const char * type ) const noexcept ; <nl> + / * * <nl> + * Log the start of a multipart value . <nl> + * <nl> + * Set ENABLE_LOGGING = true in logger . h to see logging . <nl> + * / <nl> + simdjson_really_inline void log_start_value ( const char * type ) const noexcept ; <nl> + / * * <nl> + * Log the end of a multipart value . <nl> + * <nl> + * Set ENABLE_LOGGING = true in logger . h to see logging . <nl> + * / <nl> + simdjson_really_inline void log_end_value ( const char * type ) const noexcept ; <nl> + / * * <nl> + * Log an error . <nl> + * <nl> + * Set ENABLE_LOGGING = true in logger . h to see logging . <nl> + * / <nl> + simdjson_really_inline void log_error ( const char * error ) const noexcept ; <nl> + <nl> + template < typename V > <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_root_primitive ( V & visitor , const uint8_t * value ) noexcept ; <nl> + template < typename V > <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_primitive ( V & visitor , const uint8_t * value ) noexcept ; <nl> + } ; <nl> + <nl> + template < bool STREAMING , typename V > <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code json_iterator : : walk_document ( V & visitor ) noexcept { <nl> + logger : : log_start ( ) ; <nl> + <nl> + / / <nl> + / / Start the document <nl> + / / <nl> + if ( at_eof ( ) ) { return EMPTY ; } <nl> + log_start_value ( " document " ) ; <nl> + SIMDJSON_TRY ( visitor . visit_document_start ( * this ) ) ; <nl> + <nl> + / / <nl> + / / Read first value <nl> + / / <nl> + { <nl> + auto value = advance ( ) ; <nl> + <nl> + / / Make sure the outer hash or array is closed before continuing ; otherwise , there are ways we <nl> + / / could get into memory corruption . See https : / / github . com / simdjson / simdjson / issues / 906 <nl> + if ( ! STREAMING ) { <nl> + switch ( * value ) { <nl> + case ' { ' : if ( last_structural ( ) ! = ' } ' ) { return TAPE_ERROR ; } ; break ; <nl> + case ' [ ' : if ( last_structural ( ) ! = ' ] ' ) { return TAPE_ERROR ; } ; break ; <nl> + } <nl> + } <nl> + <nl> + switch ( * value ) { <nl> + case ' { ' : if ( * peek ( ) = = ' } ' ) { advance ( ) ; log_value ( " empty object " ) ; SIMDJSON_TRY ( visitor . visit_empty_object ( * this ) ) ; break ; } goto object_begin ; <nl> + case ' [ ' : if ( * peek ( ) = = ' ] ' ) { advance ( ) ; log_value ( " empty array " ) ; SIMDJSON_TRY ( visitor . visit_empty_array ( * this ) ) ; break ; } goto array_begin ; <nl> + default : SIMDJSON_TRY ( visitor . visit_root_primitive ( * this , value ) ) ; break ; <nl> + } <nl> + } <nl> + goto document_end ; <nl> + <nl> + / / <nl> + / / Object parser states <nl> + / / <nl> + object_begin : <nl> + log_start_value ( " object " ) ; <nl> + depth + + ; <nl> + if ( depth > = dom_parser . max_depth ( ) ) { log_error ( " Exceeded max depth ! " ) ; return DEPTH_ERROR ; } <nl> + dom_parser . is_array [ depth ] = false ; <nl> + SIMDJSON_TRY ( visitor . visit_object_start ( * this ) ) ; <nl> + <nl> + { <nl> + auto key = advance ( ) ; <nl> + if ( * key ! = ' " ' ) { log_error ( " Object does not start with a key " ) ; return TAPE_ERROR ; } <nl> + SIMDJSON_TRY ( visitor . increment_count ( * this ) ) ; <nl> + SIMDJSON_TRY ( visitor . visit_key ( * this , key ) ) ; <nl> + } <nl> + <nl> + object_field : <nl> + if ( simdjson_unlikely ( * advance ( ) ! = ' : ' ) ) { log_error ( " Missing colon after key in object " ) ; return TAPE_ERROR ; } <nl> + { <nl> + auto value = advance ( ) ; <nl> + switch ( * value ) { <nl> + case ' { ' : if ( * peek ( ) = = ' } ' ) { advance ( ) ; log_value ( " empty object " ) ; SIMDJSON_TRY ( visitor . visit_empty_object ( * this ) ) ; break ; } goto object_begin ; <nl> + case ' [ ' : if ( * peek ( ) = = ' ] ' ) { advance ( ) ; log_value ( " empty array " ) ; SIMDJSON_TRY ( visitor . visit_empty_array ( * this ) ) ; break ; } goto array_begin ; <nl> + default : SIMDJSON_TRY ( visitor . visit_primitive ( * this , value ) ) ; break ; <nl> + } <nl> + } <nl> + <nl> + object_continue : <nl> + switch ( * advance ( ) ) { <nl> + case ' , ' : <nl> + SIMDJSON_TRY ( visitor . increment_count ( * this ) ) ; <nl> + { <nl> + auto key = advance ( ) ; <nl> + if ( simdjson_unlikely ( * key ! = ' " ' ) ) { log_error ( " Key string missing at beginning of field in object " ) ; return TAPE_ERROR ; } <nl> + SIMDJSON_TRY ( visitor . visit_key ( * this , key ) ) ; <nl> + } <nl> + goto object_field ; <nl> + case ' } ' : log_end_value ( " object " ) ; SIMDJSON_TRY ( visitor . visit_object_end ( * this ) ) ; goto scope_end ; <nl> + default : log_error ( " No comma between object fields " ) ; return TAPE_ERROR ; <nl> + } <nl> + <nl> + scope_end : <nl> + depth - - ; <nl> + if ( depth = = 0 ) { goto document_end ; } <nl> + if ( dom_parser . is_array [ depth ] ) { goto array_continue ; } <nl> + goto object_continue ; <nl> + <nl> + / / <nl> + / / Array parser states <nl> + / / <nl> + array_begin : <nl> + log_start_value ( " array " ) ; <nl> + depth + + ; <nl> + if ( depth > = dom_parser . max_depth ( ) ) { log_error ( " Exceeded max depth ! " ) ; return DEPTH_ERROR ; } <nl> + dom_parser . is_array [ depth ] = true ; <nl> + SIMDJSON_TRY ( visitor . visit_array_start ( * this ) ) ; <nl> + SIMDJSON_TRY ( visitor . increment_count ( * this ) ) ; <nl> + <nl> + array_value : <nl> + { <nl> + auto value = advance ( ) ; <nl> + switch ( * value ) { <nl> + case ' { ' : if ( * peek ( ) = = ' } ' ) { advance ( ) ; log_value ( " empty object " ) ; SIMDJSON_TRY ( visitor . visit_empty_object ( * this ) ) ; break ; } goto object_begin ; <nl> + case ' [ ' : if ( * peek ( ) = = ' ] ' ) { advance ( ) ; log_value ( " empty array " ) ; SIMDJSON_TRY ( visitor . visit_empty_array ( * this ) ) ; break ; } goto array_begin ; <nl> + default : SIMDJSON_TRY ( visitor . visit_primitive ( * this , value ) ) ; break ; <nl> + } <nl> + } <nl> + <nl> + array_continue : <nl> + switch ( * advance ( ) ) { <nl> + case ' , ' : SIMDJSON_TRY ( visitor . increment_count ( * this ) ) ; goto array_value ; <nl> + case ' ] ' : log_end_value ( " array " ) ; SIMDJSON_TRY ( visitor . visit_array_end ( * this ) ) ; goto scope_end ; <nl> + default : log_error ( " Missing comma between array values " ) ; return TAPE_ERROR ; <nl> + } <nl> + <nl> + document_end : <nl> + log_end_value ( " document " ) ; <nl> + SIMDJSON_TRY ( visitor . visit_document_end ( * this ) ) ; <nl> + <nl> + dom_parser . next_structural_index = uint32_t ( next_structural - & dom_parser . structural_indexes [ 0 ] ) ; <nl> + <nl> + / / If we didn ' t make it to the end , it ' s an error <nl> + if ( ! STREAMING & & dom_parser . next_structural_index ! = dom_parser . n_structural_indexes ) { <nl> + log_error ( " More than one JSON value at the root of the document , or extra characters at the end of the JSON ! " ) ; <nl> + return TAPE_ERROR ; <nl> + } <nl> + <nl> + return SUCCESS ; <nl> + <nl> + } / / walk_document ( ) <nl> + <nl> + simdjson_really_inline json_iterator : : json_iterator ( dom_parser_implementation & _dom_parser , size_t start_structural_index ) <nl> + : buf { _dom_parser . buf } , <nl> + next_structural { & _dom_parser . structural_indexes [ start_structural_index ] } , <nl> + dom_parser { _dom_parser } { <nl> + } <nl> + <nl> + simdjson_really_inline const uint8_t * json_iterator : : peek ( ) const noexcept { <nl> + return & buf [ * ( next_structural ) ] ; <nl> + } <nl> + simdjson_really_inline const uint8_t * json_iterator : : advance ( ) noexcept { <nl> + return & buf [ * ( next_structural + + ) ] ; <nl> + } <nl> + simdjson_really_inline size_t json_iterator : : remaining_len ( ) const noexcept { <nl> + return dom_parser . len - * ( next_structural - 1 ) ; <nl> + } <nl> + <nl> + simdjson_really_inline bool json_iterator : : at_eof ( ) const noexcept { <nl> + return next_structural = = & dom_parser . structural_indexes [ dom_parser . n_structural_indexes ] ; <nl> + } <nl> + simdjson_really_inline bool json_iterator : : at_beginning ( ) const noexcept { <nl> + return next_structural = = dom_parser . structural_indexes . get ( ) ; <nl> + } <nl> + simdjson_really_inline uint8_t json_iterator : : last_structural ( ) const noexcept { <nl> + return buf [ dom_parser . structural_indexes [ dom_parser . n_structural_indexes - 1 ] ] ; <nl> + } <nl> + <nl> + simdjson_really_inline void json_iterator : : log_value ( const char * type ) const noexcept { <nl> + logger : : log_line ( * this , " " , type , " " ) ; <nl> + } <nl> + <nl> + simdjson_really_inline void json_iterator : : log_start_value ( const char * type ) const noexcept { <nl> + logger : : log_line ( * this , " + " , type , " " ) ; <nl> + if ( logger : : LOG_ENABLED ) { logger : : log_depth + + ; } <nl> + } <nl> + <nl> + simdjson_really_inline void json_iterator : : log_end_value ( const char * type ) const noexcept { <nl> + if ( logger : : LOG_ENABLED ) { logger : : log_depth - - ; } <nl> + logger : : log_line ( * this , " - " , type , " " ) ; <nl> + } <nl> + <nl> + simdjson_really_inline void json_iterator : : log_error ( const char * error ) const noexcept { <nl> + logger : : log_line ( * this , " " , " ERROR " , error ) ; <nl> + } <nl> + <nl> + template < typename V > <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code json_iterator : : visit_root_primitive ( V & visitor , const uint8_t * value ) noexcept { <nl> + switch ( * value ) { <nl> + case ' " ' : return visitor . visit_root_string ( * this , value ) ; <nl> + case ' t ' : return visitor . visit_root_true_atom ( * this , value ) ; <nl> + case ' f ' : return visitor . visit_root_false_atom ( * this , value ) ; <nl> + case ' n ' : return visitor . visit_root_null_atom ( * this , value ) ; <nl> + case ' - ' : <nl> + case ' 0 ' : case ' 1 ' : case ' 2 ' : case ' 3 ' : case ' 4 ' : <nl> + case ' 5 ' : case ' 6 ' : case ' 7 ' : case ' 8 ' : case ' 9 ' : <nl> + return visitor . visit_root_number ( * this , value ) ; <nl> + default : <nl> + log_error ( " Document starts with a non - value character " ) ; <nl> + return TAPE_ERROR ; <nl> + } <nl> + } <nl> + template < typename V > <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code json_iterator : : visit_primitive ( V & visitor , const uint8_t * value ) noexcept { <nl> + switch ( * value ) { <nl> + case ' " ' : return visitor . visit_string ( * this , value ) ; <nl> + case ' t ' : return visitor . visit_true_atom ( * this , value ) ; <nl> + case ' f ' : return visitor . visit_false_atom ( * this , value ) ; <nl> + case ' n ' : return visitor . visit_null_atom ( * this , value ) ; <nl> + case ' - ' : <nl> + case ' 0 ' : case ' 1 ' : case ' 2 ' : case ' 3 ' : case ' 4 ' : <nl> + case ' 5 ' : case ' 6 ' : case ' 7 ' : case ' 8 ' : case ' 9 ' : <nl> + return visitor . visit_number ( * this , value ) ; <nl> + default : <nl> + log_error ( " Non - value found when value was expected ! " ) ; <nl> + return TAPE_ERROR ; <nl> + } <nl> + } <nl> + <nl> + } / / namespace stage2 <nl> + } / / namespace SIMDJSON_IMPLEMENTATION <nl> + } / / unnamed namespace <nl> mmm a / src / generic / stage2 / logger . h <nl> ppp b / src / generic / stage2 / logger . h <nl> namespace logger { <nl> <nl> static constexpr const bool LOG_ENABLED = false ; <nl> static constexpr const int LOG_EVENT_LEN = 20 ; <nl> - static constexpr const int LOG_BUFFER_LEN = 10 ; <nl> + static constexpr const int LOG_BUFFER_LEN = 30 ; <nl> static constexpr const int LOG_SMALL_BUFFER_LEN = 10 ; <nl> static constexpr const int LOG_INDEX_LEN = 5 ; <nl> <nl> namespace logger { <nl> } <nl> } <nl> <nl> - static simdjson_really_inline void log_string ( const char * message ) { <nl> - if ( LOG_ENABLED ) { <nl> - printf ( " % s \ n " , message ) ; <nl> - } <nl> - } <nl> - <nl> / / Logs a single line of <nl> template < typename S > <nl> static simdjson_really_inline void log_line ( S & structurals , const char * title_prefix , const char * title , const char * detail ) { <nl> mmm a / src / generic / stage2 / numberparsing . h <nl> ppp b / src / generic / stage2 / numberparsing . h <nl> namespace stage2 { <nl> namespace numberparsing { <nl> <nl> # ifdef JSON_TEST_NUMBERS <nl> - # define INVALID_NUMBER ( SRC ) ( found_invalid_number ( ( SRC ) ) , false ) <nl> - # define WRITE_INTEGER ( VALUE , SRC , WRITER ) ( found_integer ( ( VALUE ) , ( SRC ) ) , writer . append_s64 ( ( VALUE ) ) ) <nl> - # define WRITE_UNSIGNED ( VALUE , SRC , WRITER ) ( found_unsigned_integer ( ( VALUE ) , ( SRC ) ) , writer . append_u64 ( ( VALUE ) ) ) <nl> - # define WRITE_DOUBLE ( VALUE , SRC , WRITER ) ( found_float ( ( VALUE ) , ( SRC ) ) , writer . append_double ( ( VALUE ) ) ) <nl> + # define INVALID_NUMBER ( SRC ) ( found_invalid_number ( ( SRC ) ) , NUMBER_ERROR ) <nl> + # define WRITE_INTEGER ( VALUE , SRC , WRITER ) ( found_integer ( ( VALUE ) , ( SRC ) ) , ( WRITER ) . append_s64 ( ( VALUE ) ) ) <nl> + # define WRITE_UNSIGNED ( VALUE , SRC , WRITER ) ( found_unsigned_integer ( ( VALUE ) , ( SRC ) ) , ( WRITER ) . append_u64 ( ( VALUE ) ) ) <nl> + # define WRITE_DOUBLE ( VALUE , SRC , WRITER ) ( found_float ( ( VALUE ) , ( SRC ) ) , ( WRITER ) . append_double ( ( VALUE ) ) ) <nl> # else <nl> - # define INVALID_NUMBER ( SRC ) ( false ) <nl> - # define WRITE_INTEGER ( VALUE , SRC , WRITER ) writer . append_s64 ( ( VALUE ) ) <nl> - # define WRITE_UNSIGNED ( VALUE , SRC , WRITER ) writer . append_u64 ( ( VALUE ) ) <nl> - # define WRITE_DOUBLE ( VALUE , SRC , WRITER ) writer . append_double ( ( VALUE ) ) <nl> + # define INVALID_NUMBER ( SRC ) ( NUMBER_ERROR ) <nl> + # define WRITE_INTEGER ( VALUE , SRC , WRITER ) ( WRITER ) . append_s64 ( ( VALUE ) ) <nl> + # define WRITE_UNSIGNED ( VALUE , SRC , WRITER ) ( WRITER ) . append_u64 ( ( VALUE ) ) <nl> + # define WRITE_DOUBLE ( VALUE , SRC , WRITER ) ( WRITER ) . append_double ( ( VALUE ) ) <nl> # endif <nl> <nl> / / Attempts to compute i * 10 ^ ( power ) exactly ; and if " negative " is <nl> namespace numberparsing { <nl> / / set to false . This should work * most of the time * ( like 99 % of the time ) . <nl> / / We assume that power is in the [ FASTFLOAT_SMALLEST_POWER , <nl> / / FASTFLOAT_LARGEST_POWER ] interval : the caller is responsible for this check . <nl> - simdjson_really_inline double compute_float_64 ( int64_t power , uint64_t i , bool negative , bool * success ) { <nl> + simdjson_really_inline bool compute_float_64 ( int64_t power , uint64_t i , bool negative , double & d ) { <nl> / / we start with a fast path <nl> / / It was described in <nl> / / Clinger WD . How to read floating point numbers accurately . <nl> simdjson_really_inline double compute_float_64 ( int64_t power , uint64_t i , bool n <nl> # endif <nl> / / convert the integer into a double . This is lossless since <nl> / / 0 < = i < = 2 ^ 53 - 1 . <nl> - double d = double ( i ) ; <nl> + d = double ( i ) ; <nl> / / <nl> / / The general idea is as follows . <nl> / / If 0 < = s < 2 ^ 53 and if 10 ^ 0 < = p < = 10 ^ 22 then <nl> simdjson_really_inline double compute_float_64 ( int64_t power , uint64_t i , bool n <nl> if ( negative ) { <nl> d = - d ; <nl> } <nl> - * success = true ; <nl> - return d ; <nl> + return true ; <nl> } <nl> / / When 22 < power & & power < 22 + 16 , we could <nl> / / hope for another , secondary fast path . It wa <nl> simdjson_really_inline double compute_float_64 ( int64_t power , uint64_t i , bool n <nl> / / In the slow path , we need to adjust i so that it is > 1 < < 63 which is always <nl> / / possible , except if i = = 0 , so we handle i = = 0 separately . <nl> if ( i = = 0 ) { <nl> - return 0 . 0 ; <nl> + d = 0 . 0 ; <nl> + return true ; <nl> } <nl> <nl> / / We are going to need to do some 64 - bit arithmetic to get a more precise product . <nl> simdjson_really_inline double compute_float_64 ( int64_t power , uint64_t i , bool n <nl> / / This does happen , e . g . with 7 . 3177701707893310e + 15 . <nl> if ( ( ( product_middle + 1 = = 0 ) & & ( ( product_high & 0x1FF ) = = 0x1FF ) & & <nl> ( product_low + i < product_low ) ) ) { / / let us be prudent and bail out . <nl> - * success = false ; <nl> - return 0 ; <nl> + return false ; <nl> } <nl> upper = product_high ; <nl> lower = product_middle ; <nl> simdjson_really_inline double compute_float_64 ( int64_t power , uint64_t i , bool n <nl> / / floating - point values . <nl> if ( simdjson_unlikely ( ( lower = = 0 ) & & ( ( upper & 0x1FF ) = = 0 ) & & <nl> ( ( mantissa & 3 ) = = 1 ) ) ) { <nl> - / / if mantissa & 1 = = 1 we might need to round up . <nl> - / / <nl> - / / Scenarios : <nl> - / / 1 . We are not in the middle . Then we should round up . <nl> - / / <nl> - / / 2 . We are right in the middle . Whether we round up depends <nl> - / / on the last significant bit : if it is " one " then we round <nl> - / / up ( round to even ) otherwise , we do not . <nl> - / / <nl> - / / So if the last significant bit is 1 , we can safely round up . <nl> - / / Hence we only need to bail out if ( mantissa & 3 ) = = 1 . <nl> - / / Otherwise we may need more accuracy or analysis to determine whether <nl> - / / we are exactly between two floating - point numbers . <nl> - / / It can be triggered with 1e23 . <nl> - / / Note : because the factor_mantissa and factor_mantissa_low are <nl> - / / almost always rounded down ( except for small positive powers ) , <nl> - / / almost always should round up . <nl> - * success = false ; <nl> - return 0 ; <nl> + / / if mantissa & 1 = = 1 we might need to round up . <nl> + / / <nl> + / / Scenarios : <nl> + / / 1 . We are not in the middle . Then we should round up . <nl> + / / <nl> + / / 2 . We are right in the middle . Whether we round up depends <nl> + / / on the last significant bit : if it is " one " then we round <nl> + / / up ( round to even ) otherwise , we do not . <nl> + / / <nl> + / / So if the last significant bit is 1 , we can safely round up . <nl> + / / Hence we only need to bail out if ( mantissa & 3 ) = = 1 . <nl> + / / Otherwise we may need more accuracy or analysis to determine whether <nl> + / / we are exactly between two floating - point numbers . <nl> + / / It can be triggered with 1e23 . <nl> + / / Note : because the factor_mantissa and factor_mantissa_low are <nl> + / / almost always rounded down ( except for small positive powers ) , <nl> + / / almost always should round up . <nl> + return false ; <nl> } <nl> <nl> mantissa + = mantissa & 1 ; <nl> simdjson_really_inline double compute_float_64 ( int64_t power , uint64_t i , bool n <nl> uint64_t real_exponent = c . exp - lz ; <nl> / / we have to check that real_exponent is in range , otherwise we bail out <nl> if ( simdjson_unlikely ( ( real_exponent < 1 ) | | ( real_exponent > 2046 ) ) ) { <nl> - * success = false ; <nl> - return 0 ; <nl> + return false ; <nl> } <nl> mantissa | = real_exponent < < 52 ; <nl> mantissa | = ( ( ( uint64_t ) negative ) < < 63 ) ; <nl> - double d ; <nl> memcpy ( & d , & mantissa , sizeof ( d ) ) ; <nl> - * success = true ; <nl> - return d ; <nl> + return true ; <nl> } <nl> <nl> static bool parse_float_strtod ( const uint8_t * ptr , double * outDouble ) { <nl> simdjson_really_inline bool is_made_of_eight_digits_fast ( const uint8_t * chars ) { <nl> } <nl> <nl> template < typename W > <nl> - bool slow_float_parsing ( SIMDJSON_UNUSED const uint8_t * src , W writer ) { <nl> + error_code slow_float_parsing ( SIMDJSON_UNUSED const uint8_t * src , W writer ) { <nl> double d ; <nl> if ( parse_float_strtod ( src , & d ) ) { <nl> - WRITE_DOUBLE ( d , src , writer ) ; <nl> - return true ; <nl> + writer . append_double ( d ) ; <nl> + return SUCCESS ; <nl> } <nl> return INVALID_NUMBER ( src ) ; <nl> } <nl> simdjson_really_inline bool parse_digit ( const uint8_t c , I & i ) { <nl> return true ; <nl> } <nl> <nl> - simdjson_really_inline bool parse_decimal ( SIMDJSON_UNUSED const uint8_t * const src , const uint8_t * & p , uint64_t & i , int64_t & exponent ) { <nl> + simdjson_really_inline error_code parse_decimal ( SIMDJSON_UNUSED const uint8_t * const src , const uint8_t * & p , uint64_t & i , int64_t & exponent ) { <nl> / / we continue with the fiction that we have an integer . If the <nl> / / floating point number is representable as x * 10 ^ z for some integer <nl> / / z that fits in 53 bits , then we will be able to convert back the <nl> simdjson_really_inline bool parse_decimal ( SIMDJSON_UNUSED const uint8_t * const s <nl> if ( exponent = = 0 ) { <nl> return INVALID_NUMBER ( src ) ; <nl> } <nl> - return true ; <nl> + return SUCCESS ; <nl> } <nl> <nl> - simdjson_really_inline bool parse_exponent ( SIMDJSON_UNUSED const uint8_t * const src , const uint8_t * & p , int64_t & exponent ) { <nl> + simdjson_really_inline error_code parse_exponent ( SIMDJSON_UNUSED const uint8_t * const src , const uint8_t * & p , int64_t & exponent ) { <nl> / / Exp Sign : - 123 . 456e [ - ] 78 <nl> bool neg_exp = ( ' - ' = = * p ) ; <nl> if ( neg_exp | | ' + ' = = * p ) { p + + ; } / / Skip + as well <nl> simdjson_really_inline bool parse_exponent ( SIMDJSON_UNUSED const uint8_t * const <nl> / / In particular , it could overflow to INT64_MIN , and we cannot do - INT64_MIN . <nl> / / Thus we * must * check for possible overflow before we negate exp_number . <nl> <nl> - / / Performance notes : it may seem like combining the two " unlikely checks " below into <nl> - / / a single unlikely path would be faster . The reasoning is sound , but the compiler may <nl> + / / Performance notes : it may seem like combining the two " simdjson_unlikely checks " below into <nl> + / / a single simdjson_unlikely path would be faster . The reasoning is sound , but the compiler may <nl> / / not oblige and may , in fact , generate two distinct paths in any case . It might be <nl> / / possible to do uint64_t ( p - start_exp - 1 ) > = 18 but it could end up trading off <nl> - / / instructions for a likely branch , an unconclusive gain . <nl> + / / instructions for a simdjson_likely branch , an unconclusive gain . <nl> <nl> / / If there were no digits , it ' s an error . <nl> if ( simdjson_unlikely ( p = = start_exp ) ) { <nl> simdjson_really_inline bool parse_exponent ( SIMDJSON_UNUSED const uint8_t * const <nl> / / is bounded in magnitude by the size of the JSON input , we are fine in this universe . <nl> / / To sum it up : the next line should never overflow . <nl> exponent + = ( neg_exp ? - exp_number : exp_number ) ; <nl> - return true ; <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + simdjson_really_inline int significant_digits ( const uint8_t * start_digits , int digit_count ) { <nl> + / / It is possible that the integer had an overflow . <nl> + / / We have to handle the case where we have 0 . 0000somenumber . <nl> + const uint8_t * start = start_digits ; <nl> + while ( ( * start = = ' 0 ' ) | | ( * start = = ' . ' ) ) { <nl> + start + + ; <nl> + } <nl> + / / we over - decrement by one when there is a ' . ' <nl> + return digit_count - int ( start - start_digits ) ; <nl> } <nl> <nl> template < typename W > <nl> - simdjson_really_inline bool write_float ( const uint8_t * const src , bool negative , uint64_t i , const uint8_t * start_digits , int digit_count , int64_t exponent , W & writer ) { <nl> + simdjson_really_inline error_code write_float ( const uint8_t * const src , bool negative , uint64_t i , const uint8_t * start_digits , int digit_count , int64_t exponent , W & writer ) { <nl> / / If we frequently had to deal with long strings of digits , <nl> / / we could extend our code by using a 128 - bit integer instead <nl> / / of a 64 - bit integer . However , this is uncommon in practice . <nl> / / digit count is off by 1 because of the decimal ( assuming there was one ) . <nl> - if ( simdjson_unlikely ( ( digit_count - 1 > = 19 ) ) ) { / / this is uncommon <nl> - / / It is possible that the integer had an overflow . <nl> - / / We have to handle the case where we have 0 . 0000somenumber . <nl> - const uint8_t * start = start_digits ; <nl> - while ( ( * start = = ' 0 ' ) | | ( * start = = ' . ' ) ) { <nl> - start + + ; <nl> - } <nl> - / / we over - decrement by one when there is a ' . ' <nl> - digit_count - = int ( start - start_digits ) ; <nl> - if ( digit_count > = 19 ) { <nl> - / / Ok , chances are good that we had an overflow ! <nl> - / / this is almost never going to get called ! ! ! <nl> - / / we start anew , going slowly ! ! ! <nl> - / / This will happen in the following examples : <nl> - / / 10000000000000000000000000000000000000000000e + 308 <nl> - / / 3 . 1415926535897932384626433832795028841971693993751 <nl> - / / <nl> - bool success = slow_float_parsing ( src , writer ) ; <nl> - / / The number was already written , but we made a copy of the writer <nl> - / / when we passed it to the parse_large_integer ( ) function , so <nl> - writer . skip_double ( ) ; <nl> - return success ; <nl> - } <nl> + if ( simdjson_unlikely ( digit_count - 1 > = 19 & & significant_digits ( start_digits , digit_count ) > = 19 ) ) { <nl> + / / Ok , chances are good that we had an overflow ! <nl> + / / this is almost never going to get called ! ! ! <nl> + / / we start anew , going slowly ! ! ! <nl> + / / This will happen in the following examples : <nl> + / / 10000000000000000000000000000000000000000000e + 308 <nl> + / / 3 . 1415926535897932384626433832795028841971693993751 <nl> + / / <nl> + / / NOTE : This makes a * copy * of the writer and passes it to slow_float_parsing . This happens <nl> + / / because slow_float_parsing is a non - inlined function . If we passed our writer reference to <nl> + / / it , it would force it to be stored in memory , preventing the compiler from picking it apart <nl> + / / and putting into registers . i . e . if we pass it as reference , it gets slow . <nl> + / / This is what forces the skip_double , as well . <nl> + error_code error = slow_float_parsing ( src , writer ) ; <nl> + writer . skip_double ( ) ; <nl> + return error ; <nl> } <nl> - / / NOTE : it ' s weird that the unlikely ( ) only wraps half the if , but it seems to get slower any other <nl> + / / NOTE : it ' s weird that the simdjson_unlikely ( ) only wraps half the if , but it seems to get slower any other <nl> / / way we ' ve tried : https : / / github . com / simdjson / simdjson / pull / 990 # discussion_r448497331 <nl> / / To future reader : we ' d love if someone found a better way , or at least could explain this result ! <nl> if ( simdjson_unlikely ( exponent < FASTFLOAT_SMALLEST_POWER ) | | ( exponent > FASTFLOAT_LARGEST_POWER ) ) { <nl> / / this is almost never going to get called ! ! ! <nl> / / we start anew , going slowly ! ! ! <nl> - bool success = slow_float_parsing ( src , writer ) ; <nl> - / / The number was already written , but we made a copy of the writer when we passed it to the <nl> - / / slow_float_parsing ( ) function , so we have to skip those tape spots now that we ' ve returned <nl> + / / NOTE : This makes a * copy * of the writer and passes it to slow_float_parsing . This happens <nl> + / / because slow_float_parsing is a non - inlined function . If we passed our writer reference to <nl> + / / it , it would force it to be stored in memory , preventing the compiler from picking it apart <nl> + / / and putting into registers . i . e . if we pass it as reference , it gets slow . <nl> + / / This is what forces the skip_double , as well . <nl> + error_code error = slow_float_parsing ( src , writer ) ; <nl> writer . skip_double ( ) ; <nl> - return success ; <nl> + return error ; <nl> } <nl> - bool success = true ; <nl> - double d = compute_float_64 ( exponent , i , negative , & success ) ; <nl> - if ( ! success ) { <nl> + double d ; <nl> + if ( ! compute_float_64 ( exponent , i , negative , d ) ) { <nl> / / we are almost never going to get here . <nl> if ( ! parse_float_strtod ( src , & d ) ) { return INVALID_NUMBER ( src ) ; } <nl> } <nl> WRITE_DOUBLE ( d , src , writer ) ; <nl> - return true ; <nl> + return SUCCESS ; <nl> } <nl> <nl> / / for performance analysis , it is sometimes useful to skip parsing <nl> # ifdef SIMDJSON_SKIPNUMBERPARSING <nl> <nl> template < typename W > <nl> - simdjson_really_inline bool parse_number ( const uint8_t * const , W & writer ) { <nl> + simdjson_really_inline error_code parse_number ( const uint8_t * const , W & writer ) { <nl> writer . append_s64 ( 0 ) ; / / always write zero <nl> - return true ; / / always succeeds <nl> + return SUCCESS ; / / always succeeds <nl> } <nl> <nl> # else <nl> simdjson_really_inline bool parse_number ( const uint8_t * const , W & writer ) { <nl> / / <nl> / / Our objective is accurate parsing ( ULP of 0 ) at high speed . <nl> template < typename W > <nl> - simdjson_really_inline bool parse_number ( const uint8_t * const src , W & writer ) { <nl> + simdjson_really_inline error_code parse_number ( const uint8_t * const src , W & writer ) { <nl> <nl> / / <nl> / / Check for minus sign <nl> simdjson_really_inline bool parse_number ( const uint8_t * const src , W & writer ) { <nl> if ( ' . ' = = * p ) { <nl> is_float = true ; <nl> + + p ; <nl> - if ( ! parse_decimal ( src , p , i , exponent ) ) { return false ; } <nl> + SIMDJSON_TRY ( parse_decimal ( src , p , i , exponent ) ) ; <nl> digit_count = int ( p - start_digits ) ; / / used later to guard against overflows <nl> } <nl> if ( ( ' e ' = = * p ) | | ( ' E ' = = * p ) ) { <nl> is_float = true ; <nl> + + p ; <nl> - if ( ! parse_exponent ( src , p , exponent ) ) { return false ; } <nl> + SIMDJSON_TRY ( parse_exponent ( src , p , exponent ) ) ; <nl> } <nl> if ( is_float ) { <nl> const bool clean_end = is_structural_or_whitespace ( * p ) ; <nl> - return write_float ( src , negative , i , start_digits , digit_count , exponent , writer ) & & clean_end ; <nl> + SIMDJSON_TRY ( write_float ( src , negative , i , start_digits , digit_count , exponent , writer ) ) ; <nl> + if ( ! clean_end ) { return INVALID_NUMBER ( src ) ; } <nl> + return SUCCESS ; <nl> } <nl> <nl> / / The longest negative 64 - bit number is 19 digits . <nl> simdjson_really_inline bool parse_number ( const uint8_t * const src , W & writer ) { <nl> int longest_digit_count = negative ? 19 : 20 ; <nl> if ( digit_count > longest_digit_count ) { return INVALID_NUMBER ( src ) ; } <nl> if ( digit_count = = longest_digit_count ) { <nl> - if ( negative ) { <nl> + if ( negative ) { <nl> / / Anything negative above INT64_MAX + 1 is invalid <nl> - if ( i > uint64_t ( INT64_MAX ) + 1 ) { <nl> - return INVALID_NUMBER ( src ) ; <nl> - } <nl> + if ( i > uint64_t ( INT64_MAX ) + 1 ) { return INVALID_NUMBER ( src ) ; } <nl> WRITE_INTEGER ( ~ i + 1 , src , writer ) ; <nl> - return is_structural_or_whitespace ( * p ) ; <nl> + if ( ! is_structural_or_whitespace ( * p ) ) { return INVALID_NUMBER ( src ) ; } <nl> + return SUCCESS ; <nl> / / Positive overflow check : <nl> / / - A 20 digit number starting with 2 - 9 is overflow , because 18 , 446 , 744 , 073 , 709 , 551 , 615 is the <nl> / / biggest uint64_t . <nl> simdjson_really_inline bool parse_number ( const uint8_t * const src , W & writer ) { <nl> } else { <nl> WRITE_INTEGER ( negative ? ( ~ i + 1 ) : i , src , writer ) ; <nl> } <nl> - return is_structural_or_whitespace ( * p ) ; <nl> + if ( ! is_structural_or_whitespace ( * p ) ) { return INVALID_NUMBER ( src ) ; } <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + / / SAX functions <nl> + namespace { <nl> + / / Parse any number from 0 to 18 , 446 , 744 , 073 , 709 , 551 , 615 <nl> + SIMDJSON_UNUSED simdjson_really_inline simdjson_result < uint64_t > parse_unsigned ( const uint8_t * const src ) noexcept { <nl> + const uint8_t * p = src ; <nl> + <nl> + / / <nl> + / / Parse the integer part . <nl> + / / <nl> + / / PERF NOTE : we don ' t use is_made_of_eight_digits_fast because large integers like 123456789 are rare <nl> + const uint8_t * const start_digits = p ; <nl> + uint64_t i = 0 ; <nl> + while ( parse_digit ( * p , i ) ) { p + + ; } <nl> + <nl> + / / If there were no digits , or if the integer starts with 0 and has more than one digit , it ' s an error . <nl> + int digit_count = int ( p - start_digits ) ; <nl> + if ( digit_count = = 0 | | ( ' 0 ' = = * start_digits & & digit_count > 1 ) ) { return NUMBER_ERROR ; } <nl> + if ( ! is_structural_or_whitespace ( * p ) ) { return NUMBER_ERROR ; } <nl> + <nl> + / / The longest positive 64 - bit number is 20 digits . <nl> + / / We do it this way so we don ' t trigger this branch unless we must . <nl> + if ( digit_count > 20 ) { return NUMBER_ERROR ; } <nl> + if ( digit_count = = 20 ) { <nl> + / / Positive overflow check : <nl> + / / - A 20 digit number starting with 2 - 9 is overflow , because 18 , 446 , 744 , 073 , 709 , 551 , 615 is the <nl> + / / biggest uint64_t . <nl> + / / - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX . <nl> + / / If we got here , it ' s a 20 digit number starting with the digit " 1 " . <nl> + / / - If a 20 digit number starting with 1 overflowed ( i * 10 + digit ) , the result will be smaller <nl> + / / than 1 , 553 , 255 , 926 , 290 , 448 , 384 . <nl> + / / - That is smaller than the smallest possible 20 - digit number the user could write : <nl> + / / 10 , 000 , 000 , 000 , 000 , 000 , 000 . <nl> + / / - Therefore , if the number is positive and lower than that , it ' s overflow . <nl> + / / - The value we are looking at is less than or equal to 9 , 223 , 372 , 036 , 854 , 775 , 808 ( INT64_MAX ) . <nl> + / / <nl> + if ( src [ 0 ] ! = uint8_t ( ' 1 ' ) | | i < = uint64_t ( INT64_MAX ) ) { return NUMBER_ERROR ; } <nl> + } <nl> + <nl> + return i ; <nl> + } <nl> + <nl> + / / Parse any number from 0 to 18 , 446 , 744 , 073 , 709 , 551 , 615 <nl> + / / Call this version of the method if you regularly expect 8 - or 16 - digit numbers . <nl> + SIMDJSON_UNUSED simdjson_really_inline simdjson_result < uint64_t > parse_large_unsigned ( const uint8_t * const src ) noexcept { <nl> + const uint8_t * p = src ; <nl> + <nl> + / / <nl> + / / Parse the integer part . <nl> + / / <nl> + uint64_t i = 0 ; <nl> + if ( is_made_of_eight_digits_fast ( p ) ) { <nl> + i = i * 100000000 + parse_eight_digits_unrolled ( p ) ; <nl> + p + = 8 ; <nl> + if ( is_made_of_eight_digits_fast ( p ) ) { <nl> + i = i * 100000000 + parse_eight_digits_unrolled ( p ) ; <nl> + p + = 8 ; <nl> + if ( parse_digit ( * p , i ) ) { / / digit 17 <nl> + p + + ; <nl> + if ( parse_digit ( * p , i ) ) { / / digit 18 <nl> + p + + ; <nl> + if ( parse_digit ( * p , i ) ) { / / digit 19 <nl> + p + + ; <nl> + if ( parse_digit ( * p , i ) ) { / / digit 20 <nl> + p + + ; <nl> + if ( parse_digit ( * p , i ) ) { return NUMBER_ERROR ; } / / 21 digits is an error <nl> + / / Positive overflow check : <nl> + / / - A 20 digit number starting with 2 - 9 is overflow , because 18 , 446 , 744 , 073 , 709 , 551 , 615 is the <nl> + / / biggest uint64_t . <nl> + / / - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX . <nl> + / / If we got here , it ' s a 20 digit number starting with the digit " 1 " . <nl> + / / - If a 20 digit number starting with 1 overflowed ( i * 10 + digit ) , the result will be smaller <nl> + / / than 1 , 553 , 255 , 926 , 290 , 448 , 384 . <nl> + / / - That is smaller than the smallest possible 20 - digit number the user could write : <nl> + / / 10 , 000 , 000 , 000 , 000 , 000 , 000 . <nl> + / / - Therefore , if the number is positive and lower than that , it ' s overflow . <nl> + / / - The value we are looking at is less than or equal to 9 , 223 , 372 , 036 , 854 , 775 , 808 ( INT64_MAX ) . <nl> + / / <nl> + if ( src [ 0 ] ! = uint8_t ( ' 1 ' ) | | i < = uint64_t ( INT64_MAX ) ) { return NUMBER_ERROR ; } <nl> + } <nl> + } <nl> + } <nl> + } <nl> + } / / 16 digits <nl> + } else { / / 8 digits <nl> + / / Less than 8 digits can ' t overflow , simpler logic here . <nl> + if ( parse_digit ( * p , i ) ) { p + + ; } else { return NUMBER_ERROR ; } <nl> + while ( parse_digit ( * p , i ) ) { p + + ; } <nl> + } <nl> + <nl> + if ( ! is_structural_or_whitespace ( * p ) ) { return NUMBER_ERROR ; } <nl> + / / If there were no digits , or if the integer starts with 0 and has more than one digit , it ' s an error . <nl> + int digit_count = int ( p - src ) ; <nl> + if ( digit_count = = 0 | | ( ' 0 ' = = * src & & digit_count > 1 ) ) { return NUMBER_ERROR ; } <nl> + return i ; <nl> + } <nl> + <nl> + / / Parse any number from - 9 , 223 , 372 , 036 , 854 , 775 , 808 to 9 , 223 , 372 , 036 , 854 , 775 , 807 <nl> + SIMDJSON_UNUSED simdjson_really_inline simdjson_result < int64_t > parse_integer ( const uint8_t * src ) noexcept { <nl> + / / <nl> + / / Check for minus sign <nl> + / / <nl> + bool negative = ( * src = = ' - ' ) ; <nl> + const uint8_t * p = src + negative ; <nl> + <nl> + / / <nl> + / / Parse the integer part . <nl> + / / <nl> + / / PERF NOTE : we don ' t use is_made_of_eight_digits_fast because large integers like 123456789 are rare <nl> + const uint8_t * const start_digits = p ; <nl> + uint64_t i = 0 ; <nl> + while ( parse_digit ( * p , i ) ) { p + + ; } <nl> + <nl> + / / If there were no digits , or if the integer starts with 0 and has more than one digit , it ' s an error . <nl> + int digit_count = int ( p - start_digits ) ; <nl> + if ( digit_count = = 0 | | ( ' 0 ' = = * start_digits & & digit_count > 1 ) ) { return NUMBER_ERROR ; } <nl> + if ( ! is_structural_or_whitespace ( * p ) ) { return NUMBER_ERROR ; } <nl> + <nl> + / / The longest negative 64 - bit number is 19 digits . <nl> + / / The longest positive 64 - bit number is 20 digits . <nl> + / / We do it this way so we don ' t trigger this branch unless we must . <nl> + int longest_digit_count = negative ? 19 : 20 ; <nl> + if ( digit_count > longest_digit_count ) { return NUMBER_ERROR ; } <nl> + if ( digit_count = = longest_digit_count ) { <nl> + if ( negative ) { <nl> + / / Anything negative above INT64_MAX + 1 is invalid <nl> + if ( i > uint64_t ( INT64_MAX ) + 1 ) { return NUMBER_ERROR ; } <nl> + return ~ i + 1 ; <nl> + <nl> + / / Positive overflow check : <nl> + / / - A 20 digit number starting with 2 - 9 is overflow , because 18 , 446 , 744 , 073 , 709 , 551 , 615 is the <nl> + / / biggest uint64_t . <nl> + / / - A 20 digit number starting with 1 is overflow if it is less than INT64_MAX . <nl> + / / If we got here , it ' s a 20 digit number starting with the digit " 1 " . <nl> + / / - If a 20 digit number starting with 1 overflowed ( i * 10 + digit ) , the result will be smaller <nl> + / / than 1 , 553 , 255 , 926 , 290 , 448 , 384 . <nl> + / / - That is smaller than the smallest possible 20 - digit number the user could write : <nl> + / / 10 , 000 , 000 , 000 , 000 , 000 , 000 . <nl> + / / - Therefore , if the number is positive and lower than that , it ' s overflow . <nl> + / / - The value we are looking at is less than or equal to 9 , 223 , 372 , 036 , 854 , 775 , 808 ( INT64_MAX ) . <nl> + / / <nl> + } else if ( src [ 0 ] ! = uint8_t ( ' 1 ' ) | | i < = uint64_t ( INT64_MAX ) ) { return NUMBER_ERROR ; } <nl> + } <nl> + <nl> + return negative ? ( ~ i + 1 ) : i ; <nl> } <nl> <nl> + SIMDJSON_UNUSED simdjson_really_inline simdjson_result < double > parse_double ( const uint8_t * src ) noexcept { <nl> + / / <nl> + / / Check for minus sign <nl> + / / <nl> + bool negative = ( * src = = ' - ' ) ; <nl> + src + = negative ; <nl> + <nl> + / / <nl> + / / Parse the integer part . <nl> + / / <nl> + uint64_t i = 0 ; <nl> + const uint8_t * p = src ; <nl> + p + = parse_digit ( * p , i ) ; <nl> + bool leading_zero = ( i = = 0 ) ; <nl> + while ( parse_digit ( * p , i ) ) { p + + ; } <nl> + / / no integer digits , or 0123 ( zero must be solo ) <nl> + if ( p = = src | | ( leading_zero & & p ! = src + 1 ) ) { return NUMBER_ERROR ; } <nl> + <nl> + / / <nl> + / / Parse the decimal part . <nl> + / / <nl> + int64_t exponent = 0 ; <nl> + bool overflow ; <nl> + if ( simdjson_likely ( * p = = ' . ' ) ) { <nl> + p + + ; <nl> + const uint8_t * start_decimal_digits = p ; <nl> + if ( ! parse_digit ( * p , i ) ) { return NUMBER_ERROR ; } / / no decimal digits <nl> + p + + ; <nl> + while ( parse_digit ( * p , i ) ) { p + + ; } <nl> + exponent = - ( p - start_decimal_digits ) ; <nl> + <nl> + / / Overflow check . 19 digits ( minus the decimal ) may be overflow . <nl> + overflow = p - src - 1 > = 19 ; <nl> + if ( simdjson_unlikely ( overflow & & leading_zero ) ) { <nl> + / / Skip leading 0 . 00000 and see if it still overflows <nl> + const uint8_t * start_digits = src + 2 ; <nl> + while ( * start_digits = = ' 0 ' ) { start_digits + + ; } <nl> + overflow = start_digits - src > = 19 ; <nl> + } <nl> + } else { <nl> + overflow = p - src > = 19 ; <nl> + } <nl> + <nl> + / / <nl> + / / Parse the exponent <nl> + / / <nl> + if ( * p = = ' e ' | | * p = = ' E ' ) { <nl> + p + + ; <nl> + bool exp_neg = * p = = ' - ' ; <nl> + p + = exp_neg | | * p = = ' + ' ; <nl> + <nl> + uint64_t exp = 0 ; <nl> + const uint8_t * start_exp_digits = p ; <nl> + while ( parse_digit ( * p , exp ) ) { p + + ; } <nl> + / / no exp digits , or 20 + exp digits <nl> + if ( p - start_exp_digits = = 0 | | p - start_exp_digits > 19 ) { return NUMBER_ERROR ; } <nl> + <nl> + exponent + = exp_neg ? 0 - exp : exp ; <nl> + overflow = overflow | | exponent < FASTFLOAT_SMALLEST_POWER | | exponent > FASTFLOAT_LARGEST_POWER ; <nl> + } <nl> + <nl> + / / <nl> + / / Assemble ( or slow - parse ) the float <nl> + / / <nl> + double d ; <nl> + if ( simdjson_likely ( ! overflow ) ) { <nl> + if ( compute_float_64 ( exponent , i , negative , d ) ) { return d ; } <nl> + } <nl> + if ( ! parse_float_strtod ( src - negative , & d ) ) { <nl> + return NUMBER_ERROR ; <nl> + } <nl> + return d ; <nl> + } <nl> + } / / namespace { } <nl> # endif / / SIMDJSON_SKIPNUMBERPARSING <nl> <nl> } / / namespace numberparsing <nl> mmm a / src / generic / stage2 / stringparsing . h <nl> ppp b / src / generic / stage2 / stringparsing . h <nl> SIMDJSON_WARN_UNUSED simdjson_really_inline uint8_t * parse_string ( const uint8_t <nl> return nullptr ; <nl> } <nl> <nl> + SIMDJSON_UNUSED SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse_string_to_buffer ( const uint8_t * src , uint8_t * & current_string_buf_loc , std : : string_view & s ) { <nl> + if ( src [ 0 ] ! = ' " ' ) { return STRING_ERROR ; } <nl> + auto end = stringparsing : : parse_string ( src , current_string_buf_loc ) ; <nl> + if ( ! end ) { return STRING_ERROR ; } <nl> + s = std : : string_view ( ( const char * ) current_string_buf_loc , end - current_string_buf_loc ) ; <nl> + current_string_buf_loc = end ; <nl> + return SUCCESS ; <nl> + } <nl> + <nl> } / / namespace stringparsing <nl> } / / namespace stage2 <nl> } / / namespace SIMDJSON_IMPLEMENTATION <nl> deleted file mode 100644 <nl> index 75f09853c . . 000000000 <nl> mmm a / src / generic / stage2 / structural_parser . h <nl> ppp / dev / null <nl> <nl> - / / This file contains the common code every implementation uses for stage2 <nl> - / / It is intended to be included multiple times and compiled multiple times <nl> - / / We assume the file in which it is include already includes <nl> - / / " simdjson / stage2 . h " ( this simplifies amalgation ) <nl> - <nl> - # include " generic / stage2 / logger . h " <nl> - # include " generic / stage2 / structural_iterator . h " <nl> - <nl> - namespace { / / Make everything here private <nl> - namespace SIMDJSON_IMPLEMENTATION { <nl> - namespace stage2 { <nl> - <nl> - # define SIMDJSON_TRY ( EXPR ) { auto _err = ( EXPR ) ; if ( _err ) { return _err ; } } <nl> - <nl> - struct structural_parser : structural_iterator { <nl> - / * * Current depth ( nested objects and arrays ) * / <nl> - uint32_t depth { 0 } ; <nl> - <nl> - template < bool STREAMING , typename T > <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse ( T & builder ) noexcept ; <nl> - template < bool STREAMING , typename T > <nl> - SIMDJSON_WARN_UNUSED static simdjson_really_inline error_code parse ( dom_parser_implementation & dom_parser , T & builder ) noexcept { <nl> - structural_parser parser ( dom_parser , STREAMING ? dom_parser . next_structural_index : 0 ) ; <nl> - return parser . parse < STREAMING > ( builder ) ; <nl> - } <nl> - <nl> - / / For non - streaming , to pass an explicit 0 as next_structural , which enables optimizations <nl> - simdjson_really_inline structural_parser ( dom_parser_implementation & _dom_parser , uint32_t start_structural_index ) <nl> - : structural_iterator ( _dom_parser , start_structural_index ) { <nl> - } <nl> - <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code start_document ( ) { <nl> - dom_parser . is_array [ depth ] = false ; <nl> - return SUCCESS ; <nl> - } <nl> - template < typename T > <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code start_array ( T & builder ) { <nl> - depth + + ; <nl> - if ( depth > = dom_parser . max_depth ( ) ) { log_error ( " Exceeded max depth ! " ) ; return DEPTH_ERROR ; } <nl> - builder . start_array ( * this ) ; <nl> - dom_parser . is_array [ depth ] = true ; <nl> - return SUCCESS ; <nl> - } <nl> - <nl> - template < typename T > <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline bool empty_object ( T & builder ) { <nl> - if ( peek_next_char ( ) = = ' } ' ) { <nl> - advance_char ( ) ; <nl> - builder . empty_object ( * this ) ; <nl> - return true ; <nl> - } <nl> - return false ; <nl> - } <nl> - template < typename T > <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline bool empty_array ( T & builder ) { <nl> - if ( peek_next_char ( ) = = ' ] ' ) { <nl> - advance_char ( ) ; <nl> - builder . empty_array ( * this ) ; <nl> - return true ; <nl> - } <nl> - return false ; <nl> - } <nl> - <nl> - template < bool STREAMING > <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code finish ( ) { <nl> - dom_parser . next_structural_index = uint32_t ( next_structural - & dom_parser . structural_indexes [ 0 ] ) ; <nl> - <nl> - if ( depth ! = 0 ) { <nl> - log_error ( " Unclosed objects or arrays ! " ) ; <nl> - return TAPE_ERROR ; <nl> - } <nl> - <nl> - / / If we didn ' t make it to the end , it ' s an error <nl> - if ( ! STREAMING & & dom_parser . next_structural_index ! = dom_parser . n_structural_indexes ) { <nl> - logger : : log_string ( " More than one JSON value at the root of the document , or extra characters at the end of the JSON ! " ) ; <nl> - return TAPE_ERROR ; <nl> - } <nl> - <nl> - return SUCCESS ; <nl> - } <nl> - <nl> - simdjson_really_inline uint8_t last_structural ( ) { <nl> - return buf [ dom_parser . structural_indexes [ dom_parser . n_structural_indexes - 1 ] ] ; <nl> - } <nl> - <nl> - simdjson_really_inline void log_value ( const char * type ) { <nl> - logger : : log_line ( * this , " " , type , " " ) ; <nl> - } <nl> - <nl> - simdjson_really_inline void log_start_value ( const char * type ) { <nl> - logger : : log_line ( * this , " + " , type , " " ) ; <nl> - if ( logger : : LOG_ENABLED ) { logger : : log_depth + + ; } <nl> - } <nl> - <nl> - simdjson_really_inline void log_end_value ( const char * type ) { <nl> - if ( logger : : LOG_ENABLED ) { logger : : log_depth - - ; } <nl> - logger : : log_line ( * this , " - " , type , " " ) ; <nl> - } <nl> - <nl> - simdjson_really_inline void log_error ( const char * error ) { <nl> - logger : : log_line ( * this , " " , " ERROR " , error ) ; <nl> - } <nl> - } ; / / struct structural_parser <nl> - <nl> - template < bool STREAMING , typename T > <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code structural_parser : : parse ( T & builder ) noexcept { <nl> - logger : : log_start ( ) ; <nl> - <nl> - / / <nl> - / / Start the document <nl> - / / <nl> - if ( at_end ( ) ) { return EMPTY ; } <nl> - SIMDJSON_TRY ( start_document ( ) ) ; <nl> - builder . start_document ( * this ) ; <nl> - <nl> - / / <nl> - / / Read first value <nl> - / / <nl> - { <nl> - const uint8_t * value = advance ( ) ; <nl> - <nl> - / / Make sure the outer hash or array is closed before continuing ; otherwise , there are ways we <nl> - / / could get into memory corruption . See https : / / github . com / simdjson / simdjson / issues / 906 <nl> - if ( ! STREAMING ) { <nl> - switch ( * value ) { <nl> - case ' { ' : <nl> - if ( last_structural ( ) ! = ' } ' ) { <nl> - return TAPE_ERROR ; <nl> - } <nl> - break ; <nl> - case ' [ ' : <nl> - if ( last_structural ( ) ! = ' ] ' ) { <nl> - return TAPE_ERROR ; <nl> - } <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - switch ( * value ) { <nl> - case ' { ' : if ( ! empty_object ( builder ) ) { goto object_begin ; } ; break ; <nl> - case ' [ ' : if ( ! empty_array ( builder ) ) { goto array_begin ; } ; break ; <nl> - default : SIMDJSON_TRY ( builder . parse_root_primitive ( * this , value ) ) ; <nl> - } <nl> - goto document_end ; <nl> - } <nl> - <nl> - / / <nl> - / / Object parser states <nl> - / / <nl> - object_begin : { <nl> - depth + + ; <nl> - if ( depth > = dom_parser . max_depth ( ) ) { log_error ( " Exceeded max depth ! " ) ; return DEPTH_ERROR ; } <nl> - builder . start_object ( * this ) ; <nl> - dom_parser . is_array [ depth ] = false ; <nl> - <nl> - const uint8_t * key = advance ( ) ; <nl> - if ( * key ! = ' " ' ) { <nl> - log_error ( " Object does not start with a key " ) ; <nl> - return TAPE_ERROR ; <nl> - } <nl> - builder . increment_count ( * this ) ; <nl> - SIMDJSON_TRY ( builder . parse_key ( * this , key ) ) ; <nl> - goto object_field ; <nl> - } / / object_begin : <nl> - <nl> - object_field : { <nl> - if ( simdjson_unlikely ( advance_char ( ) ! = ' : ' ) ) { log_error ( " Missing colon after key in object " ) ; return TAPE_ERROR ; } <nl> - const uint8_t * value = advance ( ) ; <nl> - switch ( * value ) { <nl> - case ' { ' : if ( ! empty_object ( builder ) ) { goto object_begin ; } ; break ; <nl> - case ' [ ' : if ( ! empty_array ( builder ) ) { goto array_begin ; } ; break ; <nl> - default : SIMDJSON_TRY ( builder . parse_primitive ( * this , value ) ) ; <nl> - } <nl> - } / / object_field : <nl> - <nl> - object_continue : { <nl> - switch ( advance_char ( ) ) { <nl> - case ' , ' : { <nl> - builder . increment_count ( * this ) ; <nl> - const uint8_t * key = advance ( ) ; <nl> - if ( simdjson_unlikely ( * key ! = ' " ' ) ) { log_error ( " Key string missing at beginning of field in object " ) ; return TAPE_ERROR ; } <nl> - SIMDJSON_TRY ( builder . parse_key ( * this , key ) ) ; <nl> - goto object_field ; <nl> - } <nl> - case ' } ' : <nl> - builder . end_object ( * this ) ; <nl> - goto scope_end ; <nl> - default : <nl> - log_error ( " No comma between object fields " ) ; <nl> - return TAPE_ERROR ; <nl> - } <nl> - } / / object_continue : <nl> - <nl> - scope_end : { <nl> - depth - - ; <nl> - if ( depth = = 0 ) { goto document_end ; } <nl> - if ( dom_parser . is_array [ depth ] ) { goto array_continue ; } <nl> - goto object_continue ; <nl> - } / / scope_end : <nl> - <nl> - / / <nl> - / / Array parser states <nl> - / / <nl> - array_begin : { <nl> - depth + + ; <nl> - if ( depth > = dom_parser . max_depth ( ) ) { log_error ( " Exceeded max depth ! " ) ; return DEPTH_ERROR ; } <nl> - builder . start_array ( * this ) ; <nl> - dom_parser . is_array [ depth ] = true ; <nl> - <nl> - builder . increment_count ( * this ) ; <nl> - } / / array_begin : <nl> - <nl> - array_value : { <nl> - const uint8_t * value = advance ( ) ; <nl> - switch ( * value ) { <nl> - case ' { ' : if ( ! empty_object ( builder ) ) { goto object_begin ; } ; break ; <nl> - case ' [ ' : if ( ! empty_array ( builder ) ) { goto array_begin ; } ; break ; <nl> - default : SIMDJSON_TRY ( builder . parse_primitive ( * this , value ) ) ; <nl> - } <nl> - } / / array_value : <nl> - <nl> - array_continue : { <nl> - switch ( advance_char ( ) ) { <nl> - case ' , ' : <nl> - builder . increment_count ( * this ) ; <nl> - goto array_value ; <nl> - case ' ] ' : <nl> - builder . end_array ( * this ) ; <nl> - goto scope_end ; <nl> - default : <nl> - log_error ( " Missing comma between array values " ) ; <nl> - return TAPE_ERROR ; <nl> - } <nl> - } / / array_continue : <nl> - <nl> - document_end : { <nl> - builder . end_document ( * this ) ; <nl> - return finish < STREAMING > ( ) ; <nl> - } / / document_end : <nl> - <nl> - } / / parse_structurals ( ) <nl> - <nl> - } / / namespace stage2 <nl> - } / / namespace SIMDJSON_IMPLEMENTATION <nl> - } / / unnamed namespace <nl> mmm a / src / generic / stage2 / tape_builder . h <nl> ppp b / src / generic / stage2 / tape_builder . h <nl> <nl> + # include " generic / stage2 / json_iterator . h " <nl> # include " generic / stage2 / tape_writer . h " <nl> # include " generic / stage2 / atomparsing . h " <nl> <nl> namespace SIMDJSON_IMPLEMENTATION { <nl> namespace stage2 { <nl> <nl> struct tape_builder { <nl> + template < bool STREAMING > <nl> + SIMDJSON_WARN_UNUSED static simdjson_really_inline error_code parse_document ( <nl> + dom_parser_implementation & dom_parser , <nl> + dom : : document & doc ) noexcept ; <nl> + <nl> + / * * Called when a non - empty document starts . * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_document_start ( json_iterator & iter ) noexcept ; <nl> + / * * Called when a non - empty document ends without error . * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_document_end ( json_iterator & iter ) noexcept ; <nl> + <nl> + / * * Called when a non - empty array starts . * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_array_start ( json_iterator & iter ) noexcept ; <nl> + / * * Called when a non - empty array ends . * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_array_end ( json_iterator & iter ) noexcept ; <nl> + / * * Called when an empty array is found . * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_empty_array ( json_iterator & iter ) noexcept ; <nl> + <nl> + / * * Called when a non - empty object starts . * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_object_start ( json_iterator & iter ) noexcept ; <nl> + / * * <nl> + * Called when a key in a field is encountered . <nl> + * <nl> + * primitive , visit_object_start , visit_empty_object , visit_array_start , or visit_empty_array <nl> + * will be called after this with the field value . <nl> + * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_key ( json_iterator & iter , const uint8_t * key ) noexcept ; <nl> + / * * Called when a non - empty object ends . * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_object_end ( json_iterator & iter ) noexcept ; <nl> + / * * Called when an empty object is found . * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_empty_object ( json_iterator & iter ) noexcept ; <nl> + <nl> + / * * <nl> + * Called when a string , number , boolean or null is found . <nl> + * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_primitive ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + / * * <nl> + * Called when a string , number , boolean or null is found at the top level of a document ( i . e . <nl> + * when there is no array or object and the entire document is a single string , number , boolean or <nl> + * null . <nl> + * <nl> + * This is separate from primitive ( ) because simdjson ' s normal primitive parsing routines assume <nl> + * there is at least one more token after the value , which is only true in an array or object . <nl> + * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_root_primitive ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_string ( json_iterator & iter , const uint8_t * value , bool key = false ) noexcept ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_number ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_true_atom ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_false_atom ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_null_atom ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_root_string ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_root_number ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_root_true_atom ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_root_false_atom ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code visit_root_null_atom ( json_iterator & iter , const uint8_t * value ) noexcept ; <nl> + <nl> + / * * Called each time a new field or element in an array or object is found . * / <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code increment_count ( json_iterator & iter ) noexcept ; <nl> + <nl> / * * Next location to write to tape * / <nl> tape_writer tape ; <nl> + private : <nl> / * * Next write location in the string buf for stage 2 parsing * / <nl> uint8_t * current_string_buf_loc ; <nl> <nl> - simdjson_really_inline tape_builder ( dom : : document & doc ) noexcept : tape { doc . tape . get ( ) } , current_string_buf_loc { doc . string_buf . get ( ) } { } <nl> + simdjson_really_inline tape_builder ( dom : : document & doc ) noexcept ; <nl> <nl> - private : <nl> - friend struct structural_parser ; <nl> - <nl> - simdjson_really_inline error_code parse_root_primitive ( structural_parser & parser , const uint8_t * value ) { <nl> - switch ( * value ) { <nl> - case ' " ' : return parse_string ( parser , value ) ; <nl> - case ' t ' : return parse_root_true_atom ( parser , value ) ; <nl> - case ' f ' : return parse_root_false_atom ( parser , value ) ; <nl> - case ' n ' : return parse_root_null_atom ( parser , value ) ; <nl> - case ' - ' : <nl> - case ' 0 ' : case ' 1 ' : case ' 2 ' : case ' 3 ' : case ' 4 ' : <nl> - case ' 5 ' : case ' 6 ' : case ' 7 ' : case ' 8 ' : case ' 9 ' : <nl> - return parse_root_number ( parser , value ) ; <nl> - default : <nl> - parser . log_error ( " Document starts with a non - value character " ) ; <nl> - return TAPE_ERROR ; <nl> - } <nl> - } <nl> - simdjson_really_inline error_code parse_primitive ( structural_parser & parser , const uint8_t * value ) { <nl> - switch ( * value ) { <nl> - case ' " ' : return parse_string ( parser , value ) ; <nl> - case ' t ' : return parse_true_atom ( parser , value ) ; <nl> - case ' f ' : return parse_false_atom ( parser , value ) ; <nl> - case ' n ' : return parse_null_atom ( parser , value ) ; <nl> - case ' - ' : <nl> - case ' 0 ' : case ' 1 ' : case ' 2 ' : case ' 3 ' : case ' 4 ' : <nl> - case ' 5 ' : case ' 6 ' : case ' 7 ' : case ' 8 ' : case ' 9 ' : <nl> - return parse_number ( parser , value ) ; <nl> - default : <nl> - parser . log_error ( " Non - value found when value was expected ! " ) ; <nl> - return TAPE_ERROR ; <nl> - } <nl> - } <nl> - simdjson_really_inline void empty_object ( structural_parser & parser ) { <nl> - parser . log_value ( " empty object " ) ; <nl> - empty_container ( parser , internal : : tape_type : : START_OBJECT , internal : : tape_type : : END_OBJECT ) ; <nl> - } <nl> - simdjson_really_inline void empty_array ( structural_parser & parser ) { <nl> - parser . log_value ( " empty array " ) ; <nl> - empty_container ( parser , internal : : tape_type : : START_ARRAY , internal : : tape_type : : END_ARRAY ) ; <nl> - } <nl> + simdjson_really_inline uint32_t next_tape_index ( json_iterator & iter ) const noexcept ; <nl> + simdjson_really_inline void start_container ( json_iterator & iter ) noexcept ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code end_container ( json_iterator & iter , internal : : tape_type start , internal : : tape_type end ) noexcept ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code empty_container ( json_iterator & iter , internal : : tape_type start , internal : : tape_type end ) noexcept ; <nl> + simdjson_really_inline uint8_t * on_start_string ( json_iterator & iter ) noexcept ; <nl> + simdjson_really_inline void on_end_string ( uint8_t * dst ) noexcept ; <nl> + } ; / / class tape_builder <nl> <nl> - simdjson_really_inline void start_document ( structural_parser & parser ) { <nl> - parser . log_start_value ( " document " ) ; <nl> - start_container ( parser ) ; <nl> - } <nl> - simdjson_really_inline void start_object ( structural_parser & parser ) { <nl> - parser . log_start_value ( " object " ) ; <nl> - start_container ( parser ) ; <nl> - } <nl> - simdjson_really_inline void start_array ( structural_parser & parser ) { <nl> - parser . log_start_value ( " array " ) ; <nl> - start_container ( parser ) ; <nl> - } <nl> + template < bool STREAMING > <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : parse_document ( <nl> + dom_parser_implementation & dom_parser , <nl> + dom : : document & doc ) noexcept { <nl> + dom_parser . doc = & doc ; <nl> + json_iterator iter ( dom_parser , STREAMING ? dom_parser . next_structural_index : 0 ) ; <nl> + tape_builder builder ( doc ) ; <nl> + return iter . walk_document < STREAMING > ( builder ) ; <nl> + } <nl> <nl> - simdjson_really_inline void end_object ( structural_parser & parser ) { <nl> - parser . log_end_value ( " object " ) ; <nl> - end_container ( parser , internal : : tape_type : : START_OBJECT , internal : : tape_type : : END_OBJECT ) ; <nl> - } <nl> - simdjson_really_inline void end_array ( structural_parser & parser ) { <nl> - parser . log_end_value ( " array " ) ; <nl> - end_container ( parser , internal : : tape_type : : START_ARRAY , internal : : tape_type : : END_ARRAY ) ; <nl> - } <nl> - simdjson_really_inline void end_document ( structural_parser & parser ) { <nl> - parser . log_end_value ( " document " ) ; <nl> - constexpr uint32_t start_tape_index = 0 ; <nl> - tape . append ( start_tape_index , internal : : tape_type : : ROOT ) ; <nl> - tape_writer : : write ( parser . dom_parser . doc - > tape [ start_tape_index ] , next_tape_index ( parser ) , internal : : tape_type : : ROOT ) ; <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_root_primitive ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + return iter . visit_root_primitive ( * this , value ) ; <nl> + } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_primitive ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + return iter . visit_primitive ( * this , value ) ; <nl> + } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_empty_object ( json_iterator & iter ) noexcept { <nl> + return empty_container ( iter , internal : : tape_type : : START_OBJECT , internal : : tape_type : : END_OBJECT ) ; <nl> + } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_empty_array ( json_iterator & iter ) noexcept { <nl> + return empty_container ( iter , internal : : tape_type : : START_ARRAY , internal : : tape_type : : END_ARRAY ) ; <nl> + } <nl> <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse_key ( structural_parser & parser , const uint8_t * value ) { <nl> - return parse_string ( parser , value , true ) ; <nl> - } <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse_string ( structural_parser & parser , const uint8_t * value , bool key = false ) { <nl> - parser . log_value ( key ? " key " : " string " ) ; <nl> - uint8_t * dst = on_start_string ( parser ) ; <nl> - dst = stringparsing : : parse_string ( value , dst ) ; <nl> - if ( dst = = nullptr ) { <nl> - parser . log_error ( " Invalid escape in string " ) ; <nl> - return STRING_ERROR ; <nl> - } <nl> - on_end_string ( dst ) ; <nl> - return SUCCESS ; <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_document_start ( json_iterator & iter ) noexcept { <nl> + start_container ( iter ) ; <nl> + return SUCCESS ; <nl> + } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_object_start ( json_iterator & iter ) noexcept { <nl> + start_container ( iter ) ; <nl> + return SUCCESS ; <nl> + } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_array_start ( json_iterator & iter ) noexcept { <nl> + start_container ( iter ) ; <nl> + return SUCCESS ; <nl> + } <nl> <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse_number ( structural_parser & parser , const uint8_t * value ) { <nl> - parser . log_value ( " number " ) ; <nl> - if ( ! numberparsing : : parse_number ( value , tape ) ) { parser . log_error ( " Invalid number " ) ; return NUMBER_ERROR ; } <nl> - return SUCCESS ; <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_object_end ( json_iterator & iter ) noexcept { <nl> + return end_container ( iter , internal : : tape_type : : START_OBJECT , internal : : tape_type : : END_OBJECT ) ; <nl> + } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_array_end ( json_iterator & iter ) noexcept { <nl> + return end_container ( iter , internal : : tape_type : : START_ARRAY , internal : : tape_type : : END_ARRAY ) ; <nl> + } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_document_end ( json_iterator & iter ) noexcept { <nl> + constexpr uint32_t start_tape_index = 0 ; <nl> + tape . append ( start_tape_index , internal : : tape_type : : ROOT ) ; <nl> + tape_writer : : write ( iter . dom_parser . doc - > tape [ start_tape_index ] , next_tape_index ( iter ) , internal : : tape_type : : ROOT ) ; <nl> + return SUCCESS ; <nl> + } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_key ( json_iterator & iter , const uint8_t * key ) noexcept { <nl> + return visit_string ( iter , key , true ) ; <nl> + } <nl> <nl> - simdjson_really_inline error_code parse_root_number ( structural_parser & parser , const uint8_t * value ) { <nl> - / / <nl> - / / We need to make a copy to make sure that the string is space terminated . <nl> - / / This is not about padding the input , which should already padded up <nl> - / / to len + SIMDJSON_PADDING . However , we have no control at this stage <nl> - / / on how the padding was done . What if the input string was padded with nulls ? <nl> - / / It is quite common for an input string to have an extra null character ( C string ) . <nl> - / / We do not want to allow 9 \ 0 ( where \ 0 is the null character ) inside a JSON <nl> - / / document , but the string " 9 \ 0 " by itself is fine . So we make a copy and <nl> - / / pad the input with spaces when we know that there is just one input element . <nl> - / / This copy is relatively expensive , but it will almost never be called in <nl> - / / practice unless you are in the strange scenario where you have many JSON <nl> - / / documents made of single atoms . <nl> - / / <nl> - uint8_t * copy = static_cast < uint8_t * > ( malloc ( parser . remaining_len ( ) + SIMDJSON_PADDING ) ) ; <nl> - if ( copy = = nullptr ) { <nl> - return MEMALLOC ; <nl> - } <nl> - memcpy ( copy , value , parser . remaining_len ( ) ) ; <nl> - memset ( copy + parser . remaining_len ( ) , ' ' , SIMDJSON_PADDING ) ; <nl> - error_code error = parse_number ( parser , copy ) ; <nl> - free ( copy ) ; <nl> - return error ; <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : increment_count ( json_iterator & iter ) noexcept { <nl> + iter . dom_parser . open_containers [ iter . depth ] . count + + ; / / we have a key value pair in the object at parser . dom_parser . depth - 1 <nl> + return SUCCESS ; <nl> + } <nl> <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse_true_atom ( structural_parser & parser , const uint8_t * value ) { <nl> - parser . log_value ( " true " ) ; <nl> - if ( ! atomparsing : : is_valid_true_atom ( value ) ) { return T_ATOM_ERROR ; } <nl> - tape . append ( 0 , internal : : tape_type : : TRUE_VALUE ) ; <nl> - return SUCCESS ; <nl> - } <nl> + simdjson_really_inline tape_builder : : tape_builder ( dom : : document & doc ) noexcept : tape { doc . tape . get ( ) } , current_string_buf_loc { doc . string_buf . get ( ) } { } <nl> <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse_root_true_atom ( structural_parser & parser , const uint8_t * value ) { <nl> - parser . log_value ( " true " ) ; <nl> - if ( ! atomparsing : : is_valid_true_atom ( value , parser . remaining_len ( ) ) ) { return T_ATOM_ERROR ; } <nl> - tape . append ( 0 , internal : : tape_type : : TRUE_VALUE ) ; <nl> - return SUCCESS ; <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_string ( json_iterator & iter , const uint8_t * value , bool key ) noexcept { <nl> + iter . log_value ( key ? " key " : " string " ) ; <nl> + uint8_t * dst = on_start_string ( iter ) ; <nl> + dst = stringparsing : : parse_string ( value , dst ) ; <nl> + if ( dst = = nullptr ) { <nl> + iter . log_error ( " Invalid escape in string " ) ; <nl> + return STRING_ERROR ; <nl> } <nl> + on_end_string ( dst ) ; <nl> + return SUCCESS ; <nl> + } <nl> <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse_false_atom ( structural_parser & parser , const uint8_t * value ) { <nl> - parser . log_value ( " false " ) ; <nl> - if ( ! atomparsing : : is_valid_false_atom ( value ) ) { return F_ATOM_ERROR ; } <nl> - tape . append ( 0 , internal : : tape_type : : FALSE_VALUE ) ; <nl> - return SUCCESS ; <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_root_string ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + return visit_string ( iter , value ) ; <nl> + } <nl> <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse_root_false_atom ( structural_parser & parser , const uint8_t * value ) { <nl> - parser . log_value ( " false " ) ; <nl> - if ( ! atomparsing : : is_valid_false_atom ( value , parser . remaining_len ( ) ) ) { return F_ATOM_ERROR ; } <nl> - tape . append ( 0 , internal : : tape_type : : FALSE_VALUE ) ; <nl> - return SUCCESS ; <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_number ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + iter . log_value ( " number " ) ; <nl> + return numberparsing : : parse_number ( value , tape ) ; <nl> + } <nl> <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse_null_atom ( structural_parser & parser , const uint8_t * value ) { <nl> - parser . log_value ( " null " ) ; <nl> - if ( ! atomparsing : : is_valid_null_atom ( value ) ) { return N_ATOM_ERROR ; } <nl> - tape . append ( 0 , internal : : tape_type : : NULL_VALUE ) ; <nl> - return SUCCESS ; <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_root_number ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + / / <nl> + / / We need to make a copy to make sure that the string is space terminated . <nl> + / / This is not about padding the input , which should already padded up <nl> + / / to len + SIMDJSON_PADDING . However , we have no control at this stage <nl> + / / on how the padding was done . What if the input string was padded with nulls ? <nl> + / / It is quite common for an input string to have an extra null character ( C string ) . <nl> + / / We do not want to allow 9 \ 0 ( where \ 0 is the null character ) inside a JSON <nl> + / / document , but the string " 9 \ 0 " by itself is fine . So we make a copy and <nl> + / / pad the input with spaces when we know that there is just one input element . <nl> + / / This copy is relatively expensive , but it will almost never be called in <nl> + / / practice unless you are in the strange scenario where you have many JSON <nl> + / / documents made of single atoms . <nl> + / / <nl> + uint8_t * copy = static_cast < uint8_t * > ( malloc ( iter . remaining_len ( ) + SIMDJSON_PADDING ) ) ; <nl> + if ( copy = = nullptr ) { return MEMALLOC ; } <nl> + memcpy ( copy , value , iter . remaining_len ( ) ) ; <nl> + memset ( copy + iter . remaining_len ( ) , ' ' , SIMDJSON_PADDING ) ; <nl> + error_code error = visit_number ( iter , copy ) ; <nl> + free ( copy ) ; <nl> + return error ; <nl> + } <nl> <nl> - SIMDJSON_WARN_UNUSED simdjson_really_inline error_code parse_root_null_atom ( structural_parser & parser , const uint8_t * value ) { <nl> - parser . log_value ( " null " ) ; <nl> - if ( ! atomparsing : : is_valid_null_atom ( value , parser . remaining_len ( ) ) ) { return N_ATOM_ERROR ; } <nl> - tape . append ( 0 , internal : : tape_type : : NULL_VALUE ) ; <nl> - return SUCCESS ; <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_true_atom ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + iter . log_value ( " true " ) ; <nl> + if ( ! atomparsing : : is_valid_true_atom ( value ) ) { return T_ATOM_ERROR ; } <nl> + tape . append ( 0 , internal : : tape_type : : TRUE_VALUE ) ; <nl> + return SUCCESS ; <nl> + } <nl> <nl> - / / increment_count increments the count of keys in an object or values in an array . <nl> - simdjson_really_inline void increment_count ( structural_parser & parser ) { <nl> - parser . dom_parser . containing_scope [ parser . depth ] . count + + ; / / we have a key value pair in the object at parser . dom_parser . depth - 1 <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_root_true_atom ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + iter . log_value ( " true " ) ; <nl> + if ( ! atomparsing : : is_valid_true_atom ( value , iter . remaining_len ( ) ) ) { return T_ATOM_ERROR ; } <nl> + tape . append ( 0 , internal : : tape_type : : TRUE_VALUE ) ; <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_false_atom ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + iter . log_value ( " false " ) ; <nl> + if ( ! atomparsing : : is_valid_false_atom ( value ) ) { return F_ATOM_ERROR ; } <nl> + tape . append ( 0 , internal : : tape_type : : FALSE_VALUE ) ; <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_root_false_atom ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + iter . log_value ( " false " ) ; <nl> + if ( ! atomparsing : : is_valid_false_atom ( value , iter . remaining_len ( ) ) ) { return F_ATOM_ERROR ; } <nl> + tape . append ( 0 , internal : : tape_type : : FALSE_VALUE ) ; <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_null_atom ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + iter . log_value ( " null " ) ; <nl> + if ( ! atomparsing : : is_valid_null_atom ( value ) ) { return N_ATOM_ERROR ; } <nl> + tape . append ( 0 , internal : : tape_type : : NULL_VALUE ) ; <nl> + return SUCCESS ; <nl> + } <nl> + <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : visit_root_null_atom ( json_iterator & iter , const uint8_t * value ) noexcept { <nl> + iter . log_value ( " null " ) ; <nl> + if ( ! atomparsing : : is_valid_null_atom ( value , iter . remaining_len ( ) ) ) { return N_ATOM_ERROR ; } <nl> + tape . append ( 0 , internal : : tape_type : : NULL_VALUE ) ; <nl> + return SUCCESS ; <nl> + } <nl> <nl> / / private : <nl> <nl> - simdjson_really_inline uint32_t next_tape_index ( structural_parser & parser ) { <nl> - return uint32_t ( tape . next_tape_loc - parser . dom_parser . doc - > tape . get ( ) ) ; <nl> - } <nl> + simdjson_really_inline uint32_t tape_builder : : next_tape_index ( json_iterator & iter ) const noexcept { <nl> + return uint32_t ( tape . next_tape_loc - iter . dom_parser . doc - > tape . get ( ) ) ; <nl> + } <nl> <nl> - simdjson_really_inline void empty_container ( structural_parser & parser , internal : : tape_type start , internal : : tape_type end ) { <nl> - auto start_index = next_tape_index ( parser ) ; <nl> - tape . append ( start_index + 2 , start ) ; <nl> - tape . append ( start_index , end ) ; <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : empty_container ( json_iterator & iter , internal : : tape_type start , internal : : tape_type end ) noexcept { <nl> + auto start_index = next_tape_index ( iter ) ; <nl> + tape . append ( start_index + 2 , start ) ; <nl> + tape . append ( start_index , end ) ; <nl> + return SUCCESS ; <nl> + } <nl> <nl> - simdjson_really_inline void start_container ( structural_parser & parser ) { <nl> - parser . dom_parser . containing_scope [ parser . depth ] . tape_index = next_tape_index ( parser ) ; <nl> - parser . dom_parser . containing_scope [ parser . depth ] . count = 0 ; <nl> - tape . skip ( ) ; / / We don ' t actually * write * the start element until the end . <nl> - } <nl> + simdjson_really_inline void tape_builder : : start_container ( json_iterator & iter ) noexcept { <nl> + iter . dom_parser . open_containers [ iter . depth ] . tape_index = next_tape_index ( iter ) ; <nl> + iter . dom_parser . open_containers [ iter . depth ] . count = 0 ; <nl> + tape . skip ( ) ; / / We don ' t actually * write * the start element until the end . <nl> + } <nl> <nl> - simdjson_really_inline void end_container ( structural_parser & parser , internal : : tape_type start , internal : : tape_type end ) noexcept { <nl> - / / Write the ending tape element , pointing at the start location <nl> - const uint32_t start_tape_index = parser . dom_parser . containing_scope [ parser . depth ] . tape_index ; <nl> - tape . append ( start_tape_index , end ) ; <nl> - / / Write the start tape element , pointing at the end location ( and including count ) <nl> - / / count can overflow if it exceeds 24 bits . . . so we saturate <nl> - / / the convention being that a cnt of 0xffffff or more is undetermined in value ( > = 0xffffff ) . <nl> - const uint32_t count = parser . dom_parser . containing_scope [ parser . depth ] . count ; <nl> - const uint32_t cntsat = count > 0xFFFFFF ? 0xFFFFFF : count ; <nl> - tape_writer : : write ( parser . dom_parser . doc - > tape [ start_tape_index ] , next_tape_index ( parser ) | ( uint64_t ( cntsat ) < < 32 ) , start ) ; <nl> - } <nl> + SIMDJSON_WARN_UNUSED simdjson_really_inline error_code tape_builder : : end_container ( json_iterator & iter , internal : : tape_type start , internal : : tape_type end ) noexcept { <nl> + / / Write the ending tape element , pointing at the start location <nl> + const uint32_t start_tape_index = iter . dom_parser . open_containers [ iter . depth ] . tape_index ; <nl> + tape . append ( start_tape_index , end ) ; <nl> + / / Write the start tape element , pointing at the end location ( and including count ) <nl> + / / count can overflow if it exceeds 24 bits . . . so we saturate <nl> + / / the convention being that a cnt of 0xffffff or more is undetermined in value ( > = 0xffffff ) . <nl> + const uint32_t count = iter . dom_parser . open_containers [ iter . depth ] . count ; <nl> + const uint32_t cntsat = count > 0xFFFFFF ? 0xFFFFFF : count ; <nl> + tape_writer : : write ( iter . dom_parser . doc - > tape [ start_tape_index ] , next_tape_index ( iter ) | ( uint64_t ( cntsat ) < < 32 ) , start ) ; <nl> + return SUCCESS ; <nl> + } <nl> <nl> - simdjson_really_inline uint8_t * on_start_string ( structural_parser & parser ) noexcept { <nl> - / / we advance the point , accounting for the fact that we have a NULL termination <nl> - tape . append ( current_string_buf_loc - parser . dom_parser . doc - > string_buf . get ( ) , internal : : tape_type : : STRING ) ; <nl> - return current_string_buf_loc + sizeof ( uint32_t ) ; <nl> - } <nl> + simdjson_really_inline uint8_t * tape_builder : : on_start_string ( json_iterator & iter ) noexcept { <nl> + / / we advance the point , accounting for the fact that we have a NULL termination <nl> + tape . append ( current_string_buf_loc - iter . dom_parser . doc - > string_buf . get ( ) , internal : : tape_type : : STRING ) ; <nl> + return current_string_buf_loc + sizeof ( uint32_t ) ; <nl> + } <nl> <nl> - simdjson_really_inline void on_end_string ( uint8_t * dst ) noexcept { <nl> - uint32_t str_length = uint32_t ( dst - ( current_string_buf_loc + sizeof ( uint32_t ) ) ) ; <nl> - / / TODO check for overflow in case someone has a crazy string ( > = 4GB ? ) <nl> - / / But only add the overflow check when the document itself exceeds 4GB <nl> - / / Currently unneeded because we refuse to parse docs larger or equal to 4GB . <nl> - memcpy ( current_string_buf_loc , & str_length , sizeof ( uint32_t ) ) ; <nl> - / / NULL termination is still handy if you expect all your strings to <nl> - / / be NULL terminated ? It comes at a small cost <nl> - * dst = 0 ; <nl> - current_string_buf_loc = dst + 1 ; <nl> - } <nl> - } ; / / class tape_builder <nl> + simdjson_really_inline void tape_builder : : on_end_string ( uint8_t * dst ) noexcept { <nl> + uint32_t str_length = uint32_t ( dst - ( current_string_buf_loc + sizeof ( uint32_t ) ) ) ; <nl> + / / TODO check for overflow in case someone has a crazy string ( > = 4GB ? ) <nl> + / / But only add the overflow check when the document itself exceeds 4GB <nl> + / / Currently unneeded because we refuse to parse docs larger or equal to 4GB . <nl> + memcpy ( current_string_buf_loc , & str_length , sizeof ( uint32_t ) ) ; <nl> + / / NULL termination is still handy if you expect all your strings to <nl> + / / be NULL terminated ? It comes at a small cost <nl> + * dst = 0 ; <nl> + current_string_buf_loc = dst + 1 ; <nl> + } <nl> <nl> } / / namespace stage2 <nl> } / / namespace SIMDJSON_IMPLEMENTATION <nl> mmm a / src / haswell / dom_parser_implementation . cpp <nl> ppp b / src / haswell / dom_parser_implementation . cpp <nl> simdjson_really_inline simd8 < bool > must_be_2_3_continuation ( const simd8 < uint8_t > <nl> / / <nl> # include " haswell / stringparsing . h " <nl> # include " haswell / numberparsing . h " <nl> - # include " generic / stage2 / structural_parser . h " <nl> # include " generic / stage2 / tape_builder . h " <nl> <nl> / / <nl> SIMDJSON_WARN_UNUSED bool implementation : : validate_utf8 ( const char * buf , size_t <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : stage2 ( dom : : document & _doc ) noexcept { <nl> - doc = & _doc ; <nl> - stage2 : : tape_builder builder ( _doc ) ; <nl> - return stage2 : : structural_parser : : parse < false > ( * this , builder ) ; <nl> + return stage2 : : tape_builder : : parse_document < false > ( * this , _doc ) ; <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : stage2_next ( dom : : document & _doc ) noexcept { <nl> - doc = & _doc ; <nl> - stage2 : : tape_builder builder ( _doc ) ; <nl> - return stage2 : : structural_parser : : parse < true > ( * this , builder ) ; <nl> + return stage2 : : tape_builder : : parse_document < true > ( * this , _doc ) ; <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : parse ( const uint8_t * _buf , size_t _len , dom : : document & _doc ) noexcept { <nl> mmm a / src / implementation . cpp <nl> ppp b / src / implementation . cpp <nl> <nl> <nl> # include < initializer_list > <nl> <nl> + # define SIMDJSON_TRY ( EXPR ) { auto _err = ( EXPR ) ; if ( _err ) { return _err ; } } <nl> + <nl> / / Static array of known implementations . We ' re hoping these get baked into the executable <nl> / / without requiring a static initializer . <nl> <nl> mmm a / src / westmere / dom_parser_implementation . cpp <nl> ppp b / src / westmere / dom_parser_implementation . cpp <nl> simdjson_really_inline simd8 < bool > must_be_2_3_continuation ( const simd8 < uint8_t > <nl> / / <nl> # include " westmere / stringparsing . h " <nl> # include " westmere / numberparsing . h " <nl> - # include " generic / stage2 / structural_parser . h " <nl> # include " generic / stage2 / tape_builder . h " <nl> <nl> / / <nl> SIMDJSON_WARN_UNUSED bool implementation : : validate_utf8 ( const char * buf , size_t <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : stage2 ( dom : : document & _doc ) noexcept { <nl> - doc = & _doc ; <nl> - stage2 : : tape_builder builder ( * doc ) ; <nl> - return stage2 : : structural_parser : : parse < false > ( * this , builder ) ; <nl> + return stage2 : : tape_builder : : parse_document < false > ( * this , _doc ) ; <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : stage2_next ( dom : : document & _doc ) noexcept { <nl> - doc = & _doc ; <nl> - stage2 : : tape_builder builder ( _doc ) ; <nl> - return stage2 : : structural_parser : : parse < true > ( * this , builder ) ; <nl> + return stage2 : : tape_builder : : parse_document < true > ( * this , _doc ) ; <nl> } <nl> <nl> SIMDJSON_WARN_UNUSED error_code dom_parser_implementation : : parse ( const uint8_t * _buf , size_t _len , dom : : document & _doc ) noexcept { <nl>
Merge pull request from simdjson / jkeiser / yakety - sax
simdjson/simdjson
0a2bca3f730fc407329a38322ed430c03c231f74
2020-08-19T16:05:44Z
mmm a / src / unittest / clustering_backfill . cc <nl> ppp b / src / unittest / clustering_backfill . cc <nl> void run_backfill_test ( ) { <nl> scoped_ptr_t < fifo_enforcer_sink_t : : exit_read_t > token1 ; <nl> backfillee_store . new_read_token ( & token1 ) ; <nl> <nl> + region_map_t < dummy_protocol_t , binary_blob_t > untransformed_backfillee_metadata ; <nl> + backfillee_store . do_get_metainfo ( order_token_t : : ignore , & token1 , & interruptor , & untransformed_backfillee_metadata ) ; <nl> + <nl> region_map_t < dummy_protocol_t , version_range_t > backfillee_metadata = <nl> region_map_transform < dummy_protocol_t , binary_blob_t , version_range_t > ( <nl> - backfillee_store . get_metainfo ( order_token_t : : ignore , & token1 , & interruptor ) , <nl> + untransformed_backfillee_metadata , <nl> & binary_blob_t : : get < version_range_t > <nl> ) ; <nl> <nl>
Made untransformed_backfillee_metadata use do_get_metainfo in clustering_backfill . cc .
rethinkdb/rethinkdb
6122d5bdd62b38b6118f3aa1a0cb053db1f5b6b9
2012-07-26T01:01:33Z
mmm a / emcc <nl> ppp b / emcc <nl> try : <nl> <nl> js_optimizer_queue + = [ get_eliminate ( ) , ' simplifyExpressions ' ] <nl> <nl> - if shared . Settings . RELOOP and not shared . Settings . ASM_JS : <nl> - js_optimizer_queue + = [ ' optimizeShiftsAggressive ' , get_eliminate ( ) ] # aggressive shifts optimization requires loops , it breaks on switches <nl> - <nl> if closure and not shared . Settings . ASM_JS : <nl> flush_js_optimizer_queue ( ) <nl> <nl> mmm a / tools / js - optimizer . js <nl> ppp b / tools / js - optimizer . js <nl> function simplifyExpressions ( ast ) { <nl> / / HEAP [ x > > 2 ] <nl> / / very often . We can in some cases do the shift on the variable itself when it is set , <nl> / / to greatly reduce the number of shift operations . <nl> - / / TODO : when shifting a variable , if there are other uses , keep an unshifted version too , to prevent slowdowns ? <nl> + / / XXX this optimization is deprecated and currently invalid : does not handle overflows <nl> + / / or non - aligned ( round numbers , x > > 2 is a multiple of 4 ) . Both are ok to assume <nl> + / / for pointers ( undefined behavior otherwise ) , but invalid in general , and we do <nl> + / / no sufficiently - well distinguish the cases . <nl> function optimizeShiftsInternal ( ast , conservative ) { <nl> var MAX_SHIFTS = 3 ; <nl> traverseGeneratedFunctions ( ast , function ( fun ) { <nl>
disable optimizeShifts ; fixes
emscripten-core/emscripten
a0bcc754bea4485c24427001306284043925e9b1
2013-08-15T03:49:50Z
mmm a / tensorflow / contrib / gdr / gdr_memory_manager . cc <nl> ppp b / tensorflow / contrib / gdr / gdr_memory_manager . cc <nl> class GdrMemoryManager : public RemoteMemoryManager { <nl> / / TODO ( byronyi ) : remove this class and its registration when the default <nl> / / cpu_allocator ( ) returns visitable allocator , or cpu_allocator ( ) is no <nl> / / longer in use . <nl> - class BFCRdmaAllocator : public BFCAllocator { <nl> + class BFCGdrAllocator : public BFCAllocator { <nl> public : <nl> - BFCRdmaAllocator ( ) <nl> + BFCGdrAllocator ( ) <nl> : BFCAllocator ( new BasicCPUAllocator ( port : : kNUMANoAffinity ) , 1LL < < 36 , <nl> true , " cpu_rdma_bfc " ) { } <nl> } ; <nl> - class BFCRdmaAllocatorFactory : public AllocatorFactory { <nl> + class BFCGdrAllocatorFactory : public AllocatorFactory { <nl> public : <nl> - Allocator * CreateAllocator ( ) override { return new BFCRdmaAllocator ; } <nl> + Allocator * CreateAllocator ( ) override { return new BFCGdrAllocator ; } <nl> <nl> virtual SubAllocator * CreateSubAllocator ( int numa_node ) { <nl> return new BasicCPUAllocator ( numa_node ) ; <nl> } <nl> } ; <nl> <nl> - REGISTER_MEM_ALLOCATOR ( " BFCRdmaAllocator " , 101 , BFCRdmaAllocatorFactory ) ; <nl> + REGISTER_MEM_ALLOCATOR ( " BFCGdrAllocator " , 101 , BFCGdrAllocatorFactory ) ; <nl> <nl> GdrMemoryManager : : GdrMemoryManager ( const string & host , const string & port ) <nl> : host_ ( host ) , <nl>
Fix compilation failure with RDMA + GDR
tensorflow/tensorflow
8c3457521f719736a7ac109bf7debbedd7fe4584
2018-08-19T20:48:25Z
mmm a / hphp / hack / src / hhbc / closure_convert . ml <nl> ppp b / hphp / hack / src / hhbc / closure_convert . ml <nl> let rec convert_class st cd = <nl> ( convert_class_elt cd . Ast . c_namespace env ) in <nl> st , { cd with c_body = c_body } <nl> <nl> + and convert_class_var env st ( pos , id , expr_opt ) = <nl> + match expr_opt with <nl> + | None - > <nl> + st , ( pos , id , expr_opt ) <nl> + | Some expr - > <nl> + let st , expr = convert_expr env st expr in <nl> + st , ( pos , id , Some expr ) <nl> + <nl> and convert_class_elt ns env st ce = <nl> let ce = <nl> if constant_folding ( ) <nl> and convert_class_elt ns env st ce = <nl> let st , block = convert_block env st md . m_body in <nl> st , Method { md with m_body = block } <nl> <nl> + | ClassVars ( kinds , hint , cvl ) - > <nl> + let st , cvl = List . map_env st cvl ( convert_class_var env ) in <nl> + st , ClassVars ( kinds , hint , cvl ) <nl> + <nl> | _ - > <nl> st , ce <nl> <nl> mmm a / hphp / hack / src / hhbc / emit_method . ml <nl> ppp b / hphp / hack / src / hhbc / emit_method . ml <nl> let from_ast_wrapper : bool - > _ - > _ - > <nl> Emit_attribute . ast_any_is_memoize ast_method . Ast . m_user_attributes in <nl> let ( _ , original_name ) = ast_method . Ast . m_name in <nl> let ( _ , class_name ) = ast_class . Ast . c_name in <nl> + let class_name = Utils . strip_ns class_name in <nl> let ret = <nl> if original_name = Naming_special_names . Members . __construct <nl> | | original_name = Naming_special_names . Members . __destruct <nl> let from_ast_wrapper : bool - > _ - > _ - > <nl> let method_is_async = <nl> ast_method . Ast . m_fun_kind = Ast_defs . FAsync <nl> | | ast_method . Ast . m_fun_kind = Ast_defs . FAsyncGenerator in <nl> + if not method_is_static <nl> + & & ast_class . Ast . c_final <nl> + & & ast_class . Ast . c_kind = Ast . Cabstract <nl> + then Emit_fatal . raise_fatal_parse <nl> + ( " Class " ^ class_name ^ " contains non - static method " ^ original_name <nl> + ^ " and therefore cannot be declared ' abstract final ' " ) ; <nl> let default_dropthrough = <nl> if List . mem ast_method . Ast . m_kind Ast . Abstract <nl> then Some ( Emit_fatal . emit_fatal_runtimeomitframe <nl> - ( " Cannot call abstract method " ^ Utils . strip_ns class_name <nl> + ( " Cannot call abstract method " ^ class_name <nl> ^ " : : " ^ original_name ^ " ( ) " ) ) <nl> else <nl> if method_is_async <nl> mmm a / hphp / test / hhcodegen_failing_tests_quick <nl> ppp b / hphp / test / hhcodegen_failing_tests_quick <nl> quick / autoload6 . php <nl> quick / backtick . php <nl> quick / builtin_extension_DateTime . php <nl> quick / call_nonstatic_this . php <nl> - quick / class_abstract_final1 . php <nl> - quick / class_abstract_final2 . php <nl> - quick / class_abstract_final5 . php <nl> quick / class_constant . php <nl> quick / class_constants . php <nl> quick / class_exists_throw . php <nl>
Hack codegen : __CLASS__ in initializers , more fatals
facebook/hhvm
cb2b4645ea7e40f2ec589e287e06d6ef35f5848b
2017-06-02T15:20:39Z
mmm a / src / runtime / ext / ext_imap . cpp <nl> ppp b / src / runtime / ext / ext_imap . cpp <nl> bool f_imap_renamemailbox ( CObjRef imap_stream , CStrRef old_mbox , <nl> <nl> bool f_imap_reopen ( CObjRef imap_stream , CStrRef mailbox , <nl> int64 options / * = 0 * / , int64 retries / * = 0 * / ) { <nl> - throw NotImplementedException ( __func__ ) ; <nl> + ImapStream * obj = imap_stream . getTyped < ImapStream > ( ) ; <nl> + long flags = NIL ; <nl> + long cl_flags = NIL ; <nl> + if ( options ) { <nl> + flags = options ; <nl> + if ( flags & PHP_EXPUNGE ) { <nl> + cl_flags = CL_EXPUNGE ; <nl> + flags ^ = PHP_EXPUNGE ; <nl> + } <nl> + obj - > m_flag = cl_flags ; <nl> + } <nl> + <nl> + if ( retries ) { <nl> + mail_parameters ( NIL , SET_MAXLOGINTRIALS , ( void * ) retries ) ; <nl> + } <nl> + <nl> + MAILSTREAM * stream = mail_open ( obj - > m_stream , ( char * ) mailbox . data ( ) , flags ) ; <nl> + if ( stream = = NIL ) { <nl> + raise_warning ( " Couldn ' t re - open stream " ) ; <nl> + return false ; <nl> + } <nl> + obj - > m_stream = stream ; <nl> + return true ; <nl> } <nl> <nl> Variant f_imap_rfc822_parse_adrlist ( CStrRef address , CStrRef default_host ) { <nl>
Implement imap_reopen ( )
facebook/hhvm
be4fd7c9ea0af3dbab6a3b206fc868d459dca9e0
2011-01-07T17:57:52Z
mmm a / arangod / Aql / Query . cpp <nl> ppp b / arangod / Aql / Query . cpp <nl> QueryResultV8 Query : : executeV8 ( v8 : : Isolate * isolate , QueryRegistry * registry ) { <nl> } catch ( . . . ) { <nl> setExecutionTime ( ) ; <nl> cleanupPlanAndEngine ( TRI_ERROR_INTERNAL ) ; <nl> - return QueryResult ( TRI_ERROR_INTERNAL , <nl> - TRI_errno_string ( TRI_ERROR_INTERNAL ) + QueryExecutionState : : toStringWithPrefix ( _state ) ) ; <nl> + return QueryResultV8 ( TRI_ERROR_INTERNAL , <nl> + TRI_errno_string ( TRI_ERROR_INTERNAL ) + QueryExecutionState : : toStringWithPrefix ( _state ) ) ; <nl> } <nl> } <nl> <nl> mmm a / arangod / Aql / QueryResultV8 . h <nl> ppp b / arangod / Aql / QueryResultV8 . h <nl> namespace aql { <nl> struct QueryResultV8 : public QueryResult { <nl> QueryResultV8 & operator = ( QueryResultV8 const & other ) = delete ; <nl> <nl> - QueryResultV8 ( QueryResultV8 & & other ) <nl> - : QueryResult ( ( QueryResult & & ) other ) , result ( other . result ) { } <nl> + QueryResultV8 ( QueryResultV8 & & other ) = default ; <nl> <nl> QueryResultV8 ( QueryResult & & other ) <nl> - : QueryResult ( ( QueryResult & & ) other ) , result ( ) { } <nl> + : QueryResult ( std : : move ( other ) ) , result ( ) { } <nl> <nl> QueryResultV8 ( int code , std : : string const & details ) <nl> : QueryResult ( code , details ) , result ( ) { } <nl> mmm a / arangod / V8Server / v8 - query . cpp <nl> ppp b / arangod / V8Server / v8 - query . cpp <nl> static void EdgesQuery ( TRI_edge_direction_e direction , <nl> } <nl> <nl> std : : string const queryString = " FOR doc IN @ @ collection " + filter + " RETURN doc " ; <nl> - v8 : : Handle < v8 : : Value > result = <nl> - AqlQuery ( isolate , collection , queryString , bindVars ) . result ; <nl> + <nl> + aql : : QueryResultV8 queryResult = AqlQuery ( isolate , collection , queryString , bindVars ) ; <nl> <nl> - TRI_V8_RETURN ( result ) ; <nl> + if ( ! queryResult . result . IsEmpty ( ) ) { <nl> + TRI_V8_RETURN ( queryResult . result ) ; <nl> + } <nl> + <nl> + TRI_V8_RETURN_NULL ( ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> static void JS_LookupByKeys ( v8 : : FunctionCallbackInfo < v8 : : Value > const & args ) { <nl> aql : : QueryResultV8 queryResult = AqlQuery ( isolate , collection , queryString , bindVars ) ; <nl> <nl> v8 : : Handle < v8 : : Object > result = v8 : : Object : : New ( isolate ) ; <nl> - result - > Set ( TRI_V8_ASCII_STRING ( " documents " ) , queryResult . result ) ; <nl> + if ( ! queryResult . result . IsEmpty ( ) ) { <nl> + result - > Set ( TRI_V8_ASCII_STRING ( " documents " ) , queryResult . result ) ; <nl> + } <nl> <nl> TRI_V8_RETURN ( result ) ; <nl> TRI_V8_TRY_CATCH_END <nl> mmm a / arangod / V8Server / v8 - vocbase . cpp <nl> ppp b / arangod / V8Server / v8 - vocbase . cpp <nl> static void JS_ExecuteAql ( v8 : : FunctionCallbackInfo < v8 : : Value > const & args ) { <nl> / / return the array value as it is . this is a performance optimization <nl> v8 : : Handle < v8 : : Object > result = v8 : : Object : : New ( isolate ) ; <nl> <nl> - result - > ForceSet ( TRI_V8_ASCII_STRING ( " json " ) , queryResult . result ) ; <nl> + if ( ! queryResult . result . IsEmpty ( ) ) { <nl> + result - > ForceSet ( TRI_V8_ASCII_STRING ( " json " ) , queryResult . result ) ; <nl> + } <nl> <nl> if ( queryResult . stats ! = nullptr ) { <nl> VPackSlice stats = queryResult . stats - > slice ( ) ; <nl>
cleanup QueryResultV8 a bit ( )
arangodb/arangodb
df8d16b063050815ca4d6cbbe4ed1c907db48f4b
2017-08-10T07:40:06Z
mmm a / xbmc / addons / PVRClient . cpp <nl> ppp b / xbmc / addons / PVRClient . cpp <nl> void CPVRClient : : ResetProperties ( int iClientId / * = PVR_INVALID_CLIENT_ID * / ) <nl> m_timertypes . clear ( ) ; <nl> m_bReadyToUse = false ; <nl> m_connectionState = PVR_CONNECTION_STATE_UNKNOWN ; <nl> + m_prevConnectionState = PVR_CONNECTION_STATE_UNKNOWN ; <nl> + m_ignoreClient = false ; <nl> m_iClientId = iClientId ; <nl> m_strBackendVersion = DEFAULT_INFO_STRING_VALUE ; <nl> m_strConnectionString = DEFAULT_INFO_STRING_VALUE ; <nl> PVR_CONNECTION_STATE CPVRClient : : GetConnectionState ( void ) const <nl> void CPVRClient : : SetConnectionState ( PVR_CONNECTION_STATE state ) <nl> { <nl> CSingleLock lock ( m_critSection ) ; <nl> + <nl> + m_prevConnectionState = m_connectionState ; <nl> m_connectionState = state ; <nl> + <nl> + if ( m_connectionState = = PVR_CONNECTION_STATE_CONNECTED ) <nl> + m_ignoreClient = false ; <nl> + else if ( m_connectionState = = PVR_CONNECTION_STATE_CONNECTING & & <nl> + m_prevConnectionState = = PVR_CONNECTION_STATE_UNKNOWN ) <nl> + m_ignoreClient = true ; <nl> + } <nl> + <nl> + PVR_CONNECTION_STATE CPVRClient : : GetPreviousConnectionState ( void ) const <nl> + { <nl> + CSingleLock lock ( m_critSection ) ; <nl> + return m_prevConnectionState ; <nl> + } <nl> + <nl> + bool CPVRClient : : IgnoreClient ( void ) const <nl> + { <nl> + CSingleLock lock ( m_critSection ) ; <nl> + return m_ignoreClient ; <nl> } <nl> <nl> int CPVRClient : : GetID ( void ) const <nl> mmm a / xbmc / addons / PVRClient . h <nl> ppp b / xbmc / addons / PVRClient . h <nl> namespace PVR <nl> * / <nl> void SetConnectionState ( PVR_CONNECTION_STATE state ) ; <nl> <nl> + / * ! <nl> + * @ brief Gets the backend ' s previous connection state . <nl> + * @ return the backend ' s previous connection state . <nl> + * / <nl> + PVR_CONNECTION_STATE GetPreviousConnectionState ( void ) const ; <nl> + <nl> + / * ! <nl> + * @ brief signal to PVRMananager this client should be ignored <nl> + * @ return true if this client should be ignored <nl> + * / <nl> + bool IgnoreClient ( void ) const ; <nl> + <nl> / * ! <nl> * @ return The ID of this instance . <nl> * / <nl> namespace PVR <nl> <nl> bool m_bReadyToUse ; / * ! < true if this add - on is initialised ( ADDON_Create returned true ) , false otherwise * / <nl> PVR_CONNECTION_STATE m_connectionState ; / * ! < the backend connection state * / <nl> + PVR_CONNECTION_STATE m_prevConnectionState ; / * ! < the previous backend connection state * / <nl> + bool m_ignoreClient ; / * ! < signals to PVRManager to ignore this client until it has been connected * / <nl> PVR_MENUHOOKS m_menuhooks ; / * ! < the menu hooks for this add - on * / <nl> CPVRTimerTypes m_timertypes ; / * ! < timer types supported by this backend * / <nl> int m_iClientId ; / * ! < database ID of the client * / <nl> mmm a / xbmc / pvr / addons / PVRClients . cpp <nl> ppp b / xbmc / pvr / addons / PVRClients . cpp <nl> bool CPVRClients : : HasCreatedClients ( void ) const <nl> for ( PVR_CLIENTMAP_CITR itr = m_clientMap . begin ( ) ; itr ! = m_clientMap . end ( ) ; itr + + ) <nl> if ( itr - > second - > ReadyToUse ( ) ) <nl> { <nl> - PVR_CONNECTION_STATE state = itr - > second - > GetConnectionState ( ) ; <nl> - if ( state ! = PVR_CONNECTION_STATE_CONNECTING ) <nl> + if ( itr - > second - > IgnoreClient ( ) ) <nl> return true ; <nl> } <nl> <nl> int CPVRClients : : GetCreatedClients ( PVR_CLIENTMAP & clients ) const <nl> { <nl> if ( itr - > second - > ReadyToUse ( ) ) <nl> { <nl> - PVR_CONNECTION_STATE state = itr - > second - > GetConnectionState ( ) ; <nl> - if ( state = = PVR_CONNECTION_STATE_CONNECTING ) <nl> + if ( itr - > second - > IgnoreClient ( ) ) <nl> continue ; <nl> <nl> clients . insert ( std : : make_pair ( itr - > second - > GetID ( ) , itr - > second ) ) ; <nl> void CPVRClients : : ConnectionStateChange ( int clientId , std : : string & strConnection <nl> case PVR_CONNECTION_STATE_CONNECTED : <nl> bError = false ; <nl> iMsg = 36034 ; / / Connection established <nl> + if ( client - > GetPreviousConnectionState ( ) = = PVR_CONNECTION_STATE_UNKNOWN | | <nl> + client - > GetPreviousConnectionState ( ) = = PVR_CONNECTION_STATE_CONNECTING ) <nl> + bNotify = false ; <nl> break ; <nl> case PVR_CONNECTION_STATE_DISCONNECTED : <nl> iMsg = 36030 ; / / Connection lost <nl>
Merge pull request from FernetMenta / pvr
xbmc/xbmc
ff2fa218c0c7f4e2f63a427b654a5e81659df1ad
2016-03-30T05:27:44Z
mmm a / PowerEditor / installer / nativeLang / catalan . xml <nl> ppp b / PowerEditor / installer / nativeLang / catalan . xml <nl> <nl> < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> < ! - - <nl> Catalan translation for Notepad + + <nl> - Updated 18 . 02 . 2018 , v7 . 5 . 5 <nl> + Updated 29 . 05 . 2018 , v7 . 5 . 5 <nl> By Hiro5 < groccat at gmail > <nl> - - > <nl> < NotepadPlus > <nl> By Hiro5 < groccat at gmail > <nl> < Item id = " 2026 " name = " Hexadecimal " / > <nl> < Item id = " 2027 " name = " Binari " / > <nl> < / ColumnEditor > <nl> + < FindInFinder title = " Cerca al cercador " > <nl> + < Item id = " 1 " name = " Cerca - ho tot " / > <nl> + < Item id = " 2 " name = " Tanca " / > <nl> + < Item id = " 1711 " name = " Cerca : " / > <nl> + < Item id = " 1713 " name = " Cerca només en línies trobades " / > <nl> + < Item id = " 1714 " name = " Cerca només & amp ; paraula sencera " / > <nl> + < Item id = " 1715 " name = " & amp ; Coincideix majúscules " / > <nl> + < Item id = " 1716 " name = " Mode de cerca " / > <nl> + < Item id = " 1717 " name = " Normal " / > <nl> + < Item id = " 1719 " name = " & amp ; Expressió regular " / > <nl> + < Item id = " 1718 " name = " Estès ( \ n , \ r , \ t , \ 0 , \ x . . . ) " / > <nl> + < Item id = " 1720 " name = " & amp ; . cerca nova línia " / > <nl> + < / FindInFinder > <nl> < / Dialog > <nl> < MessageBox > <nl> < ContextMenuXmlEditWarning title = " Editant contextMenu " message = " Podeu modificar el menú contextual emergent de Notepad + + editant el fitxer contextMenu . xml . & # xD ; Reinicieu Notepad + + després de modificar contextMenu . xml perquè faci efecte . " / > <nl> By Hiro5 < groccat at gmail > <nl> < FileAlreadyOpenedInNpp title = " " message = " El fitxer ja està obert amb Notepad + + . " / > <nl> < DeleteFileFailed title = " Esborra fitxer " message = " No s ' ha pogut esborrar el fitxer " / > <nl> < NbFileToOpenImportantWarning title = " Massa fitxers per obrir " message = " Esteu a punt d ' obrir $ INT_REPLACE $ fitxers . & # xD ; Segur que voleu obrir - los ? " / > <nl> - < ColumnModeTip title = " Consell del mode de columna " message = " Utilitzeu « Alt + Selecció amb ratolí » & # xD ; o « Alt + Maj . + Fletxes del teclat » & # xD ; per canviar al mode de columna . " / > <nl> < SettingsOnCloudError title = " Opcions al núvol " message = " Sembla que el directori indicat a les opcions del núvol es troba en una unitat de només lectura , & # xD ; o en una carpeta que demana drets d ' accés d ' escriptura . & # xD ; Els vostres paràmetres del núvol es cancel · laran . Reinicieu a un valor coherent a través del diàleg de Preferències . " / > <nl> < FilePathNotFoundWarning title = " Obre fitxer " message = " El fitxer que intenteu obrir no existeix . " / > <nl> < SessionFileInvalidError title = " No s ' ha pogut carregar la sessió " message = " El fitxer de sessió està malmès o no és vàlid . " / > <nl> < DroppingFolderAsProjectModeWarning title = " Acció no vàlida " message = " Podeu arrossegar fitxers o carpetes però no ambdues , perquè s ' està arrossegant en mode de Carpeta com a projecte . & # xD ; Heu d ' activar & quot ; Obre els fitxers d ' una carpeta arrossegada en comptes d ' obrir a Carpetes de treball & quot ; a la secció & quot ; Directoris & quot ; del diàleg de Preferències per fer que aquesta operació funcioni . " / > <nl> < SortingError title = " Error d ' ordenació " message = " No s ' ha pogut realitzar l ' ordenació numèrica degut a la línia $ INT_REPLACE $ . " / > <nl> - < ColumnModeTip title = " Consell del mode de columna " message = " Utilitzeu & quot ; ALT + Selecció ratolí & quot ; o & quot ; Alt + Maj + Fletxes & quot ; per canviar al mode de columna . " / > <nl> + < ColumnModeTip title = " Consell del mode de columna " message = " Utilitzeu « Alt + Selecció amb ratolí » & # xD ; o « Alt + Maj . + Fletxes del teclat » & # xD ; per canviar al mode de columna . " / > <nl> < BufferInvalidWarning title = " El desat ha fallat " message = " No es pot desar : El buffer no es vàlid . " / > <nl> < DoSaveOrNot title = " Desa " message = " Voleu desar el fitxer & quot ; $ STR_REPLACE $ & quot ; ? " / > <nl> < DoCloseOrNot title = " Manté el fitxer inexistent " message = " El fitxer & quot ; $ STR_REPLACE $ & quot ; ja no existeix . & # xD ; El voleu mantenir en l ' editor ? " / > <nl> By Hiro5 < groccat at gmail > <nl> < UDLRemoveCurrentLang title = " Esborra el llenguatge actual " message = " Esteu segur ? " / > <nl> < SCMapperDoDeleteOrNot title = " Supressió de drecera " message = " Segur que voleu suprimir aquesta drecera ? " / > <nl> < FindCharRangeValueError title = " Valor fora de rang " message = " Hauríeu d ' escriure un valor de 0 a 255 . " / > <nl> + < OpenInAdminMode title = " Error en desar " message = " El fitxer no es pot desar i pot estar protegit . & # xD ; Voleu iniciar Notepad + + en mode d ' administrador ? " / > <nl> + < OpenInAdminModeWithoutCloseCurrent title = " Error en desar " message = " El fitxer no es pot desar i pot estar protegit . & # xD ; Voleu iniciar Notepad + + en mode d ' administrador ? " / > <nl> + < OpenInAdminModeFailed title = " Error en obrir en mode d ' administrador " message = " No es pot obrir Notepad + + en mode d ' administrador . " / > <nl> < / MessageBox > <nl> < ClipboardHistory > <nl> < PanelTitle name = " Historial del porta - retalls " / > <nl> By Hiro5 < groccat at gmail > <nl> < ColumnName name = " Nom " / > <nl> < ColumnExt name = " Ext . " / > <nl> < / DocSwitcher > <nl> + < WindowsDlg > <nl> + < ColumnName name = " Nom " / > <nl> + < ColumnPath name = " Camí " / > <nl> + < ColumnType name = " Tipus " / > <nl> + < / WindowsDlg > <nl> < AsciiInsertion > <nl> < PanelTitle name = " Panell d ' inserció ASCII " / > <nl> < ColumnVal name = " Valor " / > <nl> By Hiro5 < groccat at gmail > <nl> < find - status - replace - not - found value = " Reemplaça : cap resultat trobat " / > <nl> < find - status - replace - readonly value = " Reemplaça : No es pot reemplaçar el text . El document actual és de només lectura " / > <nl> < find - status - cannot - find value = " Cerca : No s ' ha trobat el text & quot ; $ STR_REPLACE $ & quot ; " / > <nl> - < find - status - mark - nb - matches value = " $ INT_REPLACE $ coincidències " / > <nl> + < finder - find - in - finder value = " Cerca en aquests resultats . . . " / > <nl> + < finder - close - this value = " Tanca aquest cercador " / > <nl> + < finder - collapse - all value = " Plega - ho tot " / > <nl> + < finder - uncollapse - all value = " Desplega - ho tot " / > <nl> + < finder - copy value = " Copia " / > <nl> + < finder - select - all value = " Selecciona - ho tot " / > <nl> + < finder - clear - all value = " Neteja - ho tot " / > <nl> + < finder - open - all value = " Obre - ho tot " / > <nl> < / MiscStrings > <nl> < / Native - Langue > <nl> < / NotepadPlus > <nl>
Update catalan . xml
notepad-plus-plus/notepad-plus-plus
26a3af946d7c95aaba6772ca3ca92d6ecdb643b6
2018-06-24T21:05:20Z
mmm a / tensorflow / lite / delegates / nnapi / BUILD <nl> ppp b / tensorflow / lite / delegates / nnapi / BUILD <nl> cc_test ( <nl> " : nnapi_delegate " , <nl> " : nnapi_delegate_mock_test " , <nl> " / / tensorflow / lite : framework " , <nl> + " / / tensorflow / lite : kernel_api " , <nl> " / / tensorflow / lite : minimal_logging " , <nl> " / / tensorflow / lite / c : common " , <nl> " / / tensorflow / lite / kernels : test_util " , <nl> mmm a / tensorflow / lite / delegates / nnapi / nnapi_delegate . cc <nl> ppp b / tensorflow / lite / delegates / nnapi / nnapi_delegate . cc <nl> TfLiteStatus StatefulNnApiDelegate : : DoPrepare ( TfLiteContext * context , <nl> . version = 1 , <nl> } ; <nl> <nl> - std : : vector < int > & nodes_to_delegate = supported_nodes ; <nl> - if ( is_accelerator_specified ) { <nl> - std : : vector < int > device_supported_nodes ; <nl> - int num_partitions ; <nl> - TfLiteDelegateParams * params_array ; <nl> + std : : vector < int > nodes_to_delegate ; <nl> <nl> + int num_partitions ; <nl> + TfLiteDelegateParams * params_array ; <nl> + if ( is_accelerator_specified ) { <nl> + / / Filtering out nodes not supported by target accelerators <nl> TF_LITE_ENSURE_STATUS ( GetNodesSupportedByAccelerator ( <nl> - context , delegate , nnapi , supported_nodes , & device_supported_nodes , <nl> + context , delegate , nnapi , supported_nodes , & nodes_to_delegate , <nl> & num_partitions , & params_array , nnapi_errno ) ) ; <nl> - <nl> - TF_LITE_ENSURE_STATUS ( LimitDelegatedPartitions ( <nl> - delegate_options . max_number_delegated_partitions , <nl> - std : : vector < TfLiteDelegateParams > ( params_array , <nl> - params_array + num_partitions ) , <nl> - & device_supported_nodes ) ) ; <nl> - <nl> - nodes_to_delegate = device_supported_nodes ; <nl> + } else { <nl> + nodes_to_delegate = supported_nodes ; <nl> + auto supported_nodes_int_array = BuildTfLiteIntArray ( supported_nodes ) ; <nl> + TF_LITE_ENSURE_STATUS ( context - > PreviewDelegatePartitioning ( <nl> + context , supported_nodes_int_array . get ( ) , & params_array , <nl> + & num_partitions ) ) ; <nl> } <nl> <nl> + TF_LITE_ENSURE_STATUS ( <nl> + LimitDelegatedPartitions ( delegate_options . max_number_delegated_partitions , <nl> + std : : vector < TfLiteDelegateParams > ( <nl> + params_array , params_array + num_partitions ) , <nl> + & nodes_to_delegate ) ) ; <nl> + <nl> if ( nodes_to_delegate . empty ( ) ) { <nl> return kTfLiteOk ; <nl> } else { <nl> mmm a / tensorflow / lite / delegates / nnapi / nnapi_delegate_device_selection_test . cc <nl> ppp b / tensorflow / lite / delegates / nnapi / nnapi_delegate_device_selection_test . cc <nl> limitations under the License . <nl> # include < sys / mman . h > <nl> <nl> # include < algorithm > <nl> + # include < array > <nl> # include < iterator > <nl> # include < memory > <nl> # include < numeric > <nl> limitations under the License . <nl> # include < vector > <nl> <nl> # include < gtest / gtest . h > <nl> + # include " tensorflow / lite / builtin_ops . h " <nl> # include " tensorflow / lite / c / common . h " <nl> # include " tensorflow / lite / delegates / nnapi / nnapi_delegate . h " <nl> # include " tensorflow / lite / delegates / nnapi / nnapi_delegate_mock_test . h " <nl> TEST_F ( UnsupportedOperationOnDeviceTest , ShouldCacheModelCompilation ) { <nl> } <nl> <nl> / / Model with a chain of no - op ( add with zero operations ) <nl> + / / interleaved with no - op custom nodes . <nl> class LongIdentityModel : public MultiOpModel , public AcceleratedModel { <nl> public : <nl> LongIdentityModel ( const std : : vector < int > & input_shape , int graph_size , <nl> + const std : : unordered_set < int > & custom_nodes_indexes , <nl> const NnApi * nnapi , const std : : string & accelerator_name , <nl> int max_nnapi_partitions ) <nl> : MultiOpModel ( ) , <nl> AcceleratedModel ( nnapi , accelerator_name , max_nnapi_partitions ) { <nl> + Init ( input_shape , graph_size , custom_nodes_indexes ) ; <nl> + } <nl> + <nl> + LongIdentityModel ( const std : : vector < int > & input_shape , int graph_size , <nl> + const std : : unordered_set < int > & custom_nodes_indexes , <nl> + const NnApi * nnapi , int max_nnapi_partitions ) <nl> + : MultiOpModel ( ) , AcceleratedModel ( nnapi , false , max_nnapi_partitions ) { <nl> + Init ( input_shape , graph_size , custom_nodes_indexes ) ; <nl> + } <nl> + <nl> + void SetInput ( std : : vector < float > value ) { PopulateTensor ( input_ , value ) ; } <nl> + <nl> + int CountNnApiPartitions ( ) { <nl> + return std : : count_if ( <nl> + std : : begin ( interpreter_ - > execution_plan ( ) ) , <nl> + std : : end ( interpreter_ - > execution_plan ( ) ) , [ this ] ( const int node_index ) { <nl> + return interpreter_ - > node_and_registration ( node_index ) <nl> + - > first . delegate ! = nullptr ; <nl> + } ) ; <nl> + } <nl> + <nl> + private : <nl> + void Init ( const std : : vector < int > & input_shape , int graph_size , <nl> + const std : : unordered_set < int > & custom_nodes_indexes ) { <nl> auto * delegate = GetDelegate ( ) ; <nl> this - > SetApplyDelegate ( [ delegate ] ( Interpreter * interpreter ) { <nl> interpreter - > ModifyGraphWithDelegate ( delegate ) ; <nl> class LongIdentityModel : public MultiOpModel , public AcceleratedModel { <nl> { intermediate_outputs [ 0 ] } ) ; <nl> <nl> for ( int i = 0 ; i < intermediate_outputs . size ( ) - 1 ; i + + ) { <nl> - AddBuiltinOp ( BuiltinOperator_ADD , BuiltinOptions_AddOptions , <nl> - CreateAddOptions ( builder_ ) . Union ( ) , <nl> - { intermediate_outputs [ i ] , zero_input_ } , <nl> - { intermediate_outputs [ i + 1 ] } ) ; <nl> + if ( custom_nodes_indexes . count ( i + 1 ) = = 1 ) { <nl> + AddCustomOp ( " custom_no_op " , { } , [ this ] ( ) { return CustomNoOpNode ( ) ; } , <nl> + { intermediate_outputs [ i ] } , { intermediate_outputs [ i + 1 ] } ) ; <nl> + } else { <nl> + AddBuiltinOp ( BuiltinOperator_ADD , BuiltinOptions_AddOptions , <nl> + CreateAddOptions ( builder_ ) . Union ( ) , <nl> + { intermediate_outputs [ i ] , zero_input_ } , <nl> + { intermediate_outputs [ i + 1 ] } ) ; <nl> + } <nl> } <nl> <nl> AddBuiltinOp ( <nl> class LongIdentityModel : public MultiOpModel , public AcceleratedModel { <nl> PopulateTensor ( zero_input_ , zero ) ; <nl> } <nl> <nl> - void SetInput ( std : : vector < float > value ) { PopulateTensor ( input_ , value ) ; } <nl> + / / Return the registration of a custom node simply copying input to output . <nl> + TfLiteRegistration * CustomNoOpNode ( ) { <nl> + static TfLiteRegistration no_op = { <nl> + . init = [ ] ( TfLiteContext * context , const char * buffer , <nl> + size_t length ) - > void * { return nullptr ; } , <nl> <nl> - int CountNnApiPartitions ( ) { <nl> - return std : : count_if ( <nl> - std : : begin ( interpreter_ - > execution_plan ( ) ) , <nl> - std : : end ( interpreter_ - > execution_plan ( ) ) , [ this ] ( const int node_index ) { <nl> - return interpreter_ - > node_and_registration ( node_index ) <nl> - - > first . delegate ! = nullptr ; <nl> - } ) ; <nl> - } <nl> + . free = [ ] ( TfLiteContext * context , void * buffer ) - > void { } , <nl> <nl> - private : <nl> + . prepare = [ ] ( TfLiteContext * context , <nl> + TfLiteNode * node ) - > TfLiteStatus { <nl> + if ( node - > inputs - > size ! = 1 | | node - > outputs - > size ! = 1 ) { <nl> + return kTfLiteError ; <nl> + } <nl> + <nl> + return kTfLiteOk ; <nl> + } , <nl> + <nl> + . invoke = [ ] ( TfLiteContext * context , TfLiteNode * node ) - > TfLiteStatus { <nl> + auto input_tensor = context - > tensors [ node - > inputs - > data [ 0 ] ] ; <nl> + auto output_tensor = context - > tensors [ node - > outputs - > data [ 0 ] ] ; <nl> + <nl> + std : : copy ( input_tensor . data . raw , <nl> + input_tensor . data . raw + input_tensor . bytes , <nl> + output_tensor . data . raw ) ; <nl> + <nl> + return kTfLiteOk ; <nl> + } , <nl> + <nl> + . profiling_string = nullptr , <nl> + . builtin_code = kTfLiteBuiltinDelegate , <nl> + . custom_name = " NoOpTestDelegate " , <nl> + . version = 1 , <nl> + } ; <nl> + <nl> + return & no_op ; <nl> + } <nl> int input_ ; <nl> int zero_input_ ; <nl> int output_ ; <nl> class DelegatePartitionLimitTest <nl> / / input_shape . <nl> void Init ( int max_nnapi_partitions , <nl> const std : : vector < int > & nnapi_partition_sizes , <nl> - const std : : vector < int > & input_shape ) { <nl> + const std : : vector < int > & input_shape , <nl> + bool specify_accelerator = true ) { <nl> / / The graph will have as number of nodes the sum of nodes in the NNAPI <nl> / / partitions plus nnapi_partition_sizes . size ( ) - 1 nodes that will be <nl> / / not supported by NNAPI and will cause the <nl> class DelegatePartitionLimitTest <nl> unsupported_ops_idxs . insert ( partition_node_idx ) ; <nl> } <nl> <nl> - DelegatePartitionLimitTestNodeFilter ( ) - > ConfigureSupportedNodes ( <nl> - graph_size_ , unsupported_ops_idxs ) ; <nl> - <nl> - nnapi_mock_ - > StubGetSupportedOperationsForDevicesWith ( <nl> - [ ] ( const ANeuralNetworksModel * model , <nl> - const ANeuralNetworksDevice * const * devices , uint32_t num_devices , <nl> - bool * supported_ops ) - > int { <nl> - DelegatePartitionLimitTestNodeFilter ( ) - > SetNodeSupport ( supported_ops ) ; <nl> - return ANEURALNETWORKS_NO_ERROR ; <nl> - } ) ; <nl> - <nl> - model_ = std : : make_unique < LongIdentityModel > ( <nl> - input_shape , graph_size_ , nnapi_mock_ - > GetNnApi ( ) , <nl> - / * accelerator_name = * / " test - device " , max_nnapi_partitions ) ; <nl> + if ( specify_accelerator ) { <nl> + / / Building a model that will contain initially a single partition <nl> + / / and will get then partitioned by checking the operations supported <nl> + / / by the target accelerator . <nl> + / / This because I am not able to know the size of each partition in my <nl> + / / stubbed GetSupportedOperationsForDevices API . <nl> + DelegatePartitionLimitTestNodeFilter ( ) - > ConfigureSupportedNodes ( <nl> + graph_size_ , unsupported_ops_idxs ) ; <nl> + <nl> + nnapi_mock_ - > StubGetSupportedOperationsForDevicesWith ( <nl> + [ ] ( const ANeuralNetworksModel * model , <nl> + const ANeuralNetworksDevice * const * devices , uint32_t num_devices , <nl> + bool * supported_ops ) - > int { <nl> + DelegatePartitionLimitTestNodeFilter ( ) - > SetNodeSupport ( <nl> + supported_ops ) ; <nl> + return ANEURALNETWORKS_NO_ERROR ; <nl> + } ) ; <nl> + <nl> + model_ = std : : make_unique < LongIdentityModel > ( <nl> + input_shape , graph_size_ , <nl> + / * custom_nodes_indexes = * / std : : unordered_set < int > ( ) , <nl> + nnapi_mock_ - > GetNnApi ( ) , <nl> + / * accelerator_name = * / " test - device " , max_nnapi_partitions ) ; <nl> + } else { <nl> + / / Building a model containing custom nodes that won ' t be supported <nl> + / / by the delegate and generate the partitions . <nl> + model_ = std : : make_unique < LongIdentityModel > ( <nl> + input_shape , graph_size_ , unsupported_ops_idxs , <nl> + nnapi_mock_ - > GetNnApi ( ) , max_nnapi_partitions ) ; <nl> + } <nl> } <nl> <nl> std : : unique_ptr < LongIdentityModel > model_ ; <nl> TEST_F ( DelegatePartitionLimitTest , <nl> } <nl> <nl> TEST_F ( DelegatePartitionLimitTest , ShouldDelegatePartitionWithHigherNodeCount ) { <nl> + int kLargestModelSize = 3 ; <nl> Init ( / * max_nnapi_partitions = * / 1 , <nl> / * nnapi_partition_sizes = * / { 3 , 2 } , <nl> / * input_shape = * / { 1 , 2 , 2 , 1 } ) ; <nl> <nl> EXPECT_EQ ( model_ - > CountNnApiPartitions ( ) , 1 ) ; <nl> - EXPECT_EQ ( model_ - > CountOpsExecutedByCpuKernel ( ) , OriginalGraphSize ( ) - 3 ) ; <nl> + EXPECT_EQ ( model_ - > CountOpsExecutedByCpuKernel ( ) , <nl> + OriginalGraphSize ( ) - kLargestModelSize ) ; <nl> } <nl> <nl> TEST_F ( DelegatePartitionLimitTest , <nl> ShouldDelegatePartitionsWithHigherNodeCount ) { <nl> + int kLargestModelSize = 5 ; <nl> + int kSecondLargestModelSize = 4 ; <nl> Init ( / * max_nnapi_partitions = * / 2 , <nl> - / * nnapi_partition_sizes = * / { 1 , 5 , 2 , 4 } , <nl> + / * nnapi_partition_sizes = * / <nl> + { 1 , kLargestModelSize , 2 , kSecondLargestModelSize } , <nl> / * input_shape = * / { 1 , 2 , 2 , 1 } ) ; <nl> <nl> EXPECT_EQ ( model_ - > CountNnApiPartitions ( ) , 2 ) ; <nl> EXPECT_EQ ( model_ - > CountOpsExecutedByCpuKernel ( ) , OriginalGraphSize ( ) - 9 ) ; <nl> } <nl> <nl> + TEST_F ( DelegatePartitionLimitTest , <nl> + ShouldLimitPartitionsEvenWithoutAcceleratorNameSpecified ) { <nl> + int kLargestModelSize = 5 ; <nl> + int kSecondLargestModelSize = 4 ; <nl> + Init ( / * max_nnapi_partitions = * / 2 , <nl> + / * nnapi_partition_sizes = * / <nl> + { 1 , kLargestModelSize , 2 , kSecondLargestModelSize } , <nl> + / * input_shape = * / { 1 , 2 , 2 , 1 } , / * specify_accelerator = * / false ) ; <nl> + <nl> + EXPECT_EQ ( model_ - > CountNnApiPartitions ( ) , 2 ) ; <nl> + EXPECT_EQ ( <nl> + model_ - > CountOpsExecutedByCpuKernel ( ) , <nl> + OriginalGraphSize ( ) - ( kLargestModelSize + kSecondLargestModelSize ) ) ; <nl> + } <nl> + <nl> } / / namespace <nl> } / / namespace tflite <nl> <nl>
Support partition limitation even when accelerator name is not specified
tensorflow/tensorflow
f781e5eb44d3ece0ca82627e7cf4c87ad95e4620
2020-02-21T11:57:24Z
mmm a / tensorflow / lite / core / subgraph . cc <nl> ppp b / tensorflow / lite / core / subgraph . cc <nl> TfLiteStatus Subgraph : : ResizeTensor ( TfLiteContext * context , <nl> if ( tensor - > data . raw ! = nullptr & & <nl> EqualArrayAndTfLiteIntArray ( tensor - > dims , new_size - > size , <nl> new_size - > data ) ) { <nl> + TfLiteIntArrayFree ( new_size ) ; <nl> return kTfLiteOk ; <nl> } <nl> <nl>
[ 1 ] Review comments handled
tensorflow/tensorflow
8c350bc3d1650877f68444e2e93a6cd28a3fc7b3
2019-03-21T01:50:56Z
mmm a / docs / api / browser - window . md <nl> ppp b / docs / api / browser - window . md <nl> It creates a new ` BrowserWindow ` with native properties as set by the ` options ` . <nl> the ` nodeIntegration ` option and the APIs available to the preload script <nl> are more limited . Read more about the option [ here ] ( sandbox - option . md ) . <nl> * ` enableRemoteModule ` Boolean ( optional ) - Whether to enable the [ ` remote ` ] ( remote . md ) module . <nl> - Default is ` true ` . <nl> + Default is ` false ` . <nl> * ` session ` [ Session ] ( session . md # class - session ) ( optional ) - Sets the session used by the <nl> page . Instead of passing the Session object directly , you can also choose to <nl> use the ` partition ` option instead , which accepts a partition string . When <nl>
docs : update default value for ` enableRemoteModule ` in BrowserWindow ( )
electron/electron
b55e8dc578f19430f397f812ef3e258bf506a993
2020-08-18T07:54:47Z
mmm a / tensorflow / core / kernels / ignore_errors_dataset_op . cc <nl> ppp b / tensorflow / core / kernels / ignore_errors_dataset_op . cc <nl> class IgnoreErrorsDatasetOp : public UnaryDatasetOpKernel { <nl> Status GetNextInternal ( IteratorContext * ctx , <nl> std : : vector < Tensor > * out_tensors , <nl> bool * end_of_sequence ) override { <nl> - if ( ! input_impl_ ) { <nl> - * end_of_sequence = true ; <nl> - return Status : : OK ( ) ; <nl> - } <nl> - Status s = input_impl_ - > GetNext ( ctx , out_tensors , end_of_sequence ) ; <nl> - while ( ! s . ok ( ) ) { <nl> - out_tensors - > clear ( ) ; <nl> - s = input_impl_ - > GetNext ( ctx , out_tensors , end_of_sequence ) ; <nl> + { <nl> + tf_shared_lock l ( mu_ ) ; <nl> + if ( ! input_impl_ ) { <nl> + * end_of_sequence = true ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + Status s = input_impl_ - > GetNext ( ctx , out_tensors , end_of_sequence ) ; <nl> + while ( ! s . ok ( ) ) { <nl> + out_tensors - > clear ( ) ; <nl> + s = input_impl_ - > GetNext ( ctx , out_tensors , end_of_sequence ) ; <nl> + } <nl> } <nl> if ( * end_of_sequence ) { <nl> + mutex_lock l ( mu_ ) ; <nl> input_impl_ . reset ( ) ; <nl> } <nl> return Status : : OK ( ) ; <nl> class IgnoreErrorsDatasetOp : public UnaryDatasetOpKernel { <nl> <nl> protected : <nl> Status SaveInternal ( IteratorStateWriter * writer ) override { <nl> + mutex_lock l ( mu_ ) ; <nl> if ( input_impl_ ) <nl> TF_RETURN_IF_ERROR ( SaveParent ( writer , input_impl_ ) ) ; <nl> else <nl> class IgnoreErrorsDatasetOp : public UnaryDatasetOpKernel { <nl> <nl> Status RestoreInternal ( OpKernelContext * ctx , <nl> IteratorStateReader * reader ) override { <nl> + mutex_lock l ( mu_ ) ; <nl> if ( reader - > Contains ( full_name ( " input_impls_empty " ) ) ) <nl> input_impl_ . reset ( ) ; <nl> else <nl> class IgnoreErrorsDatasetOp : public UnaryDatasetOpKernel { <nl> } <nl> <nl> private : <nl> - std : : unique_ptr < IteratorBase > input_impl_ ; <nl> + mutex mu_ ; <nl> + std : : unique_ptr < IteratorBase > input_impl_ GUARDED_BY ( mu_ ) ; <nl> } ; <nl> <nl> const DatasetBase * const input_ ; <nl>
[ tf . data ] Patch for thread safe IgnoreErrorDataset .
tensorflow/tensorflow
85fa6bdfe40f24259b3cec19637567ed3cff7370
2017-11-23T00:39:21Z
mmm a / torch / nn / parallel / distributed . py <nl> ppp b / torch / nn / parallel / distributed . py <nl> class DistributedDataParallel ( Module ) : <nl> ` ` map_location ` ` , ` ` torch . load ` ` would recover the module to devices <nl> where the module was saved from . <nl> <nl> + . . note : : When a model is trained on ` ` M ` ` nodes with ` ` batch = N ` ` , the <nl> + gradient will be ` ` M ` ` times smaller when compared to the same model <nl> + trained on a single node with ` ` batch = M * N ` ` ( because the gradients <nl> + between different nodes are averaged ) . You should take this into <nl> + consideration when you want to obtain a mathematically equivalent <nl> + training process compared to the non - DistributedDataParallel <nl> + counterpart . <nl> + <nl> . . warning : : <nl> This module works only with the ` ` gloo ` ` and ` ` nccl ` ` backends . <nl> <nl>
Improve the documentation of DistributedDataParallel ( )
pytorch/pytorch
b56db305cf441453a84ae0b55f708ac0998cafc0
2020-08-04T15:36:42Z
mmm a / src / training / combine_tessdata . cpp <nl> ppp b / src / training / combine_tessdata . cpp <nl> int main ( int argc , char * * argv ) { <nl> tesseract : : TessdataManager tm ; <nl> if ( argc > 1 & & ( ! strcmp ( argv [ 1 ] , " - v " ) | | ! strcmp ( argv [ 1 ] , " - - version " ) ) ) { <nl> printf ( " % s \ n " , tesseract : : TessBaseAPI : : Version ( ) ) ; <nl> - return 0 ; <nl> + return EXIT_SUCCESS ; <nl> } else if ( argc = = 2 ) { <nl> printf ( " Combining tessdata files \ n " ) ; <nl> STRING lang = argv [ 1 ] ; <nl> int main ( int argc , char * * argv ) { <nl> / / Initialize TessdataManager with the data in the given traineddata file . <nl> if ( ! tm . Init ( argv [ 2 ] ) ) { <nl> tprintf ( " Failed to read % s \ n " , argv [ 2 ] ) ; <nl> - exit ( 1 ) ; <nl> + return EXIT_FAILURE ; <nl> } <nl> printf ( " Extracting tessdata components from % s \ n " , argv [ 2 ] ) ; <nl> if ( strcmp ( argv [ 1 ] , " - e " ) = = 0 ) { <nl> for ( i = 3 ; i < argc ; + + i ) { <nl> + errno = 0 ; <nl> if ( tm . ExtractToFile ( argv [ i ] ) ) { <nl> printf ( " Wrote % s \ n " , argv [ i ] ) ; <nl> - } else { <nl> + } else if ( errno = = 0 ) { <nl> printf ( " Not extracting % s , since this component " <nl> " is not present \ n " , argv [ i ] ) ; <nl> + return EXIT_FAILURE ; <nl> + } else { <nl> + printf ( " Error , could not extract % s : % s \ n " , <nl> + argv [ i ] , strerror ( errno ) ) ; <nl> + return EXIT_FAILURE ; <nl> } <nl> } <nl> } else { / / extract all the components <nl> int main ( int argc , char * * argv ) { <nl> if ( * last ! = ' . ' ) <nl> filename + = ' . ' ; <nl> filename + = tesseract : : kTessdataFileSuffixes [ i ] ; <nl> + errno = 0 ; <nl> if ( tm . ExtractToFile ( filename . string ( ) ) ) { <nl> printf ( " Wrote % s \ n " , filename . string ( ) ) ; <nl> + } else if ( errno ! = 0 ) { <nl> + printf ( " Error , could not extract % s : % s \ n " , <nl> + filename . string ( ) , strerror ( errno ) ) ; <nl> + return EXIT_FAILURE ; <nl> } <nl> } <nl> } <nl> int main ( int argc , char * * argv ) { <nl> if ( rename ( new_traineddata_filename , traineddata_filename . string ( ) ) ! = 0 ) { <nl> tprintf ( " Failed to create a temporary file % s \ n " , <nl> traineddata_filename . string ( ) ) ; <nl> - exit ( 1 ) ; <nl> + return EXIT_FAILURE ; <nl> } <nl> <nl> / / Initialize TessdataManager with the data in the given traineddata file . <nl> int main ( int argc , char * * argv ) { <nl> } else if ( argc = = 3 & & strcmp ( argv [ 1 ] , " - c " ) = = 0 ) { <nl> if ( ! tm . Init ( argv [ 2 ] ) ) { <nl> tprintf ( " Failed to read % s \ n " , argv [ 2 ] ) ; <nl> - exit ( 1 ) ; <nl> + return EXIT_FAILURE ; <nl> } <nl> tesseract : : TFile fp ; <nl> if ( ! tm . GetComponent ( tesseract : : TESSDATA_LSTM , & fp ) ) { <nl> tprintf ( " No LSTM Component found in % s ! \ n " , argv [ 2 ] ) ; <nl> - exit ( 1 ) ; <nl> + return EXIT_FAILURE ; <nl> } <nl> tesseract : : LSTMRecognizer recognizer ; <nl> if ( ! recognizer . DeSerialize ( & tm , & fp ) ) { <nl> tprintf ( " Failed to deserialize LSTM in % s ! \ n " , argv [ 2 ] ) ; <nl> - exit ( 1 ) ; <nl> + return EXIT_FAILURE ; <nl> } <nl> recognizer . ConvertToInt ( ) ; <nl> GenericVector < char > lstm_data ; <nl> int main ( int argc , char * * argv ) { <nl> lstm_data . size ( ) ) ; <nl> if ( ! tm . SaveFile ( argv [ 2 ] , nullptr ) ) { <nl> tprintf ( " Failed to write modified traineddata : % s ! \ n " , argv [ 2 ] ) ; <nl> - exit ( 1 ) ; <nl> + return EXIT_FAILURE ; <nl> } <nl> } else if ( argc = = 3 & & strcmp ( argv [ 1 ] , " - d " ) = = 0 ) { <nl> / / Initialize TessdataManager with the data in the given traineddata file . <nl> int main ( int argc , char * * argv ) { <nl> return 1 ; <nl> } <nl> tm . Directory ( ) ; <nl> + return EXIT_SUCCESS ; <nl> } <nl> mmm a / src / training / lstmtraining . cpp <nl> ppp b / src / training / lstmtraining . cpp <nl> int main ( int argc , char * * argv ) { <nl> / / Purify the model name in case it is based on the network string . <nl> if ( FLAGS_model_output . empty ( ) ) { <nl> tprintf ( " Must provide a - - model_output ! \ n " ) ; <nl> - return 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> if ( FLAGS_traineddata . empty ( ) ) { <nl> tprintf ( " Must provide a - - traineddata see training wiki \ n " ) ; <nl> - return 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> STRING model_output = FLAGS_model_output . c_str ( ) ; <nl> for ( int i = 0 ; i < model_output . length ( ) ; + + i ) { <nl> int main ( int argc , char * * argv ) { <nl> if ( model_output [ i ] = = ' ( ' | | model_output [ i ] = = ' ) ' ) <nl> model_output [ i ] = ' _ ' ; <nl> } <nl> + <nl> + / / Check write permissions . <nl> + STRING test_file = FLAGS_model_output . c_str ( ) ; <nl> + test_file + = " _wtest " ; <nl> + FILE * f = fopen ( test_file . c_str ( ) , " wb " ) ; <nl> + if ( f ! = nullptr ) { <nl> + fclose ( f ) ; <nl> + remove ( test_file . c_str ( ) ) ; <nl> + } else { <nl> + tprintf ( " Error , model output cannot be written : % s \ n " , strerror ( errno ) ) ; <nl> + return EXIT_FAILURE ; <nl> + } <nl> + <nl> / / Setup the trainer . <nl> STRING checkpoint_file = FLAGS_model_output . c_str ( ) ; <nl> checkpoint_file + = " _checkpoint " ; <nl> int main ( int argc , char * * argv ) { <nl> if ( ! trainer . TryLoadingCheckpoint ( FLAGS_continue_from . c_str ( ) , nullptr ) ) { <nl> tprintf ( " Failed to read continue from : % s \ n " , <nl> FLAGS_continue_from . c_str ( ) ) ; <nl> - return 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> if ( FLAGS_debug_network ) { <nl> trainer . DebugNetwork ( ) ; <nl> int main ( int argc , char * * argv ) { <nl> FLAGS_model_output . c_str ( ) ) ; <nl> } <nl> } <nl> - return 0 ; <nl> + return EXIT_SUCCESS ; <nl> } <nl> <nl> / / Get the list of files to process . <nl> if ( FLAGS_train_listfile . empty ( ) ) { <nl> tprintf ( " Must supply a list of training filenames ! - - train_listfile \ n " ) ; <nl> - return 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> GenericVector < STRING > filenames ; <nl> if ( ! tesseract : : LoadFileLinesToStrings ( FLAGS_train_listfile . c_str ( ) , <nl> & filenames ) ) { <nl> tprintf ( " Failed to load list of training filenames from % s \ n " , <nl> FLAGS_train_listfile . c_str ( ) ) ; <nl> - return 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> <nl> / / Checkpoints always take priority if they are available . <nl> int main ( int argc , char * * argv ) { <nl> ? FLAGS_continue_from . c_str ( ) <nl> : FLAGS_old_traineddata . c_str ( ) ) ) { <nl> tprintf ( " Failed to continue from : % s \ n " , FLAGS_continue_from . c_str ( ) ) ; <nl> - return 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> tprintf ( " Continuing from % s \ n " , FLAGS_continue_from . c_str ( ) ) ; <nl> trainer . InitIterations ( ) ; <nl> int main ( int argc , char * * argv ) { <nl> tprintf ( " Appending a new network to an old one ! ! " ) ; <nl> if ( FLAGS_continue_from . empty ( ) ) { <nl> tprintf ( " Must set - - continue_from for appending ! \ n " ) ; <nl> - return 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> } <nl> / / We are initializing from scratch . <nl> int main ( int argc , char * * argv ) { <nl> FLAGS_adam_beta ) ) { <nl> tprintf ( " Failed to create network from spec : % s \ n " , <nl> FLAGS_net_spec . c_str ( ) ) ; <nl> - return 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> trainer . set_perfect_delay ( FLAGS_perfect_sample_delay ) ; <nl> } <nl> int main ( int argc , char * * argv ) { <nl> : tesseract : : CS_ROUND_ROBIN , <nl> FLAGS_randomly_rotate ) ) { <nl> tprintf ( " Load of images failed ! ! \ n " ) ; <nl> - return 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> <nl> tesseract : : LSTMTester tester ( static_cast < int64_t > ( FLAGS_max_image_MB ) * <nl> int main ( int argc , char * * argv ) { <nl> if ( ! tester . LoadAllEvalData ( FLAGS_eval_listfile . c_str ( ) ) ) { <nl> tprintf ( " Failed to load eval data from : % s \ n " , <nl> FLAGS_eval_listfile . c_str ( ) ) ; <nl> - return 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> tester_callback = <nl> NewPermanentTessCallback ( & tester , & tesseract : : LSTMTester : : RunEvalAsync ) ; <nl> int main ( int argc , char * * argv ) { <nl> FLAGS_max_iterations = = 0 ) ) ; <nl> delete tester_callback ; <nl> tprintf ( " Finished ! Error rate = % g \ n " , trainer . best_error_rate ( ) ) ; <nl> - return 0 ; <nl> + return EXIT_SUCCESS ; <nl> } / * main * / <nl>
Merge pull request from stweil / checkdir
tesseract-ocr/tesseract
0e43ae5cf42cbdaf86200b393d55560ff7fe2ffa
2018-10-05T20:38:01Z
mmm a / include / swift / Serialization / ModuleFormat . h <nl> ppp b / include / swift / Serialization / ModuleFormat . h <nl> const uint16_t SWIFTMODULE_VERSION_MAJOR = 0 ; <nl> / / / describe what change you made . The content of this comment isn ' t important ; <nl> / / / it just ensures a conflict if two people change the module format . <nl> / / / Don ' t worry about adhering to the 80 - column limit for this line . <nl> - const uint16_t SWIFTMODULE_VERSION_MINOR = 455 ; / / Last change : reorder block IDs <nl> + const uint16_t SWIFTMODULE_VERSION_MINOR = 456 ; / / Last change : encode depth in generic param XREFs <nl> <nl> using DeclIDField = BCFixed < 31 > ; <nl> <nl> namespace decls_block { <nl> <nl> using XRefGenericParamPathPieceLayout = BCRecordLayout < <nl> XREF_GENERIC_PARAM_PATH_PIECE , <nl> - BCVBR < 5 > / / index <nl> + BCVBR < 5 > , / / depth <nl> + BCVBR < 5 > / / index <nl> > ; <nl> <nl> using SILGenNameDeclAttrLayout = BCRecordLayout < <nl> mmm a / lib / Serialization / Deserialization . cpp <nl> ppp b / lib / Serialization / Deserialization . cpp <nl> ModuleFile : : resolveCrossReference ( ModuleDecl * baseModule , uint32_t pathLen ) { <nl> getXRefDeclNameForError ( ) ) ; <nl> } <nl> <nl> - uint32_t paramIndex ; <nl> - XRefGenericParamPathPieceLayout : : readRecord ( scratch , paramIndex ) ; <nl> + uint32_t depth , paramIndex ; <nl> + XRefGenericParamPathPieceLayout : : readRecord ( scratch , depth , paramIndex ) ; <nl> <nl> pathTrace . addGenericParam ( paramIndex ) ; <nl> <nl> ModuleFile : : resolveCrossReference ( ModuleDecl * baseModule , uint32_t pathLen ) { <nl> assert ( paramList & & " Couldn ' t find constrained extension " ) ; <nl> } else { <nl> / / Simple case : use the nominal type ' s generic parameters . <nl> - paramList = nominal - > getGenericParams ( ) ; <nl> + paramList = nominal - > getGenericParamsOfContext ( ) ; <nl> } <nl> } else if ( auto alias = dyn_cast < TypeAliasDecl > ( base ) ) { <nl> paramList = alias - > getGenericParams ( ) ; <nl> ModuleFile : : resolveCrossReference ( ModuleDecl * baseModule , uint32_t pathLen ) { <nl> " cross - reference to generic param for non - generic type " , <nl> pathTrace , getXRefDeclNameForError ( ) ) ; <nl> } <nl> + <nl> + unsigned currentDepth = paramList - > getDepth ( ) ; <nl> + if ( currentDepth < depth ) { <nl> + return llvm : : make_error < XRefError > ( <nl> + " a containing type has been made non - generic " , <nl> + pathTrace , getXRefDeclNameForError ( ) ) ; <nl> + } <nl> + while ( currentDepth > depth ) { <nl> + paramList = paramList - > getOuterParameters ( ) ; <nl> + - - currentDepth ; <nl> + } <nl> + <nl> if ( paramIndex > = paramList - > size ( ) ) { <nl> return llvm : : make_error < XRefError > ( <nl> " generic argument index out of bounds " , <nl> mmm a / lib / Serialization / Serialization . cpp <nl> ppp b / lib / Serialization / Serialization . cpp <nl> void Serializer : : writeCrossReference ( const Decl * D ) { <nl> " Cannot cross reference a generic type decl at module scope . " ) ; <nl> abbrCode = DeclTypeAbbrCodes [ XRefGenericParamPathPieceLayout : : Code ] ; <nl> XRefGenericParamPathPieceLayout : : emitRecord ( Out , ScratchRecord , abbrCode , <nl> + genericParam - > getDepth ( ) , <nl> genericParam - > getIndex ( ) ) ; <nl> return ; <nl> } <nl> new file mode 100644 <nl> index 000000000000 . . 2f5b721a8591 <nl> mmm / dev / null <nl> ppp b / test / Serialization / Inputs / xref - generic - params - other - extensions - constrained . swift <nl> <nl> + public struct OuterNonGeneric { } <nl> + extension OuterNonGeneric { <nl> + public struct InnerNonGeneric { } <nl> + public struct InnerGeneric < Y1 , Y2 > { } <nl> + } <nl> + <nl> + public struct OuterGeneric < X1 , X2 > { } <nl> + extension OuterGeneric { <nl> + public struct InnerNonGeneric { } <nl> + public struct InnerGeneric < Y1 , Y2 > { } <nl> + } <nl> + <nl> + <nl> + extension OuterNonGeneric . InnerNonGeneric { <nl> + public typealias AliasTy = ( ) <nl> + } <nl> + <nl> + extension OuterNonGeneric . InnerGeneric where Y1 : Equatable { <nl> + public typealias AliasTy = ( Y1 , Y2 ) <nl> + } <nl> + <nl> + extension OuterGeneric . InnerNonGeneric where X1 : Equatable { <nl> + public typealias AliasTy = ( X1 , X2 ) <nl> + } <nl> + <nl> + extension OuterGeneric . InnerGeneric where X1 : Equatable , Y1 : Equatable { <nl> + public typealias AliasTy = ( X1 , X2 , Y1 , Y2 ) <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 5ea29020ed8b <nl> mmm / dev / null <nl> ppp b / test / Serialization / Inputs / xref - generic - params - other - extensions - mixed . swift <nl> <nl> + public struct OuterNonGeneric { } <nl> + extension OuterNonGeneric { <nl> + public struct InnerNonGeneric { <nl> + public typealias AliasTy = ( ) <nl> + } <nl> + public struct InnerGeneric < Y1 , Y2 > { <nl> + public typealias AliasTy = ( Y1 , Y2 ) <nl> + } <nl> + } <nl> + <nl> + public struct OuterGeneric < X1 , X2 > { } <nl> + extension OuterGeneric { <nl> + public struct InnerNonGeneric { <nl> + public typealias AliasTy = ( X1 , X2 ) <nl> + } <nl> + public struct InnerGeneric < Y1 , Y2 > { <nl> + public typealias AliasTy = ( X1 , X2 , Y1 , Y2 ) <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . c7ef407e7daa <nl> mmm / dev / null <nl> ppp b / test / Serialization / Inputs / xref - generic - params - other - extensions . swift <nl> <nl> + public struct OuterNonGeneric { } <nl> + extension OuterNonGeneric { <nl> + public struct InnerNonGeneric { } <nl> + public struct InnerGeneric < Y1 , Y2 > { } <nl> + } <nl> + <nl> + public struct OuterGeneric < X1 , X2 > { } <nl> + extension OuterGeneric { <nl> + public struct InnerNonGeneric { } <nl> + public struct InnerGeneric < Y1 , Y2 > { } <nl> + } <nl> + <nl> + <nl> + extension OuterNonGeneric . InnerNonGeneric { <nl> + public typealias AliasTy = ( ) <nl> + } <nl> + <nl> + extension OuterNonGeneric . InnerGeneric { <nl> + public typealias AliasTy = ( Y1 , Y2 ) <nl> + } <nl> + <nl> + extension OuterGeneric . InnerNonGeneric { <nl> + public typealias AliasTy = ( X1 , X2 ) <nl> + } <nl> + <nl> + extension OuterGeneric . InnerGeneric { <nl> + public typealias AliasTy = ( X1 , X2 , Y1 , Y2 ) <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 1f9e334f366c <nl> mmm / dev / null <nl> ppp b / test / Serialization / Inputs / xref - generic - params - other . swift <nl> <nl> + public struct OuterNonGeneric { <nl> + public struct InnerNonGeneric { <nl> + public typealias AliasTy = ( ) <nl> + } <nl> + public struct InnerGeneric < Y1 , Y2 > { <nl> + public typealias AliasTy = ( Y1 , Y2 ) <nl> + } <nl> + } <nl> + <nl> + public struct OuterGeneric < X1 , X2 > { <nl> + public struct InnerNonGeneric { <nl> + public typealias AliasTy = ( X1 , X2 ) <nl> + } <nl> + public struct InnerGeneric < Y1 , Y2 > { <nl> + public typealias AliasTy = ( X1 , X2 , Y1 , Y2 ) <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 6e7ab1ad6736 <nl> mmm / dev / null <nl> ppp b / test / Serialization / xref - generic - params . swift <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + <nl> + / / Run the same test several times , providing the nested types a different way <nl> + / / each time . <nl> + <nl> + / / RUN : % target - swift - frontend - emit - module - o % t / a . swiftmodule - primary - file % s % S / Inputs / xref - generic - params - other . swift - module - name main <nl> + / / RUN : % target - swift - frontend - emit - module - o % t / b . swiftmodule % s - primary - file % S / Inputs / xref - generic - params - other . swift - module - name main <nl> + / / RUN : % target - swift - frontend - merge - modules - emit - module - o % t / main . swiftmodule % t / a . swiftmodule % t / b . swiftmodule - module - name main <nl> + / / RUN : % target - swift - ide - test - print - module - module - to - print = main - I % t - source - filename = x | % FileCheck % s <nl> + <nl> + / / RUN : % target - swift - frontend - emit - module - o % t / a - extensions . swiftmodule - primary - file % s % S / Inputs / xref - generic - params - other - extensions . swift - module - name extensions <nl> + / / RUN : % target - swift - frontend - emit - module - o % t / b - extensions . swiftmodule % s - primary - file % S / Inputs / xref - generic - params - other - extensions . swift - module - name extensions <nl> + / / RUN : % target - swift - frontend - merge - modules - emit - module - o % t / extensions . swiftmodule % t / a - extensions . swiftmodule % t / b - extensions . swiftmodule - module - name extensions <nl> + / / RUN : % target - swift - ide - test - print - module - module - to - print = extensions - I % t - source - filename = x | % FileCheck % s <nl> + <nl> + / / RUN : % target - swift - frontend - emit - module - o % t / a - extensions_mixed . swiftmodule - primary - file % s % S / Inputs / xref - generic - params - other - extensions - mixed . swift - module - name extensions_mixed <nl> + / / RUN : % target - swift - frontend - emit - module - o % t / b - extensions_mixed . swiftmodule % s - primary - file % S / Inputs / xref - generic - params - other - extensions - mixed . swift - module - name extensions_mixed <nl> + / / RUN : % target - swift - frontend - merge - modules - emit - module - o % t / extensions_mixed . swiftmodule % t / a - extensions_mixed . swiftmodule % t / b - extensions_mixed . swiftmodule - module - name extensions_mixed <nl> + / / RUN : % target - swift - ide - test - print - module - module - to - print = extensions_mixed - I % t - source - filename = x | % FileCheck % s <nl> + <nl> + / / RUN : % target - swift - frontend - emit - module - o % t / a - extensions_constrained . swiftmodule - primary - file % s % S / Inputs / xref - generic - params - other - extensions - constrained . swift - module - name extensions_constrained <nl> + / / RUN : % target - swift - frontend - emit - module - o % t / b - extensions_constrained . swiftmodule % s - primary - file % S / Inputs / xref - generic - params - other - extensions - constrained . swift - module - name extensions_constrained <nl> + / / RUN : % target - swift - frontend - merge - modules - emit - module - o % t / extensions_constrained . swiftmodule % t / a - extensions_constrained . swiftmodule % t / b - extensions_constrained . swiftmodule - module - name extensions_constrained <nl> + / / RUN : % target - swift - ide - test - print - module - module - to - print = extensions_constrained - I % t - source - filename = x | % FileCheck % s <nl> + <nl> + public struct A : Equatable { } <nl> + public struct B : Equatable { } <nl> + public struct C : Equatable { } <nl> + public struct D : Equatable { } <nl> + <nl> + / / CHECK - LABEL : func test ( <nl> + public func test ( <nl> + / / CHECK - SAME : _ : OuterNonGeneric . InnerNonGeneric . AliasTy <nl> + _ : OuterNonGeneric . InnerNonGeneric . AliasTy , <nl> + / / CHECK - SAME : _ : OuterNonGeneric . InnerGeneric < C , D > . AliasTy <nl> + _ : OuterNonGeneric . InnerGeneric < C , D > . AliasTy , <nl> + / / CHECK - SAME : _ : OuterGeneric < A , B > . InnerNonGeneric . AliasTy <nl> + _ : OuterGeneric < A , B > . InnerNonGeneric . AliasTy , <nl> + / / CHECK - SAME : _ : OuterGeneric < A , B > . InnerGeneric < C , D > . AliasTy <nl> + _ : OuterGeneric < A , B > . InnerGeneric < C , D > . AliasTy ) { } <nl>
[ Serialization ] Encode depth for cross - refs to generic parameters
apple/swift
3455510300c5375c526b73835100df5501693b3e
2018-10-26T23:51:44Z
mmm a / include / swift / AST / ASTContext . h <nl> ppp b / include / swift / AST / ASTContext . h <nl> namespace swift { <nl> class IndexSubset ; <nl> struct SILAutoDiffDerivativeFunctionKey ; <nl> struct InterfaceSubContextDelegate ; <nl> + class TypeCheckCompletionCallback ; <nl> <nl> enum class KnownProtocolKind : uint8_t ; <nl> <nl> class ASTContext final { <nl> / / / Diags - The diagnostics engine . <nl> DiagnosticEngine & Diags ; <nl> <nl> + TypeCheckCompletionCallback * CompletionCallback = nullptr ; <nl> + <nl> / / / The request - evaluator that is used to process various requests . <nl> Evaluator evaluator ; <nl> <nl> mmm a / include / swift / IDE / CodeCompletion . h <nl> ppp b / include / swift / IDE / CodeCompletion . h <nl> class CodeCompletionContext { <nl> / / / but should not hide any results . <nl> SingleExpressionBody , <nl> <nl> - / / / There are known contextual types . <nl> + / / / There are known contextual types , or there aren ' t but a nonvoid type is expected . <nl> Required , <nl> } ; <nl> <nl> mmm a / include / swift / Parse / CodeCompletionCallbacks . h <nl> ppp b / include / swift / Parse / CodeCompletionCallbacks . h <nl> class CodeCompletionCallbacks { <nl> virtual void setAttrTargetDeclKind ( Optional < DeclKind > DK ) { } <nl> <nl> / / / Complete expr - dot after we have consumed the dot . <nl> - virtual void completeDotExpr ( Expr * E , SourceLoc DotLoc ) { } ; <nl> + virtual void completeDotExpr ( CodeCompletionExpr * E , SourceLoc DotLoc ) { } ; <nl> <nl> / / / Complete the beginning of a statement or expression . <nl> virtual void completeStmtOrExpr ( CodeCompletionExpr * E ) { } ; <nl> mmm a / include / swift / Parse / Parser . h <nl> ppp b / include / swift / Parse / Parser . h <nl> class Parser { <nl> Context . LangOpts . ParseForSyntaxTreeOnly ; <nl> } <nl> <nl> + / / / If a function or closure body consists of a single expression , determine <nl> + / / / whether we should turn wrap it in a return statement or not . <nl> + / / / <nl> + / / / We don ' t do this transformation for non - solver - based code completion <nl> + / / / positions , as the source may be incomplete and the type mismatch in the <nl> + / / / return statement will just confuse the type checker . <nl> + bool shouldSuppressSingleExpressionBodyTransform ( <nl> + ParserStatus Status , MutableArrayRef < ASTNode > BodyElems ) ; <nl> + <nl> public : <nl> InFlightDiagnostic diagnose ( SourceLoc Loc , Diagnostic Diag ) { <nl> if ( Diags . isDiagnosticPointsToFirstBadToken ( Diag . getID ( ) ) & & <nl> new file mode 100644 <nl> index 000000000000 . . e461217c1708 <nl> mmm / dev / null <nl> ppp b / include / swift / Sema / CodeCompletionTypeChecking . h <nl> <nl> + / / = = = mmm CodeCompletionTypeChecking . h mmmmmmmmmmmmmmmmmmmmmmmm - - * - C + + - * - = = = / / <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2020 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / / \ file <nl> + / / / Provides TypeCheckCompletionCallback implementations for the various kinds <nl> + / / / of code completion . These extract and persist information needed to compute <nl> + / / / completion results from the solutions formed during expression typechecking . <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + # ifndef SWIFT_SEMA_CODECOMPLETIONTYPECHECKING_H <nl> + # define SWIFT_SEMA_CODECOMPLETIONTYPECHECKING_H <nl> + <nl> + namespace swift { <nl> + class Decl ; <nl> + class DeclContext ; <nl> + class Type ; <nl> + class ValueDecl ; <nl> + class CodeCompletionExpr ; <nl> + <nl> + namespace constraints { <nl> + class Solution ; <nl> + } <nl> + <nl> + class TypeCheckCompletionCallback { <nl> + public : <nl> + / / / Called for each solution produced while type - checking an expression <nl> + / / / containing a code completion expression . <nl> + virtual void sawSolution ( const constraints : : Solution & solution ) = 0 ; <nl> + virtual ~ TypeCheckCompletionCallback ( ) { } <nl> + } ; <nl> + <nl> + <nl> + / / / Used to collect and store information needed to perform member completion <nl> + / / / ( \ c CompletionKind : : DotExpr ) from the solutions formed during expression <nl> + / / / type - checking . <nl> + class DotExprTypeCheckCompletionCallback : public TypeCheckCompletionCallback { <nl> + public : <nl> + struct Result { <nl> + Type BaseTy ; <nl> + ValueDecl * BaseDecl ; <nl> + SmallVector < Type , 4 > ExpectedTypes ; <nl> + bool ExpectsNonVoid ; <nl> + bool BaseIsStaticMetaType ; <nl> + bool IsSingleExpressionBody ; <nl> + } ; <nl> + <nl> + private : <nl> + DeclContext * DC ; <nl> + CodeCompletionExpr * CompletionExpr ; <nl> + SmallVector < Result , 4 > Results ; <nl> + llvm : : DenseMap < std : : pair < Type , Decl * > , size_t > BaseToSolutionIdx ; <nl> + bool GotCallback = false ; <nl> + <nl> + public : <nl> + DotExprTypeCheckCompletionCallback ( DeclContext * DC , <nl> + CodeCompletionExpr * CompletionExpr ) <nl> + : DC ( DC ) , CompletionExpr ( CompletionExpr ) { } <nl> + <nl> + / / / Get the results collected from any sawSolutions ( ) callbacks recevied so <nl> + / / / far . <nl> + ArrayRef < Result > getResults ( ) const { return Results ; } <nl> + <nl> + / / / True if at least one solution was passed via the \ c sawSolution <nl> + / / / callback . <nl> + bool gotCallback ( ) const { return GotCallback ; } <nl> + <nl> + / / / Typecheck the code completion expression in isolation , calling <nl> + / / / \ c sawSolution for each solution formed . <nl> + void fallbackTypeCheck ( ) ; <nl> + <nl> + void sawSolution ( const constraints : : Solution & solution ) override ; <nl> + } ; <nl> + } <nl> + <nl> + # endif <nl> mmm a / lib / IDE / CodeCompletion . cpp <nl> ppp b / lib / IDE / CodeCompletion . cpp <nl> <nl> # include " swift / IDE / Utils . h " <nl> # include " swift / Parse / CodeCompletionCallbacks . h " <nl> # include " swift / Sema / IDETypeChecking . h " <nl> + # include " swift / Sema / CodeCompletionTypeChecking . h " <nl> # include " swift / Syntax / SyntaxKind . h " <nl> # include " swift / Strings . h " <nl> # include " swift / Subsystems . h " <nl> static CodeCompletionResult : : ExpectedTypeRelation calculateTypeRelation ( <nl> static CodeCompletionResult : : ExpectedTypeRelation <nl> calculateTypeRelationForDecl ( const Decl * D , Type ExpectedType , <nl> bool IsImplicitlyCurriedInstanceMethod , <nl> - bool UseFuncResultType = true ) { <nl> + bool UseFuncResultType ) { <nl> auto VD = dyn_cast < ValueDecl > ( D ) ; <nl> auto DC = D - > getDeclContext ( ) ; <nl> if ( ! VD ) <nl> calculateTypeRelationForDecl ( const Decl * D , Type ExpectedType , <nl> } <nl> <nl> static CodeCompletionResult : : ExpectedTypeRelation <nl> - calculateMaxTypeRelationForDecl ( <nl> - const Decl * D , const ExpectedTypeContext & typeContext , <nl> - bool IsImplicitlyCurriedInstanceMethod = false ) { <nl> + calculateMaxTypeRelationForDecl ( const Decl * D , <nl> + const ExpectedTypeContext & typeContext , <nl> + bool IsImplicitlyCurriedInstanceMethod ) { <nl> if ( typeContext . empty ( ) ) <nl> return CodeCompletionResult : : ExpectedTypeRelation : : Unknown ; <nl> <nl> calculateMaxTypeRelationForDecl ( <nl> continue ; <nl> <nl> Result = std : : max ( Result , calculateTypeRelationForDecl ( <nl> - D , Type , IsImplicitlyCurriedInstanceMethod ) ) ; <nl> + D , Type , IsImplicitlyCurriedInstanceMethod , <nl> + / * UseFuncResultTy * / true ) ) ; <nl> <nl> / / Map invalid - > unrelated when in a single - expression body , since the <nl> / / input may be incomplete . <nl> CodeCompletionResult * CodeCompletionResultBuilder : : takeResult ( ) { <nl> } <nl> <nl> auto typeRelation = ExpectedTypeRelation ; <nl> + / / FIXME : we don ' t actually have enough info to compute <nl> + / / IsImplicitlyCurriedInstanceMethod here . <nl> if ( typeRelation = = CodeCompletionResult : : Unknown ) <nl> typeRelation = <nl> - calculateMaxTypeRelationForDecl ( AssociatedDecl , declTypeContext ) ; <nl> + calculateMaxTypeRelationForDecl ( AssociatedDecl , declTypeContext , <nl> + / * IsImplicitlyCurriedMethod * / false ) ; <nl> <nl> return new ( * Sink . Allocator ) CodeCompletionResult ( <nl> SemanticContext , NumBytesToErase , CCS , AssociatedDecl , ModuleName , <nl> void CodeCompletionContext : : sortCompletionResults ( <nl> } <nl> <nl> namespace { <nl> + <nl> class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks { <nl> CodeCompletionContext & CompletionContext ; <nl> - std : : vector < RequestedCachedModule > RequestedModules ; <nl> CodeCompletionConsumer & Consumer ; <nl> CodeCompletionExpr * CodeCompleteTokenExpr = nullptr ; <nl> CompletionKind Kind = CompletionKind : : None ; <nl> class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks { <nl> AttTargetDK = DK ; <nl> } <nl> <nl> - void completeDotExpr ( Expr * E , SourceLoc DotLoc ) override ; <nl> + void completeDotExpr ( CodeCompletionExpr * E , SourceLoc DotLoc ) override ; <nl> void completeStmtOrExpr ( CodeCompletionExpr * E ) override ; <nl> void completePostfixExprBeginning ( CodeCompletionExpr * E ) override ; <nl> void completeForEachSequenceBeginning ( CodeCompletionExpr * E ) override ; <nl> class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks { <nl> <nl> private : <nl> void addKeywords ( CodeCompletionResultSink & Sink , bool MaybeFuncBody ) ; <nl> - void deliverCompletionResults ( ) ; <nl> + bool trySolverCompletion ( ) ; <nl> } ; <nl> } / / end anonymous namespace <nl> <nl> class CompletionLookup final : public swift : : VisibleDeclConsumer { <nl> IsStaticMetatype = value ; <nl> } <nl> <nl> - void setExpectedTypes ( ArrayRef < Type > Types , bool isSingleExpressionBody ) { <nl> + void setExpectedTypes ( ArrayRef < Type > Types , bool isSingleExpressionBody , <nl> + bool preferNonVoid = false ) { <nl> expectedTypeContext . isSingleExpressionBody = isSingleExpressionBody ; <nl> + expectedTypeContext . preferNonVoid = preferNonVoid ; <nl> expectedTypeContext . possibleTypes . clear ( ) ; <nl> expectedTypeContext . possibleTypes . reserve ( Types . size ( ) ) ; <nl> for ( auto T : Types ) <nl> class CompletionLookup final : public swift : : VisibleDeclConsumer { <nl> } <nl> <nl> CodeCompletionContext : : TypeContextKind typeContextKind ( ) const { <nl> - if ( expectedTypeContext . empty ( ) ) { <nl> + if ( expectedTypeContext . empty ( ) & & ! expectedTypeContext . preferNonVoid ) { <nl> return CodeCompletionContext : : TypeContextKind : : None ; <nl> } else if ( expectedTypeContext . isSingleExpressionBody ) { <nl> return CodeCompletionContext : : TypeContextKind : : SingleExpressionBody ; <nl> class CompletionLookup final : public swift : : VisibleDeclConsumer { <nl> HaveLParen = Value ; <nl> } <nl> <nl> - void setIsSuperRefExpr ( ) { <nl> - IsSuperRefExpr = true ; <nl> + void setIsSuperRefExpr ( bool Value = true ) { <nl> + IsSuperRefExpr = Value ; <nl> } <nl> <nl> void setIsSelfRefExpr ( bool value ) { IsSelfRefExpr = value ; } <nl> class CompletionLookup final : public swift : : VisibleDeclConsumer { <nl> <nl> if ( isUnresolvedMemberIdealType ( ResultType ) ) <nl> Builder . setSemanticContext ( SemanticContextKind : : ExpressionSpecific ) ; <nl> + <nl> + if ( ! IsImplicitlyCurriedInstanceMethod & & <nl> + expectedTypeContext . requiresNonVoid ( ) & & <nl> + ResultType - > isVoid ( ) ) { <nl> + Builder . setExpectedTypeRelation ( CodeCompletionResult : : Invalid ) ; <nl> + } <nl> } ; <nl> <nl> if ( ! AFT | | IsImplicitlyCurriedInstanceMethod ) { <nl> static void addSelectorModifierKeywords ( CodeCompletionResultSink & sink ) { <nl> addKeyword ( " setter " , CodeCompletionKeywordKind : : None ) ; <nl> } <nl> <nl> - void CodeCompletionCallbacksImpl : : completeDotExpr ( Expr * E , SourceLoc DotLoc ) { <nl> + void CodeCompletionCallbacksImpl : : completeDotExpr ( CodeCompletionExpr * E , <nl> + SourceLoc DotLoc ) { <nl> assert ( P . Tok . is ( tok : : code_complete ) ) ; <nl> <nl> / / Don ' t produce any results in an enum element . <nl> void CodeCompletionCallbacksImpl : : completeDotExpr ( Expr * E , SourceLoc DotLoc ) { <nl> CompleteExprSelectorContext = ParseExprSelectorContext ; <nl> } <nl> <nl> - ParsedExpr = E ; <nl> + ParsedExpr = E - > getBase ( ) ; <nl> this - > DotLoc = DotLoc ; <nl> CurDeclContext = P . CurDeclContext ; <nl> + CodeCompleteTokenExpr = E ; <nl> } <nl> <nl> void CodeCompletionCallbacksImpl : : completeStmtOrExpr ( CodeCompletionExpr * E ) { <nl> static void addConditionalCompilationFlags ( ASTContext & Ctx , <nl> } <nl> } <nl> <nl> + static void deliverCompletionResults ( CodeCompletionContext & CompletionContext , <nl> + CompletionLookup & Lookup , <nl> + SourceFile & SF , <nl> + CodeCompletionConsumer & Consumer ) { <nl> + llvm : : SmallPtrSet < Identifier , 8 > seenModuleNames ; <nl> + std : : vector < RequestedCachedModule > RequestedModules ; <nl> + <nl> + for ( auto & Request : Lookup . RequestedCachedResults ) { <nl> + llvm : : DenseSet < CodeCompletionCache : : Key > ImportsSeen ; <nl> + auto handleImport = [ & ] ( ModuleDecl : : ImportedModule Import ) { <nl> + ModuleDecl * TheModule = Import . importedModule ; <nl> + ModuleDecl : : AccessPathTy Path = Import . accessPath ; <nl> + if ( TheModule - > getFiles ( ) . empty ( ) ) <nl> + return ; <nl> + <nl> + / / Clang submodules are ignored and there ' s no lookup cost involved , <nl> + / / so just ignore them and don ' t put the empty results in the cache <nl> + / / because putting a lot of objects in the cache will push out <nl> + / / other lookups . <nl> + if ( isClangSubModule ( TheModule ) ) <nl> + return ; <nl> + <nl> + std : : vector < std : : string > AccessPath ; <nl> + for ( auto Piece : Path ) { <nl> + AccessPath . push_back ( std : : string ( Piece . Item ) ) ; <nl> + } <nl> + <nl> + StringRef ModuleFilename = TheModule - > getModuleFilename ( ) ; <nl> + / / ModuleFilename can be empty if something strange happened during <nl> + / / module loading , for example , the module file is corrupted . <nl> + if ( ! ModuleFilename . empty ( ) ) { <nl> + auto & Ctx = TheModule - > getASTContext ( ) ; <nl> + CodeCompletionCache : : Key K { <nl> + ModuleFilename . str ( ) , <nl> + std : : string ( TheModule - > getName ( ) ) , <nl> + AccessPath , <nl> + Request . NeedLeadingDot , <nl> + SF . hasTestableOrPrivateImport ( <nl> + AccessLevel : : Internal , TheModule , <nl> + SourceFile : : ImportQueryKind : : TestableOnly ) , <nl> + SF . hasTestableOrPrivateImport ( <nl> + AccessLevel : : Internal , TheModule , <nl> + SourceFile : : ImportQueryKind : : PrivateOnly ) , <nl> + Ctx . LangOpts . CodeCompleteInitsInPostfixExpr , <nl> + CompletionContext . getAnnotateResult ( ) , <nl> + } ; <nl> + <nl> + using PairType = llvm : : DenseSet < swift : : ide : : CodeCompletionCache : : Key , <nl> + llvm : : DenseMapInfo < CodeCompletionCache : : Key > > : : iterator ; <nl> + std : : pair < PairType , bool > Result = ImportsSeen . insert ( K ) ; <nl> + if ( ! Result . second ) <nl> + return ; / / already handled . <nl> + RequestedModules . push_back ( { std : : move ( K ) , TheModule , <nl> + Request . OnlyTypes , Request . OnlyPrecedenceGroups } ) ; <nl> + <nl> + if ( Request . IncludeModuleQualifier & & <nl> + seenModuleNames . insert ( TheModule - > getName ( ) ) . second ) <nl> + Lookup . addModuleName ( TheModule ) ; <nl> + } <nl> + } ; <nl> + <nl> + if ( Request . TheModule ) { <nl> + / / FIXME : actually check imports . <nl> + for ( auto Import : namelookup : : getAllImports ( Request . TheModule ) ) { <nl> + handleImport ( Import ) ; <nl> + } <nl> + } else { <nl> + / / Add results from current module . <nl> + Lookup . getToplevelCompletions ( Request . OnlyTypes ) ; <nl> + <nl> + / / Add the qualifying module name <nl> + auto curModule = SF . getParentModule ( ) ; <nl> + if ( Request . IncludeModuleQualifier & & <nl> + seenModuleNames . insert ( curModule - > getName ( ) ) . second ) <nl> + Lookup . addModuleName ( curModule ) ; <nl> + <nl> + / / Add results for all imported modules . <nl> + SmallVector < ModuleDecl : : ImportedModule , 4 > Imports ; <nl> + SF . getImportedModules ( <nl> + Imports , { ModuleDecl : : ImportFilterKind : : Public , <nl> + ModuleDecl : : ImportFilterKind : : Private , <nl> + ModuleDecl : : ImportFilterKind : : ImplementationOnly } ) ; <nl> + <nl> + for ( auto Imported : Imports ) { <nl> + for ( auto Import : namelookup : : getAllImports ( Imported . importedModule ) ) <nl> + handleImport ( Import ) ; <nl> + } <nl> + } <nl> + } <nl> + Lookup . RequestedCachedResults . clear ( ) ; <nl> + CompletionContext . typeContextKind = Lookup . typeContextKind ( ) ; <nl> + <nl> + / / Use the current SourceFile as the DeclContext so that we can use it to <nl> + / / perform qualified lookup , and to get the correct visibility for <nl> + / / @ testable imports . <nl> + DeclContext * DCForModules = & SF ; <nl> + Consumer . handleResultsAndModules ( CompletionContext , RequestedModules , <nl> + DCForModules ) ; <nl> + } <nl> + <nl> + void deliverDotExprResults ( <nl> + ArrayRef < DotExprTypeCheckCompletionCallback : : Result > Results , <nl> + Expr * BaseExpr , DeclContext * DC , SourceLoc DotLoc , bool IsInSelector , <nl> + ide : : CodeCompletionContext & CompletionCtx , <nl> + CodeCompletionConsumer & Consumer ) { <nl> + ASTContext & Ctx = DC - > getASTContext ( ) ; <nl> + CompletionLookup Lookup ( CompletionCtx . getResultSink ( ) , Ctx , DC , <nl> + & CompletionCtx ) ; <nl> + <nl> + if ( DotLoc . isValid ( ) ) <nl> + Lookup . setHaveDot ( DotLoc ) ; <nl> + <nl> + Lookup . setIsSuperRefExpr ( isa < SuperRefExpr > ( BaseExpr ) ) ; <nl> + <nl> + if ( auto * DRE = dyn_cast < DeclRefExpr > ( BaseExpr ) ) <nl> + Lookup . setIsSelfRefExpr ( DRE - > getDecl ( ) - > getName ( ) = = Ctx . Id_self ) ; <nl> + <nl> + if ( isa < BindOptionalExpr > ( BaseExpr ) | | isa < ForceValueExpr > ( BaseExpr ) ) <nl> + Lookup . setIsUnwrappedOptional ( true ) ; <nl> + <nl> + if ( IsInSelector ) { <nl> + Lookup . includeInstanceMembers ( ) ; <nl> + Lookup . setPreferFunctionReferencesToCalls ( ) ; <nl> + } <nl> + <nl> + for ( auto & Result : Results ) { <nl> + Lookup . setIsStaticMetatype ( Result . BaseIsStaticMetaType ) ; <nl> + Lookup . getPostfixKeywordCompletions ( Result . BaseTy , BaseExpr ) ; <nl> + Lookup . setExpectedTypes ( Result . ExpectedTypes , <nl> + Result . IsSingleExpressionBody , <nl> + Result . ExpectsNonVoid ) ; <nl> + if ( isDynamicLookup ( Result . BaseTy ) ) <nl> + Lookup . setIsDynamicLookup ( ) ; <nl> + Lookup . getValueExprCompletions ( Result . BaseTy , Result . BaseDecl ) ; <nl> + } <nl> + <nl> + SourceFile * SF = DC - > getParentSourceFile ( ) ; <nl> + deliverCompletionResults ( CompletionCtx , Lookup , * SF , Consumer ) ; <nl> + } <nl> + <nl> + bool CodeCompletionCallbacksImpl : : trySolverCompletion ( ) { <nl> + CompletionContext . CodeCompletionKind = Kind ; <nl> + <nl> + if ( Kind = = CompletionKind : : None ) <nl> + return true ; <nl> + <nl> + bool MaybeFuncBody = true ; <nl> + if ( CurDeclContext ) { <nl> + auto * CD = CurDeclContext - > getLocalContext ( ) ; <nl> + if ( ! CD | | CD - > getContextKind ( ) = = DeclContextKind : : Initializer | | <nl> + CD - > getContextKind ( ) = = DeclContextKind : : TopLevelCodeDecl ) <nl> + MaybeFuncBody = false ; <nl> + } <nl> + <nl> + if ( auto * DC = dyn_cast_or_null < DeclContext > ( ParsedDecl ) ) { <nl> + if ( DC - > isChildContextOf ( CurDeclContext ) ) <nl> + CurDeclContext = DC ; <nl> + } <nl> + <nl> + assert ( ParsedExpr | | CurDeclContext ) ; <nl> + <nl> + SourceLoc CompletionLoc = ParsedExpr <nl> + ? ParsedExpr - > getLoc ( ) <nl> + : CurDeclContext - > getASTContext ( ) . SourceMgr . getCodeCompletionLoc ( ) ; <nl> + <nl> + switch ( Kind ) { <nl> + case CompletionKind : : DotExpr : { <nl> + assert ( CodeCompleteTokenExpr ) ; <nl> + assert ( CurDeclContext ) ; <nl> + <nl> + DotExprTypeCheckCompletionCallback Lookup ( CurDeclContext , <nl> + CodeCompleteTokenExpr ) ; <nl> + llvm : : SaveAndRestore < TypeCheckCompletionCallback * > <nl> + CompletionCollector ( Context . CompletionCallback , & Lookup ) ; <nl> + typeCheckContextAt ( CurDeclContext , CompletionLoc ) ; <nl> + <nl> + / / This ( hopefully ) only happens in cases where the expression isn ' t <nl> + / / typechecked during normal compilation either ( e . g . member completion in a <nl> + / / switch case where there control expression is invalid ) . Having normal <nl> + / / typechecking still resolve even these cases would be beneficial for <nl> + / / tooling in general though . <nl> + if ( ! Lookup . gotCallback ( ) ) <nl> + Lookup . fallbackTypeCheck ( ) ; <nl> + <nl> + addKeywords ( CompletionContext . getResultSink ( ) , MaybeFuncBody ) ; <nl> + <nl> + Expr * CheckedBase = CodeCompleteTokenExpr - > getBase ( ) ; <nl> + deliverDotExprResults ( Lookup . getResults ( ) , CheckedBase , CurDeclContext , <nl> + DotLoc , isInsideObjCSelector ( ) , CompletionContext , <nl> + Consumer ) ; <nl> + return true ; <nl> + } <nl> + default : <nl> + return false ; <nl> + } <nl> + } <nl> + <nl> void CodeCompletionCallbacksImpl : : doneParsing ( ) { <nl> CompletionContext . CodeCompletionKind = Kind ; <nl> <nl> + if ( trySolverCompletion ( ) ) <nl> + return ; <nl> + <nl> if ( Kind = = CompletionKind : : None ) { <nl> return ; <nl> } <nl> void CodeCompletionCallbacksImpl : : doneParsing ( ) { <nl> <nl> switch ( Kind ) { <nl> case CompletionKind : : None : <nl> + case CompletionKind : : DotExpr : <nl> llvm_unreachable ( " should be already handled " ) ; <nl> return ; <nl> <nl> - case CompletionKind : : DotExpr : { <nl> - Lookup . setHaveDot ( DotLoc ) ; <nl> - <nl> - if ( isDynamicLookup ( * ExprType ) ) <nl> - Lookup . setIsDynamicLookup ( ) ; <nl> - <nl> - Lookup . getPostfixKeywordCompletions ( * ExprType , ParsedExpr ) ; <nl> - <nl> - if ( isa < BindOptionalExpr > ( ParsedExpr ) | | isa < ForceValueExpr > ( ParsedExpr ) ) <nl> - Lookup . setIsUnwrappedOptional ( true ) ; <nl> - <nl> - ExprContextInfo ContextInfo ( CurDeclContext , ParsedExpr ) ; <nl> - Lookup . setExpectedTypes ( ContextInfo . getPossibleTypes ( ) , <nl> - ContextInfo . isSingleExpressionBody ( ) ) ; <nl> - Lookup . getValueExprCompletions ( * ExprType , ReferencedDecl . getDecl ( ) ) ; <nl> - break ; <nl> - } <nl> - <nl> case CompletionKind : : KeyPathExprSwift : { <nl> auto KPE = dyn_cast < KeyPathExpr > ( ParsedExpr ) ; <nl> auto BGT = ( * ExprType ) - > getAs < BoundGenericType > ( ) ; <nl> void CodeCompletionCallbacksImpl : : doneParsing ( ) { <nl> break ; <nl> } <nl> <nl> - llvm : : SmallPtrSet < Identifier , 8 > seenModuleNames ; <nl> - <nl> - for ( auto & Request : Lookup . RequestedCachedResults ) { <nl> - / / Use the current SourceFile as the DeclContext so that we can use it to <nl> - / / perform qualified lookup , and to get the correct visibility for <nl> - / / @ testable imports . <nl> - const SourceFile & SF = P . SF ; <nl> - <nl> - llvm : : DenseSet < CodeCompletionCache : : Key > ImportsSeen ; <nl> - auto handleImport = [ & ] ( ModuleDecl : : ImportedModule Import ) { <nl> - ModuleDecl * TheModule = Import . importedModule ; <nl> - ModuleDecl : : AccessPathTy Path = Import . accessPath ; <nl> - if ( TheModule - > getFiles ( ) . empty ( ) ) <nl> - return ; <nl> - <nl> - / / Clang submodules are ignored and there ' s no lookup cost involved , <nl> - / / so just ignore them and don ' t put the empty results in the cache <nl> - / / because putting a lot of objects in the cache will push out <nl> - / / other lookups . <nl> - if ( isClangSubModule ( TheModule ) ) <nl> - return ; <nl> - <nl> - std : : vector < std : : string > AccessPath ; <nl> - for ( auto Piece : Path ) { <nl> - AccessPath . push_back ( std : : string ( Piece . Item ) ) ; <nl> - } <nl> - <nl> - StringRef ModuleFilename = TheModule - > getModuleFilename ( ) ; <nl> - / / ModuleFilename can be empty if something strange happened during <nl> - / / module loading , for example , the module file is corrupted . <nl> - if ( ! ModuleFilename . empty ( ) ) { <nl> - auto & Ctx = TheModule - > getASTContext ( ) ; <nl> - CodeCompletionCache : : Key K { <nl> - ModuleFilename . str ( ) , <nl> - std : : string ( TheModule - > getName ( ) ) , <nl> - AccessPath , <nl> - Request . NeedLeadingDot , <nl> - SF . hasTestableOrPrivateImport ( <nl> - AccessLevel : : Internal , TheModule , <nl> - SourceFile : : ImportQueryKind : : TestableOnly ) , <nl> - SF . hasTestableOrPrivateImport ( <nl> - AccessLevel : : Internal , TheModule , <nl> - SourceFile : : ImportQueryKind : : PrivateOnly ) , <nl> - Ctx . LangOpts . CodeCompleteInitsInPostfixExpr , <nl> - CompletionContext . getAnnotateResult ( ) , <nl> - } ; <nl> - <nl> - using PairType = llvm : : DenseSet < swift : : ide : : CodeCompletionCache : : Key , <nl> - llvm : : DenseMapInfo < CodeCompletionCache : : Key > > : : iterator ; <nl> - std : : pair < PairType , bool > Result = ImportsSeen . insert ( K ) ; <nl> - if ( ! Result . second ) <nl> - return ; / / already handled . <nl> - RequestedModules . push_back ( { std : : move ( K ) , TheModule , <nl> - Request . OnlyTypes , Request . OnlyPrecedenceGroups } ) ; <nl> - <nl> - if ( Request . IncludeModuleQualifier & & <nl> - seenModuleNames . insert ( TheModule - > getName ( ) ) . second ) <nl> - Lookup . addModuleName ( TheModule ) ; <nl> - } <nl> - } ; <nl> - <nl> - if ( Request . TheModule ) { <nl> - / / FIXME : actually check imports . <nl> - for ( auto Import : namelookup : : getAllImports ( Request . TheModule ) ) { <nl> - handleImport ( Import ) ; <nl> - } <nl> - } else { <nl> - / / Add results from current module . <nl> - Lookup . getToplevelCompletions ( Request . OnlyTypes ) ; <nl> - <nl> - / / Add the qualifying module name <nl> - auto curModule = CurDeclContext - > getParentModule ( ) ; <nl> - if ( Request . IncludeModuleQualifier & & <nl> - seenModuleNames . insert ( curModule - > getName ( ) ) . second ) <nl> - Lookup . addModuleName ( curModule ) ; <nl> - <nl> - / / Add results for all imported modules . <nl> - SmallVector < ModuleDecl : : ImportedModule , 4 > Imports ; <nl> - auto * SF = CurDeclContext - > getParentSourceFile ( ) ; <nl> - SF - > getImportedModules ( <nl> - Imports , { ModuleDecl : : ImportFilterKind : : Public , <nl> - ModuleDecl : : ImportFilterKind : : Private , <nl> - ModuleDecl : : ImportFilterKind : : ImplementationOnly } ) ; <nl> - <nl> - for ( auto Imported : Imports ) { <nl> - for ( auto Import : namelookup : : getAllImports ( Imported . importedModule ) ) <nl> - handleImport ( Import ) ; <nl> - } <nl> - } <nl> - } <nl> - Lookup . RequestedCachedResults . clear ( ) ; <nl> - <nl> - CompletionContext . typeContextKind = Lookup . typeContextKind ( ) ; <nl> - <nl> - deliverCompletionResults ( ) ; <nl> - } <nl> - <nl> - void CodeCompletionCallbacksImpl : : deliverCompletionResults ( ) { <nl> - / / Use the current SourceFile as the DeclContext so that we can use it to <nl> - / / perform qualified lookup , and to get the correct visibility for <nl> - / / @ testable imports . <nl> - DeclContext * DCForModules = & P . SF ; <nl> - <nl> - Consumer . handleResultsAndModules ( CompletionContext , RequestedModules , <nl> - DCForModules ) ; <nl> - RequestedModules . clear ( ) ; <nl> + deliverCompletionResults ( CompletionContext , Lookup , P . SF , Consumer ) ; <nl> } <nl> <nl> void PrintingCodeCompletionConsumer : : handleResults ( <nl> mmm a / lib / IDE / CodeCompletionResultBuilder . h <nl> ppp b / lib / IDE / CodeCompletionResultBuilder . h <nl> struct ExpectedTypeContext { <nl> / / / Since the input may be incomplete , we take into account that the types are <nl> / / / only a hint . <nl> bool isSingleExpressionBody = false ; <nl> + bool preferNonVoid = false ; <nl> <nl> bool empty ( ) const { return possibleTypes . empty ( ) ; } <nl> + bool requiresNonVoid ( ) const { <nl> + if ( isSingleExpressionBody ) <nl> + return false ; <nl> + if ( preferNonVoid ) <nl> + return true ; <nl> + if ( possibleTypes . empty ( ) ) <nl> + return false ; <nl> + return std : : all_of ( possibleTypes . begin ( ) , possibleTypes . end ( ) , [ ] ( Type Ty ) { <nl> + return ! Ty - > isVoid ( ) ; <nl> + } ) ; <nl> + } <nl> <nl> ExpectedTypeContext ( ) = default ; <nl> ExpectedTypeContext ( ArrayRef < Type > types , bool isSingleExpressionBody ) <nl> mmm a / lib / IDE / ConformingMethodList . cpp <nl> ppp b / lib / IDE / ConformingMethodList . cpp <nl> class ConformingMethodListCallbacks : public CodeCompletionCallbacks { <nl> <nl> / / Only handle callbacks for suffix completions . <nl> / / { <nl> - void completeDotExpr ( Expr * E , SourceLoc DotLoc ) override ; <nl> + void completeDotExpr ( CodeCompletionExpr * E , SourceLoc DotLoc ) override ; <nl> void completePostfixExpr ( Expr * E , bool hasSpace ) override ; <nl> / / } <nl> <nl> void doneParsing ( ) override ; <nl> } ; <nl> <nl> - void ConformingMethodListCallbacks : : completeDotExpr ( Expr * E , SourceLoc DotLoc ) { <nl> + void ConformingMethodListCallbacks : : completeDotExpr ( CodeCompletionExpr * E , <nl> + SourceLoc DotLoc ) { <nl> CurDeclContext = P . CurDeclContext ; <nl> - ParsedExpr = E ; <nl> + ParsedExpr = E - > getBase ( ) ; <nl> } <nl> <nl> void ConformingMethodListCallbacks : : completePostfixExpr ( Expr * E , <nl> mmm a / lib / Parse / ParseDecl . cpp <nl> ppp b / lib / Parse / ParseDecl . cpp <nl> <nl> # include " swift / Parse / SyntaxParsingContext . h " <nl> # include " swift / Syntax / SyntaxKind . h " <nl> # include " swift / Subsystems . h " <nl> + # include " swift / AST / ASTWalker . h " <nl> # include " swift / AST / Attr . h " <nl> # include " swift / AST / LazyResolver . h " <nl> # include " swift / AST / DebuggerClient . h " <nl> BraceStmt * Parser : : parseAbstractFunctionBodyImpl ( AbstractFunctionDecl * AFD ) { <nl> / / If the body consists of a single expression , turn it into a return <nl> / / statement . <nl> / / <nl> - / / But don ' t do this transformation during code completion , as the source <nl> - / / may be incomplete and the type mismatch in return statement will just <nl> - / / confuse the type checker . <nl> - if ( BS - > getNumElements ( ) ! = 1 | | Body . hasCodeCompletion ( ) ) <nl> + / / But don ' t do this transformation when performing certain kinds of code <nl> + / / completion , as the source may be incomplete and the type mismatch in return <nl> + / / statement will just confuse the type checker . <nl> + if ( shouldSuppressSingleExpressionBodyTransform ( Body , BS - > getElements ( ) ) ) <nl> return BS ; <nl> <nl> auto Element = BS - > getFirstElement ( ) ; <nl> mmm a / lib / Parse / ParseExpr . cpp <nl> ppp b / lib / Parse / ParseExpr . cpp <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> # include " swift / Parse / Parser . h " <nl> + # include " swift / AST / ASTWalker . h " <nl> # include " swift / AST / DiagnosticsParse . h " <nl> # include " swift / AST / TypeRepr . h " <nl> # include " swift / Basic / EditorPlaceholder . h " <nl> Parser : : parseExprPostfixSuffix ( ParserResult < Expr > Result , bool isExprBasic , <nl> / / Handle " x . < tab > " for code completion . <nl> if ( Tok . is ( tok : : code_complete ) ) { <nl> assert ( ! InSwiftKeyPath ) ; <nl> + auto CCExpr = new ( Context ) CodeCompletionExpr ( Result . get ( ) , <nl> + Tok . getLoc ( ) ) ; <nl> if ( CodeCompletion ) { <nl> - CodeCompletion - > completeDotExpr ( Result . get ( ) , / * DotLoc = * / TokLoc ) ; <nl> + CodeCompletion - > completeDotExpr ( CCExpr , / * DotLoc = * / TokLoc ) ; <nl> } <nl> - auto CCExpr = new ( Context ) CodeCompletionExpr ( Result . get ( ) , <nl> - consumeToken ( tok : : code_complete ) ) ; <nl> + consumeToken ( tok : : code_complete ) ; <nl> return makeParserCodeCompletionResult ( CCExpr ) ; <nl> } <nl> <nl> ParserResult < Expr > Parser : : parseExprClosure ( ) { <nl> / / If the body consists of a single expression , turn it into a return <nl> / / statement . <nl> / / <nl> - / / But don ' t do this transformation during code completion , as the source <nl> - / / may be incomplete and the type mismatch in return statement will just <nl> - / / confuse the type checker . <nl> + / / But don ' t do this transformation when performing certain kinds of code <nl> + / / completion , as the source may be incomplete and the type mismatch in return <nl> + / / statement will just confuse the type checker . <nl> bool hasSingleExpressionBody = false ; <nl> - if ( ! missingRBrace & & ! Status . hasCodeCompletion ( ) & & <nl> - bodyElements . size ( ) = = 1 ) { <nl> + if ( ! missingRBrace & & <nl> + ! shouldSuppressSingleExpressionBodyTransform ( Status , bodyElements ) ) { <nl> / / If the closure ' s only body element is a single return statement , <nl> / / use that instead of creating a new wrapping return expression . <nl> Expr * returnExpr = nullptr ; <nl> mmm a / lib / Parse / Parser . cpp <nl> ppp b / lib / Parse / Parser . cpp <nl> Parser : : getStringLiteralIfNotInterpolated ( SourceLoc Loc , <nl> Segments . front ( ) . Length ) ) ; <nl> } <nl> <nl> + bool Parser : : <nl> + shouldSuppressSingleExpressionBodyTransform ( ParserStatus Status , <nl> + MutableArrayRef < ASTNode > BodyElems ) { <nl> + if ( BodyElems . size ( ) ! = 1 ) <nl> + return true ; <nl> + <nl> + if ( ! Status . hasCodeCompletion ( ) ) <nl> + return false ; <nl> + <nl> + struct HasMemberCompletion : public ASTWalker { <nl> + bool Value = false ; <nl> + std : : pair < bool , Expr * > walkToExprPre ( Expr * E ) override { <nl> + if ( auto * CCE = dyn_cast < CodeCompletionExpr > ( E ) ) { <nl> + / / If it has a base expression this is member completion , which is <nl> + / / performed using the new solver - based mechanism , so it ' s ok to go <nl> + / / ahead with the transform ( and necessary to pick up the correct <nl> + / / expected type ) . <nl> + Value = CCE - > getBase ( ) ; <nl> + return { false , nullptr } ; <nl> + } <nl> + return { true , E } ; <nl> + } <nl> + } ; <nl> + HasMemberCompletion Check ; <nl> + BodyElems . front ( ) . walk ( Check ) ; <nl> + return ! Check . Value ; <nl> + } <nl> + <nl> struct ParserUnit : : Implementation { <nl> std : : shared_ptr < SyntaxParseActions > SPActions ; <nl> LangOptions LangOpts ; <nl> mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> ProtocolConformanceRef Solution : : resolveConformance ( <nl> return ProtocolConformanceRef : : forInvalid ( ) ; <nl> } <nl> <nl> + bool Solution : : hasType ( ASTNode node ) const { <nl> + auto result = nodeTypes . find ( node ) ; <nl> + if ( result ! = nodeTypes . end ( ) ) <nl> + return true ; <nl> + <nl> + auto & cs = getConstraintSystem ( ) ; <nl> + return cs . hasType ( node ) ; <nl> + } <nl> + <nl> Type Solution : : getType ( ASTNode node ) const { <nl> auto result = nodeTypes . find ( node ) ; <nl> if ( result ! = nodeTypes . end ( ) ) <nl> mmm a / lib / Sema / CSBindings . cpp <nl> ppp b / lib / Sema / CSBindings . cpp <nl> void ConstraintSystem : : PotentialBindings : : finalize ( <nl> if ( locator - > isLastElement < LocatorPathElt : : MemberRefBase > ( ) ) <nl> PotentiallyIncomplete = true ; <nl> <nl> + / / Delay resolution of the code completion expression until <nl> + / / the very end to give it a chance to be bound to some <nl> + / / contextual type even if it ' s a hole . <nl> + if ( locator - > directlyAt < CodeCompletionExpr > ( ) ) { <nl> + FullyBound = true ; <nl> + PotentiallyIncomplete = true ; <nl> + } <nl> + <nl> addPotentialBinding ( PotentialBinding : : forHole ( TypeVar , locator ) ) ; <nl> } <nl> <nl> mmm a / lib / Sema / CSGen . cpp <nl> ppp b / lib / Sema / CSGen . cpp <nl> namespace { <nl> virtual Type visitCodeCompletionExpr ( CodeCompletionExpr * E ) { <nl> CS . Options | = ConstraintSystemFlags : : SuppressDiagnostics ; <nl> auto locator = CS . getConstraintLocator ( E ) ; <nl> - auto ty = CS . createTypeVariable ( locator , <nl> - TVO_CanBindToLValue | <nl> - TVO_CanBindToNoEscape ) ; <nl> - <nl> - / / Defaults to the type of the base expression if we have a base <nl> - / / expression . <nl> - / / FIXME : This is just to keep the old behavior where ` foo ( base . < HERE > ) ` <nl> - / / the argument is type checked to the type of the ' base ' . Ideally , code <nl> - / / completion expression should be defauled to ' UnresolvedType ' <nl> - / / regardless of the existence of the base expression . But the constraint <nl> - / / system is simply not ready for that . <nl> - if ( auto base = E - > getBase ( ) ) { <nl> - CS . addConstraint ( ConstraintKind : : Defaultable , ty , CS . getType ( base ) , <nl> - locator ) ; <nl> - } <nl> - <nl> - return ty ; <nl> + return CS . createTypeVariable ( locator , TVO_CanBindToLValue | <nl> + TVO_CanBindToNoEscape | <nl> + TVO_CanBindToHole ) ; <nl> } <nl> <nl> Type visitNilLiteralExpr ( NilLiteralExpr * expr ) { <nl> mmm a / lib / Sema / CSSolver . cpp <nl> ppp b / lib / Sema / CSSolver . cpp <nl> void ConstraintSystem : : solveImpl ( SmallVectorImpl < Solution > & solutions ) { <nl> } <nl> } <nl> <nl> - void ConstraintSystem : : solveForCodeCompletion ( <nl> - Expr * expr , DeclContext * DC , Type contextualType , ContextualTypePurpose CTP , <nl> - llvm : : function_ref < void ( const Solution & ) > callback ) { <nl> - / / First , pre - check the expression , validating any types that occur in the <nl> - / / expression and folding sequence expressions . <nl> - if ( ConstraintSystem : : preCheckExpression ( <nl> - expr , DC , / * replaceInvalidRefsWithErrors = * / true ) ) <nl> - return ; <nl> - <nl> - ConstraintSystemOptions options ; <nl> - options | = ConstraintSystemFlags : : AllowFixes ; <nl> - options | = ConstraintSystemFlags : : SuppressDiagnostics ; <nl> - <nl> - ConstraintSystem cs ( DC , options ) ; <nl> - <nl> - if ( CTP ! = ContextualTypePurpose : : CTP_Unused ) <nl> - cs . setContextualType ( expr , TypeLoc : : withoutLoc ( contextualType ) , CTP ) ; <nl> + bool ConstraintSystem : : solveForCodeCompletion ( <nl> + SolutionApplicationTarget & target , SmallVectorImpl < Solution > & solutions ) { <nl> + auto * expr = target . getAsExpr ( ) ; <nl> + / / Tell the constraint system what the contextual type is . <nl> + setContextualType ( expr , target . getExprContextualTypeLoc ( ) , <nl> + target . getExprContextualTypePurpose ( ) ) ; <nl> <nl> / / Set up the expression type checker timer . <nl> - cs . Timer . emplace ( expr , cs ) ; <nl> + Timer . emplace ( expr , * this ) ; <nl> <nl> - cs . shrink ( expr ) ; <nl> + shrink ( expr ) ; <nl> <nl> - if ( ! cs . generateConstraints ( expr , DC ) ) <nl> - return ; <nl> + if ( isDebugMode ( ) ) { <nl> + auto & log = llvm : : errs ( ) ; <nl> + log < < " mmm Code Completion mmm \ n " ; <nl> + } <nl> <nl> - llvm : : SmallVector < Solution , 4 > solutions ; <nl> + if ( generateConstraints ( target , FreeTypeVariableBinding : : Disallow ) ) <nl> + return false ; <nl> <nl> { <nl> - SolverState state ( cs , FreeTypeVariableBinding : : Disallow ) ; <nl> + SolverState state ( * this , FreeTypeVariableBinding : : Disallow ) ; <nl> <nl> / / Enable " diagnostic mode " by default , this means that <nl> / / solver would produce " fixed " solutions alongside valid <nl> / / ones , which helps code completion to rank choices . <nl> state . recordFixes = true ; <nl> <nl> - cs . solveImpl ( solutions ) ; <nl> + solveImpl ( solutions ) ; <nl> } <nl> <nl> - for ( const auto & solution : solutions ) { <nl> - callback ( solution ) ; <nl> + if ( isDebugMode ( ) ) { <nl> + auto & log = llvm : : errs ( ) ; <nl> + log < < " mmm Discovered " < < solutions . size ( ) < < " solutions mmm \ n " ; <nl> + for ( const auto & solution : solutions ) { <nl> + log < < " mmm Solution mmm \ n " ; <nl> + solution . dump ( log ) ; <nl> + } <nl> } <nl> + <nl> + return true ; <nl> } <nl> <nl> void ConstraintSystem : : collectDisjunctions ( <nl> mmm a / lib / Sema / ConstraintSystem . h <nl> ppp b / lib / Sema / ConstraintSystem . h <nl> class Solution { <nl> <nl> void setExprTypes ( Expr * expr ) const ; <nl> <nl> + bool hasType ( ASTNode node ) const ; <nl> + <nl> / / / Retrieve the type of the given node , as recorded in this solution . <nl> Type getType ( ASTNode node ) const ; <nl> <nl> class ConstraintSystem { <nl> / / / solution , and constraint solver is allowed to produce partially correct <nl> / / / solutions . Such solutions can have any number of holes in them . <nl> / / / <nl> - / / / \ param expr The expression involved in code completion . <nl> - / / / <nl> - / / / \ param DC The declaration context this expression is found in . <nl> + / / / \ param target The expression involved in code completion . <nl> / / / <nl> - / / / \ param contextualType The type \ p expr is being converted to . <nl> + / / / \ param solutions The solutions produced for the given target without <nl> + / / / filtering . <nl> / / / <nl> - / / / \ param CTP When contextualType is specified , this indicates what <nl> - / / / the conversion is doing . <nl> - / / / <nl> - / / / \ param callback The callback to be used to provide results to <nl> - / / / code completion . <nl> - static void <nl> - solveForCodeCompletion ( Expr * expr , DeclContext * DC , Type contextualType , <nl> - ContextualTypePurpose CTP , <nl> - llvm : : function_ref < void ( const Solution & ) > callback ) ; <nl> + / / / \ returns ` false ` if this call fails ( e . g . pre - check or constraint <nl> + / / / generation fails ) , ` true ` otherwise . <nl> + bool solveForCodeCompletion ( SolutionApplicationTarget & target , <nl> + SmallVectorImpl < Solution > & solutions ) ; <nl> <nl> private : <nl> / / / Solve the system of constraints . <nl> mmm a / lib / Sema / TypeCheckCodeCompletion . cpp <nl> ppp b / lib / Sema / TypeCheckCodeCompletion . cpp <nl> <nl> # include " swift / Basic / STLExtras . h " <nl> # include " swift / Parse / Lexer . h " <nl> # include " swift / Sema / IDETypeChecking . h " <nl> + # include " swift / Sema / CodeCompletionTypeChecking . h " <nl> # include " swift / Strings . h " <nl> # include " llvm / ADT / DenseMap . h " <nl> # include " llvm / ADT / PointerUnion . h " <nl> TypeChecker : : getTypeOfCompletionOperator ( DeclContext * DC , Expr * LHS , <nl> } <nl> } <nl> <nl> - void TypeChecker : : typeCheckForCodeCompletion ( <nl> - Expr * expr , DeclContext * DC , Type contextualType , ContextualTypePurpose CTP , <nl> + bool TypeChecker : : typeCheckForCodeCompletion ( <nl> + SolutionApplicationTarget & target , <nl> llvm : : function_ref < void ( const Solution & ) > callback ) { <nl> + auto * DC = target . getDeclContext ( ) ; <nl> auto & Context = DC - > getASTContext ( ) ; <nl> <nl> + auto * expr = target . getAsExpr ( ) ; <nl> + if ( ! expr ) <nl> + return false ; <nl> + <nl> + / / First of all , let ' s check whether given target expression <nl> + / / does indeed have the code completion location in it . <nl> + { <nl> + auto range = expr - > getSourceRange ( ) ; <nl> + if ( range . isInvalid ( ) | | <nl> + ! Context . SourceMgr . rangeContainsCodeCompletionLoc ( range ) ) <nl> + return false ; <nl> + } <nl> + <nl> FrontendStatsTracer StatsTracer ( Context . Stats , <nl> " typecheck - for - code - completion " , expr ) ; <nl> PrettyStackTraceExpr stackTrace ( Context , " code - completion " , expr ) ; <nl> void TypeChecker : : typeCheckForCodeCompletion ( <nl> expr = expr - > walk ( SanitizeExpr ( Context , <nl> / * shouldReusePrecheckedType = * / false ) ) ; <nl> <nl> - ConstraintSystem : : solveForCodeCompletion ( expr , DC , contextualType , CTP , <nl> - callback ) ; <nl> + enum class ContextKind { <nl> + Expression , <nl> + Application , <nl> + StringInterpolation , <nl> + SingleStmtClosure , <nl> + MultiStmtClosure , <nl> + ErrorExpression <nl> + } ; <nl> + <nl> + class ContextFinder : public ASTWalker { <nl> + using Context = std : : pair < ContextKind , Expr * > ; <nl> + <nl> + / / Stack of all " interesting " contexts up to code completion expression . <nl> + llvm : : SmallVector < Context , 4 > Contexts ; <nl> + <nl> + Expr * CompletionExpr = nullptr ; <nl> + <nl> + public : <nl> + ContextFinder ( Expr * E ) { <nl> + Contexts . push_back ( std : : make_pair ( ContextKind : : Expression , E ) ) ; <nl> + } <nl> + <nl> + std : : pair < bool , Expr * > walkToExprPre ( Expr * E ) override { <nl> + if ( auto * closure = dyn_cast < ClosureExpr > ( E ) ) { <nl> + Contexts . push_back ( std : : make_pair ( closure - > hasSingleExpressionBody ( ) <nl> + ? ContextKind : : SingleStmtClosure <nl> + : ContextKind : : MultiStmtClosure , <nl> + closure ) ) ; <nl> + } <nl> + <nl> + if ( isa < InterpolatedStringLiteralExpr > ( E ) ) { <nl> + Contexts . push_back ( std : : make_pair ( ContextKind : : StringInterpolation , E ) ) ; <nl> + } <nl> + <nl> + if ( isa < ApplyExpr > ( E ) ) { <nl> + Contexts . push_back ( std : : make_pair ( ContextKind : : Application , E ) ) ; <nl> + } <nl> + <nl> + if ( isa < CodeCompletionExpr > ( E ) ) { <nl> + CompletionExpr = E ; <nl> + return std : : make_pair ( false , nullptr ) ; <nl> + } <nl> + <nl> + if ( auto * Error = dyn_cast < ErrorExpr > ( E ) ) { <nl> + Contexts . push_back ( std : : make_pair ( ContextKind : : ErrorExpression , E ) ) ; <nl> + if ( auto * OrigExpr = Error - > getOriginalExpr ( ) ) { <nl> + OrigExpr - > walk ( * this ) ; <nl> + return std : : make_pair ( false , hasCompletionExpr ( ) ? nullptr : E ) ; <nl> + } <nl> + } <nl> + <nl> + return std : : make_pair ( true , E ) ; <nl> + } <nl> + <nl> + Expr * walkToExprPost ( Expr * E ) override { <nl> + if ( isa < ClosureExpr > ( E ) | | isa < InterpolatedStringLiteralExpr > ( E ) | | <nl> + isa < ApplyExpr > ( E ) | | isa < ErrorExpr > ( E ) ) <nl> + Contexts . pop_back ( ) ; <nl> + return E ; <nl> + } <nl> + <nl> + / / / Check whether code completion expression is located inside of a <nl> + / / / multi - statement closure . <nl> + bool locatedInMultiStmtClosure ( ) const { <nl> + return hasContext ( ContextKind : : MultiStmtClosure ) ; <nl> + } <nl> + <nl> + bool locatedInStringIterpolation ( ) const { <nl> + return hasContext ( ContextKind : : StringInterpolation ) ; <nl> + } <nl> + <nl> + bool hasCompletionExpr ( ) const { <nl> + return CompletionExpr ; <nl> + } <nl> + <nl> + Expr * getCompletionExpr ( ) const { <nl> + assert ( CompletionExpr ) ; <nl> + return CompletionExpr ; <nl> + } <nl> + <nl> + ErrorExpr * getInnermostErrorExpr ( ) const { <nl> + for ( const Context & curr : llvm : : reverse ( Contexts ) ) { <nl> + if ( curr . first = = ContextKind : : ErrorExpression ) <nl> + return cast < ErrorExpr > ( curr . second ) ; <nl> + } <nl> + return nullptr ; <nl> + } <nl> + <nl> + ClosureExpr * getOutermostMultiStmtClosure ( ) const { <nl> + for ( const Context & curr : Contexts ) { <nl> + if ( curr . first = = ContextKind : : MultiStmtClosure ) <nl> + return cast < ClosureExpr > ( curr . second ) ; <nl> + } <nl> + return nullptr ; <nl> + } <nl> + <nl> + / / / As a fallback sometimes its useful to not only type - check <nl> + / / / code completion expression directly but instead add some <nl> + / / / of the enclosing context e . g . when completion is an argument <nl> + / / / to a call . <nl> + Expr * getCompletionExprInContext ( ) const { <nl> + assert ( CompletionExpr ) ; <nl> + <nl> + auto & innerContext = Contexts . back ( ) ; <nl> + return innerContext . first = = ContextKind : : Application <nl> + ? innerContext . second <nl> + : CompletionExpr ; <nl> + } <nl> + <nl> + private : <nl> + bool hasContext ( ContextKind kind ) const { <nl> + return llvm : : find_if ( Contexts , [ & kind ] ( const Context & currContext ) { <nl> + return currContext . first = = kind ; <nl> + } ) ! = Contexts . end ( ) ; <nl> + } <nl> + } ; <nl> + <nl> + ContextFinder contextAnalyzer ( expr ) ; <nl> + expr - > walk ( contextAnalyzer ) ; <nl> + <nl> + / / If there was no completion expr ( e . g . if the code completion location was <nl> + / / among tokens that were skipped over during parser error recovery ) bail . <nl> + if ( ! contextAnalyzer . hasCompletionExpr ( ) ) <nl> + return false ; <nl> + <nl> + / / If the completion expression is in a valid subexpression of an ErrorExpr , <nl> + / / fallback to trying the valid subexpression without any context . This can <nl> + / / happen for cases like ` expectsBoolArg ( foo . < complete > ) . ` which becomes an <nl> + / / ErrorExpr due to the missing member name after the final dot . <nl> + if ( auto * errorExpr = contextAnalyzer . getInnermostErrorExpr ( ) ) { <nl> + if ( auto * origExpr = errorExpr - > getOriginalExpr ( ) ) { <nl> + SolutionApplicationTarget completionTarget ( origExpr , DC , CTP_Unused , <nl> + / * contextualType = * / Type ( ) , <nl> + / * isDiscarded = * / true ) ; <nl> + return typeCheckForCodeCompletion ( completionTarget , callback ) ; <nl> + } <nl> + } <nl> + <nl> + / / Interpolation components are type - checked separately . <nl> + if ( contextAnalyzer . locatedInStringIterpolation ( ) ) <nl> + return false ; <nl> + <nl> + / / FIXME : There is currently no way to distinguish between <nl> + / / multi - statement closures which are function builder bodies <nl> + / / ( that are type - checked together with enclosing context ) <nl> + / / and regular closures which are type - checked separately . <nl> + <nl> + { <nl> + / / First , pre - check the expression , validating any types that occur in the <nl> + / / expression and folding sequence expressions . <nl> + auto failedPreCheck = ConstraintSystem : : preCheckExpression ( <nl> + expr , DC , <nl> + / * replaceInvalidRefsWithErrors = * / true ) ; <nl> + <nl> + target . setExpr ( expr ) ; <nl> + <nl> + if ( failedPreCheck ) <nl> + return false ; <nl> + } <nl> + <nl> + enum class CompletionResult { Ok , NotApplicable , Fallback } ; <nl> + <nl> + auto solveForCodeCompletion = <nl> + [ & ] ( SolutionApplicationTarget & target ) - > CompletionResult { <nl> + ConstraintSystemOptions options ; <nl> + options | = ConstraintSystemFlags : : AllowFixes ; <nl> + options | = ConstraintSystemFlags : : SuppressDiagnostics ; <nl> + <nl> + ConstraintSystem cs ( DC , options ) ; <nl> + <nl> + llvm : : SmallVector < Solution , 4 > solutions ; <nl> + <nl> + / / If solve failed to generate constraints or with some other <nl> + / / issue , we need to fallback to type - checking code completion <nl> + / / expression directly . <nl> + if ( ! cs . solveForCodeCompletion ( target , solutions ) ) <nl> + return CompletionResult : : Fallback ; <nl> + <nl> + / / If case type - check didn ' t produce any solutions , let ' s <nl> + / / attempt to type - check code completion expression without <nl> + / / enclosing context . <nl> + if ( solutions . empty ( ) ) <nl> + return CompletionResult : : Fallback ; <nl> + <nl> + / / If code completion expression resides inside of multi - statement <nl> + / / closure body it code either be type - checker together with context <nl> + / / or not , it ' s impossible to say without trying . If solution <nl> + / / doesn ' t have a type for a code completion expression it means that <nl> + / / we have to wait until body of the closure is type - checked . <nl> + if ( contextAnalyzer . locatedInMultiStmtClosure ( ) ) { <nl> + auto & solution = solutions . front ( ) ; <nl> + <nl> + / / Let ' s check whether closure participated in the type - check . <nl> + if ( solution . hasType ( contextAnalyzer . getCompletionExpr ( ) ) ) { <nl> + llvm : : for_each ( solutions , callback ) ; <nl> + return CompletionResult : : Ok ; <nl> + } <nl> + <nl> + if ( solutions . size ( ) > 1 ) <nl> + return CompletionResult : : Fallback ; <nl> + <nl> + auto * closure = contextAnalyzer . getOutermostMultiStmtClosure ( ) ; <nl> + auto closureType = solution . getResolvedType ( closure ) ; <nl> + <nl> + if ( closureType - > hasUnresolvedType ( ) ) <nl> + return CompletionResult : : Fallback ; <nl> + <nl> + return CompletionResult : : NotApplicable ; <nl> + } <nl> + <nl> + llvm : : for_each ( solutions , callback ) ; <nl> + return CompletionResult : : Ok ; <nl> + } ; <nl> + <nl> + switch ( solveForCodeCompletion ( target ) ) { <nl> + case CompletionResult : : Ok : <nl> + return true ; <nl> + <nl> + case CompletionResult : : NotApplicable : <nl> + return false ; <nl> + <nl> + case CompletionResult : : Fallback : <nl> + break ; <nl> + } <nl> + <nl> + { <nl> + auto * completionExpr = contextAnalyzer . getCompletionExpr ( ) ; <nl> + <nl> + if ( contextAnalyzer . locatedInMultiStmtClosure ( ) ) { <nl> + auto completionInContext = contextAnalyzer . getCompletionExprInContext ( ) ; <nl> + / / If pre - check fails , let ' s switch to code completion <nl> + / / expression without any enclosing context . <nl> + if ( ConstraintSystem : : preCheckExpression ( <nl> + completionInContext , DC , / * replaceInvalidRefsWithErrors = * / true ) ) { <nl> + completionExpr = contextAnalyzer . getCompletionExpr ( ) ; <nl> + } else { <nl> + completionExpr = completionInContext ; <nl> + } <nl> + } <nl> + <nl> + / / If initial solve failed , let ' s fallback to checking only code completion <nl> + / / expresion without any context . <nl> + SolutionApplicationTarget completionTarget ( completionExpr , DC , CTP_Unused , <nl> + / * contextualType = * / Type ( ) , <nl> + / * isDiscarded = * / true ) ; <nl> + <nl> + switch ( solveForCodeCompletion ( completionTarget ) ) { <nl> + case CompletionResult : : Ok : <nl> + case CompletionResult : : Fallback : <nl> + break ; <nl> + case CompletionResult : : NotApplicable : <nl> + llvm_unreachable ( " solve on CodeCompletionExpr produced not applicable ? " ) ; <nl> + } <nl> + } <nl> + return true ; <nl> } <nl> <nl> static Optional < Type > getTypeOfCompletionContextExpr ( <nl> LookupResult <nl> swift : : lookupSemanticMember ( DeclContext * DC , Type ty , DeclName name ) { <nl> return TypeChecker : : lookupMember ( DC , ty , DeclNameRef ( name ) , None ) ; <nl> } <nl> + <nl> + void DotExprTypeCheckCompletionCallback : : fallbackTypeCheck ( ) { <nl> + assert ( ! gotCallback ( ) ) ; <nl> + SolutionApplicationTarget completionTarget ( CompletionExpr , DC , CTP_Unused , <nl> + Type ( ) , / * isDiscared = * / true ) ; <nl> + TypeChecker : : typeCheckForCodeCompletion ( <nl> + completionTarget , [ & ] ( const Solution & S ) { sawSolution ( S ) ; } ) ; <nl> + } <nl> + <nl> + void DotExprTypeCheckCompletionCallback : : <nl> + sawSolution ( const constraints : : Solution & S ) { <nl> + GotCallback = true ; <nl> + auto & CS = S . getConstraintSystem ( ) ; <nl> + <nl> + auto GetType = [ & ] ( Expr * E ) { <nl> + / / To aid code completion , we need to attempt to convert type holes <nl> + / / back into underlying generic parameters if possible , since type <nl> + / / of the code completion expression is used as " expected " ( or contextual ) <nl> + / / type so it ' s helpful to know what requirements it has to filter <nl> + / / the list of possible member candidates e . g . <nl> + / / <nl> + / / \ code <nl> + / / func test < T : P > ( _ : [ T ] ) { } <nl> + / / <nl> + / / test ( 42 . # ^ MEMBERS ^ # ) <nl> + / / \ code <nl> + / / <nl> + / / It ' s impossible to resolve ` T ` in this case but code completion <nl> + / / expression should still have a type of ` [ T ] ` instead of ` [ < < hole > > ] ` <nl> + / / because it helps to produce correct contextual member list based on <nl> + / / a conformance requirement associated with generic parameter ` T ` . <nl> + if ( isa < CodeCompletionExpr > ( E ) ) { <nl> + auto completionTy = S . getType ( E ) . transform ( [ & ] ( Type type ) - > Type { <nl> + if ( auto * typeVar = type - > getAs < TypeVariableType > ( ) ) <nl> + return S . getFixedType ( typeVar ) ; <nl> + return type ; <nl> + } ) ; <nl> + <nl> + return S . simplifyType ( completionTy . transform ( [ & ] ( Type type ) { <nl> + if ( auto * hole = type - > getAs < HoleType > ( ) ) { <nl> + if ( auto * typeVar = <nl> + hole - > getOriginatorType ( ) . dyn_cast < TypeVariableType * > ( ) ) { <nl> + if ( auto * GP = typeVar - > getImpl ( ) . getGenericParameter ( ) ) { <nl> + / / Code completion depends on generic parameter type being <nl> + / / represented in terms of ` ArchetypeType ` since it ' s easy <nl> + / / to extract protocol requirements from it . <nl> + if ( auto * GPD = GP - > getDecl ( ) ) <nl> + return GPD - > getInnermostDeclContext ( ) - > mapTypeIntoContext ( GP ) ; <nl> + } <nl> + } <nl> + <nl> + return Type ( CS . getASTContext ( ) . TheUnresolvedType ) ; <nl> + } <nl> + <nl> + return type ; <nl> + } ) ) ; <nl> + } <nl> + <nl> + return S . getResolvedType ( E ) ; <nl> + } ; <nl> + <nl> + auto * ParsedExpr = CompletionExpr - > getBase ( ) ; <nl> + auto * SemanticExpr = ParsedExpr - > getSemanticsProvidingExpr ( ) ; <nl> + <nl> + auto BaseTy = GetType ( ParsedExpr ) ; <nl> + / / If base type couldn ' t be determined ( e . g . because base expression <nl> + / / is an invalid reference ) , let ' s not attempt to do a lookup since <nl> + / / it wouldn ' t produce any useful results anyway . <nl> + if ( ! BaseTy | | BaseTy - > is < UnresolvedType > ( ) ) <nl> + return ; <nl> + <nl> + auto * Locator = CS . getConstraintLocator ( SemanticExpr ) ; <nl> + Type ExpectedTy = GetType ( CompletionExpr ) ; <nl> + Expr * ParentExpr = CS . getParentExpr ( CompletionExpr ) ; <nl> + if ( ! ParentExpr ) <nl> + ExpectedTy = CS . getContextualType ( CompletionExpr ) ; <nl> + <nl> + auto * CalleeLocator = S . getCalleeLocator ( Locator ) ; <nl> + ValueDecl * ReferencedDecl = nullptr ; <nl> + if ( auto SelectedOverload = S . getOverloadChoiceIfAvailable ( CalleeLocator ) ) <nl> + ReferencedDecl = SelectedOverload - > choice . getDeclOrNull ( ) ; <nl> + <nl> + auto Key = std : : make_pair ( BaseTy , ReferencedDecl ) ; <nl> + auto Ret = BaseToSolutionIdx . insert ( { Key , Results . size ( ) } ) ; <nl> + if ( ! Ret . second & & ExpectedTy ) { <nl> + Results [ Ret . first - > getSecond ( ) ] . ExpectedTypes . push_back ( ExpectedTy ) ; <nl> + } else { <nl> + bool ISDMT = S . isStaticallyDerivedMetatype ( ParsedExpr ) ; <nl> + bool SingleExprBody = false ; <nl> + bool DisallowVoid = ExpectedTy <nl> + ? ! ExpectedTy - > isVoid ( ) <nl> + : ! ParentExpr & & CS . getContextualTypePurpose ( <nl> + CompletionExpr ) ! = CTP_Unused ; <nl> + <nl> + if ( ! ParentExpr ) { <nl> + if ( CS . getContextualTypePurpose ( CompletionExpr ) = = CTP_ReturnSingleExpr ) <nl> + SingleExprBody = true ; <nl> + } else if ( auto * ParentCE = dyn_cast < ClosureExpr > ( ParentExpr ) ) { <nl> + if ( ParentCE - > hasSingleExpressionBody ( ) & & <nl> + ParentCE - > getSingleExpressionBody ( ) = = CompletionExpr ) { <nl> + ASTNode Last = ParentCE - > getBody ( ) - > getLastElement ( ) ; <nl> + if ( ! Last . isStmt ( StmtKind : : Return ) | | Last . isImplicit ( ) ) <nl> + SingleExprBody = true ; <nl> + } <nl> + } <nl> + <nl> + Results . push_back ( <nl> + { BaseTy , ReferencedDecl , { } , DisallowVoid , ISDMT , SingleExprBody } ) ; <nl> + if ( ExpectedTy ) <nl> + Results . back ( ) . ExpectedTypes . push_back ( ExpectedTy ) ; <nl> + } <nl> + } <nl> mmm a / lib / Sema / TypeCheckConstraints . cpp <nl> ppp b / lib / Sema / TypeCheckConstraints . cpp <nl> <nl> # include " swift / Basic / Statistic . h " <nl> # include " swift / Parse / Confusables . h " <nl> # include " swift / Parse / Lexer . h " <nl> + # include " swift / Sema / CodeCompletionTypeChecking . h " <nl> # include " llvm / ADT / APInt . h " <nl> # include " llvm / ADT / DenseMap . h " <nl> # include " llvm / ADT / FoldingSet . h " <nl> TypeChecker : : typeCheckExpression ( <nl> " typecheck - expr " , expr ) ; <nl> PrettyStackTraceExpr stackTrace ( Context , " type - checking " , expr ) ; <nl> <nl> + / / First let ' s check whether given expression has a code completion <nl> + / / token which requires special handling . <nl> + if ( Context . CompletionCallback & & <nl> + typeCheckForCodeCompletion ( target , [ & ] ( const constraints : : Solution & S ) { <nl> + Context . CompletionCallback - > sawSolution ( S ) ; <nl> + } ) ) <nl> + return None ; <nl> + <nl> / / First , pre - check the expression , validating any types that occur in the <nl> / / expression and folding sequence expressions . <nl> if ( ConstraintSystem : : preCheckExpression ( <nl> mmm a / lib / Sema / TypeCheckStmt . cpp <nl> ppp b / lib / Sema / TypeCheckStmt . cpp <nl> bool TypeCheckASTNodeAtLocRequest : : evaluate ( Evaluator & evaluator , <nl> / / Wire up the function body now . <nl> func - > setBody ( * optBody , AbstractFunctionDecl : : BodyKind : : TypeChecked ) ; <nl> return false ; <nl> + } else if ( func - > hasSingleExpressionBody ( ) & & <nl> + func - > getResultInterfaceType ( ) - > isVoid ( ) ) { <nl> + / / The function returns void . We don ' t need an explicit return , no matter <nl> + / / what the type of the expression is . Take the inserted return back out . <nl> + func - > getBody ( ) - > setFirstElement ( func - > getSingleExpressionBody ( ) ) ; <nl> } <nl> } <nl> <nl> mmm a / lib / Sema / TypeChecker . h <nl> ppp b / lib / Sema / TypeChecker . h <nl> FunctionType * getTypeOfCompletionOperator ( DeclContext * DC , Expr * LHS , <nl> / / / it doesn ' t mutate given expression , even if there is a single valid <nl> / / / solution , and constraint solver is allowed to produce partially correct <nl> / / / solutions . Such solutions can have any number of holes in them . <nl> - void typeCheckForCodeCompletion ( <nl> - Expr * expr , DeclContext * DC , Type contextualType , ContextualTypePurpose CTP , <nl> + / / / <nl> + / / / \ returns ` true ` if target was applicable and it was possible to infer <nl> + / / / types for code completion , ` false ` othrewise . <nl> + bool typeCheckForCodeCompletion ( <nl> + constraints : : SolutionApplicationTarget & target , <nl> llvm : : function_ref < void ( const constraints : : Solution & ) > callback ) ; <nl> <nl> / / / Check the key - path expression . <nl> new file mode 100644 <nl> index 000000000000 . . 6931abc4912b <nl> mmm / dev / null <nl> ppp b / test / IDE / complete_ambiguous . swift <nl> <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = SIMPLE | % FileCheck % s - - check - prefix = SIMPLE <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = SIMPLE_EXTRAARG | % FileCheck % s - - check - prefix = SIMPLE <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = SIMPLE_MEMBERS | % FileCheck % s - - check - prefix = SIMPLE <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = RELATED | % FileCheck % s - - check - prefix = RELATED <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = RELATED_EXTRAARG | % FileCheck % s - - check - prefix = RELATED <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = RELATED_INERROREXPR | % FileCheck % s - - check - prefix = RELATED <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC | % FileCheck % s - - check - prefix = GENERIC <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = GENERIC_MISSINGARG | % FileCheck % s - - check - prefix = NORESULTS <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = CLOSURE_MISSINGARG | % FileCheck % s - - check - prefix = POINT_MEMBER <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = CLOSURE_NORETURN | % FileCheck % s - - check - prefix = POINT_MEMBER <nl> + / / RUN : % swift - ide - test - code - completion - source - filename % s - code - completion - token = CLOSURE_FUNCBUILDER | % FileCheck % s - - check - prefix = POINT_MEMBER <nl> + <nl> + struct A { <nl> + func doAThings ( ) - > A { return self } <nl> + } <nl> + <nl> + struct B { <nl> + func doBThings ( ) { } <nl> + } <nl> + <nl> + func overloadedReturn ( ) - > A { return A ( ) } <nl> + func overloadedReturn ( ) - > B { return B ( ) } <nl> + <nl> + overloadedReturn ( ) . # ^ SIMPLE ^ # <nl> + overloadedReturn ( 1 ) . # ^ SIMPLE_EXTRAARG ^ # <nl> + <nl> + struct HasMembers { <nl> + func overloadedReturn ( ) - > A { return A ( ) } <nl> + func overloadedReturn ( ) - > B { return B ( ) } <nl> + } <nl> + <nl> + HasMembers ( ) . overloadedReturn ( ) . # ^ SIMPLE_MEMBERS ^ # <nl> + <nl> + / / SIMPLE : Begin completions , 4 items <nl> + / / SIMPLE - DAG : Keyword [ self ] / CurrNominal : self [ # A # ] { { ; name = . + $ } } <nl> + / / SIMPLE - DAG : Decl [ InstanceMethod ] / CurrNominal : doAThings ( ) [ # A # ] { { ; name = . + $ } } <nl> + / / SIMPLE - DAG : Keyword [ self ] / CurrNominal : self [ # B # ] { { ; name = . + $ } } <nl> + / / SIMPLE - DAG : Decl [ InstanceMethod ] / CurrNominal : doBThings ( ) [ # Void # ] { { ; name = . + $ } } <nl> + / / SIMPLE : End completions <nl> + <nl> + let x : A = overloadedReturn ( ) . # ^ RELATED ^ # <nl> + let x : A = overloadedReturn ( 1 ) . # ^ RELATED_EXTRAARG ^ # <nl> + <nl> + / / RELATED : Begin completions , 4 items <nl> + / / RELATED - DAG : Keyword [ self ] / CurrNominal : self [ # A # ] { { ; name = . + $ } } <nl> + / / RELATED - DAG : Decl [ InstanceMethod ] / CurrNominal / TypeRelation [ Identical ] : doAThings ( ) [ # A # ] { { ; name = . + $ } } <nl> + / / RELATED - DAG : Keyword [ self ] / CurrNominal : self [ # B # ] { { ; name = . + $ } } <nl> + / / RELATED - DAG : Decl [ InstanceMethod ] / CurrNominal / TypeRelation [ Invalid ] : doBThings ( ) [ # Void # ] { { ; name = . + $ } } <nl> + / / RELATED : End completions <nl> + <nl> + func takesA ( _ callback : ( ) - > A ) - > B { } <nl> + func takesB ( _ item : B ) { } <nl> + <nl> + takesB ( ( takesA { return overloadedReturn ( ) . # ^ RELATED_INERROREXPR ^ # } ) . ) <nl> + <nl> + protocol C { <nl> + associatedtype Element <nl> + func getCElem ( ) - > Element <nl> + } <nl> + <nl> + protocol D { <nl> + associatedtype Item <nl> + func getDElem ( ) - > Item <nl> + } <nl> + <nl> + struct CDStruct : C , D { <nl> + func getDElem ( ) - > A { return A ( ) } <nl> + func getCElem ( ) - > B { return B ( ) } <nl> + } <nl> + <nl> + func genericReturn < T : C , U > ( _ x : T ) - > U where U = = T . Element { <nl> + return x . getCElem ( ) <nl> + } <nl> + func genericReturn < T : D , U > ( _ x : T ) - > U where U = = T . Item { <nl> + return x . getDElem ( ) <nl> + } <nl> + <nl> + genericReturn ( CDStruct ( ) ) . # ^ GENERIC ^ # <nl> + <nl> + / / GENERIC : Begin completions , 4 items <nl> + / / GENERIC - DAG : Keyword [ self ] / CurrNominal : self [ # B # ] { { ; name = . + $ } } <nl> + / / GENERIC - DAG : Decl [ InstanceMethod ] / CurrNominal : doBThings ( ) [ # Void # ] { { ; name = . + $ } } <nl> + / / GENERIC - DAG : Keyword [ self ] / CurrNominal : self [ # A # ] { { ; name = . + $ } } <nl> + / / GENERIC - DAG : Decl [ InstanceMethod ] / CurrNominal : doAThings ( ) [ # A # ] { { ; name = . + $ } } <nl> + / / GENERIC : End completions <nl> + <nl> + genericReturn ( ) . # ^ GENERIC_MISSINGARG ^ # <nl> + <nl> + / / NORESULTS - NOT : Begin completions <nl> + <nl> + struct Point { <nl> + let x : Int <nl> + let y : Int <nl> + var magSquared : Int { return x * y } <nl> + <nl> + init ( _ x : Int , _ y : Int ) { <nl> + self . x = x <nl> + self . y = y <nl> + } <nl> + } <nl> + <nl> + / / POINT_MEMBER : Begin completions , 4 items <nl> + / / POINT_MEMBER - DAG : Keyword [ self ] / CurrNominal : self [ # Point # ] ; name = self <nl> + / / POINT_MEMBER - DAG : Decl [ InstanceVar ] / CurrNominal : x [ # Int # ] ; name = x <nl> + / / POINT_MEMBER - DAG : Decl [ InstanceVar ] / CurrNominal : y [ # Int # ] ; name = y <nl> + / / POINT_MEMBER - DAG : Decl [ InstanceVar ] / CurrNominal : magSquared [ # Int # ] ; name = magSquared <nl> + / / POINT_MEMBER : End completions <nl> + <nl> + let _ = [ Point ( 1 , 4 ) , Point ( 20 , 2 ) , Point ( 9 , - 4 ) ] <nl> + . filter { $ 0 . magSquared > 4 } <nl> + . min { <nl> + $ 0 . # ^ CLOSURE_MISSINGARG ^ # <nl> + } <nl> + <nl> + protocol SomeProto { } <nl> + func testing < T : Collection , U : SomeProto > ( _ arg1 : T , arg2 : ( T . Element ) - > U ) { } <nl> + _ = testing ( [ Point ( 4 , 89 ) ] ) { arg in <nl> + arg . # ^ CLOSURE_NORETURN ^ # <nl> + } <nl> + <nl> + struct Thing { <nl> + init ( _ block : ( Point ) - > Void ) { } <nl> + } <nl> + @ _functionBuilder <nl> + struct ThingBuilder { <nl> + static func buildBlock ( _ x : Thing . . . ) - > [ Thing ] { x } <nl> + } <nl> + func CreateThings ( @ ThingBuilder makeThings : ( ) - > [ Thing ] ) { } <nl> + <nl> + / / FIXME : only works if the first call to Thing is passed a single expression closure <nl> + CreateThings { <nl> + Thing { point in <nl> + point . # ^ CLOSURE_FUNCBUILDER ^ # <nl> + } <nl> + Thing { _ in } <nl> + } <nl> + <nl> mmm a / test / IDE / complete_enum_elements . swift <nl> ppp b / test / IDE / complete_enum_elements . swift <nl> <nl> / / RUN : % FileCheck % s - check - prefix = QUX_ENUM_NO_DOT < % t . enum . txt <nl> <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = ENUM_QUAL_DOT_1 > % t . enum . txt <nl> - / / RUN : % FileCheck % s - check - prefix = FOO_ENUM_DOT_INVALID < % t . enum . txt <nl> + / / RUN : % FileCheck % s - check - prefix = FOO_ENUM_DOT < % t . enum . txt <nl> <nl> / / RUN : % target - swift - ide - test - code - completion - source - filename % s - code - completion - token = ENUM_QUAL_DOT_2 > % t . enum . txt <nl> / / RUN : % FileCheck % s - check - prefix = BAR_ENUM_DOT < % t . enum . txt <nl> enum FooEnum : CaseIterable { <nl> / / FOO_ENUM_DOT_CONTEXT - NEXT : Decl [ StaticVar ] / CurrNominal : allCases [ # [ FooEnum ] # ] { { ; name = . + $ } } <nl> / / FOO_ENUM_DOT_CONTEXT - NEXT : End completions <nl> <nl> - / / FOO_ENUM_DOT_INVALID : Begin completions <nl> - / / FOO_ENUM_DOT_INVALID - NEXT : Keyword [ self ] / CurrNominal : self [ # FooEnum . Type # ] ; name = self <nl> - / / FOO_ENUM_DOT_INVALID - NEXT : Keyword / CurrNominal : Type [ # FooEnum . Type # ] ; name = Type <nl> - / / FOO_ENUM_DOT_INVALID - NEXT : Decl [ EnumElement ] / CurrNominal : Foo1 [ # FooEnum # ] { { ; name = . + $ } } <nl> - / / FOO_ENUM_DOT_INVALID - NEXT : Decl [ EnumElement ] / CurrNominal : Foo2 [ # FooEnum # ] { { ; name = . + $ } } <nl> - / / FOO_ENUM_DOT_INVALID - NEXT : Decl [ StaticVar ] / CurrNominal : alias1 [ # FooEnum # ] { { ; name = . + $ } } <nl> - / / FOO_ENUM_DOT_INVALID - NEXT : Decl [ InstanceMethod ] / CurrNominal / TypeRelation [ Invalid ] : hash ( { # ( self ) : FooEnum # } ) [ # ( into : inout Hasher ) - > Void # ] { { ; name = . + $ } } <nl> - / / FOO_ENUM_DOT_INVALID - NEXT : Decl [ TypeAlias ] / CurrNominal : AllCases [ # [ FooEnum ] # ] { { ; name = . + $ } } <nl> - / / FOO_ENUM_DOT_INVALID - NEXT : Decl [ StaticVar ] / CurrNominal : allCases [ # [ FooEnum ] # ] { { ; name = . + $ } } <nl> - / / FOO_ENUM_DOT_INVALID - NEXT : End completions <nl> - <nl> / / FOO_ENUM_DOT_ELEMENTS : Begin completions , 13 items <nl> / / FOO_ENUM_DOT_ELEMENTS - NEXT : Decl [ EnumElement ] / ExprSpecific / TypeRelation [ Identical ] : Foo1 [ # FooEnum # ] { { ; name = . + $ } } <nl> / / FOO_ENUM_DOT_ELEMENTS - NEXT : Decl [ EnumElement ] / ExprSpecific / TypeRelation [ Identical ] : Foo2 [ # FooEnum # ] { { ; name = . + $ } } <nl> enum BarEnum { <nl> / / BAR_ENUM_DOT - NEXT : Decl [ EnumElement ] / CurrNominal : Bar10 ( { # Int # } , { # Float # } ) [ # BarEnum # ] { { ; name = . + $ } } <nl> / / BAR_ENUM_DOT - NEXT : Decl [ EnumElement ] / CurrNominal : Bar11 ( { # Int # } , { # ( Float ) # } ) [ # BarEnum # ] { { ; name = . + $ } } <nl> / / BAR_ENUM_DOT - NEXT : Decl [ EnumElement ] / CurrNominal : Bar12 ( { # Int # } , { # ( Float , Double ) # } ) [ # BarEnum # ] { { ; name = . + $ } } <nl> - / / BAR_ENUM_DOT - NEXT : Decl [ InstanceMethod ] / CurrNominal / TypeRelation [ Invalid ] : barInstanceFunc ( { # ( self ) : & BarEnum # } ) [ # ( ) - > Void # ] { { ; name = . + $ } } <nl> + / / BAR_ENUM_DOT - NEXT : Decl [ InstanceMethod ] / CurrNominal : barInstanceFunc ( { # ( self ) : & BarEnum # } ) [ # ( ) - > Void # ] { { ; name = . + $ } } <nl> / / BAR_ENUM_DOT - NEXT : Decl [ StaticVar ] / CurrNominal : staticVar [ # Int # ] { { ; name = . + $ } } <nl> / / BAR_ENUM_DOT - NEXT : Decl [ StaticMethod ] / CurrNominal / TypeRelation [ Invalid ] : barStaticFunc ( ) [ # Void # ] { { ; name = . + $ } } <nl> / / BAR_ENUM_DOT - NEXT : End completions <nl> enum BazEnum < T > { <nl> / / BAZ_INT_ENUM_DOT - NEXT : Keyword / CurrNominal : Type [ # BazEnum < Int > . Type # ] ; name = Type <nl> / / BAZ_INT_ENUM_DOT - NEXT : Decl [ EnumElement ] / CurrNominal : Baz1 [ # BazEnum < Int > # ] { { ; name = . + $ } } <nl> / / BAZ_INT_ENUM_DOT - NEXT : Decl [ EnumElement ] / CurrNominal : Baz2 ( { # Int # } ) [ # BazEnum < Int > # ] { { ; name = . + $ } } <nl> - / / BAZ_INT_ENUM_DOT - NEXT : Decl [ InstanceMethod ] / CurrNominal / TypeRelation [ Invalid ] : bazInstanceFunc ( { # ( self ) : & BazEnum < Int > # } ) [ # ( ) - > Void # ] { { ; name = . + $ } } <nl> + / / BAZ_INT_ENUM_DOT - NEXT : Decl [ InstanceMethod ] / CurrNominal : bazInstanceFunc ( { # ( self ) : & BazEnum < Int > # } ) [ # ( ) - > Void # ] { { ; name = . + $ } } <nl> / / BAZ_INT_ENUM_DOT - NEXT : Decl [ StaticVar ] / CurrNominal : staticVar [ # Int # ] { { ; name = . + $ } } <nl> / / BAZ_INT_ENUM_DOT - NEXT : Decl [ StaticVar ] / CurrNominal : staticVarT [ # Int # ] { { ; name = . + $ } } <nl> / / BAZ_INT_ENUM_DOT - NEXT : Decl [ StaticMethod ] / CurrNominal / TypeRelation [ Invalid ] : bazStaticFunc ( ) [ # Void # ] { { ; name = . + $ } } <nl> enum BazEnum < T > { <nl> / / BAZ_T_ENUM_DOT - NEXT : Decl [ InstanceMethod ] / CurrNominal : bazInstanceFunc ( { # ( self ) : & BazEnum < _ > # } ) [ # ( ) - > Void # ] { { ; name = . + $ } } <nl> / / BAZ_T_ENUM_DOT - NEXT : Decl [ StaticVar ] / CurrNominal : staticVar [ # Int # ] { { ; name = . + $ } } <nl> / / BAZ_T_ENUM_DOT - NEXT : Decl [ StaticVar ] / CurrNominal : staticVarT [ # _ # ] { { ; name = . + $ } } <nl> - / / BAZ_T_ENUM_DOT - NEXT : Decl [ StaticMethod ] / CurrNominal : bazStaticFunc ( ) [ # Void # ] { { ; name = . + $ } } <nl> + / / BAZ_T_ENUM_DOT - NEXT : Decl [ StaticMethod ] / CurrNominal / TypeRelation [ Invalid ] : bazStaticFunc ( ) [ # Void # ] { { ; name = . + $ } } <nl> / / BAZ_T_ENUM_DOT - NEXT : End completions <nl> <nl> enum QuxEnum : Int { <nl> enum QuxEnum : Int { <nl> / / QUX_ENUM_DOT - NEXT : Decl [ EnumElement ] / CurrNominal : Qux2 [ # QuxEnum # ] { { ; name = . + $ } } <nl> / / QUX_ENUM_DOT - NEXT : Decl [ TypeAlias ] / CurrNominal : RawValue [ # Int # ] { { ; name = . + $ } } <nl> / / QUX_ENUM_DOT - NEXT : Decl [ Constructor ] / CurrNominal : init ( { # rawValue : Int # } ) [ # QuxEnum ? # ] { { ; name = . + $ } } <nl> - / / QUX_ENUM_DOT - NEXT : Decl [ InstanceMethod ] / Super / IsSystem / TypeRelation [ Invalid ] : hash ( { # ( self ) : QuxEnum # } ) [ # ( into : inout Hasher ) - > Void # ] { { ; name = . + $ } } <nl> + / / QUX_ENUM_DOT - NEXT : Decl [ InstanceMethod ] / Super / IsSystem : hash ( { # ( self ) : QuxEnum # } ) [ # ( into : inout Hasher ) - > Void # ] { { ; name = . + $ } } <nl> / / QUX_ENUM_DOT - NEXT : End completions <nl> <nl> func freeFunc ( ) { } <nl> mmm a / test / IDE / complete_exception . swift <nl> ppp b / test / IDE / complete_exception . swift <nl> func test002 ( ) { <nl> func test003 ( ) { <nl> do { } catch Error4 . # ^ CATCH2 ^ # <nl> / / CATCH2 : Begin completions <nl> - / / CATCH2 : Decl [ EnumElement ] / CurrNominal : E1 [ # Error4 # ] { { ; name = . + $ } } <nl> - / / CATCH2 : Decl [ EnumElement ] / CurrNominal : E2 ( { # Int32 # } ) [ # Error4 # ] { { ; name = . + $ } } <nl> + / / CATCH2 : Decl [ EnumElement ] / CurrNominal / TypeRelation [ Convertible ] : E1 [ # Error4 # ] { { ; name = . + $ } } <nl> + / / CATCH2 : Decl [ EnumElement ] / CurrNominal / TypeRelation [ Convertible ] : E2 ( { # Int32 # } ) [ # Error4 # ] { { ; name = . + $ } } <nl> / / CATCH2 : End completions <nl> } <nl> <nl> func test004 ( ) { <nl> throw Error4 . # ^ THROW2 ^ # <nl> / / THROW2 : Begin completions <nl> - / / THROW2 : Decl [ EnumElement ] / CurrNominal : E1 [ # Error4 # ] { { ; name = . + $ } } <nl> - / / THROW2 : Decl [ EnumElement ] / CurrNominal : E2 ( { # Int32 # } ) [ # Error4 # ] { { ; name = . + $ } } <nl> + / / THROW2 : Decl [ EnumElement ] / CurrNominal / TypeRelation [ Convertible ] : E1 [ # Error4 # ] { { ; name = . + $ } } <nl> + / / THROW2 : Decl [ EnumElement ] / CurrNominal / TypeRelation [ Convertible ] : E2 ( { # Int32 # } ) [ # Error4 # ] { { ; name = . + $ } } <nl> / / THROW2 : End completions <nl> } <nl> <nl> func test005 ( ) { <nl> func testInvalid ( ) { <nl> try throw Error4 . # ^ THROW3 ^ # <nl> / / THROW3 : Begin completions <nl> - / / THROW3 : Decl [ EnumElement ] / CurrNominal : E1 [ # Error4 # ] { { ; name = . + $ } } <nl> - / / THROW3 : Decl [ EnumElement ] / CurrNominal : E2 ( { # Int32 # } ) [ # Error4 # ] { { ; name = . + $ } } <nl> + / / THROW3 : Decl [ EnumElement ] / CurrNominal / TypeRelation [ Convertible ] : E1 [ # Error4 # ] { { ; name = . + $ } } <nl> + / / THROW3 : Decl [ EnumElement ] / CurrNominal / TypeRelation [ Convertible ] : E2 ( { # Int32 # } ) [ # Error4 # ] { { ; name = . + $ } } <nl> / / THROW3 : End completions <nl> } <nl> <nl> mmm a / test / SourceKit / CodeComplete / complete_annotateddescription . swift . result <nl> ppp b / test / SourceKit / CodeComplete / complete_annotateddescription . swift . result <nl> <nl> key . description : " < name > init < / name > ( ) " , <nl> key . typename : " < typeid . user > MyStruct < / typeid . user > " , <nl> key . context : source . codecompletion . context . thisclass , <nl> - key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + key . typerelation : source . codecompletion . typerelation . unknown , <nl> key . num_bytes_to_erase : 0 , <nl> key . associated_usrs : " s : 29complete_annotateddescription8MyStructVACycfc " , <nl> key . modulename : " complete_annotateddescription " <nl> <nl> key . description : " < name > labelName < / name > ( < callarg > < callarg . label > _ < / callarg . label > < callarg . param > self < / callarg . param > : < callarg . type > < typeid . user > MyStruct < / typeid . user > < / callarg . type > < / callarg > ) " , <nl> key . typename : " ( label : ( < attribute > @ autoclosure < / attribute > ( ) - & gt ; < typeid . sys > Int < / typeid . sys > ) - & gt ; < typeid . sys > Int < / typeid . sys > ) - & gt ; < typeid . sys > Void < / typeid . sys > " , <nl> key . context : source . codecompletion . context . thisclass , <nl> - key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + key . typerelation : source . codecompletion . typerelation . unknown , <nl> key . num_bytes_to_erase : 0 , <nl> key . associated_usrs : " s : 29complete_annotateddescription8MyStructV9labelName0E0yS2iyXKXE_tF " , <nl> key . modulename : " complete_annotateddescription " <nl> <nl> key . description : " < name > labelNameParamName < / name > ( < callarg > < callarg . label > _ < / callarg . label > < callarg . param > self < / callarg . param > : < callarg . type > < typeid . user > MyStruct < / typeid . user > < / callarg . type > < / callarg > ) " , <nl> key . typename : " ( label : ( < keyword > inout < / keyword > < typeid . sys > Int < / typeid . sys > ) < keyword > throws < / keyword > - & gt ; < typeid . user > MyStruct < / typeid . user > ) - & gt ; < typeid . sys > Void < / typeid . sys > " , <nl> key . context : source . codecompletion . context . thisclass , <nl> - key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + key . typerelation : source . codecompletion . typerelation . unknown , <nl> key . num_bytes_to_erase : 0 , <nl> key . associated_usrs : " s : 29complete_annotateddescription8MyStructV014labelNameParamF00E0yACSizKXE_tKF " , <nl> key . modulename : " complete_annotateddescription " <nl> <nl> key . description : " < name > paramName < / name > ( < callarg > < callarg . label > _ < / callarg . label > < callarg . param > self < / callarg . param > : < callarg . type > < typeid . user > MyStruct < / typeid . user > < / callarg . type > < / callarg > ) " , <nl> key . typename : " ( < typeid . sys > Int < / typeid . sys > ) - & gt ; < typeid . sys > Void < / typeid . sys > " , <nl> key . context : source . codecompletion . context . thisclass , <nl> - key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + key . typerelation : source . codecompletion . typerelation . unknown , <nl> key . num_bytes_to_erase : 0 , <nl> key . associated_usrs : " s : 29complete_annotateddescription8MyStructV9paramNameyySiF " , <nl> key . modulename : " complete_annotateddescription " <nl> <nl> key . description : " < name > sameName < / name > ( < callarg > < callarg . label > _ < / callarg . label > < callarg . param > self < / callarg . param > : < callarg . type > < typeid . user > MyStruct < / typeid . user > < / callarg . type > < / callarg > ) " , <nl> key . typename : " ( label : < typeid . sys > Int < / typeid . sys > ) - & gt ; < typeid . sys > Void < / typeid . sys > " , <nl> key . context : source . codecompletion . context . thisclass , <nl> - key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + key . typerelation : source . codecompletion . typerelation . unknown , <nl> key . num_bytes_to_erase : 0 , <nl> key . associated_usrs : " s : 29complete_annotateddescription8MyStructV8sameName5labelySi_tF " , <nl> key . modulename : " complete_annotateddescription " <nl> mmm a / test / SourceKit / CodeComplete / complete_docbrief_1 . swift <nl> ppp b / test / SourceKit / CodeComplete / complete_docbrief_1 . swift <nl> func test ( ) { <nl> / / CHECK - NEXT : key . typename : " Void " , <nl> / / CHECK - NEXT : key . doc . brief : " This is a doc comment of P . bar " , <nl> / / CHECK - NEXT : key . context : source . codecompletion . context . superclass , <nl> - / / CHECK - NEXT : key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + / / CHECK - NEXT : key . typerelation : source . codecompletion . typerelation . unknown , <nl> / / CHECK - NEXT : key . num_bytes_to_erase : 0 , <nl> / / CHECK - NEXT : key . associated_usrs : " s : 12DocBriefTest1PPAAE3baryyF " , <nl> / / CHECK - NEXT : key . modulename : " DocBriefTest " <nl> func test ( ) { <nl> / / CHECK - NEXT : key . typename : " Void " , <nl> / / CHECK - NEXT : key . doc . brief : " This is a doc comment of P . foo " , <nl> / / CHECK - NEXT : key . context : source . codecompletion . context . thisclass , <nl> - / / CHECK - NEXT : key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + / / CHECK - NEXT : key . typerelation : source . codecompletion . typerelation . unknown , <nl> / / CHECK - NEXT : key . num_bytes_to_erase : 0 , <nl> / / CHECK - NEXT : key . associated_usrs : " s : 12DocBriefTest1SV3fooyyF s : 12DocBriefTest1PP3fooyyF " , <nl> / / CHECK - NEXT : key . modulename : " DocBriefTest " <nl> mmm a / test / SourceKit / CodeComplete / complete_docbrief_2 . swift <nl> ppp b / test / SourceKit / CodeComplete / complete_docbrief_2 . swift <nl> func test ( ) { <nl> / / CHECK - NEXT : key . typename : " Void " , <nl> / / CHECK - NEXT : key . doc . brief : " This is a doc comment of P . foo " , <nl> / / CHECK - NEXT : key . context : source . codecompletion . context . thisclass , <nl> - / / CHECK - NEXT : key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + / / CHECK - NEXT : key . typerelation : source . codecompletion . typerelation . unknown , <nl> / / CHECK - NEXT : key . num_bytes_to_erase : 0 , <nl> / / CHECK - NEXT : key . associated_usrs : " s : 12DocBriefUser1SV3fooyyF s : 12DocBriefTest1PP3fooyyF " , <nl> / / CHECK - NEXT : key . modulename : " DocBriefUser " <nl> mmm a / test / SourceKit / CodeComplete / complete_docbrief_3 . swift <nl> ppp b / test / SourceKit / CodeComplete / complete_docbrief_3 . swift <nl> func test ( ) { <nl> / / CHECK - NEXT : key . typename : " Void " , <nl> / / CHECK - NEXT : key . doc . brief : " This is a doc comment of P . foo " , <nl> / / CHECK - NEXT : key . context : source . codecompletion . context . thisclass , <nl> - / / CHECK - NEXT : key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + / / CHECK - NEXT : key . typerelation : source . codecompletion . typerelation . unknown , <nl> / / CHECK - NEXT : key . num_bytes_to_erase : 0 , <nl> / / CHECK - NEXT : key . associated_usrs : " s : 12DocBriefTest1SV3fooyyF s : 12DocBriefTest1PP3fooyyF " , <nl> / / CHECK - NEXT : key . modulename : " DocBriefTest " <nl> mmm a / test / SourceKit / CodeComplete / complete_member . swift <nl> ppp b / test / SourceKit / CodeComplete / complete_member . swift <nl> func testOverrideUSR ( ) { <nl> / / CHECK - OPTIONAL - NEXT : key . description : " fooInstanceFunc1 ( a : Int ) " , <nl> / / CHECK - OPTIONAL - NEXT : key . typename : " Double " , <nl> / / CHECK - OPTIONAL - NEXT : key . context : source . codecompletion . context . thisclass , <nl> - / / CHECK - OPTIONAL - NEXT : key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + / / CHECK - OPTIONAL - NEXT : key . typerelation : source . codecompletion . typerelation . unknown , <nl> / / CHECK - OPTIONAL - NEXT : key . num_bytes_to_erase : 1 , <nl> / / CHECK - OPTIONAL - NEXT : key . associated_usrs : " s : 15complete_member11FooProtocolP16fooInstanceFunc1ySdSiF " , <nl> / / CHECK - OPTIONAL - NEXT : key . modulename : " complete_member " <nl> func testOverrideUSR ( ) { <nl> / / CHECK - OVERRIDE_USR - NEXT : key . description : " foo ( ) " , <nl> / / CHECK - OVERRIDE_USR - NEXT : key . typename : " Void " , <nl> / / CHECK - OVERRIDE_USR - NEXT : key . context : source . codecompletion . context . thisclass , <nl> - / / CHECK - OVERRIDE_USR - NEXT : key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + / / CHECK - OVERRIDE_USR - NEXT : key . typerelation : source . codecompletion . typerelation . unknown , <nl> / / CHECK - OVERRIDE_USR - NEXT : key . num_bytes_to_erase : 0 , <nl> / / CHECK - OVERRIDE_USR - NEXT : key . associated_usrs : " s : 15complete_member7DerivedC3fooyyF s : 15complete_member4BaseC3fooyyF " , <nl> / / CHECK - OVERRIDE_USR - NEXT : key . modulename : " complete_member " <nl> mmm a / test / SourceKit / CodeComplete / complete_member . swift . response <nl> ppp b / test / SourceKit / CodeComplete / complete_member . swift . response <nl> <nl> key . description : " fooInstanceFunc0 ( ) " , <nl> key . typename : " Double " , <nl> key . context : source . codecompletion . context . thisclass , <nl> - key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + key . typerelation : source . codecompletion . typerelation . unknown , <nl> key . num_bytes_to_erase : 0 , <nl> key . associated_usrs : " s : 15complete_member11FooProtocolP16fooInstanceFunc0SdyF " , <nl> key . modulename : " complete_member " <nl> <nl> key . description : " fooInstanceFunc1 ( a : Int ) " , <nl> key . typename : " Double " , <nl> key . context : source . codecompletion . context . thisclass , <nl> - key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + key . typerelation : source . codecompletion . typerelation . unknown , <nl> key . num_bytes_to_erase : 0 , <nl> key . associated_usrs : " s : 15complete_member11FooProtocolP16fooInstanceFunc1ySdSiF " , <nl> key . modulename : " complete_member " <nl> <nl> key . typename : " Int " , <nl> key . doc . brief : " fooInstanceVar Aaa . Bbb . " , <nl> key . context : source . codecompletion . context . thisclass , <nl> - key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + key . typerelation : source . codecompletion . typerelation . unknown , <nl> key . num_bytes_to_erase : 0 , <nl> key . associated_usrs : " s : 15complete_member11FooProtocolP14fooInstanceVarSivp " , <nl> key . modulename : " complete_member " <nl> mmm a / test / SourceKit / CodeComplete / complete_optionalmethod . swift . response <nl> ppp b / test / SourceKit / CodeComplete / complete_optionalmethod . swift . response <nl> <nl> key . description : " optionalMethod ? ( ) " , <nl> key . typename : " Int " , <nl> key . context : source . codecompletion . context . thisclass , <nl> - key . typerelation : source . codecompletion . typerelation . unrelated , <nl> + key . typerelation : source . codecompletion . typerelation . unknown , <nl> key . num_bytes_to_erase : 0 , <nl> key . associated_usrs : " c : @ M @ complete_optionalmethod @ objc ( pl ) Proto ( im ) optionalMethod " , <nl> key . modulename : " complete_optionalmethod " <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
a31dd7e4c51d1f708bfd15d4f10ab161551c2cde
2020-09-10T02:11:09Z
mmm a / tensorflow / python / BUILD <nl> ppp b / tensorflow / python / BUILD <nl> py_test ( <nl> <nl> py_test ( <nl> name = " framework_importer_test " , <nl> - size = " small " , <nl> + size = " medium " , <nl> srcs = [ " framework / importer_test . py " ] , <nl> main = " framework / importer_test . py " , <nl> srcs_version = " PY2AND3 " , <nl>
framework_importer_test to size medium
tensorflow/tensorflow
2c09aaeefad66e670780d1cb99fbac342fe308fb
2016-12-27T22:24:29Z
mmm a / ports / xxhash / CONTROL <nl> ppp b / ports / xxhash / CONTROL <nl> <nl> Source : xxhash <nl> - Version : 0 . 6 . 2 <nl> + Version : 0 . 6 . 3 <nl> Description : Extremely fast hash algorithm <nl> mmm a / ports / xxhash / portfile . cmake <nl> ppp b / ports / xxhash / portfile . cmake <nl> <nl> include ( vcpkg_common_functions ) <nl> - set ( XXHASH_VERSION 0 . 6 . 2 ) <nl> - set ( SOURCE_PATH $ { CURRENT_BUILDTREES_DIR } / src / xxhash - $ { XXHASH_VERSION } ) <nl> - vcpkg_download_distfile ( ARCHIVE <nl> - URLS " https : / / github . com / Cyan4973 / xxHash / archive / v $ { XXHASH_VERSION } . zip " <nl> - FILENAME " xxhash - $ { XXHASH_VERSION } . zip " <nl> - SHA512 a2364421f46116a6e7f6bd686665fe4ee58670af6dad611ca626283c1b448fb1120ab3495903a5c8653d341ef22c0d244604edc20bf82a42734ffb4b871e2724 ) <nl> - <nl> - vcpkg_extract_source_archive ( $ { ARCHIVE } ) <nl> - <nl> - if ( VCPKG_LIBRARY_LINKAGE STREQUAL static ) <nl> - set ( XXH_STATIC ON ) <nl> - else ( ) <nl> - set ( XXH_STATIC OFF ) <nl> - endif ( ) <nl> + vcpkg_from_github ( <nl> + OUT_SOURCE_PATH SOURCE_PATH <nl> + REPO Cyan4973 / xxHash <nl> + REF v0 . 6 . 3 <nl> + SHA512 5b11009ecf142725c642be55e9072792709bd40d8674f30afdc13f9b9fd6936ea69e683c7b9df212b5126f9ba3925969fc0b65bb5518506b501bb339d3a29372 <nl> + HEAD_REF dev ) <nl> <nl> vcpkg_configure_cmake ( <nl> SOURCE_PATH $ { SOURCE_PATH } / cmake_unofficial <nl> PREFER_NINJA <nl> OPTIONS <nl> - - DBUILD_STATIC_LIBS = $ { XXH_STATIC } <nl> - DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS = ON ) <nl> <nl> vcpkg_install_cmake ( ) <nl> if ( VCPKG_LIBRARY_LINKAGE STREQUAL dynamic ) <nl> file ( READ $ { CURRENT_PACKAGES_DIR } / include / xxhash . h XXHASH_H ) <nl> string ( REPLACE " # define XXH_PUBLIC_API / * do nothing * / " " # define XXH_PUBLIC_API __declspec ( dllimport ) " XXHASH_H " $ { XXHASH_H } " ) <nl> file ( WRITE $ { CURRENT_PACKAGES_DIR } / include / xxhash . h " $ { XXHASH_H } " ) <nl> + <nl> + file ( REMOVE $ { CURRENT_PACKAGES_DIR } / bin / xxhsum . exe $ { CURRENT_PACKAGES_DIR } / debug / bin / xxhsum . exe ) <nl> + else ( ) <nl> + file ( REMOVE_RECURSE $ { CURRENT_PACKAGES_DIR } / bin $ { CURRENT_PACKAGES_DIR } / debug / bin ) <nl> endif ( ) <nl> <nl> file ( REMOVE_RECURSE $ { CURRENT_PACKAGES_DIR } / debug / include ) <nl>
[ xxhash ] update to 0 . 6 . 3
microsoft/vcpkg
5d82583cf9fa36c85e8770a082acacc9d1836e4d
2017-09-08T14:16:07Z
mmm a / shaders / src / light_punctual . fs <nl> ppp b / shaders / src / light_punctual . fs <nl> struct FroxelParams { <nl> uvec3 getFroxelCoords ( const vec3 fragCoords ) { <nl> uvec3 froxelCoord ; <nl> <nl> - froxelCoord . xy = uvec2 ( ( fragCoords . xy - frameUniforms . origin . xy ) * <nl> + vec3 adjustedFragCoords = fragCoords ; <nl> + / / In Vulkan and Metal , texture coords are Y - down . In OpenGL , texture coords are Y - up . <nl> + # if defined ( TARGET_METAL_ENVIRONMENT ) | | defined ( TARGET_VULKAN_ENVIRONMENT ) <nl> + adjustedFragCoords . y = frameUniforms . resolution . y - adjustedFragCoords . y ; <nl> + # endif <nl> + <nl> + froxelCoord . xy = uvec2 ( ( adjustedFragCoords . xy - frameUniforms . origin . xy ) * <nl> vec2 ( frameUniforms . oneOverFroxelDimension , frameUniforms . oneOverFroxelDimensionY ) ) ; <nl> <nl> froxelCoord . z = uint ( max ( 0 . 0 , <nl> - log2 ( frameUniforms . zParams . x * fragCoords . z + frameUniforms . zParams . y ) * <nl> + log2 ( frameUniforms . zParams . x * adjustedFragCoords . z + frameUniforms . zParams . y ) * <nl> frameUniforms . zParams . z + frameUniforms . zParams . w ) ) ; <nl> <nl> return froxelCoord ; <nl>
Fix froxel coordinate calculation on Metal and Vulkan ( )
google/filament
c04a111d109067a54300e9d67d3b9b9e3545943f
2019-12-09T17:57:59Z
mmm a / Installation / Windows / Plugins / SharedMemory / Contrib / SharedMem . c <nl> ppp b / Installation / Windows / Plugins / SharedMemory / Contrib / SharedMem . c <nl> BOOL CreateMyDACL ( SECURITY_ATTRIBUTES * pSA ) <nl> / / Modify these values as needed to generate the proper <nl> / / DACL for your application . <nl> TCHAR * szSD = TEXT ( " D : " ) / / Discretionary ACL <nl> - TEXT ( " ( D ; OICI ; GA ; ; ; BG ) " ) / / Deny access to <nl> - / / built - in guests <nl> - TEXT ( " ( D ; OICI ; GA ; ; ; AN ) " ) / / Deny access to <nl> - / / anonymous logon <nl> - TEXT ( " ( A ; OICI ; GWGR ; ; ; AU ) " ) <nl> + TEXT ( " ( A ; OICI ; GA ; ; ; BG ) " ) / / Allow built - in guests <nl> + TEXT ( " ( A ; OICI ; GA ; ; ; AN ) " ) / / Allow anonymous logon <nl> + TEXT ( " ( A ; OICI ; GA ; ; ; AU ) " ) <nl> / / TEXT ( " ( A ; OICI ; GRGWGX ; ; ; AU ) " ) / / Allow <nl> / / read / write / execute <nl> / / to authenticated <nl>
every body get access rights to shared mem segment of installer
arangodb/arangodb
352cd175c61fbfbe1c27beb3c904eb0452807c8a
2014-05-01T12:03:09Z
mmm a / client / undef_macros . h <nl> ppp b / client / undef_macros . h <nl> <nl> # undef ctime <nl> <nl> / / util / debug_util . h <nl> - # undef WIN <nl> # undef DEV <nl> # undef DEBUGGING <nl> # undef SOMETIMES <nl> mmm a / db / clientcursor . cpp <nl> ppp b / db / clientcursor . cpp <nl> namespace mongo { <nl> <nl> while ( 1 ) { <nl> toAdvance . push_back ( j - > second ) ; <nl> - WIN assert ( j - > first = = dl ) ; <nl> + DEV assert ( j - > first = = dl ) ; <nl> + + j ; <nl> if ( j = = stop ) <nl> break ; <nl> mmm a / util / debug_util . h <nl> ppp b / util / debug_util . h <nl> namespace mongo { <nl> char string [ 400 ] ; <nl> } * OWS ; <nl> <nl> - / / for now , running on win32 means development not production - - <nl> - / / use this to log things just there . <nl> - # if defined ( _WIN32 ) <nl> - # define MONGO_WIN if ( 1 ) <nl> - # else <nl> - # define MONGO_WIN if ( 0 ) <nl> - # endif <nl> - # define WIN MONGO_WIN <nl> - <nl> - <nl> # if defined ( _DEBUG ) <nl> # define MONGO_DEV if ( 1 ) <nl> # else <nl> namespace mongo { <nl> # endif <nl> # define DEV MONGO_DEV <nl> <nl> - <nl> # define MONGO_DEBUGGING if ( 0 ) <nl> # define DEBUGGING MONGO_DEBUGGING <nl> <nl>
decruft
mongodb/mongo
ebb1a574eb81481911fd0278dee49bed86ae8ae8
2010-04-24T18:42:59Z
mmm a / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGLES . cpp <nl> ppp b / xbmc / cores / VideoPlayer / VideoRenderers / HwDecRender / RendererVAAPIGLES . cpp <nl> bool CRendererVAAPI : : CreateTexture ( int index ) <nl> return CreateNV12Texture ( index ) ; <nl> } <nl> <nl> - YUVBUFFER & buf = m_buffers [ index ] ; <nl> + CPictureBuffer & buf = m_buffers [ index ] ; <nl> YuvImage & im = buf . image ; <nl> YUVPLANE ( & planes ) [ YuvImage : : MAX_PLANES ] = buf . fields [ 0 ] ; <nl> <nl> void CRendererVAAPI : : DeleteTexture ( int index ) <nl> return ; <nl> } <nl> <nl> - YUVBUFFER & buf = m_buffers [ index ] ; <nl> + CPictureBuffer & buf = m_buffers [ index ] ; <nl> buf . fields [ FIELD_FULL ] [ 0 ] . id = 0 ; <nl> buf . fields [ FIELD_FULL ] [ 1 ] . id = 0 ; <nl> buf . fields [ FIELD_FULL ] [ 2 ] . id = 0 ; <nl> bool CRendererVAAPI : : UploadTexture ( int index ) <nl> return UploadNV12Texture ( index ) ; <nl> } <nl> <nl> - YUVBUFFER & buf = m_buffers [ index ] ; <nl> + CPictureBuffer & buf = m_buffers [ index ] ; <nl> <nl> CVaapiRenderPicture * pic = dynamic_cast < CVaapiRenderPicture * > ( buf . videoBuffer ) ; <nl> <nl>
RendererVAAPIGLES : update YUVBUFFER to CPictureBuffer
xbmc/xbmc
45f4f41871ae67896f3fb2ce08787b980d398092
2018-06-13T06:24:05Z
mmm a / main / main . cpp <nl> ppp b / main / main . cpp <nl> bool Main : : start ( ) { <nl> bool export_debug = false ; <nl> List < String > args = OS : : get_singleton ( ) - > get_cmdline_args ( ) ; <nl> for ( int i = 0 ; i < args . size ( ) ; i + + ) { <nl> - <nl> - <nl> - if ( args [ i ] = = " - doctool " & & i < ( args . size ( ) - 1 ) ) { <nl> - <nl> - doc_tool = args [ i + 1 ] ; <nl> + / / parameters that have an argument to the right <nl> + if ( i < ( args . size ( ) - 1 ) ) { <nl> + if ( args [ i ] = = " - doctool " ) { <nl> + doc_tool = args [ i + 1 ] ; <nl> + } else if ( args [ i ] = = " - script " | | args [ i ] = = " - s " ) { <nl> + script = args [ i + 1 ] ; <nl> + } else if ( args [ i ] = = " - level " | | args [ i ] = = " - l " ) { <nl> + OS : : get_singleton ( ) - > _custom_level = args [ i + 1 ] ; <nl> + } else if ( args [ i ] = = " - test " ) { <nl> + test = args [ i + 1 ] ; <nl> + } else if ( args [ i ] = = " - optimize " ) { <nl> + optimize = args [ i + 1 ] ; <nl> + } else if ( args [ i ] = = " - optimize_preset " ) { <nl> + optimize_preset = args [ i + 1 ] ; <nl> + } else if ( args [ i ] = = " - export " ) { <nl> + editor = true ; / / needs editor <nl> + _export_platform = args [ i + 1 ] ; <nl> + } else if ( args [ i ] = = " - export_debug " ) { <nl> + editor = true ; / / needs editor <nl> + _export_platform = args [ i + 1 ] ; <nl> + export_debug = true ; <nl> + } else if ( args [ i ] = = " - import " ) { <nl> + editor = true ; / / needs editor <nl> + _import = args [ i + 1 ] ; <nl> + } else if ( args [ i ] = = " - import_script " ) { <nl> + editor = true ; / / needs editor <nl> + _import_script = args [ i + 1 ] ; <nl> + } else if ( args [ i ] = = " - dumpstrings " ) { <nl> + editor = true ; / / needs editor <nl> + dumpstrings = args [ i + 1 ] ; <nl> + } <nl> i + + ; <nl> - } else if ( args [ i ] = = " - nodocbase " ) { <nl> - <nl> + } <nl> + / / parameters that do not have an argument to the right <nl> + if ( args [ i ] = = " - nodocbase " ) { <nl> doc_base = false ; <nl> - } else if ( ( args [ i ] = = " - script " | | args [ i ] = = " - s " ) & & i < ( args . size ( ) - 1 ) ) { <nl> - <nl> - script = args [ i + 1 ] ; <nl> - i + + ; <nl> - } else if ( ( args [ i ] = = " - level " | | args [ i ] = = " - l " ) & & i < ( args . size ( ) - 1 ) ) { <nl> - <nl> - OS : : get_singleton ( ) - > _custom_level = args [ i + 1 ] ; <nl> - i + + ; <nl> - } else if ( args [ i ] = = " - test " & & i < ( args . size ( ) - 1 ) ) { <nl> - test = args [ i + 1 ] ; <nl> - i + + ; <nl> - } else if ( args [ i ] = = " - optimize " & & i < ( args . size ( ) - 1 ) ) { <nl> - optimize = args [ i + 1 ] ; <nl> - i + + ; <nl> - } else if ( args [ i ] = = " - optimize_preset " & & i < ( args . size ( ) - 1 ) ) { <nl> - optimize_preset = args [ i + 1 ] ; <nl> - i + + ; <nl> - } else if ( args [ i ] = = " - export " & & i < ( args . size ( ) - 1 ) ) { <nl> - editor = true ; / / needs editor <nl> - _export_platform = args [ i + 1 ] ; <nl> - i + + ; <nl> - } else if ( args [ i ] = = " - export_debug " & & i < ( args . size ( ) - 1 ) ) { <nl> - editor = true ; / / needs editor <nl> - _export_platform = args [ i + 1 ] ; <nl> - export_debug = true ; <nl> - i + + ; <nl> - } else if ( args [ i ] = = " - import " & & i < ( args . size ( ) - 1 ) ) { <nl> - editor = true ; / / needs editor <nl> - _import = args [ i + 1 ] ; <nl> - i + + ; <nl> - } else if ( args [ i ] = = " - import_script " & & i < ( args . size ( ) - 1 ) ) { <nl> - editor = true ; / / needs editor <nl> - _import_script = args [ i + 1 ] ; <nl> - i + + ; <nl> - } else if ( args [ i ] = = " - noquit " ) { <nl> + } else if ( args [ i ] = = " - noquit " ) { <nl> noquit = true ; <nl> - } else if ( args [ i ] = = " - dumpstrings " & & i < ( args . size ( ) - 1 ) ) { <nl> - editor = true ; / / needs editor <nl> - dumpstrings = args [ i + 1 ] ; <nl> - i + + ; <nl> - } else if ( args [ i ] = = " - editor " | | args [ i ] = = " - e " ) { <nl> - editor = true ; <nl> } else if ( args [ i ] = = " - convert_old " ) { <nl> convert_old = true ; <nl> + } else if ( args [ i ] = = " - editor " | | args [ i ] = = " - e " ) { <nl> + editor = true ; <nl> } else if ( args [ i ] . length ( ) & & args [ i ] [ 0 ] ! = ' - ' & & game_path = = " " ) { <nl> - <nl> game_path = args [ i ] ; <nl> } <nl> } <nl> mmm a / scene / gui / text_edit . cpp <nl> ppp b / scene / gui / text_edit . cpp <nl> void TextEdit : : _notification ( int p_what ) { <nl> if ( in_region = = - 1 & & ! in_keyword & & is_char & & ! prev_is_char ) { <nl> <nl> int to = j ; <nl> - while ( _is_text_char ( str [ to ] ) & & to < str . length ( ) ) <nl> + while ( to < str . length ( ) & & _is_text_char ( str [ to ] ) ) <nl> to + + ; <nl> <nl> uint32_t hash = String : : hash ( & str [ j ] , to - j ) ; <nl>
ran cppcheck , fixed cases where array index is used before limits check
godotengine/godot
692216b86ab97db91e7ff3903ffc9ac8e37433f6
2015-10-12T14:45:44Z
mmm a / doc / classes / Theme . xml <nl> ppp b / doc / classes / Theme . xml <nl> <nl> Returns all the [ Color ] s as a [ PackedStringArray ] filled with each [ Color ] ' s name , for use in [ method get_color ] , if the theme has [ code ] node_type [ / code ] . <nl> < / description > <nl> < / method > <nl> + < method name = " get_color_type_list " qualifiers = " const " > <nl> + < return type = " PackedStringArray " > <nl> + < / return > <nl> + < description > <nl> + Returns all the [ Color ] types as a [ PackedStringArray ] filled with unique type names , for use in [ method get_color ] and / or [ method get_color_list ] . <nl> + < / description > <nl> + < / method > <nl> < method name = " get_constant " qualifiers = " const " > <nl> < return type = " int " > <nl> < / return > <nl> <nl> Returns all the constants as a [ PackedStringArray ] filled with each constant ' s name , for use in [ method get_constant ] , if the theme has [ code ] node_type [ / code ] . <nl> < / description > <nl> < / method > <nl> + < method name = " get_constant_type_list " qualifiers = " const " > <nl> + < return type = " PackedStringArray " > <nl> + < / return > <nl> + < description > <nl> + Returns all the constant types as a [ PackedStringArray ] filled with unique type names , for use in [ method get_constant ] and / or [ method get_constant_list ] . <nl> + < / description > <nl> + < / method > <nl> < method name = " get_font " qualifiers = " const " > <nl> < return type = " Font " > <nl> < / return > <nl> <nl> Returns all the font sizes as a [ PackedStringArray ] filled with each font size name , for use in [ method get_font_size ] , if the theme has [ code ] node_type [ / code ] . <nl> < / description > <nl> < / method > <nl> + < method name = " get_font_type_list " qualifiers = " const " > <nl> + < return type = " PackedStringArray " > <nl> + < / return > <nl> + < description > <nl> + Returns all the [ Font ] types as a [ PackedStringArray ] filled with unique type names , for use in [ method get_font ] and / or [ method get_font_list ] . <nl> + < / description > <nl> + < / method > <nl> < method name = " get_icon " qualifiers = " const " > <nl> < return type = " Texture2D " > <nl> < / return > <nl> <nl> Returns all the icons as a [ PackedStringArray ] filled with each [ Texture2D ] ' s name , for use in [ method get_icon ] , if the theme has [ code ] node_type [ / code ] . <nl> < / description > <nl> < / method > <nl> + < method name = " get_icon_type_list " qualifiers = " const " > <nl> + < return type = " PackedStringArray " > <nl> + < / return > <nl> + < description > <nl> + Returns all the icon types as a [ PackedStringArray ] filled with unique type names , for use in [ method get_icon ] and / or [ method get_icon_list ] . <nl> + < / description > <nl> + < / method > <nl> < method name = " get_stylebox " qualifiers = " const " > <nl> < return type = " StyleBox " > <nl> < / return > <nl> <nl> Returns all the [ StyleBox ] s as a [ PackedStringArray ] filled with each [ StyleBox ] ' s name , for use in [ method get_stylebox ] , if the theme has [ code ] node_type [ / code ] . <nl> < / description > <nl> < / method > <nl> - < method name = " get_stylebox_types " qualifiers = " const " > <nl> + < method name = " get_stylebox_type_list " qualifiers = " const " > <nl> < return type = " PackedStringArray " > <nl> < / return > <nl> < description > <nl> - Returns all the [ StyleBox ] types as a [ PackedStringArray ] filled with each [ StyleBox ] ' s type , for use in [ method get_stylebox ] and / or [ method get_stylebox_list ] , if the theme has [ code ] node_type [ / code ] . <nl> + Returns all the [ StyleBox ] types as a [ PackedStringArray ] filled with unique type names , for use in [ method get_stylebox ] and / or [ method get_stylebox_list ] . <nl> < / description > <nl> < / method > <nl> < method name = " get_type_list " qualifiers = " const " > <nl> < return type = " PackedStringArray " > <nl> < / return > <nl> - < argument index = " 0 " name = " node_type " type = " String " > <nl> - < / argument > <nl> < description > <nl> - Returns all the types in [ code ] node_type [ / code ] as a [ PackedStringArray ] for use in any of the [ code ] get_ * [ / code ] functions , if the theme has [ code ] node_type [ / code ] . <nl> + Returns all the theme types as a [ PackedStringArray ] filled with unique type names , for use in other [ code ] get_ * [ / code ] functions of this theme . <nl> < / description > <nl> < / method > <nl> < method name = " has_color " qualifiers = " const " > <nl> mmm a / scene / resources / theme . cpp <nl> ppp b / scene / resources / theme . cpp <nl> Vector < String > Theme : : _get_icon_list ( const String & p_node_type ) const { <nl> return ilret ; <nl> } <nl> <nl> + Vector < String > Theme : : _get_icon_type_list ( ) const { <nl> + Vector < String > ilret ; <nl> + List < StringName > il ; <nl> + <nl> + get_icon_type_list ( & il ) ; <nl> + ilret . resize ( il . size ( ) ) ; <nl> + <nl> + int i = 0 ; <nl> + String * w = ilret . ptrw ( ) ; <nl> + for ( List < StringName > : : Element * E = il . front ( ) ; E ; E = E - > next ( ) , i + + ) { <nl> + w [ i ] = E - > get ( ) ; <nl> + } <nl> + return ilret ; <nl> + } <nl> + <nl> Vector < String > Theme : : _get_stylebox_list ( const String & p_node_type ) const { <nl> Vector < String > ilret ; <nl> List < StringName > il ; <nl> Vector < String > Theme : : _get_stylebox_list ( const String & p_node_type ) const { <nl> return ilret ; <nl> } <nl> <nl> - Vector < String > Theme : : _get_stylebox_types ( ) const { <nl> + Vector < String > Theme : : _get_stylebox_type_list ( ) const { <nl> Vector < String > ilret ; <nl> List < StringName > il ; <nl> <nl> - get_stylebox_types ( & il ) ; <nl> + get_stylebox_type_list ( & il ) ; <nl> ilret . resize ( il . size ( ) ) ; <nl> <nl> int i = 0 ; <nl> Vector < String > Theme : : _get_font_list ( const String & p_node_type ) const { <nl> return ilret ; <nl> } <nl> <nl> + Vector < String > Theme : : _get_font_type_list ( ) const { <nl> + Vector < String > ilret ; <nl> + List < StringName > il ; <nl> + <nl> + get_font_type_list ( & il ) ; <nl> + ilret . resize ( il . size ( ) ) ; <nl> + <nl> + int i = 0 ; <nl> + String * w = ilret . ptrw ( ) ; <nl> + for ( List < StringName > : : Element * E = il . front ( ) ; E ; E = E - > next ( ) , i + + ) { <nl> + w [ i ] = E - > get ( ) ; <nl> + } <nl> + return ilret ; <nl> + } <nl> + <nl> Vector < String > Theme : : _get_font_size_list ( const String & p_node_type ) const { <nl> Vector < String > ilret ; <nl> List < StringName > il ; <nl> Vector < String > Theme : : _get_color_list ( const String & p_node_type ) const { <nl> return ilret ; <nl> } <nl> <nl> + Vector < String > Theme : : _get_color_type_list ( ) const { <nl> + Vector < String > ilret ; <nl> + List < StringName > il ; <nl> + <nl> + get_color_type_list ( & il ) ; <nl> + ilret . resize ( il . size ( ) ) ; <nl> + <nl> + int i = 0 ; <nl> + String * w = ilret . ptrw ( ) ; <nl> + for ( List < StringName > : : Element * E = il . front ( ) ; E ; E = E - > next ( ) , i + + ) { <nl> + w [ i ] = E - > get ( ) ; <nl> + } <nl> + return ilret ; <nl> + } <nl> + <nl> Vector < String > Theme : : _get_constant_list ( const String & p_node_type ) const { <nl> Vector < String > ilret ; <nl> List < StringName > il ; <nl> Vector < String > Theme : : _get_constant_list ( const String & p_node_type ) const { <nl> return ilret ; <nl> } <nl> <nl> - Vector < String > Theme : : _get_type_list ( const String & p_node_type ) const { <nl> + Vector < String > Theme : : _get_constant_type_list ( ) const { <nl> + Vector < String > ilret ; <nl> + List < StringName > il ; <nl> + <nl> + get_constant_type_list ( & il ) ; <nl> + ilret . resize ( il . size ( ) ) ; <nl> + <nl> + int i = 0 ; <nl> + String * w = ilret . ptrw ( ) ; <nl> + for ( List < StringName > : : Element * E = il . front ( ) ; E ; E = E - > next ( ) , i + + ) { <nl> + w [ i ] = E - > get ( ) ; <nl> + } <nl> + return ilret ; <nl> + } <nl> + <nl> + Vector < String > Theme : : _get_type_list ( ) const { <nl> Vector < String > ilret ; <nl> List < StringName > il ; <nl> <nl> void Theme : : get_icon_list ( StringName p_node_type , List < StringName > * p_list ) cons <nl> } <nl> } <nl> <nl> + void Theme : : get_icon_type_list ( List < StringName > * p_list ) const { <nl> + ERR_FAIL_NULL ( p_list ) ; <nl> + <nl> + const StringName * key = nullptr ; <nl> + while ( ( key = icon_map . next ( key ) ) ) { <nl> + p_list - > push_back ( * key ) ; <nl> + } <nl> + } <nl> + <nl> void Theme : : set_stylebox ( const StringName & p_name , const StringName & p_node_type , const Ref < StyleBox > & p_style ) { <nl> / / ERR_FAIL_COND ( p_style . is_null ( ) ) ; <nl> <nl> void Theme : : get_stylebox_list ( StringName p_node_type , List < StringName > * p_list ) <nl> } <nl> } <nl> <nl> - void Theme : : get_stylebox_types ( List < StringName > * p_list ) const { <nl> + void Theme : : get_stylebox_type_list ( List < StringName > * p_list ) const { <nl> ERR_FAIL_NULL ( p_list ) ; <nl> <nl> const StringName * key = nullptr ; <nl> void Theme : : get_font_list ( StringName p_node_type , List < StringName > * p_list ) cons <nl> } <nl> } <nl> <nl> + void Theme : : get_font_type_list ( List < StringName > * p_list ) const { <nl> + ERR_FAIL_NULL ( p_list ) ; <nl> + <nl> + const StringName * key = nullptr ; <nl> + while ( ( key = font_map . next ( key ) ) ) { <nl> + p_list - > push_back ( * key ) ; <nl> + } <nl> + } <nl> + <nl> void Theme : : set_font_size ( const StringName & p_name , const StringName & p_node_type , int p_font_size ) { <nl> bool new_value = ! font_size_map . has ( p_node_type ) | | ! font_size_map [ p_node_type ] . has ( p_name ) ; <nl> <nl> void Theme : : get_color_list ( StringName p_node_type , List < StringName > * p_list ) con <nl> } <nl> } <nl> <nl> + void Theme : : get_color_type_list ( List < StringName > * p_list ) const { <nl> + ERR_FAIL_NULL ( p_list ) ; <nl> + <nl> + const StringName * key = nullptr ; <nl> + while ( ( key = color_map . next ( key ) ) ) { <nl> + p_list - > push_back ( * key ) ; <nl> + } <nl> + } <nl> + <nl> void Theme : : set_constant ( const StringName & p_name , const StringName & p_node_type , int p_constant ) { <nl> bool new_value = ! constant_map . has ( p_node_type ) | | ! constant_map [ p_node_type ] . has ( p_name ) ; <nl> constant_map [ p_node_type ] [ p_name ] = p_constant ; <nl> void Theme : : get_constant_list ( StringName p_node_type , List < StringName > * p_list ) <nl> } <nl> } <nl> <nl> + void Theme : : get_constant_type_list ( List < StringName > * p_list ) const { <nl> + ERR_FAIL_NULL ( p_list ) ; <nl> + <nl> + const StringName * key = nullptr ; <nl> + while ( ( key = constant_map . next ( key ) ) ) { <nl> + p_list - > push_back ( * key ) ; <nl> + } <nl> + } <nl> + <nl> void Theme : : clear ( ) { <nl> / / these need disconnecting <nl> { <nl> void Theme : : _bind_methods ( ) { <nl> ClassDB : : bind_method ( D_METHOD ( " has_icon " , " name " , " node_type " ) , & Theme : : has_icon ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " clear_icon " , " name " , " node_type " ) , & Theme : : clear_icon ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_icon_list " , " node_type " ) , & Theme : : _get_icon_list ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_icon_type_list " ) , & Theme : : _get_icon_type_list ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " set_stylebox " , " name " , " node_type " , " texture " ) , & Theme : : set_stylebox ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_stylebox " , " name " , " node_type " ) , & Theme : : get_stylebox ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " has_stylebox " , " name " , " node_type " ) , & Theme : : has_stylebox ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " clear_stylebox " , " name " , " node_type " ) , & Theme : : clear_stylebox ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_stylebox_list " , " node_type " ) , & Theme : : _get_stylebox_list ) ; <nl> - ClassDB : : bind_method ( D_METHOD ( " get_stylebox_types " ) , & Theme : : _get_stylebox_types ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_stylebox_type_list " ) , & Theme : : _get_stylebox_type_list ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " set_font " , " name " , " node_type " , " font " ) , & Theme : : set_font ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_font " , " name " , " node_type " ) , & Theme : : get_font ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " has_font " , " name " , " node_type " ) , & Theme : : has_font ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " clear_font " , " name " , " node_type " ) , & Theme : : clear_font ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_font_list " , " node_type " ) , & Theme : : _get_font_list ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_font_type_list " ) , & Theme : : _get_font_type_list ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " set_font_size " , " name " , " node_type " , " font_size " ) , & Theme : : set_font_size ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_font_size " , " name " , " node_type " ) , & Theme : : get_font_size ) ; <nl> void Theme : : _bind_methods ( ) { <nl> ClassDB : : bind_method ( D_METHOD ( " has_color " , " name " , " node_type " ) , & Theme : : has_color ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " clear_color " , " name " , " node_type " ) , & Theme : : clear_color ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_color_list " , " node_type " ) , & Theme : : _get_color_list ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_color_type_list " ) , & Theme : : _get_color_type_list ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " set_constant " , " name " , " node_type " , " constant " ) , & Theme : : set_constant ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_constant " , " name " , " node_type " ) , & Theme : : get_constant ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " has_constant " , " name " , " node_type " ) , & Theme : : has_constant ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " clear_constant " , " name " , " node_type " ) , & Theme : : clear_constant ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_constant_list " , " node_type " ) , & Theme : : _get_constant_list ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_constant_type_list " ) , & Theme : : _get_constant_type_list ) ; <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " clear " ) , & Theme : : clear ) ; <nl> <nl> void Theme : : _bind_methods ( ) { <nl> ClassDB : : bind_method ( D_METHOD ( " set_default_font_size " , " font_size " ) , & Theme : : set_default_theme_font_size ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " get_default_font_size " ) , & Theme : : get_default_theme_font_size ) ; <nl> <nl> - ClassDB : : bind_method ( D_METHOD ( " get_type_list " , " node_type " ) , & Theme : : _get_type_list ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_type_list " ) , & Theme : : _get_type_list ) ; <nl> <nl> ClassDB : : bind_method ( " copy_default_theme " , & Theme : : copy_default_theme ) ; <nl> ClassDB : : bind_method ( D_METHOD ( " copy_theme " , " other " ) , & Theme : : copy_theme ) ; <nl> mmm a / scene / resources / theme . h <nl> ppp b / scene / resources / theme . h <nl> class Theme : public Resource { <nl> HashMap < StringName , HashMap < StringName , int > > constant_map ; <nl> <nl> Vector < String > _get_icon_list ( const String & p_node_type ) const ; <nl> + Vector < String > _get_icon_type_list ( ) const ; <nl> Vector < String > _get_stylebox_list ( const String & p_node_type ) const ; <nl> - Vector < String > _get_stylebox_types ( ) const ; <nl> + Vector < String > _get_stylebox_type_list ( ) const ; <nl> Vector < String > _get_font_list ( const String & p_node_type ) const ; <nl> + Vector < String > _get_font_type_list ( ) const ; <nl> Vector < String > _get_font_size_list ( const String & p_node_type ) const ; <nl> Vector < String > _get_color_list ( const String & p_node_type ) const ; <nl> + Vector < String > _get_color_type_list ( ) const ; <nl> Vector < String > _get_constant_list ( const String & p_node_type ) const ; <nl> - Vector < String > _get_type_list ( const String & p_node_type ) const ; <nl> + Vector < String > _get_constant_type_list ( ) const ; <nl> + Vector < String > _get_type_list ( ) const ; <nl> <nl> protected : <nl> bool _set ( const StringName & p_name , const Variant & p_value ) ; <nl> class Theme : public Resource { <nl> bool has_icon ( const StringName & p_name , const StringName & p_node_type ) const ; <nl> void clear_icon ( const StringName & p_name , const StringName & p_node_type ) ; <nl> void get_icon_list ( StringName p_node_type , List < StringName > * p_list ) const ; <nl> + void get_icon_type_list ( List < StringName > * p_list ) const ; <nl> <nl> void set_stylebox ( const StringName & p_name , const StringName & p_node_type , const Ref < StyleBox > & p_style ) ; <nl> Ref < StyleBox > get_stylebox ( const StringName & p_name , const StringName & p_node_type ) const ; <nl> bool has_stylebox ( const StringName & p_name , const StringName & p_node_type ) const ; <nl> void clear_stylebox ( const StringName & p_name , const StringName & p_node_type ) ; <nl> void get_stylebox_list ( StringName p_node_type , List < StringName > * p_list ) const ; <nl> - void get_stylebox_types ( List < StringName > * p_list ) const ; <nl> + void get_stylebox_type_list ( List < StringName > * p_list ) const ; <nl> <nl> void set_font ( const StringName & p_name , const StringName & p_node_type , const Ref < Font > & p_font ) ; <nl> Ref < Font > get_font ( const StringName & p_name , const StringName & p_node_type ) const ; <nl> bool has_font ( const StringName & p_name , const StringName & p_node_type ) const ; <nl> void clear_font ( const StringName & p_name , const StringName & p_node_type ) ; <nl> void get_font_list ( StringName p_node_type , List < StringName > * p_list ) const ; <nl> + void get_font_type_list ( List < StringName > * p_list ) const ; <nl> <nl> void set_font_size ( const StringName & p_name , const StringName & p_node_type , int p_font_size ) ; <nl> int get_font_size ( const StringName & p_name , const StringName & p_node_type ) const ; <nl> class Theme : public Resource { <nl> bool has_color ( const StringName & p_name , const StringName & p_node_type ) const ; <nl> void clear_color ( const StringName & p_name , const StringName & p_node_type ) ; <nl> void get_color_list ( StringName p_node_type , List < StringName > * p_list ) const ; <nl> + void get_color_type_list ( List < StringName > * p_list ) const ; <nl> <nl> void set_constant ( const StringName & p_name , const StringName & p_node_type , int p_constant ) ; <nl> int get_constant ( const StringName & p_name , const StringName & p_node_type ) const ; <nl> bool has_constant ( const StringName & p_name , const StringName & p_node_type ) const ; <nl> void clear_constant ( const StringName & p_name , const StringName & p_node_type ) ; <nl> void get_constant_list ( StringName p_node_type , List < StringName > * p_list ) const ; <nl> + void get_constant_type_list ( List < StringName > * p_list ) const ; <nl> <nl> void get_type_list ( List < StringName > * p_list ) const ; <nl> <nl>
Remove unused argument in Theme method and expose missing methods
godotengine/godot
8d608cdc40b780e166c0b56a09055f4eb4ae8311
2020-12-17T12:51:08Z
mmm a / test / cpp / microbenchmarks / bm_cq_multiple_threads . cc <nl> ppp b / test / cpp / microbenchmarks / bm_cq_multiple_threads . cc <nl> static void pollset_init ( grpc_pollset * ps , gpr_mu * * mu ) { <nl> * mu = & ps - > mu ; <nl> } <nl> <nl> - static void pollset_destroy ( grpc_pollset * ps ) { gpr_mu_destroy ( & ps - > mu ) ; } <nl> + static void pollset_destroy ( grpc_exec_ctx * exec_ctx , grpc_pollset * ps ) { <nl> + gpr_mu_destroy ( & ps - > mu ) ; <nl> + } <nl> <nl> static grpc_error * pollset_kick ( grpc_pollset * p , grpc_pollset_worker * worker ) { <nl> return GRPC_ERROR_NONE ; <nl>
Update to new API
grpc/grpc
cc92eb42a4404b92f7dacace68090fd1f9111c4a
2017-04-19T13:54:25Z
mmm a / . travis . yml <nl> ppp b / . travis . yml <nl> <nl> language : c <nl> before_script : " bash - c ' cd UnitTests / HttpInterface & & bundle ' " <nl> - script : " make setup & & . / configure - - enable - relative - - enable - all - in - one - libev - - enable - all - in - one - v8 - - enable - all - in - one - icu & & make & & make unittests " <nl> + script : " make setup & & . / configure - - enable - relative - - enable - all - in - one - libev - - enable - all - in - one - v8 - - enable - all - in - one - icu & & make - j2 & & make unittests " <nl> <nl> branches : <nl> only : <nl>
try again . . .
arangodb/arangodb
31e1d7bdc6999823640b5f606014104ddf1e5797
2012-09-26T13:36:29Z
mmm a / native_client / definitions . mk <nl> ppp b / native_client / definitions . mk <nl> endif <nl> endif <nl> <nl> ifeq ( $ ( TARGET ) , rpi3 ) <nl> - TOOLCHAIN ? = $ { TFDIR } / bazel - $ ( shell basename " $ { TFDIR } " ) / external / GccArmRpi / arm - bcm2708 / arm - rpi - 4 . 9 . 3 - linux - gnueabihf / bin / arm - linux - gnueabihf - <nl> - RASPBIAN ? = $ ( abspath $ ( NC_DIR ) / . . / multistrap - raspbian - jessie ) <nl> - CFLAGS : = - isystem $ ( RASPBIAN ) / usr / include - isystem $ ( RASPBIAN ) / usr / include / arm - linux - gnueabihf <nl> - LDFLAGS : = - Wl , - rpath - link , $ ( RASPBIAN ) / lib / arm - linux - gnueabihf - Wl , - rpath - link , $ ( RASPBIAN ) / usr / lib / arm - linux - gnueabihf / <nl> + TOOLCHAIN ? = $ { TFDIR } / bazel - $ ( shell basename " $ { TFDIR } " ) / external / LinaroArmGcc72 / bin / arm - linux - gnueabihf - <nl> + RASPBIAN ? = $ ( abspath $ ( NC_DIR ) / . . / multistrap - raspbian - stretch ) <nl> + CFLAGS : = - D_GLIBCXX_USE_CXX11_ABI = 0 - isystem $ ( RASPBIAN ) / usr / include - isystem $ ( RASPBIAN ) / usr / include / arm - linux - gnueabihf <nl> + LDFLAGS : = $ ( RASPBIAN ) / lib / arm - linux - gnueabihf / libc . so . 6 - Wl , - rpath - link , $ ( RASPBIAN ) / lib / arm - linux - gnueabihf / - Wl , - rpath - link , $ ( RASPBIAN ) / usr / lib / arm - linux - gnueabihf / <nl> <nl> SOX_CFLAGS : = <nl> SOX_LDFLAGS : = $ ( RASPBIAN ) / usr / lib / arm - linux - gnueabihf / libsox . so <nl> mmm a / native_client / multistrap . conf <nl> ppp b / native_client / multistrap . conf <nl> aptsources = Raspbian <nl> cleanup = true <nl> <nl> [ Raspbian ] <nl> - packages = libc6 - dev libpython2 . 7 - dev libpython3 . 4 - dev libsox - dev python - numpy <nl> + packages = libc6 libc6 - dev libstdc + + - 6 - dev linux - libc - dev libpython2 . 7 - dev libpython3 . 4 - dev libsox - dev python - numpy <nl> source = http : / / mirrordirector . raspbian . org / raspbian / <nl> keyring = raspbian - archive - keyring <nl> components = main <nl> - suite = jessie <nl> + suite = stretch <nl> mmm a / taskcluster / darwin - amd64 - cpu - aot_prod - opt . yml <nl> ppp b / taskcluster / darwin - amd64 - cpu - aot_prod - opt . yml <nl> build : <nl> - " index . project . deepspeech . deepspeech . native_client . $ { event . head . branch } . osx_aot " <nl> - " index . project . deepspeech . deepspeech . native_client . $ { event . head . branch } . $ { event . head . sha } . osx_aot " <nl> - " index . project . deepspeech . deepspeech . native_client . osx_aot . $ { event . head . sha } " <nl> - tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . osx / artifacts / public / home . tar . xz " <nl> - summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . osx / artifacts / public / summarize_graph " <nl> + tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . osx / artifacts / public / home . tar . xz " <nl> + summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . osx / artifacts / public / summarize_graph " <nl> scripts : <nl> build : " taskcluster / host - build . sh - - aot " <nl> package : " taskcluster / package . sh " <nl> mmm a / taskcluster / darwin - amd64 - cpu - opt . yml <nl> ppp b / taskcluster / darwin - amd64 - cpu - opt . yml <nl> build : <nl> - " index . project . deepspeech . deepspeech . native_client . osx . $ { event . head . sha } " <nl> - " notify . irc - channel . $ { notifications . irc } . on - exception " <nl> - " notify . irc - channel . $ { notifications . irc } . on - failed " <nl> - tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . osx / artifacts / public / home . tar . xz " <nl> - summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . osx / artifacts / public / summarize_graph " <nl> + tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . osx / artifacts / public / home . tar . xz " <nl> + summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . osx / artifacts / public / summarize_graph " <nl> scripts : <nl> build : " taskcluster / host - build . sh " <nl> package : " taskcluster / package . sh " <nl> mmm a / taskcluster / linux - amd64 - cpu - aot_prod - opt . yml <nl> ppp b / taskcluster / linux - amd64 - cpu - aot_prod - opt . yml <nl> build : <nl> - " index . project . deepspeech . deepspeech . native_client . $ { event . head . branch } . cpu_aot " <nl> - " index . project . deepspeech . deepspeech . native_client . $ { event . head . branch } . $ { event . head . sha } . cpu_aot " <nl> - " index . project . deepspeech . deepspeech . native_client . cpu_aot . $ { event . head . sha } " <nl> - tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / home . tar . xz " <nl> - summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / summarize_graph " <nl> + tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / home . tar . xz " <nl> + summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / summarize_graph " <nl> system_setup : <nl> > <nl> $ { nodejs . packages . prep_6 } & & apt - get - qq update & & apt - get - qq - y install nodejs python - yaml & & <nl> mmm a / taskcluster / linux - amd64 - cpu - aot_test - opt . yml <nl> ppp b / taskcluster / linux - amd64 - cpu - aot_test - opt . yml <nl> build : <nl> template_file : linux - opt - base . tyml <nl> dependencies : <nl> - " test - training_upstream - linux - amd64 - py27mu - opt " <nl> - tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / home . tar . xz " <nl> - summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / summarize_graph " <nl> + tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / home . tar . xz " <nl> + summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / summarize_graph " <nl> system_setup : <nl> > <nl> $ { nodejs . packages . prep_6 } & & apt - get - qq update & & apt - get - qq - y install nodejs python - yaml & & <nl> mmm a / taskcluster / linux - amd64 - cpu - opt . yml <nl> ppp b / taskcluster / linux - amd64 - cpu - opt . yml <nl> build : <nl> system_config : <nl> > <nl> $ { swig . patch_nodejs . linux } <nl> - tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / home . tar . xz " <nl> - summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / summarize_graph " <nl> + tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / home . tar . xz " <nl> + summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / summarize_graph " <nl> scripts : <nl> build : " taskcluster / host - build . sh " <nl> package : " taskcluster / package . sh " <nl> mmm a / taskcluster / linux - amd64 - ctc - opt . yml <nl> ppp b / taskcluster / linux - amd64 - ctc - opt . yml <nl> build : <nl> - " pull_request . synchronize " <nl> - " pull_request . reopened " <nl> template_file : linux - opt - base . tyml <nl> - tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / home . tar . xz " <nl> - summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / summarize_graph " <nl> + tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / home . tar . xz " <nl> + summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / summarize_graph " <nl> scripts : <nl> build : ' taskcluster / decoder - build . sh ' <nl> package : ' taskcluster / decoder - package . sh ' <nl> mmm a / taskcluster / linux - amd64 - gpu - opt . yml <nl> ppp b / taskcluster / linux - amd64 - gpu - opt . yml <nl> build : <nl> system_config : <nl> > <nl> $ { swig . patch_nodejs . linux } <nl> - tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . gpu / artifacts / public / home . tar . xz " <nl> - summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . gpu / artifacts / public / summarize_graph " <nl> + tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . gpu / artifacts / public / home . tar . xz " <nl> + summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . gpu / artifacts / public / summarize_graph " <nl> maxRunTime : 14400 <nl> scripts : <nl> build : " taskcluster / cuda - build . sh " <nl> mmm a / taskcluster / linux - rpi3 - cpu - aot_prod - opt . yml <nl> ppp b / taskcluster / linux - rpi3 - cpu - aot_prod - opt . yml <nl> build : <nl> - " index . project . deepspeech . deepspeech . native_client . $ { event . head . branch } . arm_aot " <nl> - " index . project . deepspeech . deepspeech . native_client . $ { event . head . branch } . $ { event . head . sha } . arm_aot " <nl> - " index . project . deepspeech . deepspeech . native_client . arm_aot . $ { event . head . sha } " <nl> - tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . arm / artifacts / public / home . tar . xz " <nl> - summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / summarize_graph " <nl> + tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . arm / artifacts / public / home . tar . xz " <nl> + summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / summarize_graph " <nl> # # multistrap 2 . 2 . 0 - ubuntu1 is broken in 14 . 04 : https : / / bugs . launchpad . net / ubuntu / + source / multistrap / + bug / 1313787 <nl> system_setup : <nl> > <nl> mmm a / taskcluster / linux - rpi3 - cpu - opt . yml <nl> ppp b / taskcluster / linux - rpi3 - cpu - opt . yml <nl> build : <nl> - " index . project . deepspeech . deepspeech . native_client . $ { event . head . branch } . arm " <nl> - " index . project . deepspeech . deepspeech . native_client . $ { event . head . branch } . $ { event . head . sha } . arm " <nl> - " index . project . deepspeech . deepspeech . native_client . arm . $ { event . head . sha } " <nl> - tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . arm / artifacts / public / home . tar . xz " <nl> - summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / summarize_graph " <nl> + tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . arm / artifacts / public / home . tar . xz " <nl> + summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / summarize_graph " <nl> # # multistrap 2 . 2 . 0 - ubuntu1 is broken in 14 . 04 : https : / / bugs . launchpad . net / ubuntu / + source / multistrap / + bug / 1313787 <nl> system_setup : <nl> > <nl> mmm a / taskcluster / node - package . yml <nl> ppp b / taskcluster / node - package . yml <nl> build : <nl> system_config : <nl> > <nl> $ { swig . patch_nodejs . linux } <nl> - tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / home . tar . xz " <nl> - summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / summarize_graph " <nl> + tensorflow : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / home . tar . xz " <nl> + summarize_graph : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / summarize_graph " <nl> scripts : <nl> build : " taskcluster / node - build . sh " <nl> package : " taskcluster / node - package . sh " <nl> mmm a / taskcluster / test - darwin - opt - base . tyml <nl> ppp b / taskcluster / test - darwin - opt - base . tyml <nl> then : <nl> DEEPSPEECH_TEST_MODEL : https : / / queue . taskcluster . net / v1 / task / $ { training } / artifacts / public / output_graph . pb <nl> DEEPSPEECH_PROD_MODEL : https : / / s3 - us - west - 2 . amazonaws . com / deepspeech / mmap / output_graph . pb <nl> DEEPSPEECH_PROD_MODEL_MMAP : https : / / s3 - us - west - 2 . amazonaws . com / deepspeech / mmap / output_graph . pbmm <nl> - EXPECTED_TENSORFLOW_VERSION : " TensorFlow : v1 . 6 . 0 - 9 - g236f83e " <nl> + EXPECTED_TENSORFLOW_VERSION : " TensorFlow : v1 . 6 . 0 - 11 - g7554dd8 " <nl> <nl> command : <nl> - - " / bin / bash " <nl> mmm a / taskcluster / test - linux - opt - base . tyml <nl> ppp b / taskcluster / test - linux - opt - base . tyml <nl> then : <nl> DEEPSPEECH_PROD_MODEL : https : / / s3 . amazonaws . com / deep - speech / mmap / output_graph . pb <nl> DEEPSPEECH_PROD_MODEL_MMAP : https : / / s3 . amazonaws . com / deep - speech / mmap / output_graph . pbmm <nl> PIP_DEFAULT_TIMEOUT : 60 <nl> - EXPECTED_TENSORFLOW_VERSION : " TensorFlow : v1 . 6 . 0 - 9 - g236f83e " <nl> + EXPECTED_TENSORFLOW_VERSION : " TensorFlow : v1 . 6 . 0 - 11 - g7554dd8 " <nl> <nl> command : <nl> - " / bin / bash " <nl> mmm a / taskcluster / test - training_upstream - linux - amd64 - py27mu - opt . yml <nl> ppp b / taskcluster / test - training_upstream - linux - amd64 - py27mu - opt . yml <nl> build : <nl> apt - get - qq - y install $ { python . packages . apt } <nl> args : <nl> tests_cmdline : " $ { system . homedir . linux } / DeepSpeech / ds / tc - train - tests . sh 2 . 7 . 14 : mu upstream " <nl> - convert_graphdef : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 236f83eb5d4d73a33938154f4b1e631355f6a1f0 . cpu / artifacts / public / convert_graphdef_memmapped_format " <nl> + convert_graphdef : " https : / / index . taskcluster . net / v1 / task / project . deepspeech . tensorflow . pip . r1 . 6 . 7554dd8d54cc081f97d34d4f1574aa15dff5eb0d . cpu / artifacts / public / convert_graphdef_memmapped_format " <nl> metadata : <nl> name : " DeepSpeech Linux AMD64 CPU upstream training Py2 . 7 mu " <nl> description : " Training a DeepSpeech LDC93S1 model for Linux / AMD64 using upstream TensorFlow Python 2 . 7 mu , CPU only , optimized version " <nl>
Merge pull request from lissyx / linaro - gcc72 - master
mozilla/DeepSpeech
b99ddfbd29bde83123f7f270b8d3be10dacb948d
2018-03-19T20:25:22Z
mmm a / src / test . cpp <nl> ppp b / src / test . cpp <nl> void popper ( Q * q ) <nl> { <nl> string output ; <nl> while ( active ) <nl> - { <nl> - q - > clear ( ) ; <nl> - / / q - > pop ( output ) ; <nl> + { <nl> + q - > pop ( output ) ; <nl> + + pop_count ; <nl> } <nl> } <nl>
fix
gabime/spdlog
5e8eea7e90580908f9bfe25c5e383123c7e88f5b
2014-02-01T22:08:47Z
mmm a / electron_paks . gni <nl> ppp b / electron_paks . gni <nl> template ( " electron_extra_paks " ) { <nl> " $ root_gen_dir / mojo / public / js / mojo_bindings_resources . pak " , <nl> " $ root_gen_dir / net / net_resources . pak " , <nl> " $ root_gen_dir / third_party / blink / public / resources / blink_resources . pak " , <nl> + " $ root_gen_dir / ui / resources / webui_resources . pak " , <nl> " $ target_gen_dir / electron_resources . pak " , <nl> ] <nl> deps = [ <nl> template ( " electron_extra_paks " ) { <nl> " / / mojo / public / js : resources " , <nl> " / / net : net_resources " , <nl> " / / third_party / blink / public : resources " , <nl> + " / / ui / resources " , <nl> ] <nl> if ( defined ( invoker . deps ) ) { <nl> deps + = invoker . deps <nl>
chore : add webui_resources to pak ( )
electron/electron
f3c64ea9d8e3b0170a39fbb676b3867a64d4bf36
2018-12-11T17:07:32Z
mmm a / include / swift / SIL / SILModule . h <nl> ppp b / include / swift / SIL / SILModule . h <nl> class SILModule { <nl> bool linkFunction ( StringRef Name , <nl> LinkingMode LinkAll = LinkingMode : : LinkNormal ) ; <nl> <nl> - / / / Check if a given function exists in any of the modules with a <nl> - / / / required linkage , i . e . it can be linked by linkFunction . <nl> - / / / <nl> - / / / If linkage parameter is none , then the linkage of the function <nl> - / / / with a given name does not matter . <nl> + / / / Check if a given function exists in the module , <nl> + / / / i . e . it can be linked by linkFunction . <nl> / / / <nl> / / / \ return null if this module has no such function . Otherwise <nl> / / / the declaration of a function . <nl> - SILFunction * findFunction ( StringRef Name , Optional < SILLinkage > Linkage ) ; <nl> - <nl> - / / / Check if a given function exists in the module , <nl> - / / / i . e . it can be linked by linkFunction . <nl> - bool hasFunction ( StringRef Name ) ; <nl> + SILFunction * hasFunction ( StringRef Name , SILLinkage Linkage ) ; <nl> <nl> / / / Link in all Witness Tables in the module . <nl> void linkAllWitnessTables ( ) ; <nl> mmm a / include / swift / SILOptimizer / Utils / Devirtualize . h <nl> ppp b / include / swift / SILOptimizer / Utils / Devirtualize . h <nl> typedef std : : pair < ValueBase * , ApplySite > DevirtualizationResult ; <nl> DevirtualizationResult tryDevirtualizeApply ( FullApplySite AI ) ; <nl> DevirtualizationResult tryDevirtualizeApply ( FullApplySite AI , <nl> ClassHierarchyAnalysis * CHA ) ; <nl> - bool canDevirtualizeApply ( FullApplySite AI , ClassHierarchyAnalysis * CHA ) ; <nl> bool isNominalTypeWithUnboundGenericParameters ( SILType Ty , SILModule & M ) ; <nl> bool canDevirtualizeClassMethod ( FullApplySite AI , SILType ClassInstanceType ) ; <nl> SILFunction * getTargetClassMethod ( SILModule & M , SILType ClassOrMetatypeType , <nl> mmm a / include / swift / Serialization / SerializedSILLoader . h <nl> ppp b / include / swift / Serialization / SerializedSILLoader . h <nl> class SerializedSILLoader { <nl> SILFunction * lookupSILFunction ( SILFunction * Callee ) ; <nl> SILFunction * <nl> lookupSILFunction ( StringRef Name , bool declarationOnly = false , <nl> - Optional < SILLinkage > linkage = None ) ; <nl> - bool hasSILFunction ( StringRef Name , Optional < SILLinkage > linkage = None ) ; <nl> + SILLinkage linkage = SILLinkage : : Private ) ; <nl> + bool hasSILFunction ( StringRef Name , SILLinkage linkage = SILLinkage : : Private ) ; <nl> SILVTable * lookupVTable ( Identifier Name ) ; <nl> SILVTable * lookupVTable ( const ClassDecl * C ) { <nl> return lookupVTable ( C - > getName ( ) ) ; <nl> mmm a / lib / AST / Substitution . cpp <nl> ppp b / lib / AST / Substitution . cpp <nl> Substitution Substitution : : subst ( ModuleDecl * module , <nl> / / conformances from thin air . FIXME : gross . <nl> if ( ! conformance & & <nl> proto - > isSpecificProtocol ( KnownProtocolKind : : AnyObject ) ) { <nl> - auto archetype = <nl> - dyn_cast < ArchetypeType > ( substReplacement - > getCanonicalType ( ) ) ; <nl> - / / If classDecl is not nullptr , it is a concrete class . <nl> - auto classDecl = substReplacement - > getClassOrBoundGenericClass ( ) ; <nl> - if ( ! classDecl & & archetype - > getSuperclass ( ) ) { <nl> - / / Replacement type is an archetype with a superclass constraint . <nl> - classDecl = archetype - > getSuperclass ( ) - > getClassOrBoundGenericClass ( ) ; <nl> - assert ( classDecl ) ; <nl> - } <nl> - if ( classDecl ) { <nl> - / / Create a concrete conformance based on the conforming class . <nl> - SmallVector < ProtocolConformance * , 1 > lookupResults ; <nl> - classDecl - > lookupConformance ( classDecl - > getParentModule ( ) , proto , <nl> - lookupResults ) ; <nl> - conformance = ProtocolConformanceRef ( lookupResults . front ( ) ) ; <nl> - } else if ( archetype & & archetype - > requiresClass ( ) ) { <nl> - / / Replacement type is an archetype with a class constraint . <nl> - / / Create an abstract conformance . <nl> - conformance = ProtocolConformanceRef ( proto ) ; <nl> - } <nl> + auto classDecl <nl> + = substReplacement - > getClassOrBoundGenericClass ( ) ; <nl> + assert ( classDecl ) ; <nl> + SmallVector < ProtocolConformance * , 1 > lookupResults ; <nl> + classDecl - > lookupConformance ( classDecl - > getParentModule ( ) , <nl> + proto , lookupResults ) ; <nl> + conformance = ProtocolConformanceRef ( lookupResults . front ( ) ) ; <nl> } <nl> <nl> assert ( conformance ) ; <nl> mmm a / lib / IRGen / IRGenSIL . cpp <nl> ppp b / lib / IRGen / IRGenSIL . cpp <nl> class IRGenSILFunction : <nl> copy . push_back ( alloca . getAddress ( ) ) ; <nl> } <nl> <nl> - / / / Determine whether a generic variable has been inlined . <nl> - static bool isInlinedGeneric ( VarDecl * VarDecl , const SILDebugScope * DS ) { <nl> - if ( ! DS - > InlinedCallSite ) <nl> - return false ; <nl> - if ( VarDecl - > hasType ( ) ) <nl> - return VarDecl - > getType ( ) - > hasArchetype ( ) ; <nl> - return VarDecl - > getInterfaceType ( ) - > hasTypeParameter ( ) ; <nl> - } <nl> - <nl> / / / Emit debug info for a function argument or a local variable . <nl> template < typename StorageType > <nl> void emitDebugVariableDeclaration ( StorageType Storage , <nl> DebugTypeInfo Ty , <nl> SILType SILTy , <nl> const SILDebugScope * DS , <nl> - VarDecl * VarDecl , <nl> + ValueDecl * VarDecl , <nl> StringRef Name , <nl> unsigned ArgNo = 0 , <nl> IndirectionKind Indirection = DirectValue ) { <nl> / / Force all archetypes referenced by the type to be bound by this point . <nl> / / TODO : just make sure that we have a path to them that the debug info <nl> / / can follow . <nl> - <nl> - / / FIXME : The debug info type of all inlined instances of a variable must be <nl> - / / the same as the type of the abstract variable . <nl> - if ( isInlinedGeneric ( VarDecl , DS ) ) <nl> - return ; <nl> - <nl> auto runtimeTy = getRuntimeReifiedType ( IGM , <nl> Ty . getType ( ) - > getCanonicalType ( ) ) ; <nl> if ( ! IGM . IRGen . Opts . Optimize & & runtimeTy - > hasArchetype ( ) ) <nl> void IRGenSILFunction : : visitAllocBoxInst ( swift : : AllocBoxInst * i ) { <nl> CurSILFn - > getDeclContext ( ) , Decl , <nl> i - > getBoxType ( ) - > getFieldType ( IGM . getSILModule ( ) , 0 ) . getSwiftType ( ) , <nl> type , / * Unwrap = * / false ) ; <nl> - <nl> - if ( isInlinedGeneric ( Decl , i - > getDebugScope ( ) ) ) <nl> - return ; <nl> - <nl> IGM . DebugInfo - > emitVariableDeclaration ( <nl> Builder , <nl> emitShadowCopy ( boxWithAddr . getAddress ( ) , i - > getDebugScope ( ) , Name , 0 ) , <nl> mmm a / lib / SIL / Linker . cpp <nl> ppp b / lib / SIL / Linker . cpp <nl> SILFunction * SILLinkerVisitor : : lookupFunction ( StringRef Name , <nl> } <nl> <nl> / / / Process Decl , recursively deserializing any thing Decl may reference . <nl> - bool SILLinkerVisitor : : hasFunction ( StringRef Name , <nl> - Optional < SILLinkage > Linkage ) { <nl> + bool SILLinkerVisitor : : hasFunction ( StringRef Name , SILLinkage Linkage ) { <nl> return Loader - > hasSILFunction ( Name , Linkage ) ; <nl> } <nl> <nl> mmm a / lib / SIL / Linker . h <nl> ppp b / lib / SIL / Linker . h <nl> class SILLinkerVisitor : public SILInstructionVisitor < SILLinkerVisitor , bool > { <nl> <nl> / / / Process Name , try to check if there is a declaration of a function <nl> / / / with this Name . <nl> - bool hasFunction ( StringRef Name , Optional < SILLinkage > Linkage = None ) ; <nl> + bool hasFunction ( StringRef Name , SILLinkage Linkage ) ; <nl> <nl> / / / Deserialize the VTable mapped to C if it exists and all SIL the VTable <nl> / / / transitively references . <nl> mmm a / lib / SIL / SILModule . cpp <nl> ppp b / lib / SIL / SILModule . cpp <nl> bool SILModule : : linkFunction ( StringRef Name , SILModule : : LinkingMode Mode ) { <nl> return SILLinkerVisitor ( * this , getSILLoader ( ) , Mode ) . processFunction ( Name ) ; <nl> } <nl> <nl> - / / / Check if a given SIL linkage matches the required linkage . <nl> - / / / If the required linkage is Private , then anything matches it . <nl> - static bool isMatchingLinkage ( SILLinkage ActualLinkage , <nl> - Optional < SILLinkage > Linkage ) { <nl> - if ( ! Linkage ) <nl> - return true ; <nl> - return ActualLinkage = = Linkage ; <nl> - } <nl> - <nl> - bool SILModule : : hasFunction ( StringRef Name ) { <nl> - if ( lookUpFunction ( Name ) ) <nl> - return true ; <nl> - SILLinkerVisitor Visitor ( * this , getSILLoader ( ) , <nl> - SILModule : : LinkingMode : : LinkNormal ) ; <nl> - return Visitor . hasFunction ( Name ) ; <nl> - } <nl> - <nl> - SILFunction * SILModule : : findFunction ( StringRef Name , <nl> - Optional < SILLinkage > Linkage ) { <nl> + SILFunction * SILModule : : hasFunction ( StringRef Name , SILLinkage Linkage ) { <nl> + assert ( ( Linkage = = SILLinkage : : Public | | <nl> + Linkage = = SILLinkage : : PublicExternal ) & & <nl> + " Only a lookup of public functions is supported currently " ) ; <nl> <nl> SILFunction * F = nullptr ; <nl> - SILLinkage RequiredLinkage = Linkage ? * Linkage : SILLinkage : : Private ; <nl> <nl> / / First , check if there is a function with a required name in the <nl> / / current module . <nl> SILFunction * SILModule : : findFunction ( StringRef Name , <nl> <nl> / / Nothing to do if the current module has a required function <nl> / / with a proper linkage already . <nl> - if ( CurF & & isMatchingLinkage ( CurF - > getLinkage ( ) , Linkage ) ) { <nl> + if ( CurF & & CurF - > getLinkage ( ) = = Linkage ) { <nl> F = CurF ; <nl> } else { <nl> - assert ( ( ! CurF | | CurF - > getLinkage ( ) ! = RequiredLinkage ) & & <nl> + assert ( ( ! CurF | | CurF - > getLinkage ( ) ! = Linkage ) & & <nl> " hasFunction should be only called for functions that are not " <nl> " contained in the SILModule yet or do not have a required linkage " ) ; <nl> } <nl> SILFunction * SILModule : : findFunction ( StringRef Name , <nl> / / name is present in the current module . <nl> / / This is done to reduce the amount of IO from the <nl> / / swift module file . <nl> - if ( ! Visitor . hasFunction ( Name , RequiredLinkage ) ) <nl> + if ( ! Visitor . hasFunction ( Name , Linkage ) ) <nl> return nullptr ; <nl> / / The function in the current module will be changed . <nl> F = CurF ; <nl> SILFunction * SILModule : : findFunction ( StringRef Name , <nl> / / or if it is known to exist , perform a lookup . <nl> if ( ! F ) { <nl> / / Try to load the function from other modules . <nl> - F = Visitor . lookupFunction ( Name , RequiredLinkage ) ; <nl> + F = Visitor . lookupFunction ( Name , Linkage ) ; <nl> / / Bail if nothing was found and we are not sure if <nl> / / this function exists elsewhere . <nl> if ( ! F ) <nl> return nullptr ; <nl> assert ( F & & " SILFunction should be present in one of the modules " ) ; <nl> - assert ( isMatchingLinkage ( F - > getLinkage ( ) , Linkage ) & & <nl> - " SILFunction has a wrong linkage " ) ; <nl> + assert ( F - > getLinkage ( ) = = Linkage & & " SILFunction has a wrong linkage " ) ; <nl> } <nl> } <nl> <nl> SILFunction * SILModule : : findFunction ( StringRef Name , <nl> SILOptions : : SILOptMode : : Optimize ) { <nl> F - > convertToDeclaration ( ) ; <nl> } <nl> - if ( F - > isExternalDeclaration ( ) ) { <nl> + if ( F - > isExternalDeclaration ( ) ) <nl> F - > setFragile ( IsFragile_t : : IsNotFragile ) ; <nl> - if ( isAvailableExternally ( F - > getLinkage ( ) ) & & <nl> - ! hasPublicVisibility ( F - > getLinkage ( ) ) & & ! Linkage ) { <nl> - / / We were just asked if a given function exists anywhere . <nl> - / / It is not going to be used by the current module . <nl> - / / Since external non - public function declarations should not <nl> - / / exist , strip the " external " part from the linkage . <nl> - F - > setLinkage ( stripExternalFromLinkage ( F - > getLinkage ( ) ) ) ; <nl> - } <nl> - } <nl> - if ( Linkage ) <nl> - F - > setLinkage ( RequiredLinkage ) ; <nl> + F - > setLinkage ( Linkage ) ; <nl> return F ; <nl> } <nl> <nl> mmm a / lib / SILOptimizer / IPO / EagerSpecializer . cpp <nl> ppp b / lib / SILOptimizer / IPO / EagerSpecializer . cpp <nl> class EagerDispatch { <nl> substConv ( ReInfo . getSubstitutedType ( ) , GenericFunc - > getModule ( ) ) , <nl> Builder ( * GenericFunc ) , Loc ( GenericFunc - > getLocation ( ) ) { <nl> Builder . setCurrentDebugScope ( GenericFunc - > getDebugScope ( ) ) ; <nl> - IsClassF = Builder . getModule ( ) . findFunction ( <nl> + IsClassF = Builder . getModule ( ) . hasFunction ( <nl> " _swift_isClassOrObjCExistentialType " , SILLinkage : : PublicExternal ) ; <nl> assert ( IsClassF ) ; <nl> } <nl> mmm a / lib / SILOptimizer / Transforms / FunctionSignatureOpts . cpp <nl> ppp b / lib / SILOptimizer / Transforms / FunctionSignatureOpts . cpp <nl> static SILInstruction * findOnlyApply ( SILFunction * F ) { <nl> / / / <nl> / / / TODO : we should teach the demangler to understand this suffix . <nl> static std : : string getUniqueName ( std : : string Name , SILModule & M ) { <nl> - if ( ! M . hasFunction ( Name ) ) <nl> + if ( ! M . lookUpFunction ( Name ) ) <nl> return Name ; <nl> return getUniqueName ( Name + " _unique_suffix " , M ) ; <nl> } <nl> std : : string FunctionSignatureTransform : : createOptimizedSILFunctionName ( ) { <nl> do { <nl> New = NewFM . mangle ( UniqueID ) ; <nl> + + UniqueID ; <nl> - } while ( M . hasFunction ( New ) ) ; <nl> + } while ( M . lookUpFunction ( New ) ) ; <nl> <nl> return NewMangling : : selectMangling ( Old , New ) ; <nl> } <nl> mmm a / lib / SILOptimizer / Transforms / PerformanceInliner . cpp <nl> ppp b / lib / SILOptimizer / Transforms / PerformanceInliner . cpp <nl> <nl> # define DEBUG_TYPE " sil - inliner " <nl> # include " swift / SILOptimizer / PassManager / Passes . h " <nl> # include " swift / SILOptimizer / PassManager / Transforms . h " <nl> - # include " swift / SILOptimizer / Utils / Devirtualize . h " <nl> - # include " swift / SILOptimizer / Utils / Generics . h " <nl> # include " swift / SILOptimizer / Utils / PerformanceInlinerUtils . h " <nl> # include " swift / Strings . h " <nl> # include " llvm / ADT / Statistic . h " <nl> llvm : : cl : : opt < bool > PrintShortestPathInfo ( <nl> llvm : : cl : : desc ( " Print shortest - path information for inlining " ) ) ; <nl> <nl> llvm : : cl : : opt < bool > EnableSILInliningOfGenerics ( <nl> - " sil - inline - generics " , llvm : : cl : : init ( true ) , <nl> + " sil - inline - generics " , llvm : : cl : : init ( false ) , <nl> llvm : : cl : : desc ( " Enable inlining of generics " ) ) ; <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> class SILPerformanceInliner { <nl> / / / The benefit of a onFastPath builtin . <nl> FastPathBuiltinBenefit = RemovedCallBenefit + 40 , <nl> <nl> - / / / The benefit of being able to devirtualize a call . <nl> - DevirtualizedCallBenefit = RemovedCallBenefit + 300 , <nl> - <nl> - / / / The benefit of being able to produce a generic <nl> - / / / specializatio for a call . <nl> - GenericSpecializationBenefit = RemovedCallBenefit + 300 , <nl> - <nl> / / / Approximately up to this cost level a function can be inlined without <nl> / / / increasing the code size . <nl> TrivialFunctionThreshold = 18 , <nl> class SILPerformanceInliner { <nl> bool isProfitableToInline ( FullApplySite AI , <nl> Weight CallerWeight , <nl> ConstantTracker & callerTracker , <nl> - int & NumCallerBlocks ) ; <nl> + int & NumCallerBlocks , <nl> + bool IsGeneric ) ; <nl> <nl> bool decideInWarmBlock ( FullApplySite AI , <nl> Weight CallerWeight , <nl> SILFunction * SILPerformanceInliner : : getEligibleFunction ( FullApplySite AI ) { <nl> return nullptr ; <nl> } <nl> <nl> + / / We don ' t support this yet . <nl> + if ( AI . hasSubstitutions ( ) ) <nl> + return nullptr ; <nl> + <nl> SILFunction * Caller = AI . getFunction ( ) ; <nl> <nl> / / We don ' t support inlining a function that binds dynamic self because we <nl> SILFunction * SILPerformanceInliner : : getEligibleFunction ( FullApplySite AI ) { <nl> return Callee ; <nl> } <nl> <nl> - static bool canSpecializeGeneric ( ApplySite AI , SILFunction * F , <nl> - SubstitutionList Subs ) { <nl> - ReabstractionInfo ReInfo ( AI , F , Subs ) ; <nl> - if ( ! ReInfo . getSpecializedType ( ) ) <nl> - return false ; <nl> - return true ; <nl> - } <nl> - <nl> bool SILPerformanceInliner : : isProfitableToInline ( FullApplySite AI , <nl> Weight CallerWeight , <nl> ConstantTracker & callerTracker , <nl> - int & NumCallerBlocks ) { <nl> + int & NumCallerBlocks , <nl> + bool IsGeneric ) { <nl> SILFunction * Callee = AI . getReferencedFunction ( ) ; <nl> - bool IsGeneric = ! AI . getSubstitutions ( ) . empty ( ) ; <nl> - <nl> - / / Bail out if this generic call can be optimized by means of <nl> - / / the generic specialization . <nl> - if ( IsGeneric & & canSpecializeGeneric ( AI , Callee , AI . getSubstitutions ( ) ) ) <nl> - return false ; <nl> - <nl> SILLoopInfo * LI = LA - > get ( Callee ) ; <nl> ShortestPathAnalysis * SPA = getSPA ( Callee , LI ) ; <nl> assert ( SPA - > isValid ( ) ) ; <nl> bool SILPerformanceInliner : : isProfitableToInline ( FullApplySite AI , <nl> <nl> / / Start with a base benefit . <nl> int BaseBenefit = RemovedCallBenefit ; <nl> - <nl> - SubstitutionMap CalleeSubstMap ; <nl> const SILOptions & Opts = Callee - > getModule ( ) . getOptions ( ) ; <nl> <nl> / / For some reason - Ounchecked can accept a higher base benefit without <nl> bool SILPerformanceInliner : : isProfitableToInline ( FullApplySite AI , <nl> <nl> CalleeCost + = ( int ) instructionInlineCost ( I ) ; <nl> <nl> - if ( FullApplySite FAI = FullApplySite : : isa ( & I ) ) { <nl> + if ( FullApplySite AI = FullApplySite : : isa ( & I ) ) { <nl> + <nl> / / Check if the callee is passed as an argument . If so , increase the <nl> / / threshold , because inlining will ( probably ) eliminate the closure . <nl> - SILInstruction * def = constTracker . getDefInCaller ( FAI . getCallee ( ) ) ; <nl> + SILInstruction * def = constTracker . getDefInCaller ( AI . getCallee ( ) ) ; <nl> if ( def & & ( isa < FunctionRefInst > ( def ) | | isa < PartialApplyInst > ( def ) ) ) <nl> BlockW . updateBenefit ( Benefit , RemovedClosureBenefit ) ; <nl> - / / Check if inlining the callee would allow for further <nl> - / / optimizations like devirtualization or generic specialization . <nl> - if ( ! def ) <nl> - def = dyn_cast_or_null < SILInstruction > ( FAI . getCallee ( ) ) ; <nl> - <nl> - if ( ! def ) <nl> - continue ; <nl> - <nl> - auto Subs = FAI . getSubstitutions ( ) ; <nl> - <nl> - / / Bail if it is not a generic call . <nl> - if ( Subs . empty ( ) ) <nl> - continue ; <nl> - <nl> - if ( ! isa < FunctionRefInst > ( def ) & & ! isa < ClassMethodInst > ( def ) & & <nl> - ! isa < WitnessMethodInst > ( def ) ) <nl> - continue ; <nl> - <nl> - SmallVector < Substitution , 32 > NewSubs ; <nl> - SubstitutionMap SubstMap ; <nl> - GenericSignature * GenSig = nullptr ; <nl> - <nl> - if ( auto FRI = dyn_cast < FunctionRefInst > ( def ) ) { <nl> - auto Callee = FRI - > getReferencedFunction ( ) ; <nl> - if ( Callee ) { <nl> - GenSig = Callee - > getLoweredFunctionType ( ) - > getGenericSignature ( ) ; <nl> - } <nl> - } else if ( auto CMI = dyn_cast < ClassMethodInst > ( def ) ) { <nl> - GenSig = CMI - > getType ( ) <nl> - . getSwiftRValueType ( ) <nl> - - > castTo < SILFunctionType > ( ) <nl> - - > getGenericSignature ( ) ; <nl> - } else if ( auto WMI = dyn_cast < WitnessMethodInst > ( def ) ) { <nl> - GenSig = WMI - > getType ( ) <nl> - . getSwiftRValueType ( ) <nl> - - > castTo < SILFunctionType > ( ) <nl> - - > getGenericSignature ( ) ; <nl> - } <nl> - <nl> - / / It is a generic call inside the callee . Check if after inlining <nl> - / / it will be possible to perform a generic specialization or <nl> - / / devirtualization of this call . <nl> - <nl> - / / Create the list of substitutions as they will be after <nl> - / / inlining . <nl> - for ( auto Sub : Subs ) { <nl> - if ( ! Sub . getReplacement ( ) - > hasArchetype ( ) ) { <nl> - / / This substitution is a concrete type . <nl> - NewSubs . push_back ( Sub ) ; <nl> - continue ; <nl> - } <nl> - / / This substitution is not a concrete type . <nl> - if ( IsGeneric & & CalleeSubstMap . empty ( ) ) { <nl> - CalleeSubstMap = <nl> - Callee - > getGenericEnvironment ( ) - > getSubstitutionMap ( <nl> - AI . getSubstitutions ( ) ) ; <nl> - } <nl> - auto NewSub = Sub . subst ( AI . getModule ( ) . getSwiftModule ( ) , CalleeSubstMap ) ; <nl> - NewSubs . push_back ( NewSub ) ; <nl> - } <nl> - <nl> - / / Check if the call can be devirtualized . <nl> - if ( isa < ClassMethodInst > ( def ) | | isa < WitnessMethodInst > ( def ) | | <nl> - isa < SuperMethodInst > ( def ) ) { <nl> - / / TODO : Take AI . getSubstitutions ( ) into account . <nl> - if ( canDevirtualizeApply ( FAI , nullptr ) ) { <nl> - DEBUG ( llvm : : dbgs ( ) < < " Devirtualization will be possible after " <nl> - " inlining for the call : \ n " ; <nl> - FAI . getInstruction ( ) - > dumpInContext ( ) ) ; <nl> - BlockW . updateBenefit ( Benefit , DevirtualizedCallBenefit ) ; <nl> - } <nl> - } <nl> - <nl> - / / Check if a generic specialization would be possible . <nl> - if ( isa < FunctionRefInst > ( def ) ) { <nl> - auto CalleeF = FAI . getCalleeFunction ( ) ; <nl> - if ( ! canSpecializeGeneric ( FAI , CalleeF , NewSubs ) ) <nl> - continue ; <nl> - DEBUG ( llvm : : dbgs ( ) < < " Generic specialization will be possible after " <nl> - " inlining for the call : \ n " ; <nl> - FAI . getInstruction ( ) - > dumpInContext ( ) ) ; <nl> - BlockW . updateBenefit ( Benefit , GenericSpecializationBenefit ) ; <nl> - } <nl> } else if ( auto * LI = dyn_cast < LoadInst > ( & I ) ) { <nl> / / Check if it ' s a load from a stack location in the caller . Such a load <nl> / / might be optimized away if inlined . <nl> static Optional < bool > shouldInlineGeneric ( FullApplySite AI ) { <nl> assert ( ! AI . getSubstitutions ( ) . empty ( ) & & <nl> " Expected a generic apply " ) ; <nl> <nl> + if ( ! EnableSILInliningOfGenerics ) <nl> + return false ; <nl> + <nl> / / If all substitutions are concrete , then there is no need to perform the <nl> / / generic inlining . Let the generic specializer create a specialized <nl> / / function and then decide if it is beneficial to inline it . <nl> static Optional < bool > shouldInlineGeneric ( FullApplySite AI ) { <nl> if ( Callee - > getInlineStrategy ( ) = = AlwaysInline | | Callee - > isTransparent ( ) ) <nl> return true ; <nl> <nl> - if ( ! EnableSILInliningOfGenerics ) <nl> - return false ; <nl> - <nl> - / / It is not clear yet if this function should be decided or not . <nl> + / / Only inline if we decided to inline or we are asked to inline all <nl> + / / generic functions . <nl> return None ; <nl> } <nl> <nl> decideInWarmBlock ( FullApplySite AI , <nl> auto ShouldInlineGeneric = shouldInlineGeneric ( AI ) ; <nl> if ( ShouldInlineGeneric . hasValue ( ) ) <nl> return ShouldInlineGeneric . getValue ( ) ; <nl> + <nl> + return false ; <nl> } <nl> <nl> SILFunction * Callee = AI . getReferencedFunction ( ) ; <nl> decideInWarmBlock ( FullApplySite AI , <nl> if ( Callee - > getInlineStrategy ( ) = = AlwaysInline ) <nl> return true ; <nl> <nl> - return isProfitableToInline ( AI , CallerWeight , callerTracker , NumCallerBlocks ) ; <nl> + return isProfitableToInline ( AI , CallerWeight , callerTracker , NumCallerBlocks , <nl> + / * IsGeneric * / false ) ; <nl> } <nl> <nl> / / / Return true if inlining this call site into a cold block is profitable . <nl> mmm a / lib / SILOptimizer / Utils / Devirtualize . cpp <nl> ppp b / lib / SILOptimizer / Utils / Devirtualize . cpp <nl> static ApplySite devirtualizeWitnessMethod ( ApplySite AI , SILFunction * F , <nl> return SAI ; <nl> } <nl> <nl> - static bool canDevirtualizeWitnessMethod ( ApplySite AI ) { <nl> + / / / In the cases where we can statically determine the function that <nl> + / / / we ' ll call to , replace an apply of a witness_method with an apply <nl> + / / / of a function_ref , returning the new apply . <nl> + DevirtualizationResult swift : : tryDevirtualizeWitnessMethod ( ApplySite AI ) { <nl> SILFunction * F ; <nl> SILWitnessTable * WT ; <nl> <nl> static bool canDevirtualizeWitnessMethod ( ApplySite AI ) { <nl> WMI - > getMember ( ) ) ; <nl> <nl> if ( ! F ) <nl> - return false ; <nl> + return std : : make_pair ( nullptr , FullApplySite ( ) ) ; <nl> <nl> if ( AI . getFunction ( ) - > isFragile ( ) ) { <nl> / / function_ref inside fragile function cannot reference a private or <nl> / / hidden symbol . <nl> if ( ! F - > hasValidLinkageForFragileRef ( ) ) <nl> - return false ; <nl> + return std : : make_pair ( nullptr , FullApplySite ( ) ) ; <nl> } <nl> <nl> - / / Collect all the required substitutions . <nl> - / / <nl> - / / The complete set of substitutions may be different , e . g . because the found <nl> - / / witness thunk F may have been created by a specialization pass and have <nl> - / / additional generic parameters . <nl> - SmallVector < Substitution , 4 > NewSubs ; <nl> - <nl> - getWitnessMethodSubstitutions ( AI , F , WMI - > getConformance ( ) , NewSubs ) ; <nl> - <nl> - / / Figure out the exact bound type of the function to be called by <nl> - / / applying all substitutions . <nl> - auto & Module = AI . getModule ( ) ; <nl> - auto CalleeCanType = F - > getLoweredFunctionType ( ) ; <nl> - auto SubstCalleeCanType = CalleeCanType - > substGenericArgs ( Module , NewSubs ) ; <nl> - <nl> - / / Bail if some of the arguments cannot be converted into <nl> - / / types required by the found devirtualized method . <nl> - if ( ! canPassOrConvertAllArguments ( AI , SubstCalleeCanType ) ) <nl> - return false ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - / / / In the cases where we can statically determine the function that <nl> - / / / we ' ll call to , replace an apply of a witness_method with an apply <nl> - / / / of a function_ref , returning the new apply . <nl> - DevirtualizationResult swift : : tryDevirtualizeWitnessMethod ( ApplySite AI ) { <nl> - if ( ! canDevirtualizeWitnessMethod ( AI ) ) <nl> - return std : : make_pair ( nullptr , FullApplySite ( ) ) ; <nl> - <nl> - SILFunction * F ; <nl> - SILWitnessTable * WT ; <nl> - <nl> - auto * WMI = cast < WitnessMethodInst > ( AI . getCallee ( ) ) ; <nl> - <nl> - std : : tie ( F , WT ) = <nl> - AI . getModule ( ) . lookUpFunctionInWitnessTable ( WMI - > getConformance ( ) , <nl> - WMI - > getMember ( ) ) ; <nl> - <nl> auto Result = devirtualizeWitnessMethod ( AI , F , WMI - > getConformance ( ) ) ; <nl> return std : : make_pair ( Result . getInstruction ( ) , Result ) ; <nl> } <nl> swift : : tryDevirtualizeApply ( FullApplySite AI , ClassHierarchyAnalysis * CHA ) { <nl> <nl> return std : : make_pair ( nullptr , FullApplySite ( ) ) ; <nl> } <nl> - <nl> - bool swift : : canDevirtualizeApply ( FullApplySite AI , ClassHierarchyAnalysis * CHA ) { <nl> - DEBUG ( llvm : : dbgs ( ) < < " Trying to devirtualize : " < < * AI . getInstruction ( ) ) ; <nl> - <nl> - / / Devirtualize apply instructions that call witness_method instructions : <nl> - / / <nl> - / / % 8 = witness_method $ Optional < UInt16 > , # LogicValue . boolValue ! getter . 1 <nl> - / / % 9 = apply % 8 < Self = CodeUnit ? > ( % 6 # 1 ) : . . . <nl> - / / <nl> - if ( isa < WitnessMethodInst > ( AI . getCallee ( ) ) ) <nl> - return canDevirtualizeWitnessMethod ( AI ) ; <nl> - <nl> - / / / Optimize a class_method and alloc_ref pair into a direct function <nl> - / / / reference : <nl> - / / / <nl> - / / / \ code <nl> - / / / % XX = alloc_ref $ Foo <nl> - / / / % YY = class_method % XX : $ Foo , # Foo . get ! 1 : $ @ convention ( method ) . . . <nl> - / / / \ endcode <nl> - / / / <nl> - / / / or <nl> - / / / <nl> - / / / % XX = metatype $ . . . <nl> - / / / % YY = class_method % XX : . . . <nl> - / / / <nl> - / / / into <nl> - / / / <nl> - / / / % YY = function_ref @ . . . <nl> - if ( auto * CMI = dyn_cast < ClassMethodInst > ( AI . getCallee ( ) ) ) { <nl> - auto & M = AI . getModule ( ) ; <nl> - auto Instance = stripUpCasts ( CMI - > getOperand ( ) ) ; <nl> - auto ClassType = Instance - > getType ( ) ; <nl> - if ( ClassType . is < MetatypeType > ( ) ) <nl> - ClassType = ClassType . getMetatypeInstanceType ( M ) ; <nl> - <nl> - auto * CD = ClassType . getClassOrBoundGenericClass ( ) ; <nl> - <nl> - if ( isEffectivelyFinalMethod ( AI , ClassType , CD , CHA ) ) <nl> - return canDevirtualizeClassMethod ( AI , Instance - > getType ( ) ) ; <nl> - <nl> - / / Try to check if the exact dynamic type of the instance is statically <nl> - / / known . <nl> - if ( auto Instance = getInstanceWithExactDynamicType ( CMI - > getOperand ( ) , <nl> - CMI - > getModule ( ) , <nl> - CHA ) ) <nl> - return canDevirtualizeClassMethod ( AI , Instance - > getType ( ) ) ; <nl> - <nl> - if ( auto ExactTy = getExactDynamicType ( CMI - > getOperand ( ) , CMI - > getModule ( ) , <nl> - CHA ) ) { <nl> - if ( ExactTy = = CMI - > getOperand ( ) - > getType ( ) ) <nl> - return canDevirtualizeClassMethod ( AI , CMI - > getOperand ( ) - > getType ( ) ) ; <nl> - } <nl> - } <nl> - <nl> - if ( isa < SuperMethodInst > ( AI . getCallee ( ) ) ) { <nl> - if ( AI . hasSelfArgument ( ) ) { <nl> - return canDevirtualizeClassMethod ( AI , AI . getSelfArgument ( ) - > getType ( ) ) ; <nl> - } <nl> - <nl> - / / It is an invocation of a class method . <nl> - / / Last operand is the metatype that should be used for dispatching . <nl> - return canDevirtualizeClassMethod ( AI , AI . getArguments ( ) . back ( ) - > getType ( ) ) ; <nl> - } <nl> - <nl> - return false ; <nl> - } <nl> mmm a / lib / SILOptimizer / Utils / Generics . cpp <nl> ppp b / lib / SILOptimizer / Utils / Generics . cpp <nl> static SILFunction * lookupExistingSpecialization ( SILModule & M , <nl> / / Only check that this function exists , but don ' t read <nl> / / its body . It can save some compile - time . <nl> if ( isWhitelistedSpecialization ( FunctionName ) ) <nl> - return M . findFunction ( FunctionName , SILLinkage : : PublicExternal ) ; <nl> + return M . hasFunction ( FunctionName , SILLinkage : : PublicExternal ) ; <nl> <nl> return nullptr ; <nl> } <nl> mmm a / lib / Serialization / DeserializeSIL . cpp <nl> ppp b / lib / Serialization / DeserializeSIL . cpp <nl> SILFunction * SILDeserializer : : lookupSILFunction ( SILFunction * InFunc ) { <nl> / / / This function is modeled after readSILFunction . But it does not <nl> / / / create a SILFunction object . <nl> bool SILDeserializer : : hasSILFunction ( StringRef Name , <nl> - Optional < SILLinkage > Linkage ) { <nl> + SILLinkage Linkage ) { <nl> if ( ! FuncTable ) <nl> return false ; <nl> auto iter = FuncTable - > find ( Name ) ; <nl> bool SILDeserializer : : hasSILFunction ( StringRef Name , <nl> auto & cacheEntry = Funcs [ FID - 1 ] ; <nl> if ( cacheEntry . isFullyDeserialized ( ) | | <nl> ( cacheEntry . isDeserialized ( ) ) ) <nl> - return ! Linkage | | cacheEntry . get ( ) - > getLinkage ( ) = = * Linkage ; <nl> + return cacheEntry . get ( ) - > getLinkage ( ) = = Linkage | | <nl> + Linkage = = SILLinkage : : Private ; <nl> <nl> BCOffsetRAII restoreOffset ( SILCursor ) ; <nl> SILCursor . JumpToBit ( cacheEntry . getOffset ( ) ) ; <nl> bool SILDeserializer : : hasSILFunction ( StringRef Name , <nl> } <nl> <nl> / / Bail if it is not a required linkage . <nl> - if ( Linkage & & linkage . getValue ( ) ! = * Linkage ) <nl> + if ( linkage . getValue ( ) ! = Linkage & & Linkage ! = SILLinkage : : Private ) <nl> return false ; <nl> <nl> DEBUG ( llvm : : dbgs ( ) < < " Found SIL Function : " < < Name < < " \ n " ) ; <nl> mmm a / lib / Serialization / DeserializeSIL . h <nl> ppp b / lib / Serialization / DeserializeSIL . h <nl> namespace swift { <nl> SILFunction * lookupSILFunction ( SILFunction * InFunc ) ; <nl> SILFunction * lookupSILFunction ( StringRef Name , <nl> bool declarationOnly = false ) ; <nl> - bool hasSILFunction ( StringRef Name , Optional < SILLinkage > Linkage = None ) ; <nl> + bool hasSILFunction ( StringRef Name , SILLinkage Linkage ) ; <nl> SILVTable * lookupVTable ( Identifier Name ) ; <nl> SILWitnessTable * lookupWitnessTable ( SILWitnessTable * wt ) ; <nl> SILDefaultWitnessTable * <nl> mmm a / lib / Serialization / SerializedSILLoader . cpp <nl> ppp b / lib / Serialization / SerializedSILLoader . cpp <nl> SILFunction * SerializedSILLoader : : lookupSILFunction ( SILFunction * Callee ) { <nl> <nl> SILFunction * SerializedSILLoader : : lookupSILFunction ( StringRef Name , <nl> bool declarationOnly , <nl> - Optional < SILLinkage > Linkage ) { <nl> + SILLinkage Linkage ) { <nl> / / It is possible that one module has a declaration of a SILFunction , while <nl> / / another has the full definition . <nl> SILFunction * retVal = nullptr ; <nl> SILFunction * SerializedSILLoader : : lookupSILFunction ( StringRef Name , <nl> if ( auto Func = Des - > lookupSILFunction ( Name , declarationOnly ) ) { <nl> DEBUG ( llvm : : dbgs ( ) < < " Deserialized " < < Func - > getName ( ) < < " from " <nl> < < Des - > getModuleIdentifier ( ) . str ( ) < < " \ n " ) ; <nl> - if ( Linkage ) { <nl> + if ( Linkage ! = SILLinkage : : Private ) { <nl> / / This is not the linkage we are looking for . <nl> - if ( Func - > getLinkage ( ) ! = * Linkage ) { <nl> + if ( Func - > getLinkage ( ) ! = Linkage ) { <nl> DEBUG ( llvm : : dbgs ( ) <nl> < < " Wrong linkage for Function : " < < Func - > getName ( ) < < " : " <nl> < < ( int ) Func - > getLinkage ( ) < < " \ n " ) ; <nl> SILFunction * SerializedSILLoader : : lookupSILFunction ( StringRef Name , <nl> return retVal ; <nl> } <nl> <nl> - bool SerializedSILLoader : : hasSILFunction ( StringRef Name , <nl> - Optional < SILLinkage > Linkage ) { <nl> + bool SerializedSILLoader : : hasSILFunction ( StringRef Name , SILLinkage Linkage ) { <nl> / / It is possible that one module has a declaration of a SILFunction , while <nl> / / another has the full definition . <nl> SILFunction * retVal = nullptr ; <nl> mmm a / stdlib / public / SwiftOnoneSupport / CMakeLists . txt <nl> ppp b / stdlib / public / SwiftOnoneSupport / CMakeLists . txt <nl> add_swift_library ( swiftSwiftOnoneSupport $ { SWIFT_STDLIB_LIBRARY_BUILD_TYPES } IS_ <nl> # This file should be listed the first . Module name is inferred from the <nl> # filename . <nl> SwiftOnoneSupport . swift <nl> - SWIFT_COMPILE_FLAGS $ { STDLIB_SIL_SERIALIZE_ALL } " - parse - stdlib " " - Xllvm " " - sil - inline - generics = false " " $ { SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS } " <nl> + SWIFT_COMPILE_FLAGS $ { STDLIB_SIL_SERIALIZE_ALL } " - parse - stdlib " " $ { SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS } " <nl> LINK_FLAGS " $ { SWIFT_RUNTIME_SWIFT_LINK_FLAGS } " <nl> INSTALL_IN_COMPONENT stdlib ) <nl> mmm a / test / SILGen / collection_cast_crash . swift <nl> ppp b / test / SILGen / collection_cast_crash . swift <nl> <nl> - / / RUN : % target - swift - frontend - O - Xllvm - sil - inline - generics = false - primary - file % s - emit - sil - o - | % FileCheck % s <nl> + / / RUN : % target - swift - frontend - O - primary - file % s - emit - sil - o - | % FileCheck % s <nl> <nl> / / check if the compiler does not crash if a function is specialized <nl> / / which contains a collection cast <nl> mmm a / test / SILOptimizer / devirt_covariant_return . swift <nl> ppp b / test / SILOptimizer / devirt_covariant_return . swift <nl> <nl> - / / RUN : % target - swift - frontend - Xllvm - new - mangling - for - tests - Xllvm - sil - full - demangle - O - Xllvm - disable - sil - cm - rr - cm = 0 - Xllvm - sil - inline - generics = false - primary - file % s - emit - sil - sil - inline - threshold 1000 - sil - verify - all | % FileCheck % s <nl> + / / RUN : % target - swift - frontend - Xllvm - new - mangling - for - tests - Xllvm - sil - full - demangle - O - Xllvm - disable - sil - cm - rr - cm = 0 - primary - file % s - emit - sil - sil - inline - threshold 1000 - sil - verify - all | % FileCheck % s <nl> <nl> / / Make sure that we can dig all the way through the class hierarchy and <nl> / / protocol conformances with covariant return types correctly . The verifier <nl> mmm a / test / SILOptimizer / devirt_protocol_method_invocations . swift <nl> ppp b / test / SILOptimizer / devirt_protocol_method_invocations . swift <nl> <nl> - / / RUN : % target - swift - frontend - Xllvm - sil - inline - generics = false - Xllvm - new - mangling - for - tests - O - emit - sil % s | % FileCheck % s <nl> + / / RUN : % target - swift - frontend - Xllvm - new - mangling - for - tests - O - emit - sil % s | % FileCheck % s <nl> <nl> public protocol Foo { <nl> func foo ( _ x : Int ) - > Int <nl> mmm a / test / SILOptimizer / devirt_specialized_conformance . swift <nl> ppp b / test / SILOptimizer / devirt_specialized_conformance . swift <nl> <nl> - / / RUN : % target - swift - frontend - O - Xllvm - sil - inline - generics = false % s - emit - sil - sil - verify - all | % FileCheck % s <nl> + / / RUN : % target - swift - frontend - O % s - emit - sil - sil - verify - all | % FileCheck % s <nl> <nl> / / Make sure that we completely inline / devirtualize / substitute all the way down <nl> / / to unknown1 . <nl> mmm a / test / SILOptimizer / devirt_unbound_generic . swift <nl> ppp b / test / SILOptimizer / devirt_unbound_generic . swift <nl> <nl> - / / RUN : % target - swift - frontend - Xllvm - new - mangling - for - tests - Xllvm - sil - inline - generics = false - emit - sil - O % s | % FileCheck % s <nl> + / / RUN : % target - swift - frontend - Xllvm - new - mangling - for - tests - emit - sil - O % s | % FileCheck % s <nl> <nl> / / We used to crash on this when trying to devirtualize t . boo ( a , 1 ) , <nl> / / because it is an " apply " with unbound generic arguments and <nl> mmm a / test / SILOptimizer / opened_archetype_operands_tracking . sil <nl> ppp b / test / SILOptimizer / opened_archetype_operands_tracking . sil <nl> <nl> - / / RUN : % target - sil - opt - assume - parsing - unqualified - ownership - sil - sil - inline - generics = false - enable - sil - verify - all % s - O | % FileCheck % s <nl> + / / RUN : % target - sil - opt - assume - parsing - unqualified - ownership - sil - enable - sil - verify - all % s - O | % FileCheck % s <nl> <nl> / / Check some corner cases related to tracking of opened archetypes . <nl> / / For example , the compiler used to crash compiling the " process " function ( rdar : / / 28024272 ) <nl> mmm a / test / SILOptimizer / prespecialize . swift <nl> ppp b / test / SILOptimizer / prespecialize . swift <nl> <nl> - / / RUN : % target - swift - frontend % s - Onone - Xllvm - sil - inline - generics = false - emit - sil | % FileCheck % s <nl> + / / RUN : % target - swift - frontend % s - Onone - emit - sil | % FileCheck % s <nl> <nl> / / REQUIRES : optimized_stdlib <nl> <nl> <nl> / / CHECK - LABEL : sil [ noinline ] @ _TF13prespecialize4testFTRGSaSi_4sizeSi_T_ <nl> / / <nl> / / function_ref specialized Collection < A where . . . > . makeIterator ( ) - > IndexingIterator < A > <nl> - / / CHECK : function_ref @ _TTSgq5GVs14CountableRangeSi_GS_Si_s10Collections___TFesRxs10Collectionwx8IteratorzGVs16IndexingIteratorx_rS_12makeIteratorfT_GS1_x_ <nl> + / / CHECK : function_ref @ _TTSgq5SiSis10ComparablesSis11_Strideables___TFVs14CountableRangeCfT15uncheckedBoundsT5lowerx5upperx__GS_x_ <nl> / / <nl> / / function_ref specialized IndexingIterator . next ( ) - > A . _Element ? <nl> / / CHECK : function_ref @ _TTSgq5GVs14CountableRangeSi_GS_Si_s14_IndexableBases___TFVs16IndexingIterator4nextfT_GSqwx8_Element_ <nl>
Revert " Merge pull request from swiftix / wip - generics - inlining - flag - 4 "
apple/swift
1c60910198c8da69d65d5c9e22e61c6c5b835c75
2017-02-13T18:52:17Z
mmm a / drivers / gles3 / rasterizer_storage_gles3 . cpp <nl> ppp b / drivers / gles3 / rasterizer_storage_gles3 . cpp <nl> void RasterizerStorageGLES3 : : multimesh_allocate ( RID p_multimesh , int p_instances <nl> if ( multimesh - > buffer ) { <nl> glDeleteBuffers ( 1 , & multimesh - > buffer ) ; <nl> multimesh - > data . resize ( 0 ) ; <nl> + multimesh - > buffer = 0 ; <nl> } <nl> <nl> multimesh - > size = p_instances ; <nl>
Reset GLES3 MultiMesh buffer id when reallocating .
godotengine/godot
16429a4289e9738db2e451279699f35b42536527
2019-12-28T18:38:25Z
mmm a / Marlin / src / inc / Conditionals_adv . h <nl> ppp b / Marlin / src / inc / Conditionals_adv . h <nl> <nl> # define CONDITIONALS_ADV_H <nl> <nl> # ifndef USBCON <nl> - / / Define constants and variables for buffering incoming serial data . <nl> - / / Use only powers of 2 . <nl> - / / : [ 0 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 , 2048 , . . . ] <nl> + / / Define constants and variables for buffering serial data . <nl> + / / Use only 0 or powers of 2 greater than 1 <nl> + / / : [ 0 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 , 2048 , . . . ] <nl> # ifndef RX_BUFFER_SIZE <nl> # define RX_BUFFER_SIZE 128 <nl> # endif <nl> - / / 256 is the max TX buffer climit due to uint8_t head and tail . <nl> + / / 256 is the max TX buffer limit due to uint8_t head and tail <nl> + / / : [ 0 , 4 , 8 , 16 , 32 , 64 , 128 , 256 ] <nl> # ifndef TX_BUFFER_SIZE <nl> # define TX_BUFFER_SIZE 32 <nl> # endif <nl> + # else <nl> + / / SERIAL_XON_XOFF not supported on USB - native devices <nl> + # undef SERIAL_XON_XOFF <nl> # endif <nl> <nl> # endif / / CONDITIONALS_ADV_H <nl> mmm a / Marlin / src / inc / SanityCheck . h <nl> ppp b / Marlin / src / inc / SanityCheck . h <nl> <nl> * / <nl> # ifndef USBCON <nl> # if ENABLED ( SERIAL_XON_XOFF ) & & RX_BUFFER_SIZE < 1024 <nl> - # error " XON / XOFF requires RX_BUFFER_SIZE > = 1024 for reliable transfers without drops . " <nl> + # error " SERIAL_XON_XOFF requires RX_BUFFER_SIZE > = 1024 for reliable transfers without drops . " <nl> # endif <nl> <nl> # if ! IS_POWER_OF_2 ( RX_BUFFER_SIZE ) | | RX_BUFFER_SIZE < 2 <nl> # error " RX_BUFFER_SIZE must be a power of 2 greater than 1 . " <nl> # endif <nl> <nl> - / / 256 is the max limit due to uint8_t head and tail . Use only powers of 2 . ( . . . , 16 , 32 , 64 , 128 , 256 ) <nl> # if TX_BUFFER_SIZE & & ( TX_BUFFER_SIZE < 2 | | TX_BUFFER_SIZE > 256 | | ! IS_POWER_OF_2 ( TX_BUFFER_SIZE ) ) <nl> # error " TX_BUFFER_SIZE must be 0 , a power of 2 greater than 1 , and no greater than 256 . " <nl> # endif <nl> + # elif ENABLED ( SERIAL_XON_XOFF ) <nl> + # error " SERIAL_XON_XOFF is not supported on USB - native AVR devices . " <nl> # endif <nl> <nl> / * * <nl>
SERIAL_XON_XOFF not supported on USB - native AVR devices
MarlinFirmware/Marlin
91b63f6d69a86903aa6b43046286c00094b90c98
2017-12-04T11:57:01Z
new file mode 100644 <nl> index 0000000000 . . c0ead09765 <nl> mmm / dev / null <nl> ppp b / change / react - native - windows - 2020 - 08 - 03 - 22 - 04 - 44 - simplify - ws - factory . json <nl> <nl> + { <nl> + " type " : " prerelease " , <nl> + " comment " : " Handle MessageWebSocket constructor exceptions " , <nl> + " packageName " : " react - native - windows " , <nl> + " email " : " julio . rocha @ microsoft . com " , <nl> + " dependentChangeType " : " patch " , <nl> + " date " : " 2020 - 08 - 04T05 : 04 : 44 . 587Z " <nl> + } <nl> mmm a / vnext / Desktop . DLL / react - native - win32 . x64 . def <nl> ppp b / vnext / Desktop . DLL / react - native - win32 . x64 . def <nl> EXPORTS <nl> ? GetConstants @ ViewManagerBase @ react @ facebook @ @ UEBA ? AUdynamic @ folly @ @ XZ <nl> ? InitializeLogging @ react @ facebook @ @ YAX $ $ QEAV ? $ function @ $ $ A6AXW4RCTLogLevel @ react @ facebook @ @ PEBD @ Z @ std @ @ @ Z <nl> ? InitializeTracing @ react @ facebook @ @ YAXPEAUINativeTraceHandler @ 12 @ @ Z <nl> - ? Make @ IWebSocketResource @ React @ Microsoft @ @ SA ? AV ? $ shared_ptr @ UIWebSocketResource @ React @ Microsoft @ @ @ std @ @ AEBV ? $ basic_string @ DU ? $ char_traits @ D @ std @ @ V ? $ allocator @ D @ 2 @ @ 5 @ _N1 @ Z <nl> + ? Make @ IWebSocketResource @ React @ Microsoft @ @ SA ? AV ? $ shared_ptr @ UIWebSocketResource @ React @ Microsoft @ @ @ std @ @ $ $ QEAV ? $ basic_string @ DU ? $ char_traits @ D @ std @ @ V ? $ allocator @ D @ 2 @ @ 5 @ @ Z <nl> ? Make @ JSBigAbiString @ react @ facebook @ @ SA ? AV ? $ unique_ptr @ $ $ CBUJSBigAbiString @ react @ facebook @ @ U ? $ default_delete @ $ $ CBUJSBigAbiString @ react @ facebook @ @ @ std @ @ @ std @ @ $ $ QEAV ? $ unique_ptr @ U ? $ IAbiArray @ D @ AbiSafe @ @ UAbiObjectDeleter @ 2 @ @ 5 @ @ Z <nl> ? MakeMemoryMappedBuffer @ JSI @ Microsoft @ @ YA ? AV ? $ shared_ptr @ VBuffer @ jsi @ facebook @ @ @ std @ @ QEB_WI @ Z <nl> ? at @ dynamic @ folly @ @ QEGBAAEBU12 @ V ? $ Range @ PEBD @ 2 @ @ Z <nl> mmm a / vnext / Desktop . DLL / react - native - win32 . x86 . def <nl> ppp b / vnext / Desktop . DLL / react - native - win32 . x86 . def <nl> EXPORTS <nl> ? GetConstants @ ViewManagerBase @ react @ facebook @ @ UBE ? AUdynamic @ folly @ @ XZ <nl> ? InitializeLogging @ react @ facebook @ @ YGX $ $ QAV ? $ function @ $ $ A6GXW4RCTLogLevel @ react @ facebook @ @ PBD @ Z @ std @ @ @ Z <nl> ? InitializeTracing @ react @ facebook @ @ YGXPAUINativeTraceHandler @ 12 @ @ Z <nl> - ? Make @ IWebSocketResource @ React @ Microsoft @ @ SG ? AV ? $ shared_ptr @ UIWebSocketResource @ React @ Microsoft @ @ @ std @ @ ABV ? $ basic_string @ DU ? $ char_traits @ D @ std @ @ V ? $ allocator @ D @ 2 @ @ 5 @ _N1 @ Z <nl> + ? Make @ IWebSocketResource @ React @ Microsoft @ @ SG ? AV ? $ shared_ptr @ UIWebSocketResource @ React @ Microsoft @ @ @ std @ @ $ $ QAV ? $ basic_string @ DU ? $ char_traits @ D @ std @ @ V ? $ allocator @ D @ 2 @ @ 5 @ @ Z <nl> ? Make @ JSBigAbiString @ react @ facebook @ @ SG ? AV ? $ unique_ptr @ $ $ CBUJSBigAbiString @ react @ facebook @ @ U ? $ default_delete @ $ $ CBUJSBigAbiString @ react @ facebook @ @ @ std @ @ @ std @ @ $ $ QAV ? $ unique_ptr @ U ? $ IAbiArray @ D @ AbiSafe @ @ UAbiObjectDeleter @ 2 @ @ 5 @ @ Z <nl> ? MakeMemoryMappedBuffer @ JSI @ Microsoft @ @ YG ? AV ? $ shared_ptr @ VBuffer @ jsi @ facebook @ @ @ std @ @ QB_WI @ Z <nl> ? moduleNames @ ModuleRegistry @ react @ facebook @ @ QAE ? AV ? $ vector @ V ? $ basic_string @ DU ? $ char_traits @ D @ std @ @ V ? $ allocator @ D @ 2 @ @ std @ @ V ? $ allocator @ V ? $ basic_string @ DU ? $ char_traits @ D @ std @ @ V ? $ allocator @ D @ 2 @ @ std @ @ @ 2 @ @ std @ @ XZ <nl> EXPORTS <nl> ? makeChakraRuntime @ JSI @ Microsoft @ @ YG ? AV ? $ unique_ptr @ VRuntime @ jsi @ facebook @ @ U ? $ default_delete @ VRuntime @ jsi @ facebook @ @ @ std @ @ @ std @ @ $ $ QAUChakraRuntimeArgs @ 12 @ @ Z <nl> ? CreateTimingModule @ react @ facebook @ @ YG ? AV ? $ unique_ptr @ VCxxModule @ module @ xplat @ facebook @ @ U ? $ default_delete @ VCxxModule @ module @ xplat @ facebook @ @ @ std @ @ @ std @ @ ABV ? $ shared_ptr @ VMessageQueueThread @ react @ facebook @ @ @ 4 @ @ Z <nl> ? ? 0WebSocketModule @ React @ Microsoft @ @ QAE @ XZ <nl> - ? ? 0WebSocketModule @ React @ Microsoft @ @ QAE @ XZ <nl> ? CreateAsyncStorageModule @ react @ facebook @ @ YG ? AV ? $ unique_ptr @ VCxxModule @ module @ xplat @ facebook @ @ U ? $ default_delete @ VCxxModule @ module @ xplat @ facebook @ @ @ std @ @ @ std @ @ PB_W @ Z <nl> ? Make @ IHttpResource @ React @ Microsoft @ @ SG ? AV ? $ unique_ptr @ UIHttpResource @ React @ Microsoft @ @ U ? $ default_delete @ UIHttpResource @ React @ Microsoft @ @ @ std @ @ @ std @ @ XZ <nl> ? ? 0NetworkingModule @ React @ Microsoft @ @ QAE @ XZ <nl> mmm a / vnext / Desktop . IntegrationTests / RNTesterIntegrationTests . cpp <nl> ppp b / vnext / Desktop . IntegrationTests / RNTesterIntegrationTests . cpp <nl> std : : wstring ToString < TestStatus > ( const TestStatus & status ) { <nl> } / / namespace Microsoft : : VisualStudio : : CppUnitTestFramework <nl> <nl> TEST_MODULE_INITIALIZE ( InitModule ) { <nl> - Microsoft : : React : : SetFeatureGate ( " UseWinRTWebSocket " , true ) ; <nl> + Microsoft : : React : : SetFeatureGate ( " WebSocket . AcceptSelfSigned " , true ) ; <nl> } <nl> <nl> / / None of these tests are runnable <nl> mmm a / vnext / Desktop . IntegrationTests / WebSocketIntegrationTest . cpp <nl> ppp b / vnext / Desktop . IntegrationTests / WebSocketIntegrationTest . cpp <nl> TEST_CLASS ( WebSocketIntegrationTest ) <nl> string scheme = " ws " ; <nl> if ( isSecure ) <nl> scheme + = " s " ; <nl> - auto ws = IWebSocketResource : : Make ( scheme + " : / / localhost : 5556 / " , false , true ) ; <nl> + auto ws = IWebSocketResource : : Make ( scheme + " : / / localhost : 5556 / " ) ; <nl> promise < size_t > sentSizePromise ; <nl> ws - > SetOnSend ( [ & sentSizePromise ] ( size_t size ) <nl> { <nl> mmm a / vnext / Desktop . UnitTests / UtilsTest . cpp <nl> ppp b / vnext / Desktop . UnitTests / UtilsTest . cpp <nl> <nl> # include < CppUnitTest . h > <nl> # include < Utils . h > <nl> <nl> - using namespace facebook : : react ; <nl> using namespace Microsoft : : VisualStudio : : CppUnitTestFramework ; <nl> <nl> using std : : string ; <nl> TEST_CLASS ( UtilsTest ) { <nl> string path = " / " , <nl> string query = " " ) { <nl> <nl> - Url url ( urlString ) ; <nl> + Url url ( std : : move ( urlString ) ) ; <nl> <nl> Assert : : AreEqual ( protocol , url . scheme ) ; <nl> Assert : : AreEqual ( host , url . host ) ; <nl> mmm a / vnext / Desktop . UnitTests / WebSocketModuleTest . cpp <nl> ppp b / vnext / Desktop . UnitTests / WebSocketModuleTest . cpp <nl> TEST_CLASS ( WebSocketModuleTest ) { <nl> auto instance = CreateMockInstance ( jsef ) ; <nl> auto module = make_unique < WebSocketModule > ( ) ; <nl> module - > setInstance ( instance ) ; <nl> - module - > SetResourceFactory ( [ ] ( const string & , bool , bool ) { <nl> + module - > SetResourceFactory ( [ ] ( const string & ) { <nl> auto rc = make_shared < MockWebSocketResource > ( ) ; <nl> rc - > Mocks . Connect = [ rc ] ( const IWebSocketResource : : Protocols & , const IWebSocketResource : : Options & ) { <nl> rc - > OnConnect ( ) ; <nl> mmm a / vnext / Desktop . UnitTests / WinRTNetworkingMocks . cpp <nl> ppp b / vnext / Desktop . UnitTests / WinRTNetworkingMocks . cpp <nl> <nl> <nl> # include " WinRTNetworkingMocks . h " <nl> <nl> + # include < Windows . h > <nl> + <nl> using namespace winrt : : Windows : : Foundation ; <nl> using namespace winrt : : Windows : : Networking : : Sockets ; <nl> using namespace winrt : : Windows : : Storage : : Streams ; <nl> namespace Microsoft : : React : : Test { <nl> <nl> # pragma region MockMessageWebSocket <nl> <nl> + MockMessageWebSocket : : MockMessageWebSocket ( ) { <nl> + Mocks . MessageReceivedToken = <nl> + [ ] ( TypedEventHandler < MessageWebSocket , MessageWebSocketMessageReceivedEventArgs > const & ) - > event_token { <nl> + return event_token { } ; <nl> + } ; <nl> + } <nl> + <nl> / / IWebSocket <nl> IOutputStream MockMessageWebSocket : : OutputStream ( ) const { <nl> if ( Mocks . OutputStream ) <nl> void MockMessageWebSocket : : MessageReceived ( event_token const & eventCookie ) const <nl> <nl> # pragma endregion MockMessageWebSocket <nl> <nl> + # pragma region ThrowingMessageWebSocket <nl> + <nl> + ThrowingMessageWebSocket : : ThrowingMessageWebSocket ( ) : MockMessageWebSocket ( ) { <nl> + throw winrt : : hresult_error ( winrt : : hresult ( E_FAIL ) , L " Failed to instantiate WinRT class . " ) ; <nl> + } <nl> + <nl> + # pragma endregion ThrowingMessageWebSocket <nl> + <nl> # pragma region MockDataWriter <nl> <nl> uint32_t MockDataWriter : : UnstoredBufferLength ( ) const { <nl> mmm a / vnext / Desktop . UnitTests / WinRTNetworkingMocks . h <nl> ppp b / vnext / Desktop . UnitTests / WinRTNetworkingMocks . h <nl> <nl> namespace Microsoft : : React : : Test { <nl> <nl> / / / < summary > <nl> - / / Mocks winrt : : Windows : : Networking : : Sockets : : MessageWebSocket <nl> + / / Mocks winrt : : Windows : : Networking : : Sockets : : MessageWebSocket . <nl> + / / Behavior can be mocked per each interface mehtod . <nl> / / / < / summary > <nl> struct MockMessageWebSocket : public winrt : : implements < <nl> MockMessageWebSocket , <nl> winrt : : Windows : : Networking : : Sockets : : IMessageWebSocket , <nl> winrt : : Windows : : Networking : : Sockets : : IWebSocket > { <nl> + MockMessageWebSocket ( ) ; <nl> + <nl> struct Mocks { <nl> / / IWebSocket <nl> std : : function < winrt : : Windows : : Foundation : : IAsyncAction ( winrt : : Windows : : Foundation : : Uri const & ) / * const * / > <nl> struct MockMessageWebSocket : public winrt : : implements < <nl> <nl> } ; / / MockMessageWebSocket <nl> <nl> + struct ThrowingMessageWebSocket : public MockMessageWebSocket { <nl> + ThrowingMessageWebSocket ( ) ; <nl> + } ; <nl> + <nl> struct MockDataWriter : public winrt : : Windows : : Storage : : Streams : : IDataWriter { <nl> struct Mocks { <nl> std : : function < std : : uint32_t ( ) / * const * / > UnstoredBufferLength ; <nl> struct MockMessageWebSocketControl : winrt : : implements < <nl> <nl> # pragma region IMessageWebSocketControl <nl> <nl> - uint32_t MaxMessageSize ( ) const ; <nl> + std : : uint32_t MaxMessageSize ( ) const ; <nl> void MaxMessageSize ( std : : uint32_t value ) const ; <nl> winrt : : Windows : : Networking : : Sockets : : SocketMessageType MessageType ( ) const ; <nl> void MessageType ( winrt : : Windows : : Networking : : Sockets : : SocketMessageType const & value ) const ; <nl> mmm a / vnext / Desktop . UnitTests / WinRTWebSocketResourceUnitTest . cpp <nl> ppp b / vnext / Desktop . UnitTests / WinRTWebSocketResourceUnitTest . cpp <nl> using namespace winrt : : Windows : : Foundation ; <nl> using namespace winrt : : Windows : : Networking : : Sockets ; <nl> <nl> using std : : make_shared ; <nl> + using std : : shared_ptr ; <nl> using std : : string ; <nl> using winrt : : event_token ; <nl> using winrt : : param : : hstring ; <nl> IAsyncAction ThrowAsync ( ) { <nl> } / / namespace <nl> <nl> namespace Microsoft : : React : : Test { <nl> - <nl> TEST_CLASS ( WinRTWebSocketResourceUnitTest ) { <nl> TEST_METHOD ( ConnectSucceeds ) { <nl> bool connected = true ; <nl> TEST_CLASS ( WinRTWebSocketResourceUnitTest ) { <nl> auto mws { imws . as < MockMessageWebSocket > ( ) } ; <nl> / / TODO : Mock Control ( ) <nl> mws - > Mocks . ConnectAsync = [ ] ( const Uri & ) - > IAsyncAction { return DoNothingAsync ( ) ; } ; <nl> - mws - > Mocks . MessageReceivedToken = <nl> - [ ] ( TypedEventHandler < MessageWebSocket , MessageWebSocketMessageReceivedEventArgs > const & ) - > event_token { <nl> - return event_token { } ; <nl> - } ; <nl> mws - > Mocks . Close = [ ] ( uint16_t , const hstring & ) { } ; <nl> <nl> / / Test APIs <nl> TEST_CLASS ( WinRTWebSocketResourceUnitTest ) { <nl> / / Set up mocks <nl> auto mws { imws . as < MockMessageWebSocket > ( ) } ; <nl> mws - > Mocks . ConnectAsync = [ ] ( const Uri & ) - > IAsyncAction { return ThrowAsync ( ) ; } ; <nl> - mws - > Mocks . MessageReceivedToken = <nl> - [ ] ( TypedEventHandler < MessageWebSocket , MessageWebSocketMessageReceivedEventArgs > const & ) - > event_token { <nl> - return event_token { } ; <nl> - } ; <nl> mws - > Mocks . Close = [ ] ( uint16_t , const hstring & ) { } ; <nl> <nl> / / Test APIs <nl> TEST_CLASS ( WinRTWebSocketResourceUnitTest ) { <nl> Assert : : AreNotEqual ( { } , errorMessage ) ; <nl> Assert : : IsFalse ( connected ) ; <nl> } <nl> + <nl> + TEST_METHOD ( InternalSocketThrowsHResult ) { <nl> + shared_ptr < WinRTWebSocketResource > rc ; <nl> + <nl> + auto lambda = [ & rc ] ( ) mutable { <nl> + rc = make_shared < WinRTWebSocketResource > ( <nl> + winrt : : make < ThrowingMessageWebSocket > ( ) , MockDataWriter { } , Uri { L " ws : / / host : 0 " } , CertExceptions { } ) ; <nl> + } ; <nl> + <nl> + Assert : : ExpectException < winrt : : hresult_error > ( lambda ) ; <nl> + Assert : : IsTrue ( nullptr = = rc ) ; <nl> + } <nl> } ; <nl> <nl> } / / namespace Microsoft : : React : : Test <nl> mmm a / vnext / Desktop / BeastWebSocketResource . h <nl> ppp b / vnext / Desktop / BeastWebSocketResource . h <nl> class TestWebSocketResource : public BaseWebSocketResource < <nl> # pragma endregion BaseWebSocketResource overrides <nl> <nl> public : <nl> - TestWebSocketResource ( facebook : : react : : Url & & url ) ; <nl> + TestWebSocketResource ( Url & & url ) ; <nl> <nl> void SetConnectResult ( std : : function < boost : : system : : error_code ( ) > & & resultFunc ) ; <nl> void SetHandshakeResult ( std : : function < boost : : system : : error_code ( std : : string , std : : string ) > & & resultFunc ) ; <nl> mmm a / vnext / Desktop / HttpResource . cpp <nl> ppp b / vnext / Desktop / HttpResource . cpp <nl> void HttpResource : : SendRequest ( <nl> / / Validate verb . <nl> unique_ptr < Url > url ; <nl> try { <nl> - url = make_unique < Url > ( urlString ) ; <nl> + url = make_unique < Url > ( string { urlString } ) ; <nl> } catch ( . . . ) { <nl> m_errorHandler ( " Malformed URL " ) ; <nl> return ; <nl> mmm a / vnext / Desktop / Modules / WebSocketModule . cpp <nl> ppp b / vnext / Desktop / Modules / WebSocketModule . cpp <nl> <nl> using namespace facebook : : xplat ; <nl> using namespace folly ; <nl> <nl> + using Microsoft : : Common : : Unicode : : Utf16ToUtf8 ; <nl> using Microsoft : : Common : : Unicode : : Utf8ToUtf16 ; <nl> <nl> using std : : shared_ptr ; <nl> constexpr char moduleName [ ] = " WebSocketModule " ; <nl> namespace Microsoft : : React { <nl> <nl> WebSocketModule : : WebSocketModule ( ) <nl> - : m_resourceFactory { [ ] ( const string & url , bool legacyImplementation , bool acceptSelfSigned ) { <nl> - return IWebSocketResource : : Make ( url , legacyImplementation , acceptSelfSigned ) ; <nl> - } } { } <nl> + : m_resourceFactory { [ ] ( string & & url ) { return IWebSocketResource : : Make ( std : : move ( url ) ) ; } } { } <nl> <nl> void WebSocketModule : : SetResourceFactory ( <nl> - std : : function < shared_ptr < IWebSocketResource > ( const string & , bool , bool ) > & & resourceFactory ) { <nl> + std : : function < shared_ptr < IWebSocketResource > ( const string & ) > & & resourceFactory ) { <nl> m_resourceFactory = std : : move ( resourceFactory ) ; <nl> } <nl> <nl> void WebSocketModule : : SendEvent ( string & & eventName , dynamic & & args ) { <nl> } <nl> <nl> / / clang - format off <nl> - std : : shared_ptr < IWebSocketResource > WebSocketModule : : GetOrCreateWebSocket ( int64_t id , string & & url ) <nl> + shared_ptr < IWebSocketResource > WebSocketModule : : GetOrCreateWebSocket ( int64_t id , string & & url ) <nl> { <nl> auto itr = m_webSockets . find ( id ) ; <nl> if ( itr = = m_webSockets . end ( ) ) <nl> { <nl> - auto ws = m_resourceFactory ( std : : move ( url ) , / * legacyImplementation * / false , / * acceptSelfSigned * / false ) ; <nl> + shared_ptr < IWebSocketResource > ws ; <nl> + try <nl> + { <nl> + ws = m_resourceFactory ( std : : move ( url ) ) ; <nl> + } <nl> + catch ( const winrt : : hresult_error & e ) <nl> + { <nl> + string message = string { " [ " + e . code ( ) } + " ] " + Utf16ToUtf8 ( e . message ( ) ) ; <nl> + SendEvent ( " webSocketFailed " , dynamic : : object ( " id " , id ) ( " message " , std : : move ( message ) ) ) ; <nl> + <nl> + return nullptr ; <nl> + } <nl> + catch ( const std : : exception & e ) <nl> + { <nl> + SendEvent ( " webSocketFailed " , dynamic : : object ( " id " , id ) ( " message " , e . what ( ) ) ) ; <nl> + <nl> + return nullptr ; <nl> + } <nl> + catch ( . . . ) <nl> + { <nl> + SendEvent ( " webSocketFailed " , dynamic : : object ( " id " , id ) ( " message " , " Unidentified error creating IWebSocketResource " ) ) ; <nl> + <nl> + return nullptr ; <nl> + } <nl> + <nl> auto weakInstance = this - > getInstance ( ) ; <nl> ws - > SetOnError ( [ this , id , weakInstance ] ( const IWebSocketResource : : Error & err ) <nl> { <nl> mmm a / vnext / Desktop / WebSocketResourceFactory . cpp <nl> ppp b / vnext / Desktop / WebSocketResourceFactory . cpp <nl> namespace Microsoft : : React { <nl> # pragma region IWebSocketResource static members <nl> <nl> / * static * / <nl> - shared_ptr < IWebSocketResource > <nl> - IWebSocketResource : : Make ( const string & urlString , bool legacyImplementation , bool acceptSelfSigned ) { <nl> - if ( GetFeatureGate ( " UseWinRTWebSocket " ) ) { <nl> + shared_ptr < IWebSocketResource > IWebSocketResource : : Make ( string & & urlString ) { <nl> + if ( ! GetFeatureGate ( " UseBeastWebSocket " ) ) { <nl> std : : vector < winrt : : Windows : : Security : : Cryptography : : Certificates : : ChainValidationResult > certExceptions ; <nl> - if ( acceptSelfSigned ) { <nl> + if ( GetFeatureGate ( " WebSocket . AcceptSelfSigned " ) ) { <nl> certExceptions . emplace_back ( <nl> winrt : : Windows : : Security : : Cryptography : : Certificates : : ChainValidationResult : : Untrusted ) ; <nl> certExceptions . emplace_back ( <nl> winrt : : Windows : : Security : : Cryptography : : Certificates : : ChainValidationResult : : InvalidName ) ; <nl> } <nl> - return make_shared < WinRTWebSocketResource > ( urlString , std : : move ( certExceptions ) ) ; <nl> + return make_shared < WinRTWebSocketResource > ( std : : move ( urlString ) , std : : move ( certExceptions ) ) ; <nl> } else { <nl> - Url url ( urlString ) ; <nl> + Url url ( std : : move ( urlString ) ) ; <nl> <nl> if ( url . scheme = = " ws " ) { <nl> if ( url . port . empty ( ) ) <nl> mmm a / vnext / Shared / IWebSocketResource . h <nl> ppp b / vnext / Shared / IWebSocketResource . h <nl> struct IWebSocketResource { <nl> / / / WebSocket URL address the instance will connect to . <nl> / / / The address ' s scheme can be either ws : / / or wss : / / . <nl> / / / < / param > <nl> - static std : : shared_ptr < IWebSocketResource > <nl> - Make ( const std : : string & url , bool legacyImplementation = false , bool acceptSelfSigned = false ) ; <nl> + static std : : shared_ptr < IWebSocketResource > Make ( std : : string & & url ) ; <nl> <nl> virtual ~ IWebSocketResource ( ) noexcept { } <nl> <nl> mmm a / vnext / Shared / Modules / WebSocketModule . h <nl> ppp b / vnext / Shared / Modules / WebSocketModule . h <nl> class WebSocketModule : public facebook : : xplat : : module : : CxxModule { <nl> <nl> # pragma endregion CxxModule overrides <nl> <nl> - void SetResourceFactory ( <nl> - std : : function < std : : shared_ptr < IWebSocketResource > ( const std : : string & , bool , bool ) > & & resourceFactory = nullptr ) ; <nl> + void SetResourceFactory ( std : : function < std : : shared_ptr < IWebSocketResource > ( const std : : string & ) > & & resourceFactory ) ; <nl> <nl> private : <nl> / / / < summary > <nl> class WebSocketModule : public facebook : : xplat : : module : : CxxModule { <nl> / / / < summary > <nl> / / / Generates IWebSocketResource instances , defaulting to IWebSocketResource : : Make . <nl> / / / < / summary > <nl> - std : : function < std : : shared_ptr < IWebSocketResource > ( const std : : string & , bool , bool ) > m_resourceFactory ; <nl> + std : : function < std : : shared_ptr < IWebSocketResource > ( std : : string & & ) > m_resourceFactory ; <nl> } ; <nl> <nl> } / / namespace Microsoft : : React <nl> mmm a / vnext / Shared / Utils . cpp <nl> ppp b / vnext / Shared / Utils . cpp <nl> using std : : string ; <nl> <nl> namespace Microsoft : : React { <nl> <nl> - Url : : Url ( const string & source ) { <nl> + Url : : Url ( string & & source ) { <nl> / / ( 1 ) ( 2 ) ( 3 ( 4 ) ) ( 5 ) ( 6 ( 7 ) ) <nl> std : : regex expression ( " ( http | https | ws | wss ) : / / ( [ ^ : / \ \ ? ] + ) ( : ( \ \ d + ) ) ? ( / [ ^ \ \ ? ] * ) ? ( \ \ ? ( . * ) ) ? $ " ) ; <nl> / / scheme host port path query <nl> mmm a / vnext / Shared / Utils . h <nl> ppp b / vnext / Shared / Utils . h <nl> struct Url { <nl> std : : string path ; <nl> std : : string queryString ; <nl> <nl> - Url ( const std : : string & urlString ) ; <nl> + Url ( std : : string & & urlString ) ; <nl> <nl> std : : string Target ( ) ; <nl> } ; <nl> <nl> } / / namespace Microsoft : : React <nl> - <nl> - / / Deprecated . Keeping for compatibility . <nl> - namespace facebook : : react { <nl> - <nl> - using Url = Microsoft : : React : : Url ; <nl> - <nl> - } / / namespace facebook : : react <nl>
Handle MessageWebSocket constructor exceptions ( )
microsoft/react-native-windows
3892ec0503ce452be5541480eb83bdb4024680d3
2020-08-05T00:45:11Z
mmm a / 3rdparty / libtiff / tif_color . c <nl> ppp b / 3rdparty / libtiff / tif_color . c <nl> <nl> - / * $ Id : tif_color . c , v 1 . 12 . 2 . 1 2010 - 06 - 08 18 : 50 : 41 bfriesen Exp $ * / <nl> + / * $ Id : tif_color . c , v 1 . 12 . 2 . 2 2010 - 12 - 14 02 : 23 : 09 faxguy Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1988 - 1997 Sam Leffler <nl> void <nl> TIFFYCbCrtoRGB ( TIFFYCbCrToRGB * ycbcr , uint32 Y , int32 Cb , int32 Cr , <nl> uint32 * r , uint32 * g , uint32 * b ) <nl> { <nl> + int32 i ; <nl> + <nl> / * XXX : Only 8 - bit YCbCr input supported for now * / <nl> Y = HICLAMP ( Y , 255 ) , Cb = CLAMP ( Cb , 0 , 255 ) , Cr = CLAMP ( Cr , 0 , 255 ) ; <nl> <nl> - * r = ycbcr - > clamptab [ ycbcr - > Y_tab [ Y ] + ycbcr - > Cr_r_tab [ Cr ] ] ; <nl> - * g = ycbcr - > clamptab [ ycbcr - > Y_tab [ Y ] <nl> - + ( int ) ( ( ycbcr - > Cb_g_tab [ Cb ] + ycbcr - > Cr_g_tab [ Cr ] ) > > SHIFT ) ] ; <nl> - * b = ycbcr - > clamptab [ ycbcr - > Y_tab [ Y ] + ycbcr - > Cb_b_tab [ Cb ] ] ; <nl> + i = ycbcr - > Y_tab [ Y ] + ycbcr - > Cr_r_tab [ Cr ] ; <nl> + * r = CLAMP ( i , 0 , 255 ) ; <nl> + i = ycbcr - > Y_tab [ Y ] <nl> + + ( int ) ( ( ycbcr - > Cb_g_tab [ Cb ] + ycbcr - > Cr_g_tab [ Cr ] ) > > SHIFT ) ; <nl> + * g = CLAMP ( i , 0 , 255 ) ; <nl> + i = ycbcr - > Y_tab [ Y ] + ycbcr - > Cb_b_tab [ Cb ] ; <nl> + * b = CLAMP ( i , 0 , 255 ) ; <nl> } <nl> <nl> / * <nl> mmm a / 3rdparty / libtiff / tif_dir . c <nl> ppp b / 3rdparty / libtiff / tif_dir . c <nl> <nl> - / * $ Id : tif_dir . c , v 1 . 75 . 2 . 5 2010 - 06 - 09 21 : 15 : 27 bfriesen Exp $ * / <nl> + / * $ Id : tif_dir . c , v 1 . 75 . 2 . 6 2010 - 07 - 02 09 : 49 : 23 dron Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1988 - 1997 Sam Leffler <nl> _TIFFVSetField ( TIFF * tif , ttag_t tag , va_list ap ) <nl> * work in with its normal work . <nl> * / <nl> if ( tif - > tif_flags & TIFF_SWAB ) { <nl> - if ( td - > td_bitspersample = = 16 ) <nl> + if ( td - > td_bitspersample = = 8 ) <nl> + tif - > tif_postdecode = _TIFFNoPostDecode ; <nl> + else if ( td - > td_bitspersample = = 16 ) <nl> tif - > tif_postdecode = _TIFFSwab16BitData ; <nl> else if ( td - > td_bitspersample = = 24 ) <nl> tif - > tif_postdecode = _TIFFSwab24BitData ; <nl> mmm a / 3rdparty / libtiff / tif_dirread . c <nl> ppp b / 3rdparty / libtiff / tif_dirread . c <nl> <nl> - / * $ Id : tif_dirread . c , v 1 . 92 . 2 . 9 2010 - 06 - 14 00 : 21 : 46 fwarmerdam Exp $ * / <nl> + / * $ Id : tif_dirread . c , v 1 . 92 . 2 . 15 2010 - 12 - 31 16 : 12 : 40 olivier Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1988 - 1997 Sam Leffler <nl> static float TIFFFetchRational ( TIFF * , TIFFDirEntry * ) ; <nl> static int TIFFFetchNormalTag ( TIFF * , TIFFDirEntry * ) ; <nl> static int TIFFFetchPerSampleShorts ( TIFF * , TIFFDirEntry * , uint16 * ) ; <nl> static int TIFFFetchPerSampleLongs ( TIFF * , TIFFDirEntry * , uint32 * ) ; <nl> - static int TIFFFetchPerSampleAnys ( TIFF * , TIFFDirEntry * , double * ) ; <nl> + static int TIFFFetchPerSampleAnys ( TIFF * , TIFFDirEntry * , double * , double * ) ; <nl> static int TIFFFetchShortArray ( TIFF * , TIFFDirEntry * , uint16 * ) ; <nl> static int TIFFFetchStripThing ( TIFF * , TIFFDirEntry * , long , uint32 * * ) ; <nl> static int TIFFFetchRefBlackWhite ( TIFF * , TIFFDirEntry * ) ; <nl> TIFFReadDirectory ( TIFF * tif ) <nl> const TIFFFieldInfo * fip ; <nl> size_t fix ; <nl> uint16 dircount ; <nl> + uint16 previous_tag = 0 ; <nl> int diroutoforderwarning = 0 , compressionknown = 0 ; <nl> int haveunknowntags = 0 ; <nl> <nl> TIFFReadDirectory ( TIFF * tif ) <nl> tif - > tif_name , tif - > tif_nextdiroff ) ; <nl> return 0 ; <nl> } <nl> - <nl> + { <nl> + TIFFDirEntry * ma ; <nl> + uint16 mb ; <nl> + for ( ma = dir , mb = 0 ; mb < dircount ; ma + + , mb + + ) <nl> + { <nl> + TIFFDirEntry * na ; <nl> + uint16 nb ; <nl> + for ( na = ma + 1 , nb = mb + 1 ; nb < dircount ; na + + , nb + + ) <nl> + { <nl> + if ( ma - > tdir_tag = = na - > tdir_tag ) <nl> + na - > tdir_tag = IGNORE ; <nl> + } <nl> + } <nl> + } <nl> tif - > tif_flags & = ~ TIFF_BEENWRITING ; / * reset before new dir * / <nl> / * <nl> * Setup default value and then make a pass over <nl> TIFFReadDirectory ( TIFF * tif ) <nl> <nl> if ( dp - > tdir_tag = = IGNORE ) <nl> continue ; <nl> - if ( fix > = tif - > tif_nfields ) <nl> - fix = 0 ; <nl> <nl> / * <nl> * Silicon Beach ( at least ) writes unordered <nl> * directory tags ( violating the spec ) . Handle <nl> * it here , but be obnoxious ( maybe they ' ll fix it ? ) . <nl> * / <nl> - if ( dp - > tdir_tag < tif - > tif_fieldinfo [ fix ] - > field_tag ) { <nl> + if ( dp - > tdir_tag < previous_tag ) { <nl> if ( ! diroutoforderwarning ) { <nl> TIFFWarningExt ( tif - > tif_clientdata , module , <nl> " % s : invalid TIFF directory ; tags are not sorted in ascending order " , <nl> tif - > tif_name ) ; <nl> diroutoforderwarning = 1 ; <nl> } <nl> - fix = 0 ; / * O ( n ^ 2 ) * / <nl> } <nl> + previous_tag = dp - > tdir_tag ; <nl> + if ( fix > = tif - > tif_nfields | | <nl> + dp - > tdir_tag < tif - > tif_fieldinfo [ fix ] - > field_tag ) <nl> + fix = 0 ; / * O ( n ^ 2 ) * / <nl> while ( fix < tif - > tif_nfields & & <nl> tif - > tif_fieldinfo [ fix ] - > field_tag < dp - > tdir_tag ) <nl> fix + + ; <nl> TIFFReadDirectory ( TIFF * tif ) <nl> } <nl> break ; <nl> case TIFFTAG_SMINSAMPLEVALUE : <nl> + { <nl> + double minv = 0 . 0 , maxv = 0 . 0 ; <nl> + if ( ! TIFFFetchPerSampleAnys ( tif , dp , & minv , & maxv ) | | <nl> + ! TIFFSetField ( tif , dp - > tdir_tag , minv ) ) <nl> + goto bad ; <nl> + } <nl> + break ; <nl> case TIFFTAG_SMAXSAMPLEVALUE : <nl> { <nl> - double dv = 0 . 0 ; <nl> - if ( ! TIFFFetchPerSampleAnys ( tif , dp , & dv ) | | <nl> - ! TIFFSetField ( tif , dp - > tdir_tag , dv ) ) <nl> + double minv = 0 . 0 , maxv = 0 . 0 ; <nl> + if ( ! TIFFFetchPerSampleAnys ( tif , dp , & minv , & maxv ) | | <nl> + ! TIFFSetField ( tif , dp - > tdir_tag , maxv ) ) <nl> goto bad ; <nl> } <nl> break ; <nl> TIFFReadDirectory ( TIFF * tif ) <nl> } <nl> if ( ! TIFFFieldSet ( tif , FIELD_SAMPLESPERPIXEL ) ) <nl> { <nl> - if ( ( td - > td_photometric = = PHOTOMETRIC_RGB ) <nl> - | | ( td - > td_photometric = = PHOTOMETRIC_YCBCR ) ) <nl> + if ( td - > td_photometric = = PHOTOMETRIC_RGB ) <nl> { <nl> TIFFWarningExt ( tif - > tif_clientdata , <nl> " TIFFReadDirectory " , <nl> TIFFReadDirectory ( TIFF * tif ) <nl> if ( ! TIFFSetField ( tif , TIFFTAG_SAMPLESPERPIXEL , 3 ) ) <nl> goto bad ; <nl> } <nl> - else if ( ( td - > td_photometric = = PHOTOMETRIC_MINISWHITE ) <nl> - | | ( td - > td_photometric = = PHOTOMETRIC_MINISBLACK ) ) <nl> + if ( td - > td_photometric = = PHOTOMETRIC_YCBCR ) <nl> { <nl> TIFFWarningExt ( tif - > tif_clientdata , <nl> " TIFFReadDirectory " , <nl> " SamplesPerPixel tag is missing , " <nl> - " assuming correct SamplesPerPixel value is 1 " ) ; <nl> + " applying correct SamplesPerPixel value of 3 " ) ; <nl> + if ( ! TIFFSetField ( tif , TIFFTAG_SAMPLESPERPIXEL , 3 ) ) <nl> + goto bad ; <nl> + } <nl> + else if ( ( td - > td_photometric = = PHOTOMETRIC_MINISWHITE ) <nl> + | | ( td - > td_photometric = = PHOTOMETRIC_MINISBLACK ) ) <nl> + { <nl> + / * <nl> + * SamplesPerPixel tag is missing , but is not required <nl> + * by spec . Assume correct SamplesPerPixel value of 1 . <nl> + * / <nl> if ( ! TIFFSetField ( tif , TIFFTAG_SAMPLESPERPIXEL , 1 ) ) <nl> goto bad ; <nl> } <nl> TIFFReadDirectory ( TIFF * tif ) <nl> * / <nl> if ( td - > td_photometric = = PHOTOMETRIC_PALETTE & & <nl> ! TIFFFieldSet ( tif , FIELD_COLORMAP ) ) { <nl> - MissingRequired ( tif , " Colormap " ) ; <nl> - goto bad ; <nl> + if ( tif - > tif_dir . td_bitspersample > = 8 & & tif - > tif_dir . td_samplesperpixel = = 3 ) <nl> + tif - > tif_dir . td_photometric = PHOTOMETRIC_RGB ; <nl> + else if ( tif - > tif_dir . td_bitspersample > = 8 ) <nl> + tif - > tif_dir . td_photometric = PHOTOMETRIC_MINISBLACK ; <nl> + else { <nl> + MissingRequired ( tif , " Colormap " ) ; <nl> + goto bad ; <nl> + } <nl> } <nl> / * <nl> * OJPEG hack : <nl> CheckDirCount ( TIFF * tif , TIFFDirEntry * dir , uint32 count ) <nl> " incorrect count for field \ " % s \ " ( % u , expecting % u ) ; tag trimmed " , <nl> _TIFFFieldWithTag ( tif , dir - > tdir_tag ) - > field_name , <nl> dir - > tdir_count , count ) ; <nl> + dir - > tdir_count = count ; <nl> return ( 1 ) ; <nl> } <nl> return ( 1 ) ; <nl> TIFFFetchShortPair ( TIFF * tif , TIFFDirEntry * dir ) <nl> case TIFF_SHORT : <nl> case TIFF_SSHORT : <nl> { <nl> - uint16 v [ 2 ] = { 0 , 0 } ; <nl> + uint16 v [ 2 ] ; <nl> return TIFFFetchShortArray ( tif , dir , v ) <nl> & & TIFFSetField ( tif , dir - > tdir_tag , v [ 0 ] , v [ 1 ] ) ; <nl> } <nl> TIFFFetchPerSampleLongs ( TIFF * tif , TIFFDirEntry * dir , uint32 * pl ) <nl> } <nl> <nl> / * <nl> - * Fetch samples / pixel ANY values for the specified tag and verify that all <nl> - * values are the same . <nl> + * Fetch samples / pixel ANY values for the specified tag and returns their min <nl> + * and max . <nl> * / <nl> static int <nl> - TIFFFetchPerSampleAnys ( TIFF * tif , TIFFDirEntry * dir , double * pl ) <nl> + TIFFFetchPerSampleAnys ( TIFF * tif , TIFFDirEntry * dir , double * minv , double * maxv ) <nl> { <nl> uint16 samples = tif - > tif_dir . td_samplesperpixel ; <nl> int status = 0 ; <nl> TIFFFetchPerSampleAnys ( TIFF * tif , TIFFDirEntry * dir , double * pl ) <nl> if ( samples < check_count ) <nl> check_count = samples ; <nl> <nl> + * minv = * maxv = v [ 0 ] ; <nl> for ( i = 1 ; i < check_count ; i + + ) <nl> - if ( v [ i ] ! = v [ 0 ] ) { <nl> - TIFFErrorExt ( tif - > tif_clientdata , tif - > tif_name , <nl> - " Cannot handle different per - sample values for field \ " % s \ " " , <nl> - _TIFFFieldWithTag ( tif , dir - > tdir_tag ) - > field_name ) ; <nl> - goto bad ; <nl> - } <nl> - * pl = v [ 0 ] ; <nl> + { <nl> + if ( v [ i ] < * minv ) <nl> + * minv = v [ i ] ; <nl> + if ( v [ i ] > * maxv ) <nl> + * maxv = v [ i ] ; <nl> + } <nl> status = 1 ; <nl> } <nl> - bad : <nl> if ( v & & v ! = buf ) <nl> _TIFFfree ( v ) ; <nl> } <nl> mmm a / 3rdparty / libtiff / tif_dirwrite . c <nl> ppp b / 3rdparty / libtiff / tif_dirwrite . c <nl> <nl> - / * $ Id : tif_dirwrite . c , v 1 . 37 . 2 . 7 2010 - 06 - 08 18 : 50 : 42 bfriesen Exp $ * / <nl> + / * $ Id : tif_dirwrite . c , v 1 . 37 . 2 . 9 2011 - 02 - 25 15 : 28 : 30 dron Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1988 - 1997 Sam Leffler <nl> extern void TIFFCvtNativeToIEEEDouble ( TIFF * , uint32 , double * ) ; <nl> static int TIFFWriteNormalTag ( TIFF * , TIFFDirEntry * , const TIFFFieldInfo * ) ; <nl> static void TIFFSetupShortLong ( TIFF * , ttag_t , TIFFDirEntry * , uint32 ) ; <nl> static void TIFFSetupShort ( TIFF * , ttag_t , TIFFDirEntry * , uint16 ) ; <nl> + static int TIFFSetupBytePair ( TIFF * , ttag_t , TIFFDirEntry * ) ; <nl> static int TIFFSetupShortPair ( TIFF * , ttag_t , TIFFDirEntry * ) ; <nl> static int TIFFWritePerSampleShorts ( TIFF * , ttag_t , TIFFDirEntry * ) ; <nl> static int TIFFWritePerSampleAnys ( TIFF * , TIFFDataType , ttag_t , TIFFDirEntry * ) ; <nl> _TIFFWriteDirectory ( TIFF * tif , int done ) <nl> _TIFFSampleToTagType ( tif ) , fip - > field_tag , dir ) ) <nl> goto bad ; <nl> break ; <nl> - case FIELD_PAGENUMBER : <nl> - case FIELD_HALFTONEHINTS : <nl> - case FIELD_YCBCRSUBSAMPLING : <nl> - if ( ! TIFFSetupShortPair ( tif , fip - > field_tag , dir ) ) <nl> - goto bad ; <nl> - break ; <nl> case FIELD_INKNAMES : <nl> if ( ! TIFFWriteInkNames ( tif , dir ) ) <nl> goto bad ; <nl> _TIFFWriteDirectory ( TIFF * tif , int done ) <nl> } <nl> break ; <nl> default : <nl> - / * XXX : Should be fixed and removed . * / <nl> - if ( fip - > field_tag = = TIFFTAG_DOTRANGE ) { <nl> - if ( ! TIFFSetupShortPair ( tif , fip - > field_tag , dir ) ) <nl> - goto bad ; <nl> - } <nl> - else if ( ! TIFFWriteNormalTag ( tif , dir , fip ) ) <nl> + / * <nl> + * XXX : Should be fixed and removed . See comments <nl> + * related to these tags in tif_dir . c . <nl> + * / <nl> + if ( fip - > field_tag = = TIFFTAG_PAGENUMBER <nl> + | | fip - > field_tag = = TIFFTAG_HALFTONEHINTS <nl> + | | fip - > field_tag = = TIFFTAG_YCBCRSUBSAMPLING <nl> + | | fip - > field_tag = = TIFFTAG_DOTRANGE ) { <nl> + if ( fip - > field_type = = TIFF_BYTE ) { <nl> + if ( ! TIFFSetupBytePair ( tif , fip - > field_tag , dir ) ) <nl> + goto bad ; <nl> + } else if ( fip - > field_type = = TIFF_SHORT ) { <nl> + if ( ! TIFFSetupShortPair ( tif , fip - > field_tag , dir ) ) <nl> + goto bad ; <nl> + } <nl> + } else if ( ! TIFFWriteNormalTag ( tif , dir , fip ) ) <nl> goto bad ; <nl> break ; <nl> } <nl> TIFFWritePerSampleAnys ( TIFF * tif , <nl> } <nl> # undef NITEMS <nl> <nl> + / * <nl> + * Setup a pair of bytes that are returned by <nl> + * value , rather than as a reference to an array . <nl> + * / <nl> + static int <nl> + TIFFSetupBytePair ( TIFF * tif , ttag_t tag , TIFFDirEntry * dir ) <nl> + { <nl> + char v [ 2 ] ; <nl> + <nl> + TIFFGetField ( tif , tag , & v [ 0 ] , & v [ 1 ] ) ; <nl> + <nl> + dir - > tdir_tag = ( uint16 ) tag ; <nl> + dir - > tdir_type = ( uint16 ) TIFF_BYTE ; <nl> + dir - > tdir_count = 2 ; <nl> + return ( TIFFWriteByteArray ( tif , dir , v ) ) ; <nl> + } <nl> + <nl> / * <nl> * Setup a pair of shorts that are returned by <nl> * value , rather than as a reference to an array . <nl> TIFFWriteRationalArray ( TIFF * tif , TIFFDirEntry * dir , float * v ) <nl> while ( fv < 1L < < ( 31 - 3 ) & & den < 1L < < ( 31 - 3 ) ) <nl> fv * = 1 < < 3 , den * = 1L < < 3 ; <nl> } <nl> - t [ 2 * i + 0 ] = ( uint32 ) ( sign * ( fv + 0 . 5 ) ) ; <nl> + t [ 2 * i + 0 ] = ( uint32 ) ( sign * ( int32 ) ( fv + 0 . 5 ) ) ; <nl> t [ 2 * i + 1 ] = den ; <nl> } <nl> status = TIFFWriteData ( tif , dir , ( char * ) t ) ; <nl> mmm a / 3rdparty / libtiff / tif_fax3 . h <nl> ppp b / 3rdparty / libtiff / tif_fax3 . h <nl> <nl> - / * $ Id : tif_fax3 . h , v 1 . 5 . 2 . 1 2010 - 06 - 08 18 : 50 : 42 bfriesen Exp $ * / <nl> + / * $ Id : tif_fax3 . h , v 1 . 5 . 2 . 3 2011 - 03 - 10 20 : 22 : 33 fwarmerdam Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1990 - 1997 Sam Leffler <nl> done1d : \ <nl> break ; \ <nl> case S_VL : \ <nl> CHECK_b1 ; \ <nl> + if ( b1 < = ( int ) ( a0 + TabEnt - > Param ) ) { \ <nl> + if ( b1 < ( int ) ( a0 + TabEnt - > Param ) | | pa ! = thisrun ) { \ <nl> + unexpected ( " VL " , a0 ) ; \ <nl> + goto eol2d ; \ <nl> + } \ <nl> + } \ <nl> SETVALUE ( b1 - a0 - TabEnt - > Param ) ; \ <nl> b1 - = * - - pb ; \ <nl> break ; \ <nl> mmm a / 3rdparty / libtiff / tif_getimage . c <nl> ppp b / 3rdparty / libtiff / tif_getimage . c <nl> <nl> - / * $ Id : tif_getimage . c , v 1 . 63 . 2 . 4 2010 - 06 - 08 18 : 50 : 42 bfriesen Exp $ * / <nl> + / * $ Id : tif_getimage . c , v 1 . 63 . 2 . 6 2010 - 07 - 02 13 : 38 : 27 dron Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1991 - 1997 Sam Leffler <nl> DECLAREContigPutFunc ( putcontig8bitYCbCr41tile ) <nl> DECLAREContigPutFunc ( putcontig8bitYCbCr22tile ) <nl> { <nl> uint32 * cp2 ; <nl> + int32 incr = 2 * toskew + w ; <nl> ( void ) y ; <nl> fromskew = ( fromskew / 2 ) * 6 ; <nl> cp2 = cp + w + toskew ; <nl> DECLAREContigPutFunc ( putcontig8bitYCbCr22tile ) <nl> cp2 + + ; <nl> pp + = 6 ; <nl> } <nl> - cp + = toskew * 2 + w ; <nl> - cp2 + = toskew * 2 + w ; <nl> + cp + = incr ; <nl> + cp2 + = incr ; <nl> pp + = fromskew ; <nl> h - = 2 ; <nl> } <nl> DECLAREContigPutFunc ( putcontig8bitYCbCr21tile ) <nl> DECLAREContigPutFunc ( putcontig8bitYCbCr12tile ) <nl> { <nl> uint32 * cp2 ; <nl> + int32 incr = 2 * toskew + w ; <nl> ( void ) y ; <nl> fromskew = ( fromskew / 2 ) * 4 ; <nl> cp2 = cp + w + toskew ; <nl> DECLAREContigPutFunc ( putcontig8bitYCbCr12tile ) <nl> cp2 + + ; <nl> pp + = 4 ; <nl> } while ( - - x ) ; <nl> - cp + = toskew * 2 + w ; <nl> - cp2 + = toskew * 2 + w ; <nl> + cp + = incr ; <nl> + cp2 + = incr ; <nl> pp + = fromskew ; <nl> h - = 2 ; <nl> } <nl> PickContigCase ( TIFFRGBAImage * img ) <nl> } <nl> break ; <nl> case PHOTOMETRIC_YCBCR : <nl> - if ( img - > bitspersample = = 8 ) <nl> + if ( ( img - > bitspersample = = 8 ) & & ( img - > samplesperpixel = = 3 ) ) <nl> { <nl> if ( initYCbCrConversion ( img ) ! = 0 ) <nl> { <nl> mmm a / 3rdparty / libtiff / tif_jpeg . c <nl> ppp b / 3rdparty / libtiff / tif_jpeg . c <nl> <nl> - / * $ Id : tif_jpeg . c , v 1 . 50 . 2 . 9 2010 - 06 - 14 02 : 47 : 16 fwarmerdam Exp $ * / <nl> + / * $ Id : tif_jpeg . c , v 1 . 50 . 2 . 17 2011 - 01 - 04 02 : 51 : 17 faxguy Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1994 - 1997 Sam Leffler <nl> JPEGDecodeRaw ( TIFF * tif , tidata_t buf , tsize_t cc , tsample_t s ) <nl> tsize_t nrows ; <nl> ( void ) s ; <nl> <nl> - / * data is expected to be read in multiples of a scanline * / <nl> - if ( ( nrows = sp - > cinfo . d . image_height ) ) { <nl> + nrows = cc / sp - > bytesperline ; <nl> + if ( cc % sp - > bytesperline ) <nl> + TIFFWarningExt ( tif - > tif_clientdata , tif - > tif_name , " fractional scanline not read " ) ; <nl> + <nl> + if ( nrows > ( int ) sp - > cinfo . d . image_height ) <nl> + nrows = sp - > cinfo . d . image_height ; <nl> + <nl> + / * data is expected to be read in multiples of a scanline * / <nl> + if ( nrows ) { <nl> / * Cb , Cr both have sampling factors 1 , so this is correct * / <nl> JDIMENSION clumps_per_line = sp - > cinfo . d . comp_info [ 1 ] . downsampled_width ; <nl> int samples_per_clump = sp - > samplesperclump ; <nl> JPEGDecodeRaw ( TIFF * tif , tidata_t buf , tsize_t cc , tsample_t s ) <nl> } <nl> } <nl> else <nl> - { / / 12 - bit <nl> + { / * 12 - bit * / <nl> int value_pairs = ( sp - > cinfo . d . output_width <nl> * sp - > cinfo . d . num_components ) / 2 ; <nl> int iPair ; <nl> JPEGDecodeRaw ( TIFF * tif , tidata_t buf , tsize_t cc , tsample_t s ) <nl> * TODO : resolve this * / <nl> buf + = sp - > bytesperline ; <nl> cc - = sp - > bytesperline ; <nl> - nrows - = sp - > v_sampling ; <nl> - } while ( nrows > 0 ) ; <nl> + } while ( - - nrows > 0 ) ; <nl> <nl> # ifdef JPEG_LIB_MK1 <nl> _TIFFfree ( tmpbuf ) ; <nl> JPEGPreEncode ( TIFF * tif , tsample_t s ) <nl> sp - > cinfo . c . comp_info [ 0 ] . h_samp_factor = sp - > h_sampling ; <nl> sp - > cinfo . c . comp_info [ 0 ] . v_samp_factor = sp - > v_sampling ; <nl> } else { <nl> - sp - > cinfo . c . in_color_space = JCS_UNKNOWN ; <nl> - if ( ! TIFFjpeg_set_colorspace ( sp , JCS_UNKNOWN ) ) <nl> + if ( ( td - > td_photometric = = PHOTOMETRIC_MINISWHITE | | td - > td_photometric = = PHOTOMETRIC_MINISBLACK ) & & td - > td_samplesperpixel = = 1 ) <nl> + sp - > cinfo . c . in_color_space = JCS_GRAYSCALE ; <nl> + else if ( td - > td_photometric = = PHOTOMETRIC_RGB ) <nl> + sp - > cinfo . c . in_color_space = JCS_RGB ; <nl> + else if ( td - > td_photometric = = PHOTOMETRIC_SEPARATED & & td - > td_samplesperpixel = = 4 ) <nl> + sp - > cinfo . c . in_color_space = JCS_CMYK ; <nl> + else <nl> + sp - > cinfo . c . in_color_space = JCS_UNKNOWN ; <nl> + if ( ! TIFFjpeg_set_colorspace ( sp , sp - > cinfo . c . in_color_space ) ) <nl> return ( 0 ) ; <nl> / * jpeg_set_colorspace set all sampling factors to 1 * / <nl> } <nl> JPEGEncodeRaw ( TIFF * tif , tidata_t buf , tsize_t cc , tsample_t s ) <nl> sp - > scancount = 0 ; <nl> } <nl> tif - > tif_row + = sp - > v_sampling ; <nl> - buf + = sp - > bytesperline ; <nl> + buf + = bytesperclumpline ; <nl> nrows - = sp - > v_sampling ; <nl> } <nl> return ( 1 ) ; <nl> mmm a / 3rdparty / libtiff / tif_ojpeg . c <nl> ppp b / 3rdparty / libtiff / tif_ojpeg . c <nl> <nl> - / * $ Id : tif_ojpeg . c , v 1 . 24 . 2 . 6 2010 - 06 - 08 23 : 29 : 51 bfriesen Exp $ * / <nl> + / * $ Id : tif_ojpeg . c , v 1 . 24 . 2 . 8 2010 - 12 - 11 21 : 25 : 04 faxguy Exp $ * / <nl> <nl> / * WARNING : The type of JPEG encapsulation defined by the TIFF Version 6 . 0 <nl> specification is now totally obsolete and deprecated for new applications and <nl> OJPEGReadHeaderInfoSecStreamSof ( TIFF * tif , uint8 marker_id ) <nl> OJPEGReadSkip ( sp , 4 ) ; <nl> else <nl> { <nl> - / * TODO : probably best to also add check on allowed upper bound , especially x , may cause buffer overflow otherwise i think * / <nl> / * Y : Number of lines * / <nl> if ( OJPEGReadWord ( sp , & p ) = = 0 ) <nl> return ( 0 ) ; <nl> OJPEGReadHeaderInfoSecStreamSof ( TIFF * tif , uint8 marker_id ) <nl> TIFFErrorExt ( tif - > tif_clientdata , module , " JPEG compressed data indicates unexpected width " ) ; <nl> return ( 0 ) ; <nl> } <nl> + if ( ( uint32 ) p > sp - > strile_width ) <nl> + { <nl> + TIFFErrorExt ( tif - > tif_clientdata , module , " JPEG compressed data image width exceeds expected image width " ) ; <nl> + return ( 0 ) ; <nl> + } <nl> sp - > sof_x = p ; <nl> } <nl> / * Nf : Number of image components in frame * / <nl> OJPEGReadBufferFill ( OJPEGState * sp ) <nl> { <nl> if ( sp - > in_buffer_file_pos > = sp - > file_size ) <nl> sp - > in_buffer_file_pos = 0 ; <nl> + else if ( sp - > tif - > tif_dir . td_stripbytecount = = NULL ) <nl> + sp - > in_buffer_file_togo = sp - > file_size - sp - > in_buffer_file_pos ; <nl> else <nl> { <nl> + if ( sp - > tif - > tif_dir . td_stripbytecount = = 0 ) { <nl> + TIFFErrorExt ( sp - > tif - > tif_clientdata , sp - > tif - > tif_name , " Strip byte counts are missing " ) ; <nl> + return ( 0 ) ; <nl> + } <nl> sp - > in_buffer_file_togo = sp - > tif - > tif_dir . td_stripbytecount [ sp - > in_buffer_next_strile ] ; <nl> if ( sp - > in_buffer_file_togo = = 0 ) <nl> sp - > in_buffer_file_pos = 0 ; <nl> mmm a / 3rdparty / libtiff / tif_open . c <nl> ppp b / 3rdparty / libtiff / tif_open . c <nl> <nl> - / * $ Id : tif_open . c , v 1 . 33 . 2 . 1 2010 - 06 - 08 18 : 50 : 42 bfriesen Exp $ * / <nl> + / * $ Id : tif_open . c , v 1 . 33 . 2 . 2 2010 - 12 - 06 16 : 54 : 22 faxguy Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1988 - 1997 Sam Leffler <nl> TIFFClientOpen ( <nl> / * <nl> * Read in TIFF header . <nl> * / <nl> - if ( tif - > tif_mode & O_TRUNC | | <nl> + if ( ( m & O_TRUNC ) | | <nl> ! ReadOK ( tif , & tif - > tif_header , sizeof ( TIFFHeader ) ) ) { <nl> if ( tif - > tif_mode = = O_RDONLY ) { <nl> TIFFErrorExt ( tif - > tif_clientdata , name , <nl> mmm a / 3rdparty / libtiff / tif_print . c <nl> ppp b / 3rdparty / libtiff / tif_print . c <nl> <nl> - / * $ Id : tif_print . c , v 1 . 36 . 2 . 4 2010 - 06 - 08 18 : 50 : 42 bfriesen Exp $ * / <nl> + / * $ Id : tif_print . c , v 1 . 36 . 2 . 5 2010 - 07 - 06 14 : 05 : 30 dron Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1988 - 1997 Sam Leffler <nl> static int <nl> _TIFFPrettyPrintField ( TIFF * tif , FILE * fd , ttag_t tag , <nl> uint32 value_count , void * raw_data ) <nl> { <nl> - / / TIFFDirectory * td = & tif - > tif_dir ; <nl> - <nl> switch ( tag ) <nl> { <nl> case TIFFTAG_INKSET : <nl> _TIFFPrettyPrintField ( TIFF * tif , FILE * fd , ttag_t tag , <nl> break ; <nl> } <nl> return 1 ; <nl> - case TIFFTAG_DOTRANGE : <nl> - fprintf ( fd , " Dot Range : % u - % u \ n " , <nl> - ( ( uint16 * ) raw_data ) [ 0 ] , ( ( uint16 * ) raw_data ) [ 1 ] ) ; <nl> - return 1 ; <nl> case TIFFTAG_WHITEPOINT : <nl> fprintf ( fd , " White Point : % g - % g \ n " , <nl> ( ( float * ) raw_data ) [ 0 ] , ( ( float * ) raw_data ) [ 1 ] ) ; return 1 ; <nl> mmm a / 3rdparty / libtiff / tif_strip . c <nl> ppp b / 3rdparty / libtiff / tif_strip . c <nl> <nl> - / * $ Id : tif_strip . c , v 1 . 19 . 2 . 1 2010 - 06 - 08 18 : 50 : 43 bfriesen Exp $ * / <nl> + / * $ Id : tif_strip . c , v 1 . 19 . 2 . 3 2010 - 12 - 15 00 : 50 : 30 faxguy Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1991 - 1997 Sam Leffler <nl> TIFFVStripSize ( TIFF * tif , uint32 nrows ) <nl> uint16 ycbcrsubsampling [ 2 ] ; <nl> tsize_t w , scanline , samplingarea ; <nl> <nl> - TIFFGetField ( tif , TIFFTAG_YCBCRSUBSAMPLING , <nl> - ycbcrsubsampling + 0 , <nl> - ycbcrsubsampling + 1 ) ; <nl> + TIFFGetFieldDefaulted ( tif , TIFFTAG_YCBCRSUBSAMPLING , <nl> + ycbcrsubsampling + 0 , <nl> + ycbcrsubsampling + 1 ) ; <nl> <nl> samplingarea = ycbcrsubsampling [ 0 ] * ycbcrsubsampling [ 1 ] ; <nl> if ( samplingarea = = 0 ) { <nl> TIFFScanlineSize ( TIFF * tif ) <nl> & & ! isUpSampled ( tif ) ) { <nl> uint16 ycbcrsubsampling [ 2 ] ; <nl> <nl> - TIFFGetField ( tif , TIFFTAG_YCBCRSUBSAMPLING , <nl> - ycbcrsubsampling + 0 , <nl> - ycbcrsubsampling + 1 ) ; <nl> + TIFFGetFieldDefaulted ( tif , TIFFTAG_YCBCRSUBSAMPLING , <nl> + ycbcrsubsampling + 0 , <nl> + ycbcrsubsampling + 1 ) ; <nl> <nl> - if ( ycbcrsubsampling [ 0 ] = = 0 ) { <nl> + if ( ycbcrsubsampling [ 0 ] * ycbcrsubsampling [ 1 ] = = 0 ) { <nl> TIFFErrorExt ( tif - > tif_clientdata , tif - > tif_name , <nl> " Invalid YCbCr subsampling " ) ; <nl> return 0 ; <nl> } <nl> <nl> - scanline = TIFFroundup ( td - > td_imagewidth , <nl> + / * number of sample clumps per line * / <nl> + scanline = TIFFhowmany ( td - > td_imagewidth , <nl> ycbcrsubsampling [ 0 ] ) ; <nl> - scanline = TIFFhowmany8 ( multiply ( tif , scanline , <nl> - td - > td_bitspersample , <nl> - " TIFFScanlineSize " ) ) ; <nl> - return ( ( tsize_t ) <nl> - summarize ( tif , scanline , <nl> - multiply ( tif , 2 , <nl> - scanline / ycbcrsubsampling [ 0 ] , <nl> - " TIFFVStripSize " ) , <nl> - " TIFFVStripSize " ) ) ; <nl> + / * number of samples per line * / <nl> + scanline = multiply ( tif , scanline , <nl> + ycbcrsubsampling [ 0 ] * ycbcrsubsampling [ 1 ] + 2 , <nl> + " TIFFScanlineSize " ) ; <nl> } else { <nl> scanline = multiply ( tif , td - > td_imagewidth , <nl> td - > td_samplesperpixel , <nl> TIFFNewScanlineSize ( TIFF * tif ) <nl> & & ! isUpSampled ( tif ) ) { <nl> uint16 ycbcrsubsampling [ 2 ] ; <nl> <nl> - TIFFGetField ( tif , TIFFTAG_YCBCRSUBSAMPLING , <nl> - ycbcrsubsampling + 0 , <nl> - ycbcrsubsampling + 1 ) ; <nl> + TIFFGetFieldDefaulted ( tif , TIFFTAG_YCBCRSUBSAMPLING , <nl> + ycbcrsubsampling + 0 , <nl> + ycbcrsubsampling + 1 ) ; <nl> <nl> if ( ycbcrsubsampling [ 0 ] * ycbcrsubsampling [ 1 ] = = 0 ) { <nl> TIFFErrorExt ( tif - > tif_clientdata , tif - > tif_name , <nl> mmm a / 3rdparty / libtiff / tif_thunder . c <nl> ppp b / 3rdparty / libtiff / tif_thunder . c <nl> <nl> - / * $ Id : tif_thunder . c , v 1 . 5 . 2 . 1 2010 - 06 - 08 18 : 50 : 43 bfriesen Exp $ * / <nl> + / * $ Id : tif_thunder . c , v 1 . 5 . 2 . 2 2011 - 03 - 21 16 : 01 : 28 fwarmerdam Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1988 - 1997 Sam Leffler <nl> <nl> * / <nl> <nl> # include " tiffiop . h " <nl> + # include < assert . h > <nl> # ifdef THUNDER_SUPPORT <nl> / * <nl> * TIFF Library . <nl> <nl> static const int twobitdeltas [ 4 ] = { 0 , 1 , 0 , - 1 } ; <nl> static const int threebitdeltas [ 8 ] = { 0 , 1 , 2 , 3 , 0 , - 3 , - 2 , - 1 } ; <nl> <nl> - # define SETPIXEL ( op , v ) { \ <nl> - lastpixel = ( v ) & 0xf ; \ <nl> - if ( npixels + + & 1 ) \ <nl> - * op + + | = lastpixel ; \ <nl> - else \ <nl> + # define SETPIXEL ( op , v ) { \ <nl> + lastpixel = ( v ) & 0xf ; \ <nl> + if ( npixels < maxpixels ) \ <nl> + { \ <nl> + if ( npixels + + & 1 ) \ <nl> + * op + + | = lastpixel ; \ <nl> + else \ <nl> op [ 0 ] = ( tidataval_t ) ( lastpixel < < 4 ) ; \ <nl> + } \ <nl> + } <nl> + <nl> + static int <nl> + ThunderSetupDecode ( TIFF * tif ) <nl> + { <nl> + static const char module [ ] = " ThunderSetupDecode " ; <nl> + <nl> + if ( tif - > tif_dir . td_bitspersample ! = 4 ) <nl> + { <nl> + TIFFErrorExt ( tif - > tif_clientdata , module , <nl> + " Wrong bitspersample value ( % d ) , Thunder decoder only supports 4bits per sample . " , <nl> + ( int ) tif - > tif_dir . td_bitspersample ) ; <nl> + return 0 ; <nl> + } <nl> + <nl> + <nl> + return ( 1 ) ; <nl> } <nl> <nl> static int <nl> ThunderDecodeRow ( TIFF * tif , tidata_t buf , tsize_t occ , tsample_t s ) <nl> occ - = tif - > tif_scanlinesize ; <nl> row + = tif - > tif_scanlinesize ; <nl> } <nl> - return ( 1 ) ; <nl> + <nl> + return ( 1 ) ; <nl> } <nl> <nl> int <nl> TIFFInitThunderScan ( TIFF * tif , int scheme ) <nl> ( void ) scheme ; <nl> tif - > tif_decoderow = ThunderDecodeRow ; <nl> tif - > tif_decodestrip = ThunderDecodeRow ; <nl> + tif - > tif_setupdecode = ThunderSetupDecode ; <nl> return ( 1 ) ; <nl> } <nl> # endif / * THUNDER_SUPPORT * / <nl> TIFFInitThunderScan ( TIFF * tif , int scheme ) <nl> * fill - column : 78 <nl> * End : <nl> * / <nl> + <nl> mmm a / 3rdparty / libtiff / tiffiop . h <nl> ppp b / 3rdparty / libtiff / tiffiop . h <nl> <nl> - / * $ Id : tiffiop . h , v 1 . 51 . 2 . 6 2010 - 06 - 12 02 : 55 : 16 bfriesen Exp $ * / <nl> + / * $ Id : tiffiop . h , v 1 . 51 . 2 . 7 2011 - 03 - 21 21 : 09 : 19 fwarmerdam Exp $ * / <nl> <nl> / * <nl> * Copyright ( c ) 1988 - 1997 Sam Leffler <nl> extern void * lfind ( const void * , const void * , size_t * , size_t , <nl> <nl> / * <nl> Libtiff itself does not require a 64 - bit type , but bundled TIFF <nl> - utilities may use it . <nl> + utilities may use it . <nl> * / <nl> + <nl> + # if ! defined ( __xlC__ ) & & ! defined ( __xlc__ ) / / Already defined there ( # 2301 ) <nl> typedef TIFF_INT64_T int64 ; <nl> typedef TIFF_UINT64_T uint64 ; <nl> + # endif <nl> <nl> # include " tiffio . h " <nl> # include " tif_dir . h " <nl> mmm a / 3rdparty / libtiff / tiffvers . h <nl> ppp b / 3rdparty / libtiff / tiffvers . h <nl> <nl> - # define TIFFLIB_VERSION_STR " LIBTIFF , Version 3 . 9 . 4 \ nCopyright ( c ) 1988 - 1996 Sam Leffler \ nCopyright ( c ) 1991 - 1996 Silicon Graphics , Inc . " <nl> + # define TIFFLIB_VERSION_STR " LIBTIFF , Version 3 . 9 . 5 \ nCopyright ( c ) 1988 - 1996 Sam Leffler \ nCopyright ( c ) 1991 - 1996 Silicon Graphics , Inc . " <nl> / * <nl> * This define can be used in code that requires <nl> * compilation - related definitions specific to a <nl> <nl> * version checking should be done based on the <nl> * string returned by TIFFGetVersion . <nl> * / <nl> - # define TIFFLIB_VERSION 20100615 <nl> + # define TIFFLIB_VERSION 20110409 <nl> mmm a / 3rdparty / readme . txt <nl> ppp b / 3rdparty / readme . txt <nl> libjpeg 6b ( 6 . 2 ) - The Independent JPEG Group ' s JPEG software . <nl> <nl> HAVE_JPEG preprocessor flag must be set to make highgui use libjpeg . <nl> On UNIX systems configure script takes care of it . <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> libpng 1 . 4 . 3 - Portable Network Graphics library . <nl> Copyright ( C ) 1998 - 2010 , Glenn Randers - Pehrson . <nl> libpng 1 . 4 . 3 - Portable Network Graphics library . <nl> <nl> HAVE_PNG preprocessor flag must be set to make highgui use libpng . <nl> On UNIX systems configure script takes care of it . <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> - libtiff 3 . 9 . 4 - Tag Image File Format ( TIFF ) Software <nl> + libtiff 3 . 9 . 5 - Tag Image File Format ( TIFF ) Software <nl> Copyright ( c ) 1988 - 1997 Sam Leffler <nl> Copyright ( c ) 1991 - 1997 Silicon Graphics , Inc . <nl> See libtiff home page http : / / www . libtiff . org <nl> for details and links to the source code <nl> <nl> - <nl> HAVE_TIFF preprocessor flag must be set to make highgui use libtiff . <nl> On UNIX systems configure script takes care of it . <nl> <nl> zlib 1 . 2 . 5 - General purpose LZ77 compression library <nl> <nl> No preprocessor definition is needed to make highgui use this library - <nl> it is included automatically if either libpng or libtiff are used . <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> - <nl> jasper - 1 . 900 . 1 - JasPer is a collection of software <nl> ( i . e . , a library and application programs ) for the coding <nl> and manipulation of images . This software can handle image data in a <nl> jasper - 1 . 900 . 1 - JasPer is a collection of software <nl> ( lib / libjasper * ) . To get the latest source code , <nl> please , visit the project homepage : <nl> http : / / www . ece . uvic . ca / ~ mdadams / jasper / <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> - <nl> openexr - 1 . 4 . 0 - OpenEXR is a high dynamic - range ( HDR ) image file format developed <nl> by Industrial Light & Magic for use in computer imaging applications . <nl> <nl> openexr - 1 . 4 . 0 - OpenEXR is a high dynamic - range ( HDR ) image file format develope <nl> <nl> The project homepage : http : / / www . openexr . com / <nl> <nl> - OpenCV on Windows does not include openexr codec by default . <nl> - To add it , you will need to recompile highgui with OpenEXR support <nl> - using VS . NET2003 or VS . NET2005 ( MSVC6 can not compile it ) : <nl> - 1 ) download binaries ( e . g . openexr - 1 . 4 . 0 - vs2005 . zip ) <nl> - from the official site . <nl> - 2 ) copy <nl> - half . lib , iex . lib , ilmimf . lib ilmthread . lib imath . lib to <nl> - _graphics / lib <nl> - 3 ) copy include / openexr / * . h to _graphics / include / openexr <nl> - 4 ) open _make / opencv . sln <nl> - 5 ) in highgui / _highgui . h uncomment <nl> - # define HAVE_ILMIMF 1 <nl> - 6 ) build debug / release configurations of highgui . <nl> - <nl> + OpenCV does not include openexr codec . <nl> + To add it , you will need install OpenEXR , reconfigure OpenCV <nl> + using CMake ( make sure OpenEXR library is found ) and the rebuild OpenCV . <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> - <nl> - ffmpeg - 0 . 6 . 0 - FFmpeg is a complete , cross - platform solution to record , <nl> + ffmpeg - 0 . 8 . 0 - FFmpeg is a complete , cross - platform solution to record , <nl> convert and stream audio and video . It includes libavcodec - <nl> the leading audio / video codec library , and also libavformat , libavutils and <nl> other helper libraries that are used by OpenCV ( in highgui module ) to <nl> read and write video files . <nl> <nl> The project homepage : http : / / ffmpeg . org / <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> - <nl> - videoInput - 0 . 1995 - Video capturing library for Windows using DirectShow as backend <nl> - Written by Theodore Watson <nl> - http : / / muonics . net / school / spring05 / videoInput / <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl>
updated libtiff to 3 . 9 . 5 ( ticket )
opencv/opencv
217f345e66688757b4b1ecb1652c4013a369be01
2011-08-03T07:51:40Z
mmm a / tests / cpp - tests / Classes / Scene3DTest / Scene3DTest . cpp <nl> ppp b / tests / cpp - tests / Classes / Scene3DTest / Scene3DTest . cpp <nl> class Scene3DTestScene : public TestCase <nl> } ; <nl> # define GAME_3D_MASK CameraFlag : : DEFAULT <nl> # define GAME_UI_MASK CameraFlag : : USER1 <nl> - # define GAME_DIALOG_MASK CameraFlag : : USER2 <nl> - # define GAME_UI_ZORDER 1 <nl> - # define GAME_DIALOG_ZORDER 2 <nl> + # define GAME_ACTOR_MASK CameraFlag : : USER3 <nl> + <nl> + # define UI_CAMERA_DEPTH 1 <nl> + # define ACTOR_CAMERA_DEPTH 3 <nl> <nl> Scene3DTestScene : : Scene3DTestScene ( ) <nl> : _dialog ( nullptr ) <nl> void Scene3DTestScene : : createUI ( ) <nl> auto menu = Menu : : create ( closeItem , nullptr ) ; <nl> menu - > setPosition ( Vec2 : : ZERO ) ; <nl> menu - > setCameraMask ( ( unsigned short ) GAME_UI_MASK , true ) ; <nl> - this - > addChild ( menu , GAME_UI_ZORDER ) ; <nl> + this - > addChild ( menu ) ; <nl> _ui = menu ; <nl> <nl> auto uiCamera = Camera : : create ( ) ; <nl> / / uiCamera - > setPositionX ( uiCamera - > getPositionX ( ) + 50 ) ; <nl> uiCamera - > setCameraFlag ( GAME_UI_MASK ) ; <nl> + uiCamera - > setDepth ( UI_CAMERA_DEPTH ) ; <nl> this - > addChild ( uiCamera ) ; <nl> } <nl> <nl> void Scene3DTestScene : : createDialog ( ) <nl> girl - > setPosition ( 100 , - 20 ) ; <nl> layer - > addChild ( girl ) ; <nl> <nl> - this - > addChild ( layer , GAME_DIALOG_ZORDER ) ; <nl> + this - > addChild ( layer ) ; <nl> + layer - > setCameraMask ( ( unsigned short ) GAME_UI_MASK ) ; <nl> + girl - > setCameraMask ( ( unsigned short ) GAME_ACTOR_MASK ) ; <nl> + <nl> + auto actorCamera = Camera : : create ( ) ; <nl> + actorCamera - > setCameraFlag ( GAME_ACTOR_MASK ) ; <nl> + actorCamera - > setDepth ( ACTOR_CAMERA_DEPTH ) ; <nl> + this - > addChild ( actorCamera ) ; <nl> + <nl> _dialog = layer ; <nl> } <nl> <nl>
Merge bug fix code .
cocos2d/cocos2d-x
1daca7fac900fdeb79563209b8632fc8124c25fb
2015-05-07T08:52:37Z
mmm a / xbmc / settings / Settings . cpp <nl> ppp b / xbmc / settings / Settings . cpp <nl> <nl> # include " filesystem / File . h " <nl> # include " filesystem / DirectoryCache . h " <nl> # include " DatabaseManager . h " <nl> + # ifdef HAS_UPNP <nl> # include " network / upnp / UPnPSettings . h " <nl> + # endif <nl> # include " utils / RssManager . h " <nl> <nl> using namespace std ; <nl> void CSettings : : Clear ( ) <nl> m_ResInfo . clear ( ) ; <nl> m_Calibrations . clear ( ) ; <nl> <nl> + # ifdef HAS_UPNP <nl> CUPnPSettings : : Get ( ) . Clear ( ) ; <nl> + # endif <nl> CRssManager : : Get ( ) . Clear ( ) ; <nl> } <nl> <nl>
add # ifdef around UPnP setting things to fix build with - - disable - upnp
xbmc/xbmc
a230c3d4981e680bb4bfccf2dd090884a4535d77
2013-03-10T14:44:50Z
mmm a / src / init . cpp <nl> ppp b / src / init . cpp <nl> bool AppInitBasicSetup ( ) <nl> / / Turn off Microsoft heap dump noise <nl> _CrtSetReportMode ( _CRT_WARN , _CRTDBG_MODE_FILE ) ; <nl> _CrtSetReportFile ( _CRT_WARN , CreateFileA ( " NUL " , GENERIC_WRITE , 0 , NULL , OPEN_EXISTING , 0 , 0 ) ) ; <nl> - # endif <nl> - # if _MSC_VER > = 1400 <nl> / / Disable confusing " helpful " text message on abort , Ctrl - C <nl> _set_abort_behavior ( 0 , _WRITE_ABORT_MSG | _CALL_REPORTFAULT ) ; <nl> # endif <nl>
Remove obsolete _MSC_VER check
bitcoin/bitcoin
700d8d85bd728d53cc3bebb0944c92766b410583
2017-06-21T12:28:26Z
mmm a / docs / README . md <nl> ppp b / docs / README . md <nl> an issue : <nl> <nl> # # Guides <nl> <nl> + * [ Glossary of Terms ] ( glossary . md ) <nl> * [ Supported Platforms ] ( tutorial / supported - platforms . md ) <nl> * [ Security ] ( tutorial / security . md ) <nl> * [ Electron Versioning ] ( tutorial / electron - versioning . md ) <nl>
lint to glossary from docs readme
electron/electron
f1692f3274a3875579e7af605e287ec8f4aca985
2016-12-21T21:47:40Z
mmm a / arangod / Aql / CollectionAccessingNode . cpp <nl> ppp b / arangod / Aql / CollectionAccessingNode . cpp <nl> <nl> <nl> # include < velocypack / velocypack - aliases . h > <nl> <nl> + using namespace arangodb ; <nl> using namespace arangodb : : aql ; <nl> <nl> CollectionAccessingNode : : CollectionAccessingNode ( aql : : Collection const * collection ) <nl>
make msvc happy ( )
arangodb/arangodb
0be84ee13822d752b8bd519aec954a99402c94c9
2018-06-08T15:22:22Z
mmm a / test / cctest / cctest . status <nl> ppp b / test / cctest / cctest . status <nl> test - spaces / LargeObjectSpace : PASS | | FAIL <nl> <nl> [ $ system = = macos ] <nl> <nl> - test - regexp / MacroAssemblerIA32Simple : FAIL <nl> + # TODO ( lrn ) : Please fix this asap . <nl> + test - regexp / MacroAssemblerIA32Simple : PASS | | CRASH <nl> + test - regexp / MacroAssemblerIA32Registers : PASS | | CRASH <nl> + <nl>
Really marked the assembler tests as crashing on mac .
v8/v8
02a4aeeb5f13a4dfa646a184b5488c07eabe727c
2008-11-25T16:01:25Z
mmm a / libraries / fc <nl> ppp b / libraries / fc <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit b3445961eb906931cd9f0b370d8153409e11c492 <nl> + Subproject commit f050d0cd0f81ff2e176548ffd34917a3b1f1f87b <nl>
Fix - cleos can create r1 keys
EOSIO/eos
0db936dc86a4a942335531aead7dd2199f026fc7
2018-06-08T19:58:05Z
mmm a / test / attr / dynamicReplacement . swift <nl> ppp b / test / attr / dynamicReplacement . swift <nl> extension K { <nl> func replacement_finalFunction ( ) { } <nl> } <nl> <nl> + extension undeclared { / / expected - error { { use of undeclared type ' undeclared ' } } <nl> + @ _dynamicReplacement ( for : property ) <nl> + var replacement_property : Int { return 2 } <nl> + <nl> + @ _dynamicReplacement ( for : func ) <nl> + func func2 ( ) - > Int { return 2 } <nl> + } <nl> + <nl> extension P { <nl> @ _dynamicReplacement ( for : v ) <nl> var replacement_v : Int { <nl> mmm a / test / decl / nested / type_in_extension . swift <nl> ppp b / test / decl / nested / type_in_extension . swift <nl> extension G { <nl> } <nl> } <nl> <nl> - extension G { <nl> - struct S < T > { / / expected - note { { generic type ' S ' declared here } } <nl> + extension { / / expected - error { { expected type name in extension declaration } } <nl> + struct S < T > { <nl> func foo ( t : T ) { } <nl> } <nl> <nl> - class M : S { } / / expected - error { { reference to generic type ' G < T > . S ' requires arguments in < . . . > } } <nl> + class M : S { } <nl> <nl> - protocol P { / / expected - error { { protocol ' P ' cannot be nested inside another declaration } } <nl> + protocol P { <nl> associatedtype A <nl> } <nl> } <nl>
Merge pull request from CodaFi / extensional - angst
apple/swift
eac416690fa7abc8a6418f8a499dbce989a99c2c
2019-09-06T18:15:54Z
mmm a / tools / sniffer . cpp <nl> ppp b / tools / sniffer . cpp <nl> struct sniff_ip { <nl> <nl> / * TCP header * / <nl> # ifdef _WIN32 <nl> - typedef __int32 uint32_t ; <nl> + typedef unsigned __int32 uint32_t ; <nl> # endif <nl> typedef uint32_t tcp_seq ; <nl> <nl>
also needs unsigned
mongodb/mongo
ac9c6a7f9aa86be1fcd619c85e6a7c296185e0a6
2011-04-28T14:28:08Z
mmm a / src / audio_core / stream . cpp <nl> ppp b / src / audio_core / stream . cpp <nl> Stream : : State Stream : : GetState ( ) const { <nl> <nl> s64 Stream : : GetBufferReleaseCycles ( const Buffer & buffer ) const { <nl> const std : : size_t num_samples { buffer . GetSamples ( ) . size ( ) / GetNumChannels ( ) } ; <nl> - return Core : : Timing : : usToCycles ( ( static_cast < u64 > ( num_samples ) * 1000000 ) / sample_rate ) ; <nl> + const auto us = <nl> + std : : chrono : : microseconds ( ( static_cast < u64 > ( num_samples ) * 1000000 ) / sample_rate ) ; <nl> + return Core : : Timing : : usToCycles ( us ) ; <nl> } <nl> <nl> static void VolumeAdjustSamples ( std : : vector < s16 > & samples ) { <nl> mmm a / src / core / core_timing_util . cpp <nl> ppp b / src / core / core_timing_util . cpp <nl> namespace Core : : Timing { <nl> <nl> constexpr u64 MAX_VALUE_TO_MULTIPLY = std : : numeric_limits < s64 > : : max ( ) / BASE_CLOCK_RATE ; <nl> <nl> - s64 usToCycles ( s64 us ) { <nl> - if ( static_cast < u64 > ( us / 1000000 ) > MAX_VALUE_TO_MULTIPLY ) { <nl> + s64 msToCycles ( std : : chrono : : milliseconds ms ) { <nl> + if ( static_cast < u64 > ( ms . count ( ) / 1000 ) > MAX_VALUE_TO_MULTIPLY ) { <nl> LOG_ERROR ( Core_Timing , " Integer overflow , use max value " ) ; <nl> return std : : numeric_limits < s64 > : : max ( ) ; <nl> } <nl> - if ( static_cast < u64 > ( us ) > MAX_VALUE_TO_MULTIPLY ) { <nl> + if ( static_cast < u64 > ( ms . count ( ) ) > MAX_VALUE_TO_MULTIPLY ) { <nl> LOG_DEBUG ( Core_Timing , " Time very big , do rounding " ) ; <nl> - return BASE_CLOCK_RATE * ( us / 1000000 ) ; <nl> + return BASE_CLOCK_RATE * ( ms . count ( ) / 1000 ) ; <nl> } <nl> - return ( BASE_CLOCK_RATE * us ) / 1000000 ; <nl> + return ( BASE_CLOCK_RATE * ms . count ( ) ) / 1000 ; <nl> } <nl> <nl> - s64 usToCycles ( u64 us ) { <nl> - return usToCycles ( static_cast < s64 > ( us ) ) ; <nl> - } <nl> - <nl> - s64 nsToCycles ( s64 ns ) { <nl> - if ( static_cast < u64 > ( ns / 1000000000 ) > MAX_VALUE_TO_MULTIPLY ) { <nl> + s64 usToCycles ( std : : chrono : : microseconds us ) { <nl> + if ( static_cast < u64 > ( us . count ( ) / 1000000 ) > MAX_VALUE_TO_MULTIPLY ) { <nl> LOG_ERROR ( Core_Timing , " Integer overflow , use max value " ) ; <nl> return std : : numeric_limits < s64 > : : max ( ) ; <nl> } <nl> - if ( static_cast < u64 > ( ns ) > MAX_VALUE_TO_MULTIPLY ) { <nl> + if ( static_cast < u64 > ( us . count ( ) ) > MAX_VALUE_TO_MULTIPLY ) { <nl> LOG_DEBUG ( Core_Timing , " Time very big , do rounding " ) ; <nl> - return BASE_CLOCK_RATE * ( ns / 1000000000 ) ; <nl> + return BASE_CLOCK_RATE * ( us . count ( ) / 1000000 ) ; <nl> } <nl> - return ( BASE_CLOCK_RATE * ns ) / 1000000000 ; <nl> + return ( BASE_CLOCK_RATE * us . count ( ) ) / 1000000 ; <nl> } <nl> <nl> - s64 nsToCycles ( u64 ns ) { <nl> - return nsToCycles ( static_cast < s64 > ( ns ) ) ; <nl> + s64 nsToCycles ( std : : chrono : : nanoseconds ns ) { <nl> + if ( static_cast < u64 > ( ns . count ( ) / 1000000000 ) > MAX_VALUE_TO_MULTIPLY ) { <nl> + LOG_ERROR ( Core_Timing , " Integer overflow , use max value " ) ; <nl> + return std : : numeric_limits < s64 > : : max ( ) ; <nl> + } <nl> + if ( static_cast < u64 > ( ns . count ( ) ) > MAX_VALUE_TO_MULTIPLY ) { <nl> + LOG_DEBUG ( Core_Timing , " Time very big , do rounding " ) ; <nl> + return BASE_CLOCK_RATE * ( ns . count ( ) / 1000000000 ) ; <nl> + } <nl> + return ( BASE_CLOCK_RATE * ns . count ( ) ) / 1000000000 ; <nl> } <nl> <nl> u64 CpuCyclesToClockCycles ( u64 ticks ) { <nl> mmm a / src / core / core_timing_util . h <nl> ppp b / src / core / core_timing_util . h <nl> <nl> <nl> # pragma once <nl> <nl> + # include < chrono > <nl> # include " common / common_types . h " <nl> <nl> namespace Core : : Timing { <nl> namespace Core : : Timing { <nl> constexpr u64 BASE_CLOCK_RATE = 1019215872 ; / / Switch clock speed is 1020MHz un / docked <nl> constexpr u64 CNTFREQ = 19200000 ; / / Value from fusee . <nl> <nl> - s64 usToCycles ( s64 us ) ; <nl> - s64 usToCycles ( u64 us ) ; <nl> + s64 msToCycles ( std : : chrono : : milliseconds ms ) ; <nl> + s64 usToCycles ( std : : chrono : : microseconds us ) ; <nl> + s64 nsToCycles ( std : : chrono : : nanoseconds ns ) ; <nl> <nl> - s64 nsToCycles ( s64 ns ) ; <nl> - s64 nsToCycles ( u64 ns ) ; <nl> - <nl> - inline u64 cyclesToNs ( s64 cycles ) { <nl> - return cycles * 1000000000 / BASE_CLOCK_RATE ; <nl> + inline std : : chrono : : milliseconds cyclesToMs ( s64 cycles ) { <nl> + return std : : chrono : : milliseconds ( cycles * 1000 / BASE_CLOCK_RATE ) ; <nl> } <nl> <nl> - inline s64 cyclesToUs ( s64 cycles ) { <nl> - return cycles * 1000000 / BASE_CLOCK_RATE ; <nl> + inline std : : chrono : : nanoseconds cyclesToNs ( s64 cycles ) { <nl> + return std : : chrono : : nanoseconds ( cycles * 1000000000 / BASE_CLOCK_RATE ) ; <nl> } <nl> <nl> - inline u64 cyclesToMs ( s64 cycles ) { <nl> - return cycles * 1000 / BASE_CLOCK_RATE ; <nl> + inline std : : chrono : : microseconds cyclesToUs ( s64 cycles ) { <nl> + return std : : chrono : : microseconds ( cycles * 1000000 / BASE_CLOCK_RATE ) ; <nl> } <nl> <nl> u64 CpuCyclesToClockCycles ( u64 ticks ) ; <nl> mmm a / src / core / hle / kernel / thread . cpp <nl> ppp b / src / core / hle / kernel / thread . cpp <nl> void Thread : : WakeAfterDelay ( s64 nanoseconds ) { <nl> <nl> / / This function might be called from any thread so we have to be cautious and use the <nl> / / thread - safe version of ScheduleEvent . <nl> + const s64 cycles = Core : : Timing : : nsToCycles ( std : : chrono : : nanoseconds { nanoseconds } ) ; <nl> Core : : System : : GetInstance ( ) . CoreTiming ( ) . ScheduleEventThreadsafe ( <nl> - Core : : Timing : : nsToCycles ( nanoseconds ) , kernel . ThreadWakeupCallbackEventType ( ) , <nl> - callback_handle ) ; <nl> + cycles , kernel . ThreadWakeupCallbackEventType ( ) , callback_handle ) ; <nl> } <nl> <nl> void Thread : : CancelWakeupTimer ( ) { <nl> mmm a / src / core / hle / service / nvdrv / devices / nvhost_ctrl_gpu . cpp <nl> ppp b / src / core / hle / service / nvdrv / devices / nvhost_ctrl_gpu . cpp <nl> u32 nvhost_ctrl_gpu : : GetGpuTime ( const std : : vector < u8 > & input , std : : vector < u8 > & o <nl> <nl> IoctlGetGpuTime params { } ; <nl> std : : memcpy ( & params , input . data ( ) , input . size ( ) ) ; <nl> - params . gpu_time = Core : : Timing : : cyclesToNs ( Core : : System : : GetInstance ( ) . CoreTiming ( ) . GetTicks ( ) ) ; <nl> + const auto ns = Core : : Timing : : cyclesToNs ( Core : : System : : GetInstance ( ) . CoreTiming ( ) . GetTicks ( ) ) ; <nl> + params . gpu_time = static_cast < u64_le > ( ns . count ( ) ) ; <nl> std : : memcpy ( output . data ( ) , & params , output . size ( ) ) ; <nl> return 0 ; <nl> } <nl> mmm a / src / core / hle / service / time / time . cpp <nl> ppp b / src / core / hle / service / time / time . cpp <nl> class ISteadyClock final : public ServiceFramework < ISteadyClock > { <nl> LOG_DEBUG ( Service_Time , " called " ) ; <nl> <nl> const auto & core_timing = Core : : System : : GetInstance ( ) . CoreTiming ( ) ; <nl> - const SteadyClockTimePoint steady_clock_time_point { <nl> - Core : : Timing : : cyclesToMs ( core_timing . GetTicks ( ) ) / 1000 } ; <nl> + const auto ms = Core : : Timing : : cyclesToMs ( core_timing . GetTicks ( ) ) ; <nl> + const SteadyClockTimePoint steady_clock_time_point { static_cast < u64_le > ( ms . count ( ) / 1000 ) , <nl> + { } } ; <nl> IPC : : ResponseBuilder rb { ctx , ( sizeof ( SteadyClockTimePoint ) / 4 ) + 2 } ; <nl> rb . Push ( RESULT_SUCCESS ) ; <nl> rb . PushRaw ( steady_clock_time_point ) ; <nl> void Module : : Interface : : GetClockSnapshot ( Kernel : : HLERequestContext & ctx ) { <nl> } <nl> <nl> const auto & core_timing = Core : : System : : GetInstance ( ) . CoreTiming ( ) ; <nl> - const SteadyClockTimePoint steady_clock_time_point { <nl> - Core : : Timing : : cyclesToMs ( core_timing . GetTicks ( ) ) / 1000 , { } } ; <nl> + const auto ms = Core : : Timing : : cyclesToMs ( core_timing . GetTicks ( ) ) ; <nl> + const SteadyClockTimePoint steady_clock_time_point { static_cast < u64_le > ( ms . count ( ) / 1000 ) , { } } ; <nl> <nl> CalendarTime calendar_time { } ; <nl> calendar_time . year = tm - > tm_year + 1900 ; <nl> mmm a / src / video_core / gpu_thread . cpp <nl> ppp b / src / video_core / gpu_thread . cpp <nl> void ThreadManager : : StartThread ( VideoCore : : RendererBase & renderer , Tegra : : DmaPus <nl> <nl> void ThreadManager : : SubmitList ( Tegra : : CommandList & & entries ) { <nl> const u64 fence { PushCommand ( SubmitListCommand ( std : : move ( entries ) ) ) } ; <nl> - const s64 synchronization_ticks { Core : : Timing : : usToCycles ( 9000 ) } ; <nl> + const s64 synchronization_ticks { Core : : Timing : : usToCycles ( std : : chrono : : microseconds { 9000 } ) } ; <nl> system . CoreTiming ( ) . ScheduleEvent ( synchronization_ticks , synchronization_event , fence ) ; <nl> } <nl> <nl>
core / core_timing_util : Use std : : chrono types for specifying time units
yuzu-emu/yuzu
42f5fd0ab32b117901d0cae228103811719606ff
2019-06-05T00:31:24Z
mmm a / tensorflow / python / keras / callbacks . py <nl> ppp b / tensorflow / python / keras / callbacks . py <nl> class History ( Callback ) : <nl> gets returned by the ` fit ` method of models . <nl> " " " <nl> <nl> + def __init__ ( self ) : <nl> + super ( History , self ) . __init__ ( ) <nl> + self . history = { } <nl> + <nl> def on_train_begin ( self , logs = None ) : <nl> self . epoch = [ ] <nl> - self . history = { } <nl> <nl> def on_epoch_end ( self , epoch , logs = None ) : <nl> logs = logs or { } <nl> def on_epoch_end ( self , epoch , logs = None ) : <nl> for k , v in logs . items ( ) : <nl> self . history . setdefault ( k , [ ] ) . append ( v ) <nl> <nl> + # Set the history attribute on the model after the epoch ends . This will <nl> + # make sure that the state which is set is the latest one . <nl> + self . model . history = self <nl> + <nl> <nl> @ keras_export ( ' keras . callbacks . ModelCheckpoint ' ) <nl> class ModelCheckpoint ( Callback ) : <nl> mmm a / tensorflow / python / keras / engine / training . py <nl> ppp b / tensorflow / python / keras / engine / training . py <nl> def __init__ ( self , * args , * * kwargs ) : <nl> <nl> # Fault - tolerance handler . Set in ` ModelCheckpoint ` . <nl> self . _training_state = None <nl> + self . history = None <nl> <nl> def get_weights ( self ) : <nl> " " " Retrieves the weights of the model . <nl>
Set model . history after ` on_epoch_end ` in ` History ` class .
tensorflow/tensorflow
8c97290ba3a918af97b68fa57bb5211a916d7cc3
2020-02-26T04:19:53Z
mmm a / android / sdk / src / main / java / com / taobao / weex / ui / component / NestedContainer . java <nl> ppp b / android / sdk / src / main / java / com / taobao / weex / ui / component / NestedContainer . java <nl> <nl> package com . taobao . weex . ui . component ; <nl> <nl> import android . view . ViewGroup ; <nl> + import com . taobao . weex . WXSDKInstance ; <nl> <nl> / * * <nl> * Created by sospartan on 8 / 24 / 16 . <nl> <nl> <nl> ViewGroup getViewContainer ( ) ; <nl> <nl> + void renderNewURL ( String url ) ; <nl> + <nl> interface OnNestedInstanceEventListener { <nl> void onException ( NestedContainer comp , String errCode , String msg ) ; <nl> + <nl> + / * * <nl> + * <nl> + * @ param comp <nl> + * @ param src <nl> + * @ return true if keep load <nl> + * / <nl> + boolean onPreCreate ( NestedContainer comp , String src ) ; <nl> + <nl> + void onCreated ( NestedContainer comp , WXSDKInstance nestedInstance ) ; <nl> } <nl> } <nl> mmm a / android / sdk / src / main / java / com / taobao / weex / ui / component / WXEmbed . java <nl> ppp b / android / sdk / src / main / java / com / taobao / weex / ui / component / WXEmbed . java <nl> <nl> public class WXEmbed extends WXDiv implements WXSDKInstance . OnInstanceVisibleListener , NestedContainer { <nl> <nl> private String src ; <nl> - private WXSDKInstance instance ; <nl> + private WXSDKInstance mNestedInstance ; <nl> private final static int ERROR_IMG_WIDTH = ( int ) WXViewUtils . getRealPxByWidth ( 270 ) ; <nl> private final static int ERROR_IMG_HEIGHT = ( int ) WXViewUtils . getRealPxByWidth ( 260 ) ; <nl> <nl> public void onClick ( View v ) { <nl> WXLogUtils . e ( " WXEmbed " , " NetWork failure : " + errCode + " , \ n error message : " + msg ) ; <nl> } <nl> } <nl> + <nl> + @ Override <nl> + public boolean onPreCreate ( NestedContainer comp , String src ) { <nl> + return true ; <nl> + } <nl> + <nl> + @ Override <nl> + public void onCreated ( NestedContainer comp , WXSDKInstance nestedInstance ) { <nl> + <nl> + } <nl> } <nl> <nl> static class EmbedRenderListener implements IWXRenderListener { <nl> protected boolean setProperty ( String key , Object param ) { <nl> return super . setProperty ( key , param ) ; <nl> } <nl> <nl> + @ Override <nl> + public void renderNewURL ( String url ) { <nl> + src = url ; <nl> + loadInstance ( ) ; <nl> + } <nl> + <nl> @ WXComponentProp ( name = Constants . Name . SRC ) <nl> public void setSrc ( String src ) { <nl> this . src = src ; <nl> - if ( instance ! = null ) { <nl> - instance . destroy ( ) ; <nl> - instance = null ; <nl> + if ( mNestedInstance ! = null ) { <nl> + mNestedInstance . destroy ( ) ; <nl> + mNestedInstance = null ; <nl> } <nl> if ( TextUtils . equals ( getVisibility ( ) , Constants . Value . VISIBLE ) ) { <nl> loadInstance ( ) ; <nl> public void setSrc ( String src ) { <nl> } <nl> <nl> void loadInstance ( ) { <nl> - instance = createInstance ( ) ; <nl> + mNestedInstance = createInstance ( ) ; <nl> + if ( mListener ! = null & & mListener . mEventListener ! = null ) { <nl> + if ( ! mListener . mEventListener . onPreCreate ( this , src ) ) { <nl> + / / cancel render <nl> + mListener . mEventListener . onCreated ( this , mNestedInstance ) ; <nl> + } <nl> + } <nl> } <nl> <nl> private WXSDKInstance createInstance ( ) { <nl> WXSDKInstance sdkInstance = getInstance ( ) . createNestedInstance ( this ) ; <nl> mInstance . addOnInstanceVisibleListener ( this ) ; <nl> sdkInstance . registerRenderListener ( mListener ) ; <nl> + <nl> + if ( mListener ! = null & & mListener . mEventListener ! = null ) { <nl> + if ( ! mListener . mEventListener . onPreCreate ( this , src ) ) { <nl> + / / cancel render <nl> + return null ; <nl> + } <nl> + } <nl> + <nl> ViewGroup . LayoutParams layoutParams = getHostView ( ) . getLayoutParams ( ) ; <nl> sdkInstance . renderByUrl ( WXPerformance . DEFAULT , <nl> src , <nl> public void setVisibility ( String visibility ) { <nl> super . setVisibility ( visibility ) ; <nl> boolean visible = TextUtils . equals ( getVisibility ( ) , Constants . Value . VISIBLE ) ; <nl> if ( ! TextUtils . isEmpty ( src ) & & visible ) { <nl> - if ( instance = = null ) { <nl> - instance = createInstance ( ) ; <nl> + if ( mNestedInstance = = null ) { <nl> + loadInstance ( ) ; <nl> } else { <nl> - instance . onViewAppear ( ) ; <nl> + mNestedInstance . onViewAppear ( ) ; <nl> } <nl> } <nl> <nl> if ( ! visible ) { <nl> - if ( instance ! = null ) { <nl> - instance . onViewDisappear ( ) ; <nl> + if ( mNestedInstance ! = null ) { <nl> + mNestedInstance . onViewDisappear ( ) ; <nl> } <nl> } <nl> mIsVisible = visible ; <nl> public void setVisibility ( String visibility ) { <nl> @ Override <nl> public void destroy ( ) { <nl> super . destroy ( ) ; <nl> - if ( instance ! = null ) { <nl> - instance . destroy ( ) ; <nl> - instance = null ; <nl> + if ( mNestedInstance ! = null ) { <nl> + mNestedInstance . destroy ( ) ; <nl> + mNestedInstance = null ; <nl> } <nl> src = null ; <nl> } <nl> public void destroy ( ) { <nl> @ Override <nl> public void onAppear ( ) { <nl> / / appear event from root instance will not trigger visibility change <nl> - if ( mIsVisible & & instance ! = null ) { <nl> - WXComponent comp = instance . getRootCom ( ) ; <nl> + if ( mIsVisible & & mNestedInstance ! = null ) { <nl> + WXComponent comp = mNestedInstance . getRootCom ( ) ; <nl> if ( comp ! = null ) <nl> - WXBridgeManager . getInstance ( ) . fireEvent ( instance . getInstanceId ( ) , comp . getRef ( ) , Constants . Event . VIEWAPPEAR , null , null ) ; <nl> + WXBridgeManager . getInstance ( ) . fireEvent ( mNestedInstance . getInstanceId ( ) , comp . getRef ( ) , Constants . Event . VIEWAPPEAR , null , null ) ; <nl> } <nl> } <nl> <nl> @ Override <nl> public void onDisappear ( ) { <nl> / / appear event from root instance will not trigger visibility change <nl> - if ( mIsVisible & & instance ! = null ) { <nl> - WXComponent comp = instance . getRootCom ( ) ; <nl> + if ( mIsVisible & & mNestedInstance ! = null ) { <nl> + WXComponent comp = mNestedInstance . getRootCom ( ) ; <nl> if ( comp ! = null ) <nl> - WXBridgeManager . getInstance ( ) . fireEvent ( instance . getInstanceId ( ) , comp . getRef ( ) , Constants . Event . VIEWDISAPPEAR , null , null ) ; <nl> + WXBridgeManager . getInstance ( ) . fireEvent ( mNestedInstance . getInstanceId ( ) , comp . getRef ( ) , Constants . Event . VIEWDISAPPEAR , null , null ) ; <nl> } <nl> } <nl> } <nl> \ No newline at end of file <nl>
* [ android ] add method to nested instance event
apache/incubator-weex
3b063a47c4d1aa043df64f953ac169f32e954e32
2016-08-31T10:11:44Z
mmm a / src / core / ext / filters / client_channel / lb_policy . c <nl> ppp b / src / core / ext / filters / client_channel / lb_policy . c <nl> <nl> <nl> # define WEAK_REF_BITS 16 <nl> <nl> + # ifndef NDEBUG <nl> grpc_tracer_flag grpc_trace_lb_policy_refcount = GRPC_TRACER_INITIALIZER ( false ) ; <nl> + # endif <nl> + <nl> <nl> void grpc_lb_policy_init ( grpc_lb_policy * policy , <nl> const grpc_lb_policy_vtable * vtable , <nl> mmm a / src / core / ext / filters / client_channel / lb_policy . h <nl> ppp b / src / core / ext / filters / client_channel / lb_policy . h <nl> typedef struct grpc_lb_policy grpc_lb_policy ; <nl> typedef struct grpc_lb_policy_vtable grpc_lb_policy_vtable ; <nl> typedef struct grpc_lb_policy_args grpc_lb_policy_args ; <nl> <nl> + # ifndef NDEBUG <nl> extern grpc_tracer_flag grpc_trace_lb_policy_refcount ; <nl> + # endif <nl> <nl> struct grpc_lb_policy { <nl> const grpc_lb_policy_vtable * vtable ; <nl> mmm a / src / core / ext / filters / client_channel / resolver . c <nl> ppp b / src / core / ext / filters / client_channel / resolver . c <nl> <nl> # include " src / core / ext / filters / client_channel / resolver . h " <nl> # include " src / core / lib / iomgr / combiner . h " <nl> <nl> + # ifndef NDEBUG <nl> grpc_tracer_flag grpc_trace_resolver_refcount = GRPC_TRACER_INITIALIZER ( false ) ; <nl> + # endif <nl> <nl> void grpc_resolver_init ( grpc_resolver * resolver , <nl> const grpc_resolver_vtable * vtable , <nl> mmm a / src / core / ext / filters / client_channel / resolver . h <nl> ppp b / src / core / ext / filters / client_channel / resolver . h <nl> <nl> typedef struct grpc_resolver grpc_resolver ; <nl> typedef struct grpc_resolver_vtable grpc_resolver_vtable ; <nl> <nl> + # ifndef NDEBUG <nl> extern grpc_tracer_flag grpc_trace_resolver_refcount ; <nl> + # endif <nl> <nl> / * * \ a grpc_resolver provides \ a grpc_channel_args objects to its caller * / <nl> struct grpc_resolver { <nl> mmm a / src / core / lib / iomgr / closure . c <nl> ppp b / src / core / lib / iomgr / closure . c <nl> <nl> <nl> # include " src / core / lib / profiling / timers . h " <nl> <nl> + # ifndef NDEBUG <nl> grpc_tracer_flag grpc_trace_closure = GRPC_TRACER_INITIALIZER ( false ) ; <nl> + # endif <nl> <nl> # ifndef NDEBUG <nl> grpc_closure * grpc_closure_init ( const char * file , int line , <nl> mmm a / src / core / lib / iomgr / closure . h <nl> ppp b / src / core / lib / iomgr / closure . h <nl> <nl> struct grpc_closure ; <nl> typedef struct grpc_closure grpc_closure ; <nl> <nl> + # ifndef NDEBUG <nl> extern grpc_tracer_flag grpc_trace_closure ; <nl> + # endif <nl> <nl> typedef struct grpc_closure_list { <nl> grpc_closure * head ; <nl> mmm a / src / core / lib / iomgr / combiner . c <nl> ppp b / src / core / lib / iomgr / combiner . c <nl> static void start_destroy ( grpc_exec_ctx * exec_ctx , grpc_combiner * lock ) { <nl> } <nl> } <nl> <nl> - # ifdef GRPC_COMBINER_REFCOUNT_DEBUG <nl> + # ifndef NDEBUG <nl> # define GRPC_COMBINER_DEBUG_SPAM ( op , delta ) \ <nl> - gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , \ <nl> - " combiner [ % p ] % s % " PRIdPTR " - - > % " PRIdPTR " % s " , lock , ( op ) , \ <nl> + if ( GRPC_TRACER_ON ( grpc_combiner_trace ) ) { gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , \ <nl> + " C : % p % s % " PRIdPTR " - - > % " PRIdPTR " % s " , lock , ( op ) , \ <nl> gpr_atm_no_barrier_load ( & lock - > refs . count ) , \ <nl> - gpr_atm_no_barrier_load ( & lock - > refs . count ) + ( delta ) , reason ) ; <nl> + gpr_atm_no_barrier_load ( & lock - > refs . count ) + ( delta ) , reason ) ; } <nl> # else <nl> # define GRPC_COMBINER_DEBUG_SPAM ( op , delta ) <nl> # endif <nl> mmm a / src / core / lib / iomgr / combiner . h <nl> ppp b / src / core / lib / iomgr / combiner . h <nl> <nl> / / necessary <nl> grpc_combiner * grpc_combiner_create ( void ) ; <nl> <nl> - / / # define GRPC_COMBINER_REFCOUNT_DEBUG <nl> - # ifdef GRPC_COMBINER_REFCOUNT_DEBUG <nl> + # ifndef NDEBUG <nl> # define GRPC_COMBINER_DEBUG_ARGS \ <nl> , const char * file , int line , const char * reason <nl> # define GRPC_COMBINER_REF ( combiner , reason ) \ <nl> mmm a / src / core / lib / iomgr / error . c <nl> ppp b / src / core / lib / iomgr / error . c <nl> <nl> # include " src / core / lib / profiling / timers . h " <nl> # include " src / core / lib / slice / slice_internal . h " <nl> <nl> + # ifndef NDEBUG <nl> grpc_tracer_flag grpc_trace_error_refcount = GRPC_TRACER_INITIALIZER ( false ) ; <nl> + # endif <nl> <nl> static const char * error_int_name ( grpc_error_ints key ) { <nl> switch ( key ) { <nl> mmm a / src / core / lib / iomgr / error . h <nl> ppp b / src / core / lib / iomgr / error . h <nl> extern " C " { <nl> <nl> typedef struct grpc_error grpc_error ; <nl> <nl> + # ifndef NDEBUG <nl> extern grpc_tracer_flag grpc_trace_error_refcount ; <nl> + # endif <nl> <nl> typedef enum { <nl> / / / ' errno ' from the operating system <nl> mmm a / src / core / lib / iomgr / ev_epollsig_linux . c <nl> ppp b / src / core / lib / iomgr / ev_epollsig_linux . c <nl> static void fd_global_shutdown ( void ) ; <nl> * Polling island Declarations <nl> * / <nl> <nl> - / / # define PI_REFCOUNT_DEBUG <nl> - <nl> - # ifdef PI_REFCOUNT_DEBUG <nl> + # ifndef NDEBUG <nl> <nl> # define PI_ADD_REF ( p , r ) pi_add_ref_dbg ( ( p ) , ( r ) , __FILE__ , __LINE__ ) <nl> # define PI_UNREF ( exec_ctx , p , r ) \ <nl> pi_unref_dbg ( ( exec_ctx ) , ( p ) , ( r ) , __FILE__ , __LINE__ ) <nl> <nl> - # else / * defined ( GRPC_WORKQUEUE_REFCOUNT_DEBUG ) * / <nl> + # else <nl> <nl> # define PI_ADD_REF ( p , r ) pi_add_ref ( ( p ) ) <nl> # define PI_UNREF ( exec_ctx , p , r ) pi_unref ( ( exec_ctx ) , ( p ) ) <nl> <nl> - # endif / * ! defined ( GRPC_PI_REF_COUNT_DEBUG ) * / <nl> + # endif <nl> <nl> / * This is also used as grpc_workqueue ( by directly casing it ) * / <nl> typedef struct polling_island { <nl> gpr_atm g_epoll_sync ; <nl> static void pi_add_ref ( polling_island * pi ) ; <nl> static void pi_unref ( grpc_exec_ctx * exec_ctx , polling_island * pi ) ; <nl> <nl> - # ifdef PI_REFCOUNT_DEBUG <nl> + # ifndef NDEBUG <nl> + grpc_tracer_flag grpc_trace_workqueue_refcount = GRPC_TRACER_INITIALIZER ( false ) ; <nl> static void pi_add_ref_dbg ( polling_island * pi , const char * reason , <nl> const char * file , int line ) { <nl> - long old_cnt = gpr_atm_acq_load ( & pi - > ref_count ) ; <nl> - pi_add_ref ( pi ) ; <nl> - gpr_log ( GPR_DEBUG , " Add ref pi : % p , old : % ld - > new : % ld ( % s ) - ( % s , % d ) " , <nl> + if ( GRPC_TRACER_ON ( grpc_trace_workqueue_refcount ) ) { <nl> + long old_cnt = gpr_atm_acq_load ( & pi - > ref_count ) ; <nl> + gpr_log ( GPR_DEBUG , " Add ref pi : % p , old : % ld - > new : % ld ( % s ) - ( % s , % d ) " , <nl> ( void * ) pi , old_cnt , old_cnt + 1 , reason , file , line ) ; <nl> + } <nl> + pi_add_ref ( pi ) ; <nl> } <nl> <nl> static void pi_unref_dbg ( grpc_exec_ctx * exec_ctx , polling_island * pi , <nl> const char * reason , const char * file , int line ) { <nl> - long old_cnt = gpr_atm_acq_load ( & pi - > ref_count ) ; <nl> - pi_unref ( exec_ctx , pi ) ; <nl> - gpr_log ( GPR_DEBUG , " Unref pi : % p , old : % ld - > new : % ld ( % s ) - ( % s , % d ) " , <nl> + if ( GRPC_TRACER_ON ( grpc_trace_workqueue_refcount ) ) { <nl> + long old_cnt = gpr_atm_acq_load ( & pi - > ref_count ) ; <nl> + gpr_log ( GPR_DEBUG , " Unref pi : % p , old : % ld - > new : % ld ( % s ) - ( % s , % d ) " , <nl> ( void * ) pi , old_cnt , ( old_cnt - 1 ) , reason , file , line ) ; <nl> + } <nl> + pi_unref ( exec_ctx , pi ) ; <nl> } <nl> # endif <nl> <nl> mmm a / src / core / lib / iomgr / ev_poll_posix . c <nl> ppp b / src / core / lib / iomgr / ev_poll_posix . c <nl> static void pollset_set_del_fd ( grpc_exec_ctx * exec_ctx , <nl> } <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + <nl> * Condition Variable polling extensions <nl> * / <nl> <nl> mmm a / src / core / lib / iomgr / ev_posix . c <nl> ppp b / src / core / lib / iomgr / ev_posix . c <nl> <nl> # include " src / core / lib / iomgr / ev_poll_posix . h " <nl> # include " src / core / lib / support / env . h " <nl> <nl> + <nl> grpc_tracer_flag grpc_polling_trace = <nl> GRPC_TRACER_INITIALIZER ( false ) ; / * Disabled by default * / <nl> <nl> mmm a / src / core / lib / transport / transport . c <nl> ppp b / src / core / lib / transport / transport . c <nl> <nl> # include " src / core / lib / support / string . h " <nl> # include " src / core / lib / transport / transport_impl . h " <nl> <nl> + <nl> + # ifndef NDEBUG <nl> grpc_tracer_flag grpc_trace_stream_refcount = GRPC_TRACER_INITIALIZER ( false ) ; <nl> + # endif <nl> <nl> # ifndef NDEBUG <nl> void grpc_stream_ref ( grpc_stream_refcount * refcount , const char * reason ) { <nl> mmm a / src / core / lib / transport / transport . h <nl> ppp b / src / core / lib / transport / transport . h <nl> typedef struct grpc_transport grpc_transport ; <nl> for a stream . * / <nl> typedef struct grpc_stream grpc_stream ; <nl> <nl> + # ifndef NDEBUG <nl> extern grpc_tracer_flag grpc_trace_stream_refcount ; <nl> + # endif <nl> <nl> typedef struct grpc_stream_refcount { <nl> gpr_refcount refs ; <nl>
Add workqueue tracer
grpc/grpc
a135485bb8ecbbea027727525c0828e4dce5d3da
2017-06-09T00:50:02Z
mmm a / src / script . cpp <nl> ppp b / src / script . cpp <nl> unsigned int HaveKeys ( const vector < valtype > & pubkeys , const CKeyStore & keystore ) <nl> return nResult ; <nl> } <nl> <nl> - <nl> - class CKeyStoreIsMineVisitor : public boost : : static_visitor < bool > <nl> - { <nl> - private : <nl> - const CKeyStore * keystore ; <nl> - public : <nl> - CKeyStoreIsMineVisitor ( const CKeyStore * keystoreIn ) : keystore ( keystoreIn ) { } <nl> - bool operator ( ) ( const CNoDestination & dest ) const { return false ; } <nl> - bool operator ( ) ( const CKeyID & keyID ) const { return keystore - > HaveKey ( keyID ) ; } <nl> - bool operator ( ) ( const CScriptID & scriptID ) const { return keystore - > HaveCScript ( scriptID ) ; } <nl> - } ; <nl> - <nl> isminetype IsMine ( const CKeyStore & keystore , const CTxDestination & dest ) <nl> { <nl> CScript script ; <nl>
Remove unused CKeyStoreIsMineVisitor
bitcoin/bitcoin
54e658f249f8b2a2cbf7dbe2bab9749faa91c611
2014-08-12T00:02:17Z
mmm a / src / policy / policy . cpp <nl> ppp b / src / policy / policy . cpp <nl> bool IsStandard ( const CScript & scriptPubKey , txnouttype & whichType ) <nl> <nl> bool IsStandardTx ( const CTransaction & tx , std : : string & reason ) <nl> { <nl> - if ( tx . nVersion > CTransaction : : CURRENT_VERSION | | tx . nVersion < 1 ) { <nl> + if ( tx . nVersion > CTransaction : : MAX_STANDARD_VERSION | | tx . nVersion < 1 ) { <nl> reason = " version " ; <nl> return false ; <nl> } <nl> mmm a / src / primitives / transaction . h <nl> ppp b / src / primitives / transaction . h <nl> class CTransaction <nl> void UpdateHash ( ) const ; <nl> <nl> public : <nl> + / / Default transaction version . <nl> static const int32_t CURRENT_VERSION = 1 ; <nl> <nl> + / / Changing the default transaction version requires a two step process : first <nl> + / / adapting relay policy by bumping MAX_STANDARD_VERSION , and then later date <nl> + / / bumping the default CURRENT_VERSION at which point both CURRENT_VERSION and <nl> + / / MAX_STANDARD_VERSION will be equal . <nl> + static const int32_t MAX_STANDARD_VERSION = 2 ; <nl> + <nl> / / The local variables are made const to prevent unintended modification <nl> / / without updating the cached hash value . However , CTransaction is not <nl> / / actually immutable ; deserialization and assignment are implemented , <nl>
Policy : allow transaction version 2 relay policy .
bitcoin/bitcoin
12c89c918534f8e615e80381b692d89d6b09d174
2016-03-18T08:09:06Z
mmm a / addons / resource . language . en_gb / resources / strings . po <nl> ppp b / addons / resource . language . en_gb / resources / strings . po <nl> msgctxt " # 179 " <nl> msgid " Song " <nl> msgstr " " <nl> <nl> + # . generic " duration " label used in different places <nl> # : xbmc / dialogs / GUIDialogMediaFilter . cpp <nl> # : xbmc / playlists / SmartPlaylist . cpp <nl> + # : xbmc / xbmc / pvr / windows / GUIViewStatePVR . cpp <nl> # : addons / skin . estuary / 1080i / Variables . xml <nl> # : addons / skin . estuary / 1080i / View_51_Poster . xml <nl> # : addons / skin . estuary / 1080i / DialogVideoInfo . xml <nl> msgctxt " # 193 " <nl> msgid " Scan " <nl> msgstr " " <nl> <nl> + <nl> + # . label for " searching " message box heading <nl> # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> # : xbmc / video / dialogs / GUIDialogVideoInfo . cpp <nl> # : xbmc / video / windows / GUIWindowVideoBase . cpp <nl> msgctxt " # 207 " <nl> msgid " Plot " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / windows / PVRGUIWindowRecordings . cpp <nl> + # . generic " play " ( some sort of media ) label used in different places <nl> + # : addons / skin . estuary / 1080i / DialogVideoInfo . xml <nl> # : xbmc / dialogs / GUIDialogPlayEject . cpp <nl> # : xbmc / games / windows / GUIWindowGames . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> + # : xbmc / video / windows / GUIWindowVideoBase . cpp <nl> # : system / settings / settings . xml <nl> msgctxt " # 208 " <nl> msgid " Play " <nl> msgstr " " <nl> # . Label for a context menu entry to start / schedule a recording <nl> # : xbmc / music / windows / GUIWindowMusicBase . cpp <nl> # : xbmc / pvr / dialogs / GUIDialogPVRGuideInfo . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> # : addons / skin . estuary / 1080i / Variables . xml <nl> msgctxt " # 264 " <nl> msgid " Record " <nl> msgstr " " <nl> <nl> + # : xbmc / music / windows / GUIWindowMusicBase . cpp <nl> msgctxt " # 265 " <nl> msgid " Stop Rec . " <nl> msgstr " " <nl> msgctxt " # 283 " <nl> msgid " Search results " <nl> msgstr " " <nl> <nl> + # . generic " no search results found " label used in diferent places <nl> # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> # : xbmc / video / dialogs / GUIDialogVideoInfo . cpp <nl> # : xbmc / video / windows / GUIWindowVideoBase . cpp <nl> msgctxt " # 304 " <nl> msgid " Language " <nl> msgstr " " <nl> <nl> - # . Label of active / inactive radiobutton in PVR timer settings dialog <nl> + # . Label of ' Enabled ' radiobutton in PVR timer settings dialog <nl> + # . Label of timers state in PVR timer / timer rule window <nl> # : system / peripherals . xml <nl> # : xbmc / filesystem / AddonsDirectory . cpp <nl> # : system / settings / settings . xml <nl> # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 305 " <nl> msgid " Enabled " <nl> msgstr " " <nl> msgctxt " # 312 " <nl> msgid " ( 0 = auto ) " <nl> msgstr " " <nl> <nl> + # . generic " cleaning database " label used in different places <nl> # : xbmc / music / MusicDatabase . cpp <nl> # : xbmc / pvr / PVRManager . cpp <nl> + # : xbmc / settings / MediaSettings . cpp <nl> + # : xbmc / video / VideoDatabase . cpp <nl> msgctxt " # 313 " <nl> msgid " Cleaning database " <nl> msgstr " " <nl> msgctxt " # 548 " <nl> msgid " Downmix multichannel audio to stereo " <nl> msgstr " " <nl> <nl> - # : / xbmc / xbmc / pvr / windows / GUIViewStatePVR . cpp <nl> - # : / xbmc / xbmc / utils / SortUtils . cpp <nl> + # . generic " number " label used in different places <nl> + # : xbmc / xbmc / pvr / windows / GUIViewStatePVR . cpp <nl> + # : xbmc / xbmc / utils / SortUtils . cpp <nl> msgctxt " # 549 " <nl> msgid " Number " <nl> msgstr " " <nl> msgctxt " # 550 " <nl> msgid " Sort by : % s " <nl> msgstr " " <nl> <nl> + # . generic " name " label used in different places <nl> + # : xbmc / xbmc / pvr / windows / GUIViewStatePVR . cpp <nl> # : xbmc / view / GUIViewState . cpp <nl> msgctxt " # 551 " <nl> msgid " Name " <nl> msgstr " " <nl> <nl> + # . generic " date " label used in different places <nl> # : addons / skin . estuary / 1080i / Variables . xml <nl> + # : xbmc / xbmc / pvr / windows / GUIViewStatePVR . cpp <nl> msgctxt " # 552 " <nl> msgid " Date " <nl> msgstr " " <nl> msgctxt " # 567 " <nl> msgid " Play count " <nl> msgstr " " <nl> <nl> + # . generic " last played " label used in different places <nl> # : xbmc / dialogs / GUIDialogMediaFilter . cpp <nl> # : xbmc / playlists / SmartPlaylist . cpp <nl> + # : xbmc / xbmc / pvr / windows / GUIViewStatePVR . cpp <nl> msgctxt " # 568 " <nl> msgid " Last played " <nl> msgstr " " <nl> msgstr " " <nl> # : xbmc / filesystem / AddonsDirectory . cpp <nl> # : xbmc / PlayListPlayer . cpp <nl> # : xbmc / profiles / dialogs / GUIDialogLockSettings . cpp <nl> - # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 593 " <nl> msgid " All " <nl> msgstr " " <nl> msgctxt " # 810 " <nl> msgid " Start any time " <nl> msgstr " " <nl> <nl> - # Label of " Recording group " list in the PVR timer setting dialog <nl> + # . Label of recording group list control in the PVR timer settings dialog <nl> + # . Part of value of recording group list control in the PVR timer settings dialog ( e . g . " Recording Group 1 " ) <nl> # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> + # : xbmc / pvr / timers / PVRTimerType . cpp <nl> msgctxt " # 811 " <nl> msgid " Recording group " <nl> msgstr " " <nl> msgctxt " # 812 " <nl> msgid " Prevent duplicate episodes " <nl> msgstr " " <nl> <nl> - # . Label of pre - record margin spinner in PVR timer settings dialog <nl> + # . Label of start padding time list control in PVR timer settings dialog <nl> # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> msgctxt " # 813 " <nl> msgid " Start padding time " <nl> msgstr " " <nl> <nl> - # . Label of post - record margin spinner in PVR timer settings dialog <nl> + # . Label of end padding time list control in PVR timer settings dialog <nl> # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> msgctxt " # 814 " <nl> msgid " End padding time " <nl> msgstr " " <nl> <nl> - # . Value of prevent duplicate episodes list control <nl> - # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> + # . Value of prevent duplicate episodes list control in PVR timer settings dialog <nl> + # : xbmc / pvr / timers / PVRTimerType . cpp <nl> msgctxt " # 815 " <nl> msgid " Record all episodes " <nl> msgstr " " <nl> <nl> - # . Value of prevent duplicate episodes list control <nl> - # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> + # . Value of prevent duplicate episodes list control in PVR timer settings dialog <nl> + # : xbmc / pvr / timers / PVRTimerType . cpp <nl> msgctxt " # 816 " <nl> msgid " Record only new episodes " <nl> msgstr " " <nl> msgctxt " # 817 " <nl> msgid " End any time " <nl> msgstr " " <nl> <nl> - # . Label of " MaxRecordings " list in the PVR timer setting dialog <nl> + # . Label of " MaxRecordings " list in the PVR timer settings dialog <nl> # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> msgctxt " # 818 " <nl> msgid " Max recordings " <nl> msgstr " " <nl> # empty strings from id 829 to 830 <nl> <nl> # . Weekday representation <nl> - # : xbmc / dialogs / GUIDialogPVRTimerWeekdaysSettings . cpp <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 831 " <nl> msgid " Mondays " <nl> msgstr " " <nl> <nl> # . Weekday representation <nl> - # : xbmc / dialogs / GUIDialogPVRTimerWeekdaysSettings . cpp <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 832 " <nl> msgid " Tuesdays " <nl> msgstr " " <nl> <nl> # . Weekday representation <nl> - # : xbmc / dialogs / GUIDialogPVRTimerWeekdaysSettings . cpp <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 833 " <nl> msgid " Wednesdays " <nl> msgstr " " <nl> <nl> # . Weekday representation <nl> - # : xbmc / dialogs / GUIDialogPVRTimerWeekdaysSettings . cpp <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 834 " <nl> msgid " Thursdays " <nl> msgstr " " <nl> <nl> # . Weekday representation <nl> - # : xbmc / dialogs / GUIDialogPVRTimerWeekdaysSettings . cpp <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 835 " <nl> msgid " Fridays " <nl> msgstr " " <nl> <nl> # . Weekday representation <nl> - # : xbmc / dialogs / GUIDialogPVRTimerWeekdaysSettings . cpp <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 836 " <nl> msgid " Saturdays " <nl> msgstr " " <nl> <nl> # . Weekday representation <nl> - # : xbmc / dialogs / GUIDialogPVRTimerWeekdaysSettings . cpp <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 837 " <nl> msgid " Sundays " <nl> msgstr " " <nl> # empty strings from id 838 to 839 <nl> <nl> # . Message in a dialog when a user wants to delete a timer that was scheduled by a timer rule <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 840 " <nl> msgid " Do you only want to delete this timer or also the timer rule that has scheduled it ? " <nl> msgstr " " <nl> <nl> # . Label for No button in a dialog when a user wants to delete a timer that was scheduled by a timer rule <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 841 " <nl> msgid " Only this " <nl> msgstr " " <nl> msgstr " " <nl> # empty string with id 842 <nl> <nl> # . Label for a context menu entry to activate a currently inactive timer <nl> - # : xbmc / pvr / windows / GUIWindowPVRTimers . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 843 " <nl> msgid " Activate " <nl> msgstr " " <nl> <nl> # . Label for a context menu entry to deactivate a currently active timer <nl> - # : xbmc / pvr / windows / GUIWindowPVRTimers . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 844 " <nl> msgid " Deactivate " <nl> msgstr " " <nl> <nl> # . Message in a dialog when a user wants to delete a timer rule <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 845 " <nl> msgid " Are you sure you want to delete this timer rule and all timers it has scheduled ? " <nl> msgstr " " <nl> <nl> # . Message in a dialog when a user wants to delete a timer <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 846 " <nl> msgid " Are you sure you want to delete this timer ? " <nl> msgstr " " <nl> <nl> # . Heading for a dialog for confirming to stop an active recording <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 847 " <nl> msgid " Confirm stop recording " <nl> msgstr " " <nl> <nl> # . Message in a dialog when a user wants to stop an active recording <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 848 " <nl> msgid " Are you sure you want to stop this recording ? " <nl> msgstr " " <nl> msgstr " " <nl> <nl> # . Label of various controls for starting playback from the beginning <nl> # : xbmc / Autorun . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRRecordings . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> # : xbmc / video / windows / GUIWindowVideoBase . cpp <nl> msgctxt " # 12021 " <nl> msgid " Play from beginning " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / windows / GUIWindowPVRRecordings . cpp <nl> + # . Label of various controls for resuming playback from a certain point in time <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> # : xbmc / video / windows / GUIWindowVideoBase . cpp <nl> msgctxt " # 12022 " <nl> msgid " Resume from % s " <nl> msgstr " " <nl> <nl> # . Label of video / recordings context menu items <nl> - # : xbmc / pvr / windows / PVRGUIWindowRecordings . cpp <nl> # : xbmc / video / ContextMenus . cpp <nl> msgctxt " # 12023 " <nl> msgid " Play from beginning " <nl> msgstr " " <nl> <nl> # empty strings from id 13102 to 13105 <nl> <nl> + # . generic " disabled " label used in different places <nl> # : xbmc / peripherals / bus / PeripheralBus . cpp <nl> # : system / settings / settings . xml <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 13108 " <nl> msgid " Always enabled " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13109 " <nl> msgid " Test & apply the resolution " <nl> msgstr " " <nl> msgctxt " # 13111 " <nl> msgid " Would you like to keep this change ? " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13112 " <nl> msgid " High quality upscaling " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . used by several skins <nl> msgctxt " # 13113 " <nl> msgid " Disabled " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13114 " <nl> msgid " Enabled for SD content " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 13115 " <nl> msgid " Always enabled " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 13116 " <nl> msgid " Upscaling method " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 13117 " <nl> msgid " Bicubic " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 13118 " <nl> msgid " Lanczos " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13119 " <nl> msgid " Sinc " <nl> msgstr " " <nl> msgstr " " <nl> <nl> # empty strings from id 13121 to 13122 <nl> <nl> + # : xbmc / Application . cpp <nl> msgctxt " # 13123 " <nl> msgid " Keep skin ? " <nl> msgstr " " <nl> msgctxt " # 13130 " <nl> msgid " Blank other displays " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13131 " <nl> msgid " Disabled " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13132 " <nl> msgid " Blank displays " <nl> msgstr " " <nl> msgctxt " # 13161 " <nl> msgid " Primary DNS " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13162 " <nl> msgid " Initialise failed " <nl> msgstr " " <nl> msgctxt " # 13170 " <nl> msgid " Never " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13171 " <nl> msgid " Immediately " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13172 " <nl> msgid " After % i secs " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13173 " <nl> msgid " HDD install date : " <nl> msgstr " " <nl> <nl> - # : unknown <nl> + # . unused ? <nl> msgctxt " # 13174 " <nl> msgid " HDD power cycle count : " <nl> msgstr " " <nl> msgstr " " <nl> <nl> # empty strings from id 13202 to 13203 <nl> <nl> - # : unknown <nl> + # . used by several skins <nl> msgctxt " # 13204 " <nl> msgid " Last loaded profile : " <nl> msgstr " " <nl> <nl> - # : xbmc / addons / GUIDialogAddonInfo . cpp <nl> - # : xbmc / peripherals / devices / Peripheral . cpp <nl> + # . generic " unknown " label used in different places <nl> + # : xbmc / GUIInfoManager . cpp <nl> + # : xbmc / LangInfo . cpp <nl> + # : xbmc / music / MusicDatabase . cpp <nl> # : xbmc / peripherals / bus / PeripheralBus . cpp <nl> + # : xbmc / peripherals / devices / Peripheral . cpp <nl> + # : xbmc / platform / win32 / WIN32Util . cpp <nl> + # : xbmc / pvr / addons / PVRClients . cpp <nl> + # : xbmc / pvr / channels / PVRChannel . cpp <nl> + # : xbmc / pvr / PVRGUIInfo . cpp <nl> + # : xbmc / video / dialogs / GUIDialogAudioSubtitleSettings . cpp <nl> + # : xbmc / video / PlayerController . cpp <nl> msgctxt " # 13205 " <nl> msgid " Unknown " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 13206 " <nl> msgid " Overwrite " <nl> msgstr " " <nl> <nl> # . Subtitle selection to only use forced subtitles <nl> - # : xbmc / LangInfo . cpp <nl> + # : xbmc / LangInfo . cpp <nl> msgctxt " # 13207 " <nl> msgid " Forced only " <nl> msgstr " " <nl> <nl> + # : xbmc / utils / AlarmClock . cpp <nl> msgctxt " # 13208 " <nl> msgid " Alarm clock " <nl> msgstr " " <nl> <nl> + # : xbmc / interfaces / builtins / GUIBuiltins . cpp <nl> msgctxt " # 13209 " <nl> msgid " Alarm clock interval ( in minutes ) " <nl> msgstr " " <nl> <nl> + # : xbmc / utils / AlarmClock . cpp <nl> msgctxt " # 13210 " <nl> msgid " Started , alarm in % im " <nl> msgstr " " <nl> <nl> + # : xbmc / utils / AlarmClock . cpp <nl> msgctxt " # 13211 " <nl> msgid " Alarm ! " <nl> msgstr " " <nl> <nl> + # : xbmc / utils / AlarmClock . cpp <nl> msgctxt " # 13212 " <nl> msgid " Cancelled with % im % is left " <nl> msgstr " " <nl> <nl> # . minutes ( left from countdown ) <nl> + # : xbmc / GUIInfoManager . cpp <nl> msgctxt " # 13213 " <nl> msgid " % 2 . 0fm " <nl> msgstr " " <nl> <nl> # . seconds ( left from countdown ) <nl> + # : xbmc / GUIInfoManager . cpp <nl> msgctxt " # 13214 " <nl> msgid " % 2 . 0fs " <nl> msgstr " " <nl> msgstr " " <nl> <nl> # empty strings from id 14278 to 14299 <nl> <nl> + # . " pvr manager " settings group label <nl> # : system / settings / settings . xml <nl> msgctxt " # 14300 " <nl> msgid " PVR Manager " <nl> msgstr " " <nl> <nl> + # . pvr " channels " settings group label <nl> # : system / settings / settings . xml <nl> msgctxt " # 14301 " <nl> msgid " Channels " <nl> msgstr " " <nl> <nl> + # . pvr " icons " settings group label <nl> # : system / settings / settings . xml <nl> msgctxt " # 14302 " <nl> msgid " Icons " <nl> msgstr " " <nl> <nl> + # . pvr " epg updates " settings group label <nl> # : system / settings / settings . xml <nl> msgctxt " # 14303 " <nl> msgid " Updates " <nl> msgstr " " <nl> <nl> + # . pvr " RDS " settings group label <nl> # : system / settings / settings . xml <nl> msgctxt " # 14304 " <nl> msgid " RDS Radio " <nl> msgstr " " <nl> # empty strings from id 15043 to 15046 <nl> <nl> # . Label for a context menu entry and dialog button to open audio DSP settings dialog <nl> - # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRRecordings . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> # : xbmc / music / windows / GUIWindowMusicBase . cpp <nl> # : addons / skin . estuary / 1080i / Custom_1105_MusicOSDSettings . xml <nl> msgctxt " # 15047 " <nl> msgctxt " # 16028 " <nl> msgid " Enter value " <nl> msgstr " " <nl> <nl> + # . PVR error messages dialog text . <nl> + # : xbmc / addons / PVRClients . cpp <nl> # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> msgctxt " # 16029 " <nl> msgid " Check the log for more information about this message . " <nl> msgstr " " <nl> <nl> # . Label for a context menu entry to mark an item as watched <nl> # : xbmc / music / windows / GUIWindowMusicNav . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRRecordings . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> # : xbmc / video / dialogs / GUIDialogVideoInfo . cpp <nl> # : xbmc / video / windows / GUIWindowVideoNav . cpp <nl> msgctxt " # 16103 " <nl> msgstr " " <nl> <nl> # . Label for a context menu entry to mark an item as unwatched <nl> # : xbmc / music / windows / GUIWindowMusicNav . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRRecordings . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> # : xbmc / video / dialogs / GUIDialogVideoInfo . cpp <nl> # : xbmc / video / windows / GUIWindowVideoNav . cpp <nl> msgctxt " # 16104 " <nl> msgctxt " # 19002 " <nl> msgid " or use phrases to find an exact match , like \ " The wizard of Oz \ " . " <nl> msgstr " " <nl> <nl> - # . Label of a button / context menu entry to find similar programs ( matching a given epg event ) <nl> - # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRRecordings . cpp <nl> + # . Label of a context menu entry to find similar programs ( matching a given epg event ) <nl> + # : xbmc / pvr / PVRContextMenuItem . cpp <nl> msgctxt " # 19003 " <nl> msgid " Find similar " <nl> msgstr " " <nl> <nl> + # . label for epg import progess control <nl> # : xbmc / epg / EpgContainer . cpp <nl> msgctxt " # 19004 " <nl> msgid " Importing guide from clients " <nl> msgstr " " <nl> <nl> - # : addons / skin . estuary / 1080i / VideoFullScreen . xml <nl> + # . used by several skins <nl> msgctxt " # 19005 " <nl> msgid " PVR stream information " <nl> msgstr " " <nl> <nl> + # . label for ' tuner name ' in pvr player information dialog <nl> + # : addons / skin . estuary / 1080i / DialogPlayerProcessInfo . xml <nl> msgctxt " # 19006 " <nl> msgid " Receiving device " <nl> msgstr " " <nl> <nl> + # . label for ' device status ' in pvr player information dialog <nl> + # : addons / skin . estuary / 1080i / DialogPlayerProcessInfo . xml <nl> msgctxt " # 19007 " <nl> msgid " Device status " <nl> msgstr " " <nl> <nl> - # : addons / skin . estuary / 1080i / VideoFullScreen . xml <nl> + # . label for ' signal quality ' in pvr player information dialog <nl> + # : addons / skin . estuary / 1080i / DialogPlayerProcessInfo . xml <nl> msgctxt " # 19008 " <nl> msgid " Signal quality " <nl> msgstr " " <nl> <nl> - # : addons / skin . estuary / 1080i / VideoFullScreen . xml <nl> + # . label for ' signal noise ratio ' in pvr player information dialog <nl> + # : addons / skin . estuary / 1080i / DialogPlayerProcessInfo . xml <nl> msgctxt " # 19009 " <nl> msgid " SNR " <nl> msgstr " " <nl> <nl> + # . label for ' bit error ratio ' in pvr player information dialog <nl> + # : addons / skin . estuary / 1080i / DialogPlayerProcessInfo . xml <nl> msgctxt " # 19010 " <nl> msgid " BER " <nl> msgstr " " <nl> <nl> + # . label for ' number of uncorrected errors ' in pvr player information dialog <nl> + # : addons / skin . estuary / 1080i / DialogPlayerProcessInfo . xml <nl> msgctxt " # 19011 " <nl> msgid " UNC " <nl> msgstr " " <nl> <nl> + # . label for PVR backend name in system information ' s PVR section <nl> # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> msgctxt " # 19012 " <nl> msgid " PVR backend " <nl> msgstr " " <nl> <nl> + # . PVR ' channel encryption system ' textual presentation for free to air channels <nl> # : xbmc / pvr / channels / PVRChannel . cpp <nl> msgctxt " # 19013 " <nl> msgid " Free to air " <nl> msgstr " " <nl> <nl> + # . PVR ' channel encryption system ' textual presentation for ' fixed ' channels <nl> # : xbmc / pvr / channels / PVRChannel . cpp <nl> msgctxt " # 19014 " <nl> msgid " Fixed " <nl> msgstr " " <nl> <nl> + # . label for ' channel encryption ' in pvr player information dialog <nl> + # : addons / skin . estuary / 1080i / DialogPlayerProcessInfo . xml <nl> msgctxt " # 19015 " <nl> msgid " Encryption " <nl> msgstr " " <nl> <nl> - # : unused <nl> + # . unused ? <nl> msgctxt " # 19016 " <nl> msgid " PVR backend % i - % s " <nl> msgstr " " <nl> <nl> - # : xbmc / dialogs / GUIDialogMediaSource . cpp <nl> + # . generic label for pvr recordings used in different places <nl> + # : addons / skin . estuary / 1080i / Home . xml <nl> # : addons / skin . estuary / 1080i / Variables . xml <nl> + # : xbmc / dialogs / GUIDialogMediaSource . cpp <nl> + # : xbmc / filesystem / PVRDirectory . cpp <nl> msgctxt " # 19017 " <nl> msgid " Recordings " <nl> msgstr " " <nl> msgctxt " # 19018 " <nl> msgid " Folder with channel icons " <nl> msgstr " " <nl> <nl> - # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> + # . label for PVR backend number of channels in system information ' s PVR section <nl> # : addons / skin . estuary / 1080i / DialogPVRGuideOSD . xml <nl> # : addons / skin . estuary / 1080i / DialogPVRChannelManager . xml <nl> # : addons / skin . estuary / 1080i / DialogPVRChannelsOSD . xml <nl> # : addons / skin . estuary / 1080i / Variables . xml <nl> # : addons / skin . estuary / 1080i / Home . xml <nl> + # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> msgctxt " # 19019 " <nl> msgid " Channels " <nl> msgstr " " <nl> <nl> + # . generic label for ' Live TV ' used in different places <nl> + # : addons / skin . estuary / 1080i / Home . xml <nl> + # : addons / skin . estuary / 1080i / SkinSettings . xml : <nl> + # : addons / skin . estuary / 1080i / Variables . xml <nl> # : xbmc / pvr / channels / PVRChannelGroupsContainer . cpp <nl> # : xbmc / pvr / PVRManager . cpp <nl> - # : addons / skin . estuary / 1080i / Includes . xml <nl> - # : addons / skin . estuary / 1080i / Home . xml <nl> msgctxt " # 19020 " <nl> msgid " TV " <nl> msgstr " " <nl> <nl> + # . generic label for pvr - provided ' Radio ' used in different places <nl> + # : addons / skin . estuary / 1080i / Home . xml <nl> + # : addons / skin . estuary / 1080i / SkinSettings . xml <nl> + # : addons / skin . estuary / 1080i / Variables . xml <nl> # : xbmc / pvr / channels / PVRChannelGroupsContainer . cpp <nl> # : xbmc / pvr / PVRManager . cpp <nl> - # : addons / skin . estuary / 1080i / Home . xml <nl> msgctxt " # 19021 " <nl> msgid " Radio " <nl> msgstr " " <nl> <nl> + # . generic ' hidden ' label used in different places <nl> # : xbmc / pvr / dialogs / GUIDialogPVRGroupManager . cpp <nl> # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> msgctxt " # 19022 " <nl> msgid " Hidden " <nl> msgstr " " <nl> <nl> + # . generic label for ' Live TV channels ' used in different places <nl> # : xbmc / pvr / dialogs / GUIDialogPVRGroupManager . cpp <nl> # : addons / skin . estuary / 1080i / Variables . xml <nl> # : addons / skin . estuary / 1080i / DialogPVRChannelManager . xml <nl> msgctxt " # 19023 " <nl> msgid " TV channels " <nl> msgstr " " <nl> <nl> + # . generic label for pvr - provided ' Radio channels ' used in different places <nl> # : xbmc / pvr / dialogs / GUIDialogPVRGroupManager . cpp <nl> # : addons / skin . estuary / 1080i / DialogPVRChannelManager . xml <nl> # : addons / skin . estuary / 1080i / Variables . xml <nl> msgctxt " # 19024 " <nl> msgid " Radio channels " <nl> msgstr " " <nl> <nl> + # . label for PVR backend number of timers in system information ' s PVR section <nl> # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> msgctxt " # 19025 " <nl> msgid " Upcoming recordings " <nl> msgstr " " <nl> <nl> + # . label for " add timer . . . " list item used in pvr timers / timer rules window <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> + # : xbmc / pvr / timers / PVRTimers . cpp <nl> msgctxt " # 19026 " <nl> msgid " Add timer . . . " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19027 " <nl> msgid " No search results " <nl> msgstr " " <nl> <nl> + # . label used in pvr guide window views to indicate that there are no epg data for the current view ( channel , now , next ) <nl> + # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> msgctxt " # 19028 " <nl> msgid " No guide entries " <nl> msgstr " " <nl> <nl> + # . generic ' channel ' label used in different places <nl> # : addons / skin . estuary / 1080i / DialogFullScreenInfo . xml <nl> - # : addons / skin . estuary / 1080i / MyPVRGuide . xml <nl> + # : xbmc / filesystem / PluginDirectory . cpp <nl> + # : xbmc / pvr / channels / PVRChannel . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> + # : xbmc / utils / SortUtils . cpp <nl> msgctxt " # 19029 " <nl> msgid " Channel " <nl> msgstr " " <nl> <nl> + # . generic ' now ' label used in diffrent places <nl> # : addons / skin . estuary / 1080i / DialogPVRRadioRDSInfo . xml <nl> # : addons / skin . estuary / 1080i / MyWeather . xml <nl> + # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> msgctxt " # 19030 " <nl> msgid " Now " <nl> msgstr " " <nl> <nl> - # . Label prefix for the next playing tv - show ( PVR ) or media , like " Next : The Simpsons " , " Next : AC / DC - Thunderstruck " . It ' s also used as EPG display mode ( EPG : timeline / now / next ) <nl> + # . generic ' next ' label used in diffrent places in pvr context <nl> # : addons / skin . estuary / 1080i / DialogFullScreenInfo . xml <nl> # : addons / skin . estuary / 1080i / DialogPVRRadioRDSInfo . xml <nl> + # : addons / skin . estuary / 1080i / MyPVRChannels . xml <nl> + # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> msgctxt " # 19031 " <nl> msgid " Next " <nl> msgstr " " <nl> <nl> + # . ' timeline ' label used in pvr guide window <nl> # : addons / skin . estuary / 1080i / MyPVRGuide . xml <nl> + # . xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> msgctxt " # 19032 " <nl> msgid " Timeline " <nl> msgstr " " <nl> <nl> + # . generic ' information ' label used in different places , like labels for message box headers <nl> # : xbmc / event / windows / GUIWindowEventLog . cpp <nl> # : xbmc / pvr / addons / PVRClients . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGroupManager . cpp <nl> # : xbmc / pvr / dialogs / GUIDialogPVRGuideInfo . cpp <nl> - # : xbmc / pvr / PVRManager . cpp <nl> + # : xbmc / pvr / recordings / PVRRecording . cpp <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> # : xbmc / pvr / timers / PVRTimers . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> + # : xbmc / pvr / windows / GUIWindowPVRTimersBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> + # : xbmc / pvr / PVRManager . cpp <nl> # : xbmc / video / windows / GUIWindowVideoBase . cpp <nl> # : addons / skin . estuary / 1080i / VideoOSD . xml <nl> msgctxt " # 19033 " <nl> msgid " Information " <nl> msgstr " " <nl> <nl> # . message box text stating that a timer is already set for a given epg event . <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 19034 " <nl> msgid " There is already a timer set for this event " <nl> msgstr " " <nl> <nl> + # . message box text stating that a pvr channel could not be played . <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> + # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19035 " <nl> - msgid " % s couldn ' t be played . Check the log for more information about this message . " <nl> + msgid " % s can ' t be played . Check the log for more information about this message . " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # . message box text stating that a recording could not be played . <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> # : xbmc / video / windows / GUIWindowVideoBase . cpp <nl> msgctxt " # 19036 " <nl> msgid " This recording can ' t be played . Check the log for more information about this message . " <nl> msgstr " " <nl> <nl> + # . pvr settings " show signal quality " label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19037 " <nl> msgid " Show signal quality " <nl> msgstr " " <nl> <nl> + # . message box text stating that a PVR backend does not support a certain functionality . <nl> # : xbmc / pvr / addons / PVRClients . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> msgctxt " # 19038 " <nl> msgid " Not supported by the PVR backend . " <nl> msgstr " " <nl> <nl> + # . message box text asking for confirmation to hide a channel . <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 19039 " <nl> msgid " Are you sure you want to hide this channel ? " <nl> msgstr " " <nl> msgctxt " # 19040 " <nl> msgid " Timers " <nl> msgstr " " <nl> <nl> + # . label for " rename recording " confirmation input dialog <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 19041 " <nl> msgid " Are you sure you want to rename this recording ? " <nl> msgstr " " <nl> <nl> + # . label for " rename timer " confirmation input dialog <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 19042 " <nl> msgid " Are you sure you want to rename this timer ? " <nl> msgstr " " <nl> <nl> + # . pvr settings " recording " category label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19043 " <nl> msgid " Recording " <nl> msgstr " " <nl> <nl> + # : @ @ @ unused ? <nl> msgctxt " # 19044 " <nl> msgid " Please check your configuration . Check the log for more information about this message . " <nl> msgstr " " <nl> <nl> + # : @ @ @ unused ? <nl> msgctxt " # 19045 " <nl> msgid " No PVR clients have been started yet . Wait for the PVR clients to start up . Check the log for more information about this message . " <nl> msgstr " " <nl> <nl> + # : @ @ @ unused ? <nl> msgctxt " # 19046 " <nl> msgid " New channel " <nl> msgstr " " <nl> <nl> # . Label for a context menu entry to open an EPG event information dialog <nl> - # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRtimers . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 19047 " <nl> msgid " Programme information " <nl> msgstr " " <nl> <nl> + # . pvr settings " group manager " action button label <nl> + # . Label for a context menu entry to open the pvr channel group manager dialog <nl> + # : system / settings / settings . xml <nl> + # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> msgctxt " # 19048 " <nl> msgid " Group manager " <nl> msgstr " " <nl> <nl> + # : @ @ @ unused ? <nl> msgctxt " # 19049 " <nl> msgid " Show channel " <nl> msgstr " " <nl> <nl> + # : @ @ @ unused ? <nl> msgctxt " # 19050 " <nl> msgid " Show visible channels " <nl> msgstr " " <nl> msgctxt " # 19051 " <nl> msgid " Show hidden channels " <nl> msgstr " " <nl> <nl> + # : @ @ @ unused ? <nl> msgctxt " # 19052 " <nl> msgid " Move channel to : " <nl> msgstr " " <nl> <nl> # . Label for a context menu entry to open recording info dialog <nl> - # : xbmc / pvr / windows / GUIWindowPVRRecordings . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 19053 " <nl> msgid " Recording information " <nl> msgstr " " <nl> <nl> + # . header label for hide channel confirmation message box <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 19054 " <nl> msgid " Hide channel " <nl> msgstr " " <nl> <nl> - # : xbmc / epg / EpgInfoTag . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> - # : addons / skin . estuary / 1080i / View_50_List . xml <nl> + # . generic text used in several places to state that there is no information available <nl> # : addons / skin . estuary / 1080i / DialogMusicInfo . xml <nl> + # : addons / skin . estuary / 1080i / DialogVideoInfo . xml <nl> + # : addons / skin . estuary / 1080i / Includes_PVR . xml <nl> # : addons / skin . estuary / 1080i / MyGames . xml <nl> + # : addons / skin . estuary / 1080i / MyMusicNav . xml <nl> # : addons / skin . estuary / 1080i / MyPics . xml <nl> # : addons / skin . estuary / 1080i / MyVideoNav . xml <nl> - # : addons / skin . estuary / 1080i / Includes_PVR . xml <nl> - # : addons / skin . estuary / 1080i / DialogVideoInfo . xml <nl> - # : addons / skin . estuary / 1080i / MyMusicNav . xml <nl> + # : addons / skin . estuary / 1080i / View_50_List . xml <nl> + # : xbmc / epg / EpgInfoTag . cpp <nl> + # : xbmc / FileItem . cpp <nl> + # : xbmc / GUIInfoManager . cpp <nl> + # : xbmc / pvr / PVRManager . cpp <nl> + # : xbmc / utils / SystemInfo . cpp <nl> msgctxt " # 19055 " <nl> msgid " No information available " <nl> msgstr " " <nl> <nl> # . Label for a new timer <nl> - # : xbmc / pvr / timers / PVRTimers . cpp <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> msgctxt " # 19056 " <nl> msgctxt " # 19058 " <nl> msgid " Timer enabled " <nl> msgstr " " <nl> <nl> + # . Label for a context menu entry and for a button to stop a recording <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideInfo . cpp <nl> msgctxt " # 19059 " <nl> msgid " Stop recording " <nl> msgstr " " <nl> <nl> # . Label for a context menu entry to delete a timer associated with an epg event and for a button to delete a timer in epg event info dialog <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> # : xbmc / pvr / dialogs / GUIDialogPVRGuideInfo . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> msgctxt " # 19060 " <nl> msgid " Delete timer " <nl> msgstr " " <nl> <nl> # . Label for a context menu entry to open the timer settings dialog <nl> - # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> # : addons / skin . estuary / 1080i / DialogPVRInfo . xml <nl> msgctxt " # 19061 " <nl> msgid " Add timer " <nl> msgstr " " <nl> <nl> + # : @ @ @ unused ? <nl> msgctxt " # 19062 " <nl> msgid " Sort by : Channel " <nl> msgstr " " <nl> <nl> + # . Label for epg grid window " jump to grid start " ( oldest available events ) context menu entry <nl> + # : / xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> msgctxt " # 19063 " <nl> msgid " Go to beginning " <nl> msgstr " " <nl> <nl> + # . Label for epg grid window " jump to grid end " ( youngest available events ) context menu entry <nl> + # : / xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> msgctxt " # 19064 " <nl> msgid " Go to end " <nl> msgstr " " <nl> <nl> + # . Label for timer settings dialog header <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> msgctxt " # 19065 " <nl> msgid " Timer settings " <nl> msgstr " " <nl> <nl> # . Name of a shortcut to a custom folder for channel icons <nl> - # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> msgctxt " # 19066 " <nl> msgid " Channel icons " <nl> msgstr " " <nl> <nl> + # . message box text stating that an epg event is already being recorded <nl> # : xbmc / pvr / dialogs / GUIDialogPVRGuideInfo . cpp <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19067 " <nl> msgid " This event is already being recorded . " <nl> msgstr " " <nl> <nl> + # . error box text stating that a given pvr recording could not be deleted <nl> # : xbmc / pvr / recording / PVRRecording . cpp <nl> msgctxt " # 19068 " <nl> msgid " This recording couldn ' t be deleted . Check the log for more information about this message . " <nl> msgstr " " <nl> <nl> - # . Electronic program guide . used by ? <nl> + # . Electronic program guide <nl> # : addons / skin . estuary / 1080i / Variables . xml <nl> msgctxt " # 19069 " <nl> msgid " Guide " <nl> msgstr " " <nl> <nl> + # . Label for epg grid window " jump to now " ( current epg events ) context menu entry <nl> + # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> msgctxt " # 19070 " <nl> msgid " Go to now " <nl> msgstr " " <nl> <nl> + # . pvr settings " epg update interval " setting label <nl> + # : system / settings / settings . xml <nl> msgctxt " # 19071 " <nl> msgid " Update interval " <nl> msgstr " " <nl> <nl> + # . pvr settings " do not store epg data in local database " setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19072 " <nl> msgid " Don ' t cache in local database " <nl> msgstr " " <nl> <nl> + # . pvr settings " delay channel switch " setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19073 " <nl> msgid " Delay channel switch " <nl> msgctxt " # 19078 " <nl> msgid " Channel " <nl> msgstr " " <nl> <nl> - # . heading for PVR timer days of week settings dialog <nl> + # . Heading for PVR timer days of week settings dialog <nl> # . Label of days of week button in PVR timer settings dialog <nl> # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> msgctxt " # 19079 " <nl> msgid " Days of week " <nl> msgstr " " <nl> <nl> + # . used by several skins <nl> msgctxt " # 19080 " <nl> msgid " Begin " <nl> msgstr " " <nl> <nl> + # . used by several skins <nl> msgctxt " # 19081 " <nl> msgid " End " <nl> msgstr " " <nl> msgctxt " # 19084 " <nl> msgid " First day " <nl> msgstr " " <nl> <nl> + # . default for channels without a name . place holder will be filled with channel number . <nl> + # : xbmc / pvr / channels / PVRChannel . cpp <nl> msgctxt " # 19085 " <nl> msgid " Unknown channel % u " <nl> msgstr " " <nl> msgid " Instant recording : % s " <nl> msgstr " " <nl> <nl> # . error message displayed in case adding a timer failed because no suitable epg - based timer type could be found . <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 19094 " <nl> msgid " Timer creation failed . The PVR add - on does not support a suitable timer type . " <nl> msgstr " " <nl> <nl> # . error message displayed in case adding a timer rule failed because no suitable epg - based timer rule type could be found . <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 19095 " <nl> msgid " Timer rule creation failed . The PVR add - on does not support a suitable timer rule type . " <nl> msgstr " " <nl> <nl> # empty string with id 19096 <nl> <nl> + # . label of the help text for the timer name edit field in PVR timer settings dialog <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> msgctxt " # 19097 " <nl> - msgid " Enter the name for the recording " <nl> + msgid " Enter the name for the timer " <nl> msgstr " " <nl> <nl> + # . generic warning label used at several places <nl> # : xbmc / addons / AddonSystemSettings . cpp <nl> # : xbmc / cores / AudioEngine / DSPAddons / ActiveAEDSP . cpp <nl> # : xbmc / pvr / channels / PVRChannelGroupInternal . cpp <nl> # : xbmc / pvr / PVRManager . cpp <nl> - # : xbmc / settings / dialogs / GUIDialogAudioDSPManager . cpp : <nl> + # : xbmc / settings / dialogs / GUIDialogAudioDSPManager . cpp <nl> msgctxt " # 19098 " <nl> msgid " Warning ! " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / PVRGUIInfo . cpp <nl> + # . service label in pvr info dialog <nl> + # : addons / skin . estuary / 1080i / DialogPlayerProcessInfo . xml <nl> msgctxt " # 19099 " <nl> msgid " Service " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / PVRGUIInfo . cpp <nl> + # . mux label in pvr info dialog <nl> + # : addons / skin . estuary / 1080i / DialogPlayerProcessInfo . xml <nl> msgctxt " # 19100 " <nl> msgid " Mux " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / PVRGUIInfo . cpp <nl> + # . provider label in pvr info dialog <nl> + # : addons / skin . estuary / 1080i / DialogPlayerProcessInfo . xml <nl> msgctxt " # 19101 " <nl> msgid " Provider " <nl> msgstr " " <nl> <nl> + # . message box text prompting user to switch to nother channel <nl> # : xbmc / pvr / channels / PVRChannelGroupInternal . cpp <nl> msgctxt " # 19102 " <nl> msgid " Please switch to another channel . " <nl> msgstr " " <nl> <nl> # . Title of numeric dialog for choosing a channel by entering a number <nl> - # : xbmc / pvr / windows / GUIWindowPVRCommon . cpp <nl> + # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> + # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> msgctxt " # 19103 " <nl> msgid " Go to channel " <nl> msgstr " " <nl> <nl> + # . label of the help text for the recording folder edit field in PVR timer settings dialog <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRTimerSettings . cpp <nl> msgctxt " # 19104 " <nl> msgid " Enter the name of the folder for the recording " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19105 " <nl> msgid " Please select a channel " <nl> msgstr " " <nl> <nl> + # . part of timer information text ( e . g . " Next timer on 10 / 10 / 2016 at 9 : 00 AM " ) <nl> + # : xbmc / pvr / PVRGUIInfo . cpp <nl> msgctxt " # 19106 " <nl> msgid " Next timer on " <nl> msgstr " " <nl> <nl> + # . part of timer information text ( e . g . " Next timer on 10 / 10 / 2016 at 9 : 00 AM " ) <nl> + # : xbmc / pvr / PVRGUIInfo . cpp <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19107 " <nl> msgid " at " <nl> msgstr " " <nl> <nl> + # . label for PVR settings " tv fallback framerate " ( in Hz ) selector <nl> # : system / settings / settings . xml <nl> msgctxt " # 19108 " <nl> msgid " Fallback framerate " <nl> msgstr " " <nl> <nl> + # . message box text stating that a timer could not be saved <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> # : xbmc / pvr / timers / PVRTimers . cpp <nl> msgctxt " # 19109 " <nl> msgid " Couldn ' t save timer . Check the log for more information about this message . " <nl> msgstr " " <nl> <nl> + # . message box text stating that an unexpected error occured <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19110 " <nl> msgid " An unexpected error occurred . Try again later or check the log for more information . " <nl> msgstr " " <nl> <nl> + # . message box text stating that a PVR backend error occured <nl> # : xbmc / pvr / addons / PVRClients . cpp <nl> # : xbmc / pvr / recording / PVRRecording . cpp <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19111 " <nl> msgid " PVR backend error . Check the log for more information about this message . " <nl> msgstr " " <nl> <nl> + # . delete recordings confirmation message box text <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 19112 " <nl> msgid " Delete this recording ? " <nl> msgstr " " <nl> <nl> + # . delete multiple recordings confirmation message box text <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 19113 " <nl> msgid " Delete all recordings in this folder ? " <nl> msgstr " " <nl> <nl> + # . label for PVR backend version in system information ' s PVR section <nl> # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> msgctxt " # 19114 " <nl> msgid " Version " <nl> msgstr " " <nl> <nl> + # . label for PVR backend address ( e . g . ID address of the PVR backend server ) in system information ' s PVR section <nl> # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> msgctxt " # 19115 " <nl> msgid " Address " <nl> msgstr " " <nl> <nl> + # . label for PVR backend disk size in system information ' s PVR section <nl> # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> msgctxt " # 19116 " <nl> msgid " Disksize " <nl> msgstr " " <nl> <nl> + # . label for PVR settings channels search action control <nl> # : system / settings / settings . xml <nl> msgctxt " # 19117 " <nl> msgid " Search for channels " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19118 " <nl> msgid " Can ' t use PVR functions while searching . " <nl> msgstr " " <nl> <nl> + # . channel scan backend selection dialog text <nl> + # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 19119 " <nl> - msgid " On which server do you want to search ? " <nl> + msgid " On which backend do you want to search ? " <nl> msgstr " " <nl> <nl> + # . label for PVR client number in system information ' s PVR section <nl> # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> msgctxt " # 19120 " <nl> msgid " Client number " <nl> msgctxt " # 19121 " <nl> msgid " Avoid repeats " <nl> msgstr " " <nl> <nl> + # . delete active timer confirmation message box text <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19122 " <nl> msgid " This timer is still recording . Are you sure you want to delete this timer ? " <nl> msgstr " " <nl> msgctxt " # 19132 " <nl> msgid " Include unknown genres " <nl> msgstr " " <nl> <nl> + # : addons / skin . estuary / 1080i / DialogPVRGuideSearch . xml <nl> msgctxt " # 19133 " <nl> msgid " Search string " <nl> msgstr " " <nl> msgctxt " # 19135 " <nl> msgid " Case sensitive " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19136 " <nl> msgid " Channel unavailable " <nl> msgstr " " <nl> <nl> + # . channel group manager dialog error message box text <nl> # : xbmc / pvr / dialogs / GUIDialogPVRGroupManager . cpp <nl> msgctxt " # 19137 " <nl> msgid " No groups defined . Please create a group first " <nl> msgctxt " # 19138 " <nl> msgid " Timer rules " <nl> msgstr " " <nl> <nl> + # . channel group manager dialog create group / rename group message box text <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGroupManager . cpp <nl> msgctxt " # 19139 " <nl> msgid " Name of the new group " <nl> msgstr " " <nl> <nl> + # . PVR search window ' search ' list item label <nl> # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> msgctxt " # 19140 " <nl> msgid " Search . . . " <nl> msgstr " " <nl> <nl> + # . part of PVR window ' s active channel group label ( e . g . " Group : HD Sports Channels " ) <nl> # : addons / skin . estuary / 1080i / Includes_MediaMenu . xml <nl> # : addons / skin . estuary / 1080i / DialogPVRGuideSearch . xml <nl> + # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> msgctxt " # 19141 " <nl> msgid " Group " <nl> msgstr " " <nl> <nl> + # : addons / skin . estuary / 1080i / DialogPVRGuideSearch . xml <nl> msgctxt " # 19142 " <nl> msgid " Search guide " <nl> msgstr " " <nl> <nl> + # : addons / skin . estuary / 1080i / DialogPVRGroupManager . xml <nl> msgctxt " # 19143 " <nl> msgid " Group management " <nl> msgstr " " <nl> <nl> + # . used by several skins <nl> msgctxt " # 19144 " <nl> msgid " No groups defined " <nl> msgstr " " <nl> <nl> + # . used by several skins <nl> msgctxt " # 19145 " <nl> msgid " Grouped " <nl> msgstr " " <nl> <nl> + # : addons / skin . estuary / 1080i / DialogPVRChannelsOSD . xml <nl> msgctxt " # 19146 " <nl> msgid " Groups " <nl> msgstr " " <nl> <nl> + # . message box text stating that a PVR backend does not support a certain functionality . <nl> # : xbmc / pvr / recording / PVRRecording . cpp <nl> msgctxt " # 19147 " <nl> msgid " The PVR backend does not support this action . Check the log for more information about this message . " <nl> msgctxt " # 19148 " <nl> msgid " Channel " <nl> msgstr " " <nl> <nl> + # . part of timer rule textual weekdays representation ( e . g . " Mo - Tu - Fr - Su " , " Mo - Tu - __ - __ - Fr - __ - Su " ) <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19149 " <nl> msgid " Mo " <nl> msgstr " " <nl> <nl> + # . part of timer rule textual weekdays representation ( e . g . " Mo - Tu - Fr - Su " , " Mo - Tu - __ - __ - Fr - __ - Su " ) <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19150 " <nl> msgid " Tu " <nl> msgstr " " <nl> <nl> + # . part of timer rule textual weekdays representation ( e . g . " Mo - Tu - Fr - Su " , " Mo - Tu - __ - __ - Fr - __ - Su " ) <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19151 " <nl> msgid " We " <nl> msgstr " " <nl> <nl> + # . part of timer rule textual weekdays representation ( e . g . " Mo - Tu - Fr - Su " , " Mo - Tu - __ - __ - Fr - __ - Su " ) <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19152 " <nl> msgid " Th " <nl> msgstr " " <nl> <nl> + # . part of timer rule textual weekdays representation ( e . g . " Mo - Tu - Fr - Su " , " Mo - Tu - __ - __ - Fr - __ - Su " ) <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19153 " <nl> msgid " Fr " <nl> msgstr " " <nl> <nl> + # . part of timer rule textual weekdays representation ( e . g . " Mo - Tu - Fr - Su " , " Mo - Tu - __ - __ - Fr - __ - Su " ) <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19154 " <nl> msgid " Sa " <nl> msgstr " " <nl> <nl> + # . part of timer rule textual weekdays representation ( e . g . " Mo - Tu - Fr - Su " , " Mo - Tu - __ - __ - Fr - __ - Su " ) <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19155 " <nl> msgid " Su " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19156 " <nl> msgid " from " <nl> msgstr " " <nl> <nl> + # : addons / skin . estuary / 1080i / Home . xml <nl> msgctxt " # 19157 " <nl> msgid " Next recording " <nl> msgstr " " <nl> <nl> + # : addons / skin . estuary / 1080i / Home . xml <nl> msgctxt " # 19158 " <nl> msgid " Currently recording " <nl> msgstr " " <nl> <nl> + # . part of timer / timer rule textual representation ( e . g . " 10 / 10 / 2016 from 11 : 00 PM to 10 / 11 / 2016 1 : 00 AM " . " Mondays from any time to any time " ) <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19159 " <nl> msgid " from " <nl> msgstr " " <nl> <nl> + # . part of timer / timer rule textual representation ( e . g . " 10 / 10 / 2016 from 11 : 00 PM to 10 / 11 / 2016 1 : 00 AM " . " Mondays from any time to any time " ) <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19160 " <nl> msgid " to " <nl> msgstr " " <nl> <nl> - # . timer rule presentation string . < start - day - date | days - of - week > " from " < start - day - time | " any time " > " to " < end - day - time | " any time " > <nl> + # . timer rule presentation string . ( start - day - date | days - of - week ) " from " ( start - day - time | " any time " ) " to " ( end - day - time | " any time " ) <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19161 " <nl> msgid " any time " <nl> msgstr " " <nl> <nl> + # . timer status textual representation <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19162 " <nl> msgid " Recording active " <nl> msgstr " " <nl> <nl> + # . label for number of PVR recordings in system information ' s PVR section <nl> # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> msgctxt " # 19163 " <nl> msgid " Recordings " <nl> msgstr " " <nl> <nl> + # . error box text stating that recording could not be started <nl> # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19164 " <nl> msgid " Can ' t start recording . Check the log for more information about this message . " <nl> msgstr " " <nl> <nl> + # : addons / skin . estuary / 1080i / DialogPVRInfo . xml <nl> msgctxt " # 19165 " <nl> msgid " Switch " <nl> msgstr " " <nl> <nl> + # . label for header of system information ' s PVR section <nl> # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> msgctxt " # 19166 " <nl> msgid " PVR information " <nl> msgstr " " <nl> <nl> + # . pvr settings " scan for missing channel icons " action button label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19167 " <nl> msgid " Scan for missing icons " <nl> msgstr " " <nl> <nl> - # . Used in system info to show amount of it <nl> + # . label for PVR number of deleted recordings in system information ' s PVR section <nl> # : xbmc / windows / GUIWindowSystemInfo . cpp <nl> msgctxt " # 19168 " <nl> msgid " Deleted and recoverable recordings " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19169 " <nl> msgid " Hide video information box " <nl> msgstr " " <nl> <nl> + # . pvr settings " playback timeout " setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19170 " <nl> msgid " Timeout when starting playback " <nl> msgstr " " <nl> <nl> + # . pvr settings " start playback in a window instead of full screen " setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19171 " <nl> msgid " Start playback minimised " <nl> msgstr " " <nl> <nl> + # . pvr settings " duration for an instant recording " setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19172 " <nl> msgid " Instant recording duration " <nl> msgstr " " <nl> <nl> + # . pvr settings " default priority for recordings " setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19173 " <nl> msgid " Default recording priority " <nl> msgstr " " <nl> <nl> + # . pvr settings " default lifetime for recordings " setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19174 " <nl> msgid " Default recording lifetime " <nl> msgstr " " <nl> <nl> + # . pvr settings " default time to add before the start of an event to record ( according to its epg data ) " setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19175 " <nl> msgid " Default start padding time " <nl> msgstr " " <nl> <nl> + # . pvr settings " default time to add after the end of an event to record ( according to epg its data ) " setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19176 " <nl> msgid " Default end padding time " <nl> msgstr " " <nl> <nl> + # . pvr settings category and group label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19177 " <nl> msgid " Playback " <nl> msgstr " " <nl> <nl> + # . pvr setting " show channel info while switching channels " value <nl> # : system / settings / settings . xml <nl> msgctxt " # 19178 " <nl> msgid " Show channel information when switching channels " <nl> msgstr " " <nl> <nl> - # . Used as extension header on recordings window <nl> + # . header used in pvr recordings window <nl> # : xbmc / pvr / windows / GUIWindowPVRRecordings . cpp <nl> msgctxt " # 19179 " <nl> msgid " Deleted " <nl> msgstr " " <nl> <nl> - # . Settings - > Interface - > Other - > Startup window <nl> + # . Settings - > Interface - > Other - > Startup window value <nl> # : system / settings / settings . xml <nl> msgctxt " # 19180 " <nl> msgid " TV channels " <nl> msgstr " " <nl> <nl> + # . pvr settings " Menu / OSD " category label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19181 " <nl> msgid " Menu / OSD " <nl> msgstr " " <nl> <nl> + # . pvr settings " epg days to display " setting value <nl> # : system / settings / settings . xml <nl> msgctxt " # 19182 " <nl> msgid " Days to display " <nl> msgstr " " <nl> <nl> - # . Settings - > Interface - > Other - > Startup window <nl> + # . Settings - > Interface - > Other - > Startup window value <nl> # : system / settings / settings . xml <nl> msgctxt " # 19183 " <nl> msgid " Radio channels " <nl> msgstr " " <nl> <nl> - # . Used on pvr recordings as button to show of them <nl> + # . label for " deleted recordings " data source in media source window <nl> # : addons / skin . estuary / 1080i / Includes_MediaMenu . xml <nl> + # : xbmc / dialogs / GUIDialogMediaSource . cpp <nl> msgctxt " # 19184 " <nl> msgid " Deleted recordings " <nl> msgstr " " <nl> <nl> + # . pvr settings " clear epg data " action button label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19185 " <nl> msgid " Clear data " <nl> msgstr " " <nl> <nl> + # . message box text for pvr data reset confirmation <nl> # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19186 " <nl> msgid " All your TV related data ( channels , groups , guide ) will be cleared . Are you sure ? " <nl> msgstr " " <nl> <nl> + # . progress dialog text shown while purging pvr data <nl> # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19187 " <nl> msgid " Clearing all related data . " <nl> msgstr " " <nl> <nl> + # . message box text for epg data reset confirmation <nl> # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19188 " <nl> msgid " All your guide data will be cleared . Are you sure ? " <nl> msgstr " " <nl> <nl> + # . pvr settings " automatically start last played channel after Kodi startup " setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19189 " <nl> msgid " Continue last channel on startup " <nl> msgstr " " <nl> <nl> + # . pvr settings " automatically start last played channel after Kodi startup " setting value <nl> # : system / settings / settings . xml <nl> msgctxt " # 19190 " <nl> msgid " Background " <nl> msgctxt " # 19191 " <nl> msgid " PVR service " <nl> msgstr " " <nl> <nl> + # . error message box text stating that none of the available pvr clients does support channel scanning <nl> # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 19192 " <nl> msgid " None of the connected PVR backends supports scanning for channels . " <nl> msgstr " " <nl> <nl> + # . error message box text stating that a given pvr channel could not be played <nl> # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 19193 " <nl> msgid " The channel scan can ' t be started . Check the log for more information about this message . " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19194 " <nl> msgid " Continue ? " <nl> msgstr " " <nl> <nl> + # . label for a context menu entry for pvr client specific actions <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 19195 " <nl> msgid " Client actions " <nl> msgstr " " <nl> <nl> + # . value for " pvr client specific actions " dialog headers <nl> + # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 19196 " <nl> msgid " PVR client specific actions " <nl> msgstr " " <nl> <nl> - # : xbmc / addons / addoncallbackspvr . cpp <nl> + # . text for " recording started on < pvr client name > " pvr client addon callback notification <nl> + # : xbmc / addons / binary / interfaces / api1 / PVR / AddonCallbacksPVR . cpp <nl> msgctxt " # 19197 " <nl> msgid " Recording started on : % s " <nl> msgstr " " <nl> <nl> - # : xbmc / addons / addoncallbackspvr . cpp <nl> + # . text for " recording finished on < pvr client name > " pvr client addon callback notification <nl> + # : xbmc / addons / binary / interfaces / api1 / PVR / AddonCallbacksPVR . cpp <nl> msgctxt " # 19198 " <nl> msgid " Recording finished on : % s " <nl> msgstr " " <nl> <nl> + # . pvr settings " channel manager " action button label <nl> # : system / settings / settings . xml <nl> # : addons / skin . estuary / 1080i / Variables . xml <nl> msgctxt " # 19199 " <nl> msgctxt " # 19202 " <nl> msgid " Channel icon : " <nl> msgstr " " <nl> <nl> + # . used by several skins <nl> msgctxt " # 19203 " <nl> msgid " Edit channel " <nl> msgstr " " <nl> <nl> + # . initial name for new channels , used in pvr channel manager dialog <nl> # : addons / skin . estuary / 1080i / DialogPVRChannelManager . xml <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> msgctxt " # 19204 " <nl> msgid " New channel " <nl> msgstr " " <nl> msgctxt " # 19206 " <nl> msgid " Activate guide : " <nl> msgstr " " <nl> <nl> + # . used by several skins <nl> msgctxt " # 19207 " <nl> msgid " Group : " <nl> msgstr " " <nl> <nl> + # . text for " new channel name input " dialog <nl> + # : xbmc / pvr / dialogs / GUIDialogChannelManager . cpp <nl> msgctxt " # 19208 " <nl> msgid " Enter the name of the new channel " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19209 " <nl> msgid " Kodi virtual backend " <nl> msgstr " " <nl> <nl> + # . pvr channel manager " epg source " selector value <nl> # : addons / skin . estuary / 1080i / DialogPVRChannelManager . xml <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> msgctxt " # 19210 " <nl> msgid " Client " <nl> msgstr " " <nl> msgctxt " # 19211 " <nl> msgid " Delete channel " <nl> msgstr " " <nl> <nl> + # . pvr channel manager " save changes " , part of confirmation dialog message <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> msgctxt " # 19212 " <nl> msgid " This list contains changes " <nl> msgstr " " <nl> <nl> + # . pvr channel manager " create new channel " , backend selector dialog message <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> msgctxt " # 19213 " <nl> msgid " Select backend " <nl> msgstr " " <nl> <nl> + # . @ @ @ dead code in pvr channel manager , action for a context menu item never added ? <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> msgctxt " # 19214 " <nl> msgid " Enter a valid URL for the new channel " <nl> msgstr " " <nl> <nl> + # . message box text stating that a pvr backend does not support timers <nl> # : xbmc / pvr / timers / PVRTimers . cpp <nl> + # : xbmc / pvr / windows / GUIWindowsPVRTimersBase . cpp <nl> msgctxt " # 19215 " <nl> msgid " The PVR backend does not support timers . " <nl> msgstr " " <nl> <nl> + # . used by several skins <nl> msgctxt " # 19216 " <nl> msgid " All radio channels " <nl> msgstr " " <nl> <nl> + # . label for ' all channels ' value for ' channels ' selector control in pvr guide search dialog <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19217 " <nl> msgid " All TV channels " <nl> msgstr " " <nl> <nl> + # . ' visible ' label used as prefix for ' group ' control label in pvr channel group manager dialog , e . g . " Visible TV groups " <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGroupManager . cpp <nl> msgctxt " # 19218 " <nl> msgid " Visible " <nl> msgstr " " <nl> <nl> + # . label for ' ungrouped ' control in pvr channel group manager dialog <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGroupManager . cpp <nl> msgctxt " # 19219 " <nl> msgid " Ungrouped channels " <nl> msgstr " " <nl> <nl> + # . ' channels in ' label used as prefix for ' group ' control label in pvr channel group manager dialog , e . g . " Channels in My Sports Channels Group " <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGroupManager . cpp <nl> msgctxt " # 19220 " <nl> msgid " Channels in " <nl> msgstr " " <nl> <nl> + # . pvr settings " sync channel groups with backend ( s ) " control label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19221 " <nl> msgid " Synchronise channel groups with backend ( s ) " <nl> msgstr " " <nl> <nl> + # : addons / skin . estouchy / xml / Includes . xml <nl> msgctxt " # 19222 " <nl> msgid " Guide " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19223 " <nl> msgid " No PVR add - on could be enabled . Check your settings or the log for more information . " <nl> msgstr " " <nl> <nl> + # . Notification text to announce that a recording was aborted <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19224 " <nl> msgid " Recording aborted " <nl> msgstr " " <nl> <nl> + # . Notification text to announce that a recording was scheduled <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19225 " <nl> msgid " Recording scheduled " <nl> msgstr " " <nl> <nl> + # . Notification text to announce that a recording started <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19226 " <nl> msgid " Recording started " <nl> msgstr " " <nl> <nl> + # . Notification text to announce that a recording completed <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19227 " <nl> msgid " Recording completed " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / timers / PVRTimerInfoTag . cpp , displayed when a timer is deleted <nl> + # . Notification text to announce that a timer was deleted <nl> + # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19228 " <nl> msgid " Timer deleted " <nl> msgstr " " <nl> <nl> + # . label for PVR settings close channel OSD after channel switch control <nl> + # : system / settings / settings . xml <nl> msgctxt " # 19229 " <nl> msgid " Close channel OSD after switching channels " <nl> msgstr " " <nl> <nl> + # . label for PVR settings no epg updates during playback control <nl> # : system / settings / settings . xml <nl> msgctxt " # 19230 " <nl> msgid " Prevent updates during playback " <nl> msgstr " " <nl> <nl> + # . label for PVR settings use backend channel order control <nl> # : system / settings / settings . xml <nl> msgctxt " # 19231 " <nl> msgid " Use channel order from backend ( s ) " <nl> msgstr " " <nl> <nl> + # . label for pvr epg search window ' clear search results ' context menu item <nl> + # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> msgctxt " # 19232 " <nl> msgid " Clear search results " <nl> msgstr " " <nl> <nl> + # . label for PVR settings timer updates notification control <nl> # : system / settings / settings . xml <nl> msgctxt " # 19233 " <nl> msgid " Display a notification on timer updates " <nl> msgstr " " <nl> <nl> + # . label for PVR settings use backend channel numbers control <nl> # : system / settings / settings . xml <nl> msgctxt " # 19234 " <nl> msgid " Use channel numbers from backend " <nl> msgstr " " <nl> <nl> + # . label ' pvr starting up ' for progress dialog text <nl> + # : xbmc / pvr / PVRManager . cpp <nl> + # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> msgctxt " # 19235 " <nl> msgid " PVR manager is starting up " <nl> msgstr " " <nl> <nl> + # . label ' loading channels ' for progress dialog text <nl> + # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19236 " <nl> msgid " Loading channels from clients " <nl> msgstr " " <nl> <nl> + # . label ' loading timers ' for progress dialog text <nl> + # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19237 " <nl> msgid " Loading timers from clients " <nl> msgstr " " <nl> <nl> + # . label ' loading recordings ' for progress dialog text <nl> + # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19238 " <nl> msgid " Loading recordings from clients " <nl> msgstr " " <nl> <nl> + # . label ' starting background tasks ' for progress dialog text <nl> + # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19239 " <nl> msgid " Starting background threads " <nl> msgstr " " <nl> msgstr " " <nl> # empty string with id 19240 <nl> <nl> # . Label for context menu entry to open settings dialog for a timer ( read - only ) <nl> - # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRTimersBase . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 19241 " <nl> msgid " View timer information " <nl> msgstr " " <nl> <nl> # . Label for context menu entry to open settings dialog for a timer <nl> - # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 19242 " <nl> msgid " Edit timer " <nl> msgstr " " <nl> <nl> # . Label for context menu entry to open settings dialog for a timer rule <nl> - # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRTimersBase . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 19243 " <nl> msgid " Edit timer rule " <nl> msgstr " " <nl> <nl> + # . label for PVR settings pvr backend idle time control . if enabled , kodi will be automatically shutdown after the defined amount of pvr backend idle time . <nl> # : system / settings / settings . xml <nl> msgctxt " # 19244 " <nl> msgid " Backend idle time " <nl> msgstr " " <nl> <nl> + # . label for PVR settings wakeup command control . if not empty , kodi will execute the given command upon waking up from suspend . <nl> # : system / settings / settings . xml <nl> msgctxt " # 19245 " <nl> msgid " Wakeup command " <nl> msgstr " " <nl> <nl> + # . label for PVR settings wakeup before recording control . if checked , the box where kodi is installed on will be automatically turned on before a recording starts . <nl> # : system / settings / settings . xml <nl> msgctxt " # 19246 " <nl> msgid " Wakeup before recording " <nl> msgstr " " <nl> <nl> + # . label for PVR settings daily wakeup control . if checked , the box where kodi is installed on will be automatically turned on at the given time . <nl> # : system / settings / settings . xml <nl> msgctxt " # 19247 " <nl> msgid " Daily wakeup " <nl> msgstr " " <nl> <nl> + # . label for PVR settings daily wakeup time control . if checked , the box where kodi is installed on will be automatically turned on at the given time . <nl> # : system / settings / settings . xml <nl> msgctxt " # 19248 " <nl> msgid " Daily wakeup time ( HH : MM : SS ) " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19249 " <nl> msgid " Filter channels " <nl> msgstr " " <nl> <nl> + # . label ' loading epg data from database ' for progress dialog text <nl> # : xbmc / epg / EpgContainer . cpp <nl> msgctxt " # 19250 " <nl> msgid " Loading guide from database " <nl> msgstr " " <nl> <nl> + # . label for ' update epg ' context menu item and ' update epg ' confirmation dialog header <nl> + # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> msgctxt " # 19251 " <nl> msgid " Update guide information " <nl> msgstr " " <nl> <nl> + # . label for ' update channel epg ' confirmation dialog text <nl> + # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> msgctxt " # 19252 " <nl> msgid " Schedule guide update for this channel ? " <nl> msgstr " " <nl> <nl> + # . label for notification text stating that an epg data update for a given channel was started <nl> + # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> msgctxt " # 19253 " <nl> msgid " Guide update scheduled for channel " <nl> msgstr " " <nl> <nl> + # . label for notification text stating that an epg data update for a given channel failed <nl> + # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> msgctxt " # 19254 " <nl> msgid " Guide update failed for channel " <nl> msgstr " " <nl> msgctxt " # 19256 " <nl> msgid " Completed " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19257 " <nl> msgid " Lock channel " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19258 " <nl> msgid " Unlock channel " <nl> msgstr " " <nl> <nl> + # . pvr settings category label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19259 " <nl> msgid " Parental control " <nl> msgstr " " <nl> <nl> + # . pvr settings ' parental control channel unlock duration ' setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19260 " <nl> msgid " Unlock duration " <nl> msgstr " " <nl> <nl> + # . pvr settings ' parental control change pin ' setting label <nl> # : system / settings / settings . xml <nl> msgctxt " # 19261 " <nl> msgid " Change PIN " <nl> msgstr " " <nl> <nl> + # . generic ' parental control enter pin ' label <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> + # : xbmc / pvr / PVRManager . cpp <nl> + # : xbmc / settings / SettingConditions . cpp <nl> msgctxt " # 19262 " <nl> msgid " Parental control . Enter PIN : " <nl> msgstr " " <nl> <nl> + # . label for ' parental control pin ' verification dialog <nl> + # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19263 " <nl> msgid " Locked channel . Enter PIN : " <nl> msgstr " " <nl> <nl> + # . label for ' incorrect pin ' error dialog header <nl> # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19264 " <nl> msgid " Incorrect PIN " <nl> msgstr " " <nl> <nl> + # . label for ' incorrect pin ' error dialog text <nl> # : xbmc / pvr / PVRManager . cpp <nl> msgctxt " # 19265 " <nl> - msgid " The entered PIN number was incorrect . " <nl> + msgid " The entered PIN was incorrect . " <nl> msgstr " " <nl> <nl> + # . label to use for epg tag title instead of actual event title if the respective channel is parental locked <nl> # : xbmc / epg / EpgInfoTag . cpp <nl> msgctxt " # 19266 " <nl> msgid " Parental locked " <nl> msgctxt " # 19267 " <nl> msgid " Parental locked : " <nl> msgstr " " <nl> <nl> + # . pvr settings ' hide no info available labels ' setting label . Instead of displaying " no information available " text ( for example in epg grid for time spans without epg data ) , show nothing <nl> # : system / settings / settings . xml <nl> msgctxt " # 19268 " <nl> msgid " Hide \ " No information available \ " labels " <nl> msgstr " " <nl> <nl> + # . pvr settings ' hide connection lost warnings ' setting label . Do not display notification message in case Kodi cannot reach a pvr backend <nl> # : system / settings / settings . xml <nl> msgctxt " # 19269 " <nl> msgid " Disable \ " Connection lost \ " warnings " <nl> msgstr " " <nl> <nl> - # . Label of the option to switch between a grouped recordings list and a non - grouped recordings list . <nl> + # . Label of the option to switch between a grouped recordings list and a non - grouped recordings list in pvr recordings window . <nl> # : addons / skin . estuary / 1080i / Includes_MediaMenu . xml <nl> msgctxt " # 19270 " <nl> msgid " Group Items " <nl> msgstr " " <nl> <nl> + # . unused ? <nl> msgctxt " # 19271 " <nl> msgid " No PVR add - ons could be found " <nl> msgstr " " <nl> <nl> + # . label for ' pvr configuration incomplete ' information dialog text <nl> + # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> msgctxt " # 19272 " <nl> msgid " You need a tuner , backend software , and an add - on for the backend to be able to use PVR . Please visit http : / / kodi . wiki / view / PVR to learn more . " <nl> msgstr " " <nl> <nl> - # . Settings - > Interface - > Other - > Startup window <nl> - # : system / settings / settings . xml <nl> + # . Settings - > Interface - > Other - > Startup window value <nl> + # : xbmc / addons / Skin . cpp <nl> msgctxt " # 19273 " <nl> msgid " TV guide " <nl> msgstr " " <nl> <nl> - # . Settings - > Interface - > Other - > Startup window <nl> - # : system / settings / settings . xml <nl> + # . Settings - > Interface - > Other - > Startup window value <nl> + # : xbmc / addons / Skin . cpp <nl> msgctxt " # 19274 " <nl> msgid " Radio guide " <nl> msgstr " " <nl> <nl> + # . timer status textual representation <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19275 " <nl> msgid " Conflict warning " <nl> msgstr " " <nl> <nl> + # . timer status textual representation <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19276 " <nl> msgid " Conflict error " <nl> msgstr " " <nl> <nl> + # . Notification text to announce that a recording has a conflict <nl> # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> msgctxt " # 19277 " <nl> msgid " Recording conflict " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / timers / PVRTimerInfoTag . cpp <nl> + # . Notification text to announce that a recording has an error <nl> msgctxt " # 19278 " <nl> msgid " Recording error " <nl> msgstr " " <nl> <nl> + # . pvr settings ' client specific ' category label . <nl> # : system / settings / settings . xml <nl> msgctxt " # 19279 " <nl> msgid " Client specific " <nl> msgstr " " <nl> <nl> + # . pvr client specific settings ' client specific settings ' action control label . <nl> # : system / settings / settings . xml <nl> msgctxt " # 19280 " <nl> msgid " Client specific settings " <nl> msgstr " " <nl> <nl> + # . pvr settings ' confirm channel switch ' setting label . <nl> # : system / settings / settings . xml <nl> msgctxt " # 19281 " <nl> msgid " Confirm channel switches by pressing \ " OK \ " " <nl> msgstr " " <nl> <nl> # . Label for a select option or list item , representing an icon graphic ( like a TV channel icon ) <nl> - # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> msgctxt " # 19282 " <nl> msgid " Current icon " <nl> msgstr " " <nl> <nl> # . Label for a select option or list item , representing an icon graphic ( like a TV channel icon ) <nl> - # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> msgctxt " # 19283 " <nl> msgid " No icon " <nl> msgstr " " <nl> <nl> - # . Label for a select / menu option to select an icon graphic <nl> - # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> - # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> + # . used by several skins <nl> msgctxt " # 19284 " <nl> msgid " Choose icon " <nl> msgstr " " <nl> <nl> # . Label for a select / menu option to select an icon graphic <nl> - # : xbmc / pvr / windows / GUIWindowPVRChannels . cpp <nl> # : xbmc / pvr / dialogs / GUIDialogPVRChannelManager . cpp <nl> msgctxt " # 19285 " <nl> msgid " Browse for icon " <nl> msgstr " " <nl> <nl> - # . Notification message if process starts searching for missing channel icons <nl> - # : xbmc / pvr / PVRManager . cpp <nl> + # . unused ? <nl> msgctxt " # 19286 " <nl> msgid " Searching for channel icons " <nl> msgstr " " <nl> <nl> # . Label for the default pvr channel group <nl> - # : xbmc / pvr / windows / GUIWindowPVRCommon . cpp <nl> + # : xbmc / pvr / channels / PVRChannelGroup . cpp <nl> + # : xbmc / pvr / channels / PVRChannelGroupInternal . cpp <nl> msgctxt " # 19287 " <nl> msgid " All channels " <nl> msgstr " " <nl> <nl> + # . pvr settings ' continue last channel on startup ' setting value label . <nl> # : system / settings / settings . xml <nl> msgctxt " # 19288 " <nl> msgid " Foreground " <nl> msgid " Hide group " <nl> msgstr " " <nl> <nl> # . Label for a context menu entry of a recording to undelete a deleted recording <nl> - # : xbmc / pvr / windows / GUIWindowPVRRecordings . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 19290 " <nl> msgid " Undelete " <nl> msgstr " " <nl> <nl> + # . Label for a context menu entry of a recording to permanently delete a deleted recording <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 19291 " <nl> msgid " Delete permanently " <nl> msgstr " " <nl> msgid " Remove this deleted recording from trash ? This operation cannot be revert <nl> msgstr " " <nl> <nl> # . Label for context menu entry to delete a timer rule <nl> - # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRTimersBase . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 19295 " <nl> msgid " Delete timer rule " <nl> msgstr " " <nl> msgstr " " <nl> <nl> # empty strings from id 19297 to 19498 <nl> <nl> + # . label for epg genre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19499 " <nl> msgid " Other / Unknown " <nl> msgstr " " <nl> <nl> + # . label for epg " movie / drama " genre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19500 " <nl> msgid " Movie / Drama " <nl> msgstr " " <nl> <nl> + # . label for epg " movie / drama " subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19501 " <nl> msgid " Detective / Thriller " <nl> msgstr " " <nl> <nl> + # . label for epg " movie / drama " subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19502 " <nl> msgid " Adventure / Western / War " <nl> msgstr " " <nl> <nl> + # . label for epg " movie / drama " subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19503 " <nl> msgid " Science fiction / Fantasy / Horror " <nl> msgstr " " <nl> <nl> + # . label for epg " movie / drama " subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19504 " <nl> msgid " Comedy " <nl> msgstr " " <nl> <nl> + # . label for epg " movie / drama " subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19505 " <nl> msgid " Soap / Melodrama / Folkloric " <nl> msgstr " " <nl> <nl> + # . label for epg " movie / drama " subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19506 " <nl> msgid " Romance " <nl> msgstr " " <nl> <nl> + # . label for epg " movie / drama " subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19507 " <nl> msgid " Serious / Classical / Religious / Historical movie / drama " <nl> msgstr " " <nl> <nl> + # . label for epg " movie / drama " subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19508 " <nl> msgid " Adult movie / drama " <nl> msgstr " " <nl> <nl> # empty strings from id 19509 to 19515 <nl> <nl> + # . label for " news / current affairs " epg genre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19516 " <nl> msgid " News / Current affairs " <nl> msgstr " " <nl> <nl> + # . label for " news / current affairs " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19517 " <nl> msgid " News / Weather report " <nl> msgstr " " <nl> <nl> + # . label for " news / current affairs " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19518 " <nl> msgid " News magazine " <nl> msgstr " " <nl> <nl> + # . label for " news / current affairs " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19519 " <nl> msgid " Documentary " <nl> msgstr " " <nl> <nl> + # . label for " news / current affairs " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19520 " <nl> msgid " Discussion / Interview / Debate " <nl> msgstr " " <nl> <nl> # empty strings from id 19521 to 19531 <nl> <nl> + # . label for " show / game show " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19532 " <nl> msgid " Show / Game show " <nl> msgstr " " <nl> <nl> + # . label for " show / game show " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19533 " <nl> msgid " Game show / Quiz / Contest " <nl> msgstr " " <nl> <nl> + # . label for " show / game show " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19534 " <nl> msgid " Variety show " <nl> msgstr " " <nl> <nl> + # . label for " show / game show " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19535 " <nl> msgid " Talk show " <nl> msgstr " " <nl> <nl> # empty strings from id 19536 to 19547 <nl> <nl> + # . label for " sports " epg genre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19548 " <nl> msgid " Sports " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19549 " <nl> msgid " Special event " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19550 " <nl> msgid " Sport magazine " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19551 " <nl> msgid " Football " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19552 " <nl> msgid " Tennis / Squash " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19553 " <nl> msgid " Team sports " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19554 " <nl> msgid " Athletics " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19555 " <nl> msgid " Motor sport " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19556 " <nl> msgid " Water sport " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19557 " <nl> msgid " Winter sports " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19558 " <nl> msgid " Equestrian " <nl> msgstr " " <nl> <nl> + # . label for " sports " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19559 " <nl> msgid " Martial sports " <nl> msgstr " " <nl> <nl> # empty strings from id 19560 to 19563 <nl> <nl> + # . label for " children ' s / youth programmes " epg genre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19564 " <nl> msgid " Children ' s / Youth programmes " <nl> msgstr " " <nl> <nl> + # . label for " children ' s / youth programmes " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19565 " <nl> msgid " Pre - school children ' s programmes " <nl> msgstr " " <nl> <nl> + # . label for " children ' s / youth programmes " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19566 " <nl> msgid " Entertainment programmes for 6 to 14 " <nl> msgstr " " <nl> <nl> + # . label for " children ' s / youth programmes " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19567 " <nl> msgid " Entertainment programmes for 10 to 16 " <nl> msgstr " " <nl> <nl> + # . label for " children ' s / youth programmes " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19568 " <nl> msgid " Informational / Educational / School programme " <nl> msgstr " " <nl> <nl> + # . label for " children ' s / youth programmes " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19569 " <nl> msgid " Cartoons / Puppets " <nl> msgstr " " <nl> <nl> # empty strings from id 19570 to 19579 <nl> <nl> + # . label for " music / ballet / dance " epg genre value <nl> + # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19580 " <nl> msgid " Music / Ballet / Dance " <nl> msgstr " " <nl> <nl> + # . label for " music / ballet / dance " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19581 " <nl> msgid " Rock / Pop " <nl> msgstr " " <nl> <nl> + # . label for " music / ballet / dance " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19582 " <nl> msgid " Serious / Classical music " <nl> msgstr " " <nl> <nl> + # . label for " music / ballet / dance " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19583 " <nl> msgid " Folk / Traditional music " <nl> msgstr " " <nl> <nl> + # . label for " music / ballet / dance " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19584 " <nl> msgid " Musical / Opera " <nl> msgstr " " <nl> <nl> + # . label for " music / ballet / dance " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19585 " <nl> msgid " Ballet " <nl> msgstr " " <nl> <nl> # empty strings from id 19586 to 19595 <nl> <nl> + # . label for " arts / culture " epg genre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19596 " <nl> msgid " Arts / Culture " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19597 " <nl> msgid " Performing arts " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19598 " <nl> msgid " Fine arts " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19599 " <nl> msgid " Religion " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19600 " <nl> msgid " Popular culture / Traditional arts " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19601 " <nl> msgid " Literature " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19602 " <nl> msgid " Film / Cinema " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19603 " <nl> msgid " Experimental film / video " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19604 " <nl> msgid " Broadcasting / Press " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19605 " <nl> msgid " New media " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19606 " <nl> msgid " Arts / Culture magazines " <nl> msgstr " " <nl> <nl> + # . label for " arts / culture " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19607 " <nl> msgid " Fashion " <nl> msgstr " " <nl> <nl> # empty strings from id 19608 to 19611 <nl> <nl> + # . label for " social / political / economics " epg genre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19612 " <nl> msgid " Social / Political / Economics " <nl> msgstr " " <nl> <nl> + # . label for " social / political / economics " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19613 " <nl> msgid " Magazines / Reports / Documentary " <nl> msgstr " " <nl> <nl> + # . label for " social / political / economics " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19614 " <nl> msgid " Economics / Social advisory " <nl> msgstr " " <nl> <nl> + # . label for " social / political / economics " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19615 " <nl> msgid " Remarkable people " <nl> msgstr " " <nl> <nl> # empty strings from id 19616 to 19627 <nl> <nl> + # . label for " education / science / factual " epg genre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19628 " <nl> msgid " Education / Science / Factual " <nl> msgstr " " <nl> <nl> + # . label for " education / science / factual " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19629 " <nl> msgid " Nature / Animals / Environment " <nl> msgstr " " <nl> <nl> + # . label for " education / science / factual " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19630 " <nl> msgid " Technology / Natural sciences " <nl> msgstr " " <nl> <nl> + # . label for " education / science / factual " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19631 " <nl> msgid " Medicine / Physiology / Psychology " <nl> msgstr " " <nl> <nl> + # . label for " education / science / factual " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19632 " <nl> msgid " Foreign countries / Expeditions " <nl> msgstr " " <nl> <nl> + # . label for " education / science / factual " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19633 " <nl> msgid " Social / Spiritual sciences " <nl> msgstr " " <nl> <nl> + # . label for " education / science / factual " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19634 " <nl> msgid " Further education " <nl> msgstr " " <nl> <nl> + # . label for " education / science / factual " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19635 " <nl> msgid " Languages " <nl> msgstr " " <nl> <nl> # empty strings from id 19636 to 19643 <nl> <nl> + # . label for " leisure / hobbies " epg genre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19644 " <nl> msgid " Leisure / Hobbies " <nl> msgstr " " <nl> <nl> + # . label for " leisure / hobbies " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19645 " <nl> msgid " Tourism / Travel " <nl> msgstr " " <nl> <nl> + # . label for " leisure / hobbies " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19646 " <nl> msgid " Handicraft " <nl> msgstr " " <nl> <nl> + # . label for " leisure / hobbies " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19647 " <nl> msgid " Motoring " <nl> msgstr " " <nl> <nl> + # . label for " leisure / hobbies " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19648 " <nl> msgid " Fitness & health " <nl> msgstr " " <nl> <nl> + # . label for " leisure / hobbies " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19649 " <nl> msgid " Cooking " <nl> msgstr " " <nl> <nl> + # . label for " leisure / hobbies " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19650 " <nl> msgid " Advertisement / Shopping " <nl> msgstr " " <nl> <nl> + # . label for " leisure / hobbies " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19651 " <nl> msgid " Gardening " <nl> msgstr " " <nl> <nl> # empty strings from id 19652 to 19659 <nl> <nl> + # . label for " special characteristics " epg genre value <nl> # : xbmc / epg / Epg . cpp <nl> + # : xbmc / pvr / dialogs / GUIDialogPVRGuideSearch . cpp <nl> msgctxt " # 19660 " <nl> msgid " Special characteristics " <nl> msgstr " " <nl> <nl> + # . label for " special characteristics " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19661 " <nl> msgid " Original language " <nl> msgstr " " <nl> <nl> + # . label for " special characteristics " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19662 " <nl> msgid " Black & white " <nl> msgstr " " <nl> <nl> + # . label for " special characteristics " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19663 " <nl> msgid " Unpublished " <nl> msgstr " " <nl> <nl> + # . label for " special characteristics " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19664 " <nl> msgid " Live broadcast " <nl> msgstr " " <nl> <nl> # empty strings from id 19665 to 19675 <nl> <nl> + # . label for " user defined " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19676 " <nl> msgid " Drama " <nl> msgstr " " <nl> <nl> + # . label for " user defined " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19677 " <nl> msgid " Detective / Thriller " <nl> msgstr " " <nl> <nl> + # . label for " user defined " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19678 " <nl> msgid " Adventure / Western / War " <nl> msgstr " " <nl> <nl> + # . label for " user defined " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19679 " <nl> msgid " Science fiction / Fantasy / Horror " <nl> msgstr " " <nl> <nl> + # . label for " user defined " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19680 " <nl> msgid " Comedy " <nl> msgstr " " <nl> <nl> + # . label for " user defined " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19681 " <nl> msgid " Soap / Melodrama / Folkloric " <nl> msgstr " " <nl> <nl> + # . label for " user defined " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19682 " <nl> msgid " Romance " <nl> msgstr " " <nl> <nl> + # . label for " user defined " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19683 " <nl> msgid " Serious / Classical / Religion / Historical " <nl> msgstr " " <nl> <nl> + # . label for " user defined " epg subgenre value <nl> # : xbmc / epg / Epg . cpp <nl> msgctxt " # 19684 " <nl> msgid " Adult " <nl> msgstr " " <nl> <nl> # empty string with id 19686 <nl> <nl> - # : Label for a context menu entries , dialog heading , button to start playing a recording <nl> - # : xbmc / pvr / windows / GUIWindowPVRGuide . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRSearch . cpp <nl> - # : xbmc / pvr / windows / GUIWindowPVRBase . cpp <nl> + # : Label for context menu entries , dialog heading , button to start playing a recording <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> + # : xbmc / pvr / PVRGUIActions . cpp <nl> msgctxt " # 19687 " <nl> msgid " Play recording " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / addons / PVRClients . cpp <nl> + # . label for ' scanning for pvr services ' dialog header <nl> + # : xbmc / addons / PVRClient . cpp <nl> msgctxt " # 19688 " <nl> msgid " Scanning for PVR services " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / addons / PVRClients . cpp <nl> + # . label for ' scanning for pvr services ' dialog text <nl> + # : xbmc / addons / PVRClient . cpp <nl> msgctxt " # 19689 " <nl> msgid " % s service found at % s " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / addons / PVRClient . cpp <nl> + # . label for ' scanning for pvr services ' dialog text <nl> + # : xbmc / addons / PVRClient . cpp <nl> msgctxt " # 19690 " <nl> msgid " Do you want to use this service ? " <nl> msgstr " " <nl> msgstr " " <nl> <nl> # . Label for controls used to edit something ( e . g . setting " Appearance - > Skin - > Edit " or a context menu entry to open timer settings dialog ) <nl> # : system / settings / settings . xml <nl> - # : xbmc / pvr / windows / GUIWindowPVRTimers . cpp <nl> + # : xbmc / pvr / PVRContextMenus . cpp <nl> msgctxt " # 21450 " <nl> msgid " Edit " <nl> msgstr " " <nl> msgctxt " # 24031 " <nl> msgid " Error loading settings " <nl> msgstr " " <nl> <nl> - # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 24032 " <nl> msgid " All add - ons " <nl> msgstr " " <nl> msgctxt " # 29919 " <nl> msgid " Lottery " <nl> msgstr " " <nl> <nl> - # Stock information , in list selector ( if present ) <nl> + # . Stock information , in list selector ( if present ) <nl> # : xbmc / pvr / dialogs / GUIDialogPVRRadioRDSInfo . cpp <nl> msgctxt " # 29920 " <nl> msgid " Stock " <nl> msgstr " " <nl> # empty strings from id 35256 to 35504 <nl> <nl> # . connection state " host unreachable " <nl> - # : xbmc / addons / AddonCallbacksPVR . cpp <nl> + # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 35505 " <nl> msgid " Server is unreachable . " <nl> msgstr " " <nl> <nl> # . connection state " server type mismatch " ( reachable , but maybe an HTTP server where an FTP server is expected ) <nl> - # : xbmc / addons / AddonCallbacksPVR . cpp <nl> + # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 35506 " <nl> msgid " Server does not respond properly . " <nl> msgstr " " <nl> <nl> # . connection state " client - server version mismatch ( reachable , but maybe server version to low ) " <nl> - # : xbmc / addons / AddonCallbacksPVR . cpp <nl> + # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 35507 " <nl> msgid " Server version is not compatible . " <nl> msgstr " " <nl> <nl> # . connection state " access denied " ( e . g . due to wrong credentials ) <nl> - # : xbmc / addons / AddonCallbacksPVR . cpp <nl> + # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 35508 " <nl> msgid " Access denied . " <nl> msgstr " " <nl> <nl> # . connection state " connecting " ( asynchronous addon start ) <nl> - # : xbmc / addons / AddonCallbacksPVR . cpp <nl> + # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 35509 " <nl> msgid " Connecting to backend . " <nl> msgstr " " <nl> msgctxt " # 36029 " <nl> msgid " When the TV is switched off " <nl> msgstr " " <nl> <nl> - # : xbmc / addons / addonstatushandler . cpp <nl> - # : xbmc / addons / AddonCallbacksPVR . cpp <nl> + # . connection state " connection lost " <nl> # : xbmc / peripherals / devices / PeripheralCecAdapter . cpp <nl> + # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 36030 " <nl> msgid " Connection lost " <nl> msgstr " " <nl> msgctxt " # 36033 " <nl> msgid " Action when switching to another source " <nl> msgstr " " <nl> <nl> - # : xbmc / addons / AddonCallbacksPVR . cpp <nl> + # . connection state " connection established " <nl> + # : xbmc / pvr / addons / PVRClients . cpp <nl> msgctxt " # 36034 " <nl> msgid " Connection established " <nl> msgstr " " <nl> msgstr " " <nl> <nl> # empty strings from id 36578 to 36579 <nl> <nl> - # Dialog title for 3D LUT file picker <nl> + # . Dialog title for 3D LUT file picker <nl> # : xbmc / video / dialogs / GUIDialogVideoSettings . cpp <nl> msgctxt " # 36580 " <nl> msgid " 3D LUT file " <nl> msgstr " " <nl> <nl> - # Dialog title for ICC display profile file picker <nl> + # . Dialog title for ICC display profile file picker <nl> # : xbmc / video / dialogs / GUIDialogVideoSettings . cpp <nl> msgctxt " # 36581 " <nl> msgid " ICC Profile " <nl>
[ PVR ] gui actions refactoring : cleanup strings . po
xbmc/xbmc
655b218fc70e979118dd76b2819e32c4b8fa6b06
2016-12-02T06:32:05Z
mmm a / src / objects . cc <nl> ppp b / src / objects . cc <nl> MaybeHandle < Object > Object : : GetPropertyWithAccessor ( Handle < Object > receiver , <nl> if ( structure - > IsAccessorInfo ( ) ) { <nl> Handle < AccessorInfo > info = Handle < AccessorInfo > : : cast ( structure ) ; <nl> if ( ! info - > IsCompatibleReceiver ( * receiver ) ) { <nl> - Handle < Object > args [ 2 ] = { name , receiver } ; <nl> + Handle < Object > args [ ] = { name , receiver } ; <nl> THROW_NEW_ERROR ( isolate , <nl> NewTypeError ( " incompatible_method_receiver " , <nl> HandleVector ( args , arraysize ( args ) ) ) , <nl> MaybeHandle < Object > Object : : SetPropertyWithAccessor ( <nl> / / api style callbacks <nl> ExecutableAccessorInfo * info = ExecutableAccessorInfo : : cast ( * structure ) ; <nl> if ( ! info - > IsCompatibleReceiver ( * receiver ) ) { <nl> - Handle < Object > args [ 2 ] = { name , receiver } ; <nl> + Handle < Object > args [ ] = { name , receiver } ; <nl> THROW_NEW_ERROR ( isolate , <nl> NewTypeError ( " incompatible_method_receiver " , <nl> HandleVector ( args , arraysize ( args ) ) ) , <nl> MaybeHandle < Object > Object : : SetPropertyWithAccessor ( <nl> receiver , Handle < JSReceiver > : : cast ( setter ) , value ) ; <nl> } else { <nl> if ( is_sloppy ( language_mode ) ) return value ; <nl> - Handle < Object > args [ 2 ] = { name , holder } ; <nl> - THROW_NEW_ERROR ( <nl> - isolate , NewTypeError ( " no_setter_in_callback " , HandleVector ( args , 2 ) ) , <nl> - Object ) ; <nl> + Handle < Object > args [ ] = { name , holder } ; <nl> + THROW_NEW_ERROR ( isolate , <nl> + NewTypeError ( " no_setter_in_callback " , <nl> + HandleVector ( args , arraysize ( args ) ) ) , <nl> + Object ) ; <nl> } <nl> } <nl> <nl> MaybeHandle < Object > Object : : SetElementWithReceiver ( <nl> Handle < JSObject > target = Handle < JSObject > : : cast ( receiver ) ; <nl> ElementsAccessor * accessor = target - > GetElementsAccessor ( ) ; <nl> PropertyAttributes attrs = accessor - > GetAttributes ( target , index ) ; <nl> - if ( ( attrs & READ_ONLY ) ! = 0 ) { <nl> - return WriteToReadOnlyElement ( isolate , receiver , index , value , <nl> - language_mode ) ; <nl> + if ( attrs = = ABSENT ) { <nl> + return JSObject : : SetElement ( target , index , value , NONE , language_mode , <nl> + false ) ; <nl> } <nl> - PropertyAttributes new_attrs = attrs ! = ABSENT ? attrs : NONE ; <nl> - return JSObject : : SetElement ( target , index , value , new_attrs , language_mode , <nl> - false ) ; <nl> + return JSObject : : SetElement ( target , index , value , attrs , language_mode , false , <nl> + DEFINE_PROPERTY ) ; <nl> } <nl> <nl> <nl> MaybeHandle < Object > Object : : SetProperty ( Handle < Object > object , <nl> } <nl> <nl> <nl> - MaybeHandle < Object > Object : : SetProperty ( LookupIterator * it , <nl> - Handle < Object > value , <nl> - LanguageMode language_mode , <nl> - StoreFromKeyed store_mode , <nl> - StorePropertyMode data_store_mode ) { <nl> + MaybeHandle < Object > Object : : SetPropertyInternal ( LookupIterator * it , <nl> + Handle < Object > value , <nl> + LanguageMode language_mode , <nl> + StoreFromKeyed store_mode , <nl> + bool * found ) { <nl> / / Make sure that the top context does not change when doing callbacks or <nl> / / interceptor calls . <nl> AssertNoContextChange ncc ( it - > isolate ( ) ) ; <nl> <nl> + * found = true ; <nl> + <nl> bool done = false ; <nl> for ( ; it - > IsFound ( ) ; it - > Next ( ) ) { <nl> switch ( it - > state ( ) ) { <nl> MaybeHandle < Object > Object : : SetProperty ( LookupIterator * it , <nl> / / the property did not exist yet on the global object itself , we have to <nl> / / throw a reference error in strict mode . <nl> if ( it - > GetReceiver ( ) - > IsJSGlobalObject ( ) & & is_strict ( language_mode ) ) { <nl> - Handle < Object > args [ 1 ] = { it - > name ( ) } ; <nl> - THROW_NEW_ERROR ( it - > isolate ( ) , <nl> - NewReferenceError ( " not_defined " , HandleVector ( args , 1 ) ) , <nl> - Object ) ; <nl> + Handle < Object > args [ ] = { it - > name ( ) } ; <nl> + THROW_NEW_ERROR ( <nl> + it - > isolate ( ) , <nl> + NewReferenceError ( " not_defined " , HandleVector ( args , arraysize ( args ) ) ) , <nl> + Object ) ; <nl> } <nl> <nl> - if ( data_store_mode = = SUPER_PROPERTY ) { <nl> - LookupIterator own_lookup ( it - > GetReceiver ( ) , it - > name ( ) , <nl> - LookupIterator : : OWN ) ; <nl> + * found = false ; <nl> + return MaybeHandle < Object > ( ) ; <nl> + } <nl> <nl> - return JSObject : : SetProperty ( & own_lookup , value , language_mode , store_mode , <nl> - NORMAL_PROPERTY ) ; <nl> - } <nl> <nl> + MaybeHandle < Object > Object : : SetProperty ( LookupIterator * it , <nl> + Handle < Object > value , <nl> + LanguageMode language_mode , <nl> + StoreFromKeyed store_mode ) { <nl> + bool found = false ; <nl> + MaybeHandle < Object > result = <nl> + SetPropertyInternal ( it , value , language_mode , store_mode , & found ) ; <nl> + if ( found ) return result ; <nl> return AddDataProperty ( it , value , NONE , language_mode , store_mode ) ; <nl> } <nl> <nl> <nl> + MaybeHandle < Object > Object : : SetSuperProperty ( LookupIterator * it , <nl> + Handle < Object > value , <nl> + LanguageMode language_mode , <nl> + StoreFromKeyed store_mode ) { <nl> + bool found = false ; <nl> + MaybeHandle < Object > result = <nl> + SetPropertyInternal ( it , value , language_mode , store_mode , & found ) ; <nl> + if ( found ) return result ; <nl> + <nl> + LookupIterator own_lookup ( it - > GetReceiver ( ) , it - > name ( ) , LookupIterator : : OWN ) ; <nl> + <nl> + switch ( own_lookup . state ( ) ) { <nl> + case LookupIterator : : NOT_FOUND : <nl> + return JSObject : : AddDataProperty ( & own_lookup , value , NONE , language_mode , <nl> + store_mode ) ; <nl> + <nl> + case LookupIterator : : DATA : { <nl> + PropertyDetails details = own_lookup . property_details ( ) ; <nl> + if ( details . IsConfigurable ( ) | | ! details . IsReadOnly ( ) ) { <nl> + return JSObject : : SetOwnPropertyIgnoreAttributes ( <nl> + Handle < JSObject > : : cast ( it - > GetReceiver ( ) ) , it - > name ( ) , value , <nl> + details . attributes ( ) ) ; <nl> + } <nl> + return WriteToReadOnlyProperty ( & own_lookup , value , language_mode ) ; <nl> + } <nl> + <nl> + case LookupIterator : : ACCESSOR : { <nl> + PropertyDetails details = own_lookup . property_details ( ) ; <nl> + if ( details . IsConfigurable ( ) ) { <nl> + return JSObject : : SetOwnPropertyIgnoreAttributes ( <nl> + Handle < JSObject > : : cast ( it - > GetReceiver ( ) ) , it - > name ( ) , value , <nl> + details . attributes ( ) ) ; <nl> + } <nl> + <nl> + return RedefineNonconfigurableProperty ( it - > isolate ( ) , it - > name ( ) , value , <nl> + language_mode ) ; <nl> + } <nl> + <nl> + case LookupIterator : : TRANSITION : <nl> + UNREACHABLE ( ) ; <nl> + break ; <nl> + <nl> + case LookupIterator : : INTERCEPTOR : <nl> + case LookupIterator : : JSPROXY : <nl> + case LookupIterator : : ACCESS_CHECK : { <nl> + bool found = false ; <nl> + MaybeHandle < Object > result = SetPropertyInternal ( <nl> + & own_lookup , value , language_mode , store_mode , & found ) ; <nl> + if ( found ) return result ; <nl> + return SetDataProperty ( & own_lookup , value ) ; <nl> + } <nl> + } <nl> + <nl> + UNREACHABLE ( ) ; <nl> + return MaybeHandle < Object > ( ) ; <nl> + } <nl> + <nl> + <nl> MaybeHandle < Object > Object : : WriteToReadOnlyProperty ( <nl> LookupIterator * it , Handle < Object > value , LanguageMode language_mode ) { <nl> - if ( is_sloppy ( language_mode ) ) return value ; <nl> + return WriteToReadOnlyProperty ( it - > isolate ( ) , it - > GetReceiver ( ) , it - > name ( ) , <nl> + value , language_mode ) ; <nl> + } <nl> <nl> - Handle < Object > args [ ] = { it - > name ( ) , it - > GetReceiver ( ) } ; <nl> - THROW_NEW_ERROR ( it - > isolate ( ) , <nl> - NewTypeError ( " strict_read_only_property " , <nl> - HandleVector ( args , arraysize ( args ) ) ) , <nl> + <nl> + MaybeHandle < Object > Object : : WriteToReadOnlyProperty ( <nl> + Isolate * isolate , Handle < Object > receiver , Handle < Object > name , <nl> + Handle < Object > value , LanguageMode language_mode ) { <nl> + if ( is_sloppy ( language_mode ) ) return value ; <nl> + Handle < Object > args [ ] = { name , receiver } ; <nl> + THROW_NEW_ERROR ( isolate , NewTypeError ( " strict_read_only_property " , <nl> + HandleVector ( args , arraysize ( args ) ) ) , <nl> Object ) ; <nl> } <nl> <nl> MaybeHandle < Object > Object : : WriteToReadOnlyElement ( Isolate * isolate , <nl> uint32_t index , <nl> Handle < Object > value , <nl> LanguageMode language_mode ) { <nl> - if ( is_sloppy ( language_mode ) ) return value ; <nl> + return WriteToReadOnlyProperty ( isolate , receiver , <nl> + isolate - > factory ( ) - > NewNumberFromUint ( index ) , <nl> + value , language_mode ) ; <nl> + } <nl> <nl> - Handle < Object > args [ ] = { isolate - > factory ( ) - > NewNumberFromUint ( index ) , <nl> - receiver } ; <nl> - THROW_NEW_ERROR ( isolate , NewTypeError ( " strict_read_only_property " , <nl> + <nl> + MaybeHandle < Object > Object : : RedefineNonconfigurableProperty ( <nl> + Isolate * isolate , Handle < Object > name , Handle < Object > value , <nl> + LanguageMode language_mode ) { <nl> + if ( is_sloppy ( language_mode ) ) return value ; <nl> + Handle < Object > args [ ] = { name } ; <nl> + THROW_NEW_ERROR ( isolate , NewTypeError ( " redefine_disallowed " , <nl> HandleVector ( args , arraysize ( args ) ) ) , <nl> Object ) ; <nl> } <nl> MaybeHandle < Object > Object : : AddDataProperty ( LookupIterator * it , <nl> if ( it - > state ( ) ! = LookupIterator : : TRANSITION ) { <nl> if ( is_sloppy ( language_mode ) ) return value ; <nl> <nl> - Handle < Object > args [ 1 ] = { it - > name ( ) } ; <nl> + Handle < Object > args [ ] = { it - > name ( ) } ; <nl> THROW_NEW_ERROR ( it - > isolate ( ) , <nl> NewTypeError ( " object_not_extensible " , <nl> HandleVector ( args , arraysize ( args ) ) ) , <nl> MaybeHandle < Object > JSProxy : : SetPropertyViaPrototypesWithHandler ( <nl> DCHECK ( writable - > IsBoolean ( ) ) ; <nl> * done = writable - > IsFalse ( ) ; <nl> if ( ! * done ) return isolate - > factory ( ) - > the_hole_value ( ) ; <nl> - if ( is_sloppy ( language_mode ) ) return value ; <nl> - Handle < Object > args [ ] = { name , receiver } ; <nl> - THROW_NEW_ERROR ( isolate , NewTypeError ( " strict_read_only_property " , <nl> - HandleVector ( args , arraysize ( args ) ) ) , <nl> - Object ) ; <nl> + return WriteToReadOnlyProperty ( isolate , receiver , name , value , <nl> + language_mode ) ; <nl> } <nl> <nl> / / We have an AccessorDescriptor . <nl> MaybeHandle < Object > JSObject : : DeleteElement ( Handle < JSObject > object , <nl> if ( is_strict ( language_mode ) ) { <nl> / / Deleting a non - configurable property in strict mode . <nl> Handle < Object > name = factory - > NewNumberFromUint ( index ) ; <nl> - Handle < Object > args [ 2 ] = { name , object } ; <nl> - THROW_NEW_ERROR ( isolate , NewTypeError ( " strict_delete_property " , <nl> - HandleVector ( args , 2 ) ) , <nl> + Handle < Object > args [ ] = { name , object } ; <nl> + THROW_NEW_ERROR ( isolate , <nl> + NewTypeError ( " strict_delete_property " , <nl> + HandleVector ( args , arraysize ( args ) ) ) , <nl> Object ) ; <nl> } <nl> return factory - > false_value ( ) ; <nl> MaybeHandle < Object > JSObject : : DeleteProperty ( Handle < JSObject > object , <nl> if ( ! it . IsConfigurable ( ) ) { <nl> / / Fail if the property is not configurable . <nl> if ( is_strict ( language_mode ) ) { <nl> - Handle < Object > args [ 2 ] = { name , object } ; <nl> + Handle < Object > args [ ] = { name , object } ; <nl> THROW_NEW_ERROR ( it . isolate ( ) , <nl> NewTypeError ( " strict_delete_property " , <nl> HandleVector ( args , arraysize ( args ) ) ) , <nl> MaybeHandle < Object > JSObject : : SetElementWithCallback ( <nl> } else { <nl> if ( is_sloppy ( language_mode ) ) return value ; <nl> Handle < Object > key ( isolate - > factory ( ) - > NewNumberFromUint ( index ) ) ; <nl> - Handle < Object > args [ 2 ] = { key , holder } ; <nl> - THROW_NEW_ERROR ( <nl> - isolate , NewTypeError ( " no_setter_in_callback " , HandleVector ( args , 2 ) ) , <nl> - Object ) ; <nl> + Handle < Object > args [ ] = { key , holder } ; <nl> + THROW_NEW_ERROR ( isolate , <nl> + NewTypeError ( " no_setter_in_callback " , <nl> + HandleVector ( args , arraysize ( args ) ) ) , <nl> + Object ) ; <nl> } <nl> } <nl> <nl> MaybeHandle < Object > JSObject : : SetDictionaryElement ( <nl> if ( details . type ( ) = = ACCESSOR_CONSTANT & & set_mode = = SET_PROPERTY ) { <nl> return SetElementWithCallback ( object , element , index , value , object , <nl> language_mode ) ; <nl> + } else if ( set_mode = = DEFINE_PROPERTY & & ! details . IsConfigurable ( ) & & <nl> + details . kind ( ) = = kAccessor ) { <nl> + return RedefineNonconfigurableProperty ( <nl> + isolate , isolate - > factory ( ) - > NewNumberFromUint ( index ) , <nl> + isolate - > factory ( ) - > undefined_value ( ) , language_mode ) ; <nl> + <nl> + } else if ( ( set_mode = = DEFINE_PROPERTY & & ! details . IsConfigurable ( ) & & <nl> + details . IsReadOnly ( ) ) | | <nl> + ( set_mode = = SET_PROPERTY & & details . IsReadOnly ( ) & & <nl> + ! element - > IsTheHole ( ) ) ) { <nl> + / / If a value has not been initialized we allow writing to it even if it <nl> + / / is read - only ( a declared const that has not been initialized ) . <nl> + return WriteToReadOnlyProperty ( <nl> + isolate , object , isolate - > factory ( ) - > NewNumberFromUint ( index ) , <nl> + isolate - > factory ( ) - > undefined_value ( ) , language_mode ) ; <nl> } else { <nl> + DCHECK ( details . IsConfigurable ( ) | | ! details . IsReadOnly ( ) | | <nl> + element - > IsTheHole ( ) ) ; <nl> dictionary - > UpdateMaxNumberKey ( index ) ; <nl> - / / If a value has not been initialized we allow writing to it even if it <nl> - / / is read - only ( a declared const that has not been initialized ) . If a <nl> - / / value is being defined we skip attribute checks completely . <nl> if ( set_mode = = DEFINE_PROPERTY ) { <nl> details = PropertyDetails ( attributes , DATA , details . dictionary_index ( ) ) ; <nl> dictionary - > DetailsAtPut ( entry , details ) ; <nl> - } else if ( details . IsReadOnly ( ) & & ! element - > IsTheHole ( ) ) { <nl> - if ( is_sloppy ( language_mode ) ) { <nl> - return isolate - > factory ( ) - > undefined_value ( ) ; <nl> - } else { <nl> - Handle < Object > number = isolate - > factory ( ) - > NewNumberFromUint ( index ) ; <nl> - Handle < Object > args [ 2 ] = { number , object } ; <nl> - THROW_NEW_ERROR ( isolate , NewTypeError ( " strict_read_only_property " , <nl> - HandleVector ( args , 2 ) ) , <nl> - Object ) ; <nl> - } <nl> } <nl> + <nl> / / Elements of the arguments object in slow mode might be slow aliases . <nl> if ( is_arguments & & element - > IsAliasedArgumentsEntry ( ) ) { <nl> Handle < AliasedArgumentsEntry > entry = <nl> MaybeHandle < Object > JSObject : : SetDictionaryElement ( <nl> } else { <nl> Handle < Object > number = isolate - > factory ( ) - > NewNumberFromUint ( index ) ; <nl> Handle < String > name = isolate - > factory ( ) - > NumberToString ( number ) ; <nl> - Handle < Object > args [ 1 ] = { name } ; <nl> - THROW_NEW_ERROR ( isolate , NewTypeError ( " object_not_extensible " , <nl> - HandleVector ( args , 1 ) ) , <nl> + Handle < Object > args [ ] = { name } ; <nl> + THROW_NEW_ERROR ( isolate , <nl> + NewTypeError ( " object_not_extensible " , <nl> + HandleVector ( args , arraysize ( args ) ) ) , <nl> Object ) ; <nl> } <nl> } <nl> bool JSArray : : WouldChangeReadOnlyLength ( Handle < JSArray > array , <nl> MaybeHandle < Object > JSArray : : ReadOnlyLengthError ( Handle < JSArray > array ) { <nl> Isolate * isolate = array - > GetIsolate ( ) ; <nl> Handle < Name > length = isolate - > factory ( ) - > length_string ( ) ; <nl> - Handle < Object > args [ 2 ] = { length , array } ; <nl> + Handle < Object > args [ ] = { length , array } ; <nl> THROW_NEW_ERROR ( isolate , NewTypeError ( " strict_read_only_property " , <nl> HandleVector ( args , arraysize ( args ) ) ) , <nl> Object ) ; <nl> mmm a / src / objects . h <nl> ppp b / src / objects . h <nl> class Object { <nl> CERTAINLY_NOT_STORE_FROM_KEYED <nl> } ; <nl> <nl> - enum StorePropertyMode { NORMAL_PROPERTY , SUPER_PROPERTY } ; <nl> - <nl> INLINE ( bool IsFixedArrayBase ( ) const ) ; <nl> INLINE ( bool IsExternal ( ) const ) ; <nl> INLINE ( bool IsAccessorInfo ( ) const ) ; <nl> class Object { <nl> <nl> MUST_USE_RESULT static MaybeHandle < Object > SetProperty ( <nl> LookupIterator * it , Handle < Object > value , LanguageMode language_mode , <nl> - StoreFromKeyed store_mode , <nl> - StorePropertyMode data_store_mode = NORMAL_PROPERTY ) ; <nl> + StoreFromKeyed store_mode ) ; <nl> + <nl> + MUST_USE_RESULT static MaybeHandle < Object > SetSuperProperty ( <nl> + LookupIterator * it , Handle < Object > value , LanguageMode language_mode , <nl> + StoreFromKeyed store_mode ) ; <nl> + <nl> MUST_USE_RESULT static MaybeHandle < Object > WriteToReadOnlyProperty ( <nl> LookupIterator * it , Handle < Object > value , LanguageMode language_mode ) ; <nl> + MUST_USE_RESULT static MaybeHandle < Object > WriteToReadOnlyProperty ( <nl> + Isolate * isolate , Handle < Object > reciever , Handle < Object > name , <nl> + Handle < Object > value , LanguageMode language_mode ) ; <nl> MUST_USE_RESULT static MaybeHandle < Object > WriteToReadOnlyElement ( <nl> Isolate * isolate , Handle < Object > receiver , uint32_t index , <nl> Handle < Object > value , LanguageMode language_mode ) ; <nl> + MUST_USE_RESULT static MaybeHandle < Object > RedefineNonconfigurableProperty ( <nl> + Isolate * isolate , Handle < Object > name , Handle < Object > value , <nl> + LanguageMode language_mode ) ; <nl> MUST_USE_RESULT static MaybeHandle < Object > SetDataProperty ( <nl> LookupIterator * it , Handle < Object > value ) ; <nl> MUST_USE_RESULT static MaybeHandle < Object > AddDataProperty ( <nl> class Object { <nl> / / Return the map of the root of object ' s prototype chain . <nl> Map * GetRootMap ( Isolate * isolate ) ; <nl> <nl> + / / Helper for SetProperty and SetSuperProperty . <nl> + MUST_USE_RESULT static MaybeHandle < Object > SetPropertyInternal ( <nl> + LookupIterator * it , Handle < Object > value , LanguageMode language_mode , <nl> + StoreFromKeyed store_mode , bool * found ) ; <nl> + <nl> DISALLOW_IMPLICIT_CONSTRUCTORS ( Object ) ; <nl> } ; <nl> <nl> mmm a / src / runtime / runtime - classes . cc <nl> ppp b / src / runtime / runtime - classes . cc <nl> static Object * StoreToSuper ( Isolate * isolate , Handle < JSObject > home_object , <nl> Handle < Object > result ; <nl> ASSIGN_RETURN_FAILURE_ON_EXCEPTION ( <nl> isolate , result , <nl> - Object : : SetProperty ( & it , value , language_mode , <nl> - Object : : CERTAINLY_NOT_STORE_FROM_KEYED , <nl> - Object : : SUPER_PROPERTY ) ) ; <nl> + Object : : SetSuperProperty ( & it , value , language_mode , <nl> + Object : : CERTAINLY_NOT_STORE_FROM_KEYED ) ) ; <nl> return * result ; <nl> } <nl> <nl> mmm a / test / mjsunit / harmony / super . js <nl> ppp b / test / mjsunit / harmony / super . js <nl> <nl> setCalled = 0 ; <nl> getCalled = 0 ; <nl> assertEquals ( ' object ' , typeof this ) ; <nl> - assertTrue ( this instanceof Number ) <nl> + assertInstanceof ( this , Number ) <nl> assertEquals ( 42 , this . valueOf ( ) ) ; <nl> assertEquals ( 1 , super . x ) ; <nl> assertEquals ( 1 , getCalled ) ; <nl> <nl> try { <nl> super . newProperty = 15 ; <nl> } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + assertInstanceof ( ex , TypeError ) ; <nl> } <nl> } <nl> <nl> <nl> super . toString ( ) ; <nl> } catch ( e ) { ex = e ; } <nl> <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + assertInstanceof ( ex , TypeError ) ; <nl> } <nl> } ; <nl> <nl> <nl> setCalled = 0 ; <nl> getCalled = 0 ; <nl> assertEquals ( ' object ' , typeof this ) ; <nl> - assertTrue ( this instanceof Number ) <nl> + assertInstanceof ( this , Number ) <nl> assertEquals ( 42 , this . valueOf ( ) ) ; <nl> assertEquals ( 1 , super [ x ] ) ; <nl> assertEquals ( 1 , getCalled ) ; <nl> <nl> try { <nl> super [ newProperty ] = 15 ; <nl> } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + assertInstanceof ( ex , TypeError ) ; <nl> } <nl> } ; <nl> <nl> <nl> super [ toString ] ( ) ; <nl> } catch ( e ) { ex = e ; } <nl> <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + assertInstanceof ( ex , TypeError ) ; <nl> } <nl> } ; <nl> DerivedFromString . prototype . f . call ( 42 ) ; <nl> <nl> setCalled = 0 ; <nl> getCalled = 0 ; <nl> assertEquals ( ' object ' , typeof this ) ; <nl> - assertTrue ( this instanceof Number ) <nl> + assertInstanceof ( this , Number ) <nl> assertEquals ( 42 , this . valueOf ( ) ) ; <nl> assertEquals ( 1 , super [ x ] ) ; <nl> assertEquals ( 1 , getCalled ) ; <nl> <nl> try { <nl> super [ newProperty ] = 15 ; <nl> } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + assertInstanceof ( ex , TypeError ) ; <nl> } <nl> } ; <nl> <nl> <nl> try { <nl> super [ 5 ] = ' q ' ; <nl> } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + assertInstanceof ( ex , TypeError ) ; <nl> <nl> ex = null ; <nl> try { <nl> super [ 1024 ] = ' q ' ; <nl> } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + assertInstanceof ( ex , TypeError ) ; <nl> } <nl> } ; <nl> <nl> <nl> } ( ) ) ; <nl> <nl> <nl> - ( function TestSetterCreatingOwnProperties ( ) { <nl> - var setterCalled ; <nl> + ( function TestSetterCreatingOwnPropertiesReconfigurable ( ) { <nl> function Base ( ) { } <nl> function Derived ( ) { } <nl> Derived . prototype = { <nl> <nl> mSloppy ( ) { <nl> assertEquals ( 42 , this . ownReadOnly ) ; <nl> super . ownReadOnly = 55 ; <nl> - assertEquals ( 42 , this . ownReadOnly ) ; <nl> + assertEquals ( 55 , this . ownReadOnly ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ' ownReadOnly ' ) ; <nl> + assertEquals ( 55 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertFalse ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ' ownReadOnly ' ) ) ; <nl> <nl> assertEquals ( 15 , this . ownReadonlyAccessor ) ; <nl> - super . ownReadonlyAccessor = 55 ; <nl> + super . ownReadonlyAccessor = 25 ; <nl> + assertEquals ( 25 , this . ownReadonlyAccessor ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ' ownReadonlyAccessor ' ) ; <nl> + assertEquals ( 25 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertTrue ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ' ownReadonlyAccessor ' ) ) ; <nl> + <nl> + super . ownSetter = 35 ; <nl> + assertEquals ( 35 , this . ownSetter ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ' ownSetter ' ) ; <nl> + assertEquals ( 35 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertTrue ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ' ownSetter ' ) ) ; <nl> + } , <nl> + mStrict ( ) { <nl> + ' use strict ' ; <nl> + assertEquals ( 42 , this . ownReadOnly ) ; <nl> + super . ownReadOnly = 55 ; <nl> + assertEquals ( 55 , this . ownReadOnly ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ' ownReadOnly ' ) ; <nl> + assertEquals ( 55 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertFalse ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ' ownReadOnly ' ) ) ; <nl> + <nl> assertEquals ( 15 , this . ownReadonlyAccessor ) ; <nl> + super . ownReadonlyAccessor = 25 ; <nl> + assertEquals ( 25 , this . ownReadonlyAccessor ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ' ownReadonlyAccessor ' ) ; <nl> + assertEquals ( 25 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertTrue ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ' ownReadonlyAccessor ' ) ) ; <nl> + <nl> + super . ownSetter = 35 ; <nl> + assertEquals ( 35 , this . ownSetter ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ' ownSetter ' ) ; <nl> + assertEquals ( 35 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertTrue ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ' ownSetter ' ) ) ; <nl> + } , <nl> + } ; <nl> + <nl> + var d = new Derived ( ) ; <nl> + Object . defineProperty ( d , ' ownReadOnly ' , { <nl> + value : 42 , <nl> + writable : false , <nl> + configurable : true <nl> + } ) ; <nl> + Object . defineProperty ( d , ' ownSetter ' , { <nl> + set : function ( ) { assertUnreachable ( ) ; } , <nl> + configurable : true <nl> + } ) ; <nl> + Object . defineProperty ( d , ' ownReadonlyAccessor ' , { <nl> + get : function ( ) { return 15 ; } , <nl> + configurable : true <nl> + } ) ; <nl> <nl> - setterCalled = 0 ; <nl> - super . ownSetter = 42 ; <nl> - assertEquals ( 1 , setterCalled ) ; <nl> + d . mSloppy ( ) ; <nl> + <nl> + var d = new Derived ( ) ; <nl> + Object . defineProperty ( d , ' ownReadOnly ' , { <nl> + value : 42 , <nl> + writable : false , <nl> + configurable : true <nl> + } ) ; <nl> + Object . defineProperty ( d , ' ownSetter ' , { <nl> + set : function ( ) { assertUnreachable ( ) ; } , <nl> + configurable : true <nl> + } ) ; <nl> + Object . defineProperty ( d , ' ownReadonlyAccessor ' , { <nl> + get : function ( ) { return 15 ; } , <nl> + configurable : true <nl> + } ) ; <nl> + d . mStrict ( ) ; <nl> + } ( ) ) ; <nl> + <nl> + <nl> + ( function TestSetterCreatingOwnPropertiesNonConfigurable ( ) { <nl> + function Base ( ) { } <nl> + function Derived ( ) { } <nl> + Derived . prototype = { <nl> + __proto__ : Base . prototype , <nl> + mSloppy ( ) { <nl> + assertEquals ( 42 , this . ownReadOnly ) ; <nl> + super . ownReadOnly = 55 ; <nl> + assertEquals ( 42 , this . ownReadOnly ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ' ownReadOnly ' ) ; <nl> + assertEquals ( 42 , descr . value ) ; <nl> + assertFalse ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertFalse ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ' ownReadOnly ' ) ) ; <nl> + <nl> + assertEquals ( 15 , this . ownReadonlyAccessor ) ; <nl> + super . ownReadonlyAccessor = 25 ; <nl> + assertEquals ( 15 , this . ownReadonlyAccessor ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ' ownReadonlyAccessor ' ) ; <nl> + assertFalse ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ' ownReadonlyAccessor ' ) ) ; <nl> + <nl> + super . ownSetter = 35 ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ' ownSetter ' ) ; <nl> + assertFalse ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ' ownSetter ' ) ) ; <nl> } , <nl> mStrict ( ) { <nl> ' use strict ' ; <nl> - assertEquals ( 42 , this . ownReadOnly ) ; <nl> var ex ; <nl> + assertEquals ( 42 , this . ownReadOnly ) ; <nl> try { <nl> super . ownReadOnly = 55 ; <nl> - } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + } catch ( e ) { <nl> + ex = e ; <nl> + } <nl> + assertInstanceof ( ex , TypeError ) ; <nl> + assertEquals ( <nl> + " Cannot assign to read only property ' ownReadOnly ' of # < Base > " , <nl> + ex . message ) ; <nl> assertEquals ( 42 , this . ownReadOnly ) ; <nl> <nl> - assertEquals ( 15 , this . ownReadonlyAccessor ) ; <nl> ex = null ; <nl> + assertEquals ( 15 , this . ownReadonlyAccessor ) ; <nl> try { <nl> - super . ownReadonlyAccessor = 55 ; <nl> - } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + super . ownReadonlyAccessor = 25 ; <nl> + } catch ( e ) { <nl> + ex = e ; <nl> + } <nl> + assertInstanceof ( ex , TypeError ) ; <nl> + assertEquals ( ' Cannot redefine property : ownReadonlyAccessor ' , ex . message ) ; <nl> assertEquals ( 15 , this . ownReadonlyAccessor ) ; <nl> <nl> - setterCalled = 0 ; <nl> - super . ownSetter = 42 ; <nl> - assertEquals ( 1 , setterCalled ) ; <nl> + ex = null ; <nl> + try { <nl> + super . ownSetter = 35 ; <nl> + } catch ( e ) { <nl> + ex = e ; <nl> + } <nl> + assertInstanceof ( ex , TypeError ) ; <nl> + assertEquals ( ' Cannot redefine property : ownSetter ' , ex . message ) ; <nl> } <nl> } ; <nl> <nl> var d = new Derived ( ) ; <nl> Object . defineProperty ( d , ' ownReadOnly ' , { value : 42 , writable : false } ) ; <nl> Object . defineProperty ( d , ' ownSetter ' , <nl> - { set : function ( ) { setterCalled + + ; } } ) ; <nl> + { set : function ( ) { assertUnreachable ( ) ; } } ) ; <nl> Object . defineProperty ( d , ' ownReadonlyAccessor ' , <nl> { get : function ( ) { return 15 ; } } ) ; <nl> d . mSloppy ( ) ; <nl> <nl> } ( ) ) ; <nl> <nl> <nl> - ( function TestKeyedSetterCreatingOwnProperties ( ) { <nl> - var ownReadOnly = ' ownReadOnly ' ; <nl> - var ownReadonlyAccessor = ' ownReadonlyAccessor ' ; <nl> - var ownSetter = ' ownSetter ' ; <nl> - var setterCalled ; <nl> + function TestKeyedSetterCreatingOwnPropertiesReconfigurable ( ownReadOnly , <nl> + ownReadonlyAccessor , ownSetter ) { <nl> function Base ( ) { } <nl> function Derived ( ) { } <nl> Derived . prototype = { <nl> <nl> mSloppy ( ) { <nl> assertEquals ( 42 , this [ ownReadOnly ] ) ; <nl> super [ ownReadOnly ] = 55 ; <nl> - assertEquals ( 42 , this [ ownReadOnly ] ) ; <nl> + assertEquals ( 55 , this [ ownReadOnly ] ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ownReadOnly ) ; <nl> + assertEquals ( 55 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertFalse ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ownReadOnly ) ) ; <nl> <nl> assertEquals ( 15 , this [ ownReadonlyAccessor ] ) ; <nl> - super [ ownReadonlyAccessor ] = 55 ; <nl> - assertEquals ( 15 , this [ ownReadonlyAccessor ] ) ; <nl> - <nl> - setterCalled = 0 ; <nl> - super [ ownSetter ] = 42 ; <nl> - assertEquals ( 1 , setterCalled ) ; <nl> + super [ ownReadonlyAccessor ] = 25 ; <nl> + assertEquals ( 25 , this [ ownReadonlyAccessor ] ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ownReadonlyAccessor ) ; <nl> + assertEquals ( 25 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertTrue ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ownReadonlyAccessor ) ) ; <nl> + <nl> + super [ ownSetter ] = 35 ; <nl> + assertEquals ( 35 , this [ ownSetter ] ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ownSetter ) ; <nl> + assertEquals ( 35 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertTrue ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ownSetter ) ) ; <nl> } , <nl> mStrict ( ) { <nl> ' use strict ' ; <nl> assertEquals ( 42 , this [ ownReadOnly ] ) ; <nl> - var ex ; <nl> - try { <nl> - super [ ownReadOnly ] = 55 ; <nl> - } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> - assertEquals ( 42 , this [ ownReadOnly ] ) ; <nl> + super [ ownReadOnly ] = 55 ; <nl> + assertEquals ( 55 , this [ ownReadOnly ] ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ownReadOnly ) ; <nl> + assertEquals ( 55 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertFalse ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ownReadOnly ) ) ; <nl> <nl> assertEquals ( 15 , this [ ownReadonlyAccessor ] ) ; <nl> - ex = null ; <nl> - try { <nl> - super [ ownReadonlyAccessor ] = 55 ; <nl> - } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> - assertEquals ( 15 , this [ ownReadonlyAccessor ] ) ; <nl> - <nl> - setterCalled = 0 ; <nl> - super [ ownSetter ] = 42 ; <nl> - assertEquals ( 1 , setterCalled ) ; <nl> - } <nl> + super [ ownReadonlyAccessor ] = 25 ; <nl> + assertEquals ( 25 , this [ ownReadonlyAccessor ] ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ownReadonlyAccessor ) ; <nl> + assertEquals ( 25 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertTrue ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ownReadonlyAccessor ) ) ; <nl> + <nl> + super [ ownSetter ] = 35 ; <nl> + assertEquals ( 35 , this [ ownSetter ] ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ownSetter ) ; <nl> + assertEquals ( 35 , descr . value ) ; <nl> + assertTrue ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertTrue ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ownSetter ) ) ; <nl> + } , <nl> } ; <nl> <nl> var d = new Derived ( ) ; <nl> - Object . defineProperty ( d , ' ownReadOnly ' , { value : 42 , writable : false } ) ; <nl> - Object . defineProperty ( d , ' ownSetter ' , <nl> - { set : function ( ) { setterCalled + + ; } } ) ; <nl> - Object . defineProperty ( d , ' ownReadonlyAccessor ' , <nl> - { get : function ( ) { return 15 ; } } ) ; <nl> + Object . defineProperty ( d , ownReadOnly , { <nl> + value : 42 , <nl> + writable : false , <nl> + configurable : true <nl> + } ) ; <nl> + Object . defineProperty ( d , ownSetter , { <nl> + set : function ( ) { assertUnreachable ( ) ; } , <nl> + configurable : true <nl> + } ) ; <nl> + Object . defineProperty ( d , ownReadonlyAccessor , { <nl> + get : function ( ) { return 15 ; } , <nl> + configurable : true <nl> + } ) ; <nl> + <nl> d . mSloppy ( ) ; <nl> + <nl> + var d = new Derived ( ) ; <nl> + Object . defineProperty ( d , ownReadOnly , { <nl> + value : 42 , <nl> + writable : false , <nl> + configurable : true <nl> + } ) ; <nl> + Object . defineProperty ( d , ownSetter , { <nl> + set : function ( ) { assertUnreachable ( ) ; } , <nl> + configurable : true <nl> + } ) ; <nl> + Object . defineProperty ( d , ownReadonlyAccessor , { <nl> + get : function ( ) { return 15 ; } , <nl> + configurable : true <nl> + } ) ; <nl> d . mStrict ( ) ; <nl> - } ( ) ) ; <nl> + } <nl> + TestKeyedSetterCreatingOwnPropertiesReconfigurable ( ' ownReadOnly ' , <nl> + ' ownReadonlyAccessor ' , <nl> + ' ownSetter ' ) ; <nl> + TestKeyedSetterCreatingOwnPropertiesReconfigurable ( 42 , 43 , 44 ) ; <nl> <nl> <nl> - ( function TestKeyedNumericSetterCreatingOwnProperties ( ) { <nl> - var ownReadOnly = 42 ; <nl> - var ownReadonlyAccessor = 43 ; <nl> - var ownSetter = 44 ; <nl> - var setterCalled ; <nl> + function TestKeyedSetterCreatingOwnPropertiesNonConfigurable ( <nl> + ownReadOnly , ownReadonlyAccessor , ownSetter ) { <nl> function Base ( ) { } <nl> function Derived ( ) { } <nl> Derived . prototype = { <nl> <nl> assertEquals ( 42 , this [ ownReadOnly ] ) ; <nl> super [ ownReadOnly ] = 55 ; <nl> assertEquals ( 42 , this [ ownReadOnly ] ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ownReadOnly ) ; <nl> + assertEquals ( 42 , descr . value ) ; <nl> + assertFalse ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertFalse ( descr . writable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ownReadOnly ) ) ; <nl> <nl> assertEquals ( 15 , this [ ownReadonlyAccessor ] ) ; <nl> - super [ ownReadonlyAccessor ] = 55 ; <nl> + super [ ownReadonlyAccessor ] = 25 ; <nl> assertEquals ( 15 , this [ ownReadonlyAccessor ] ) ; <nl> - <nl> - setterCalled = 0 ; <nl> - super [ ownSetter ] = 42 ; <nl> - assertEquals ( 1 , setterCalled ) ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ownReadonlyAccessor ) ; <nl> + assertFalse ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ownReadonlyAccessor ) ) ; <nl> + <nl> + super [ ownSetter ] = 35 ; <nl> + var descr = Object . getOwnPropertyDescriptor ( this , ownSetter ) ; <nl> + assertFalse ( descr . configurable ) ; <nl> + assertFalse ( descr . enumerable ) ; <nl> + assertFalse ( Base . prototype . hasOwnProperty ( ownSetter ) ) ; <nl> } , <nl> mStrict ( ) { <nl> ' use strict ' ; <nl> - assertEquals ( 42 , this [ ownReadOnly ] ) ; <nl> var ex ; <nl> + assertEquals ( 42 , this [ ownReadOnly ] ) ; <nl> try { <nl> super [ ownReadOnly ] = 55 ; <nl> - } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + } catch ( e ) { <nl> + ex = e ; <nl> + } <nl> + assertInstanceof ( ex , TypeError ) ; <nl> + assertEquals ( <nl> + " Cannot assign to read only property ' " + ownReadOnly + <nl> + " ' of # < Base > " , <nl> + ex . message ) ; <nl> assertEquals ( 42 , this [ ownReadOnly ] ) ; <nl> <nl> - assertEquals ( 15 , this [ ownReadonlyAccessor ] ) ; <nl> ex = null ; <nl> + assertEquals ( 15 , this [ ownReadonlyAccessor ] ) ; <nl> try { <nl> - super [ ownReadonlyAccessor ] = 55 ; <nl> - } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + super [ ownReadonlyAccessor ] = 25 ; <nl> + } catch ( e ) { <nl> + ex = e ; <nl> + } <nl> + assertInstanceof ( ex , TypeError ) ; <nl> + assertEquals ( ' Cannot redefine property : ' + ownReadonlyAccessor , <nl> + ex . message ) ; <nl> assertEquals ( 15 , this [ ownReadonlyAccessor ] ) ; <nl> <nl> - setterCalled = 0 ; <nl> - super [ ownSetter ] = 42 ; <nl> - assertEquals ( 1 , setterCalled ) ; <nl> + ex = null ; <nl> + try { <nl> + super [ ownSetter ] = 35 ; <nl> + } catch ( e ) { <nl> + ex = e ; <nl> + } <nl> + assertInstanceof ( ex , TypeError ) ; <nl> + assertEquals ( ' Cannot redefine property : ' + ownSetter , ex . message ) ; <nl> } <nl> - } <nl> + } ; <nl> <nl> var d = new Derived ( ) ; <nl> Object . defineProperty ( d , ownReadOnly , { value : 42 , writable : false } ) ; <nl> Object . defineProperty ( d , ownSetter , <nl> - { set : function ( ) { setterCalled + + ; } } ) ; <nl> + { set : function ( ) { assertUnreachable ( ) ; } } ) ; <nl> Object . defineProperty ( d , ownReadonlyAccessor , <nl> { get : function ( ) { return 15 ; } } ) ; <nl> d . mSloppy ( ) ; <nl> d . mStrict ( ) ; <nl> - } ( ) ) ; <nl> + } <nl> + TestKeyedSetterCreatingOwnPropertiesNonConfigurable ( ' ownReadOnly ' , <nl> + ' ownReadonlyAccessor ' , ' ownSetter ' ) ; <nl> + TestKeyedSetterCreatingOwnPropertiesNonConfigurable ( 42 , 43 , 44 ) ; <nl> <nl> <nl> ( function TestSetterNoProtoWalk ( ) { <nl> <nl> assertEquals ( 27 , this . x ) ; <nl> var ex = null ; <nl> try { super . x = 10 ; } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + assertInstanceof ( ex , TypeError ) ; <nl> assertEquals ( 27 , super . x ) ; <nl> assertEquals ( 27 , this . x ) ; <nl> } <nl> <nl> assertEquals ( 27 , this [ x ] ) ; <nl> var ex = null ; <nl> try { super [ x ] = 10 ; } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + assertInstanceof ( ex , TypeError ) ; <nl> assertEquals ( 27 , super [ x ] ) ; <nl> assertEquals ( 27 , this [ x ] ) ; <nl> } <nl> <nl> assertEquals ( 27 , this [ x ] ) ; <nl> var ex = null ; <nl> try { super [ x ] = 10 ; } catch ( e ) { ex = e ; } <nl> - assertTrue ( ex instanceof TypeError ) ; <nl> + assertInstanceof ( ex , TypeError ) ; <nl> assertEquals ( 27 , super [ x ] ) ; <nl> assertEquals ( 27 , this [ x ] ) ; <nl> } <nl> <nl> var f = new F ( 42 ) ; <nl> <nl> / / TODO ( dslomov , arv ) : Fix this . BUG = v8 : 3886 . <nl> - assertTrue ( f instanceof Number ) ; <nl> + assertInstanceof ( f , Number ) ; <nl> } ( ) ) ; <nl> <nl> ( function TestSuperCallErrorCases ( ) { <nl>
Super store
v8/v8
0cffc08b667a067089c7eecffea3e8021ab2ff57
2015-02-19T16:15:35Z
mmm a / bench / competitors / mysql_bench <nl> ppp b / bench / competitors / mysql_bench <nl> MYSQL_DURABILITY_FLAGS = " - - innodb_flush_log_at_trx_commit = 0 - - innodb_doublewrite = <nl> <nl> DATABASE = " mysql " <nl> <nl> + # Remove old bench databases <nl> + rm - rf / usr / local / mysql / var / bench <nl> + <nl> # Initialize InnoDB RAW tablespace <nl> / usr / local / mysql / libexec / mysqld $ MYSQL_COMMON_FLAGS $ MYSQL_BUFFER_FLAGS $ MYSQL_DURABILITY_FLAGS $ MYSQL_SSD_CREATE_FLAGS - - port = 9874 & <nl> # Wait for server to finish initialization and shut it down <nl> done <nl> <nl> <nl> # TODO : Consider / Benchmark influence of " cache warmup " ( e . g . check what happens with longer test durations ) <nl> - # TODO : What about the number of cores ? <nl> - # TODO : See http : / / www . cyberciti . biz / faq / debian - rhel - centos - redhat - suse - hotplug - cpu / on how to turn off CPUs <nl> + <nl> + <nl> + echo " To get the canonical hardware , we have to disable all but 12 CPUs . " <nl> + echo ' Please give me authorization to run sh - c " for CPU in 12 13 14 15 16 17 18 19 20 21 22 23 ; do echo 0 > / sys / devices / system / cpu / cpu $ CPU ; done " ' <nl> + sudo sh - c " for CPU in 12 13 14 15 16 17 18 19 20 21 22 23 ; do echo 0 > / sys / devices / system / cpu / cpu $ CPU ; done " <nl> <nl> # Run workloads <nl> for WORKLOAD in . . / workloads / * ; do <nl> done <nl> # Concurrent clients scalability <nl> # Canonical workload on HDD performance <nl> <nl> + echo " We can turn on the CPUs again now . . . " <nl> + echo ' Please give me authorization to run sh - c " for CPU in 12 13 14 15 16 17 18 19 20 21 22 23 ; do echo 1 > / sys / devices / system / cpu / cpu $ CPU ; done " ' <nl> + sudo sh - c " for CPU in 12 13 14 15 16 17 18 19 20 21 22 23 ; do echo 1 > / sys / devices / system / cpu / cpu $ CPU ; done " <nl> + <nl> <nl> # Now that all benchmarks are done , delete any database files that might have been left over <nl> # delete_database_files <nl>
Remove old bench database before running benchmark
rethinkdb/rethinkdb
9d001463a77cf55c5f10cb7926ea60b195e1adaf
2010-12-22T02:12:07Z
mmm a / jstests / core / version_api_field_parsing . js <nl> ppp b / jstests / core / version_api_field_parsing . js <nl> <nl> ( function ( ) { <nl> " use strict " ; <nl> <nl> + / / Test parsing logic on command included in API V1 . <nl> / / If the client passed apiStrict , they must also pass apiVersion . <nl> assert . commandFailedWithCode ( db . runCommand ( { ping : 1 , apiStrict : true } ) , <nl> 4886600 , <nl> assert . commandWorked ( <nl> assert . commandWorked ( <nl> db . runCommand ( { ping : 1 , apiVersion : " 1 " , apiStrict : false , apiDeprecationErrors : false } ) ) ; <nl> assert . commandWorked ( db . runCommand ( { ping : 1 , apiVersion : " 1 " } ) ) ; <nl> + <nl> + / / Test parsing logic on command not included in API V1 . <nl> + assert . commandWorked ( db . runCommand ( { listCommands : 1 , apiVersion : " 1 " } ) ) ; <nl> + / / If the client passed apiStrict : true , but the command is not in V1 , reply with <nl> + / / APIStrictError . <nl> + assert . commandFailedWithCode ( <nl> + db . runCommand ( { listCommands : 1 , apiVersion : " 1 " , apiStrict : true } ) , <nl> + ErrorCodes . APIStrictError , <nl> + " Provided apiStrict : true , but the invoked command ' s apiVersions ( ) does not include \ " 1 \ " " ) ; <nl> + assert . commandWorked ( db . runCommand ( { listCommands : 1 , apiVersion : " 1 " , apiDeprecationErrors : true } ) ) ; <nl> + <nl> + / / Test parsing logic of command deprecated in API V1 . <nl> + assert . commandWorked ( db . runCommand ( { testDeprecation : 1 , apiVersion : " 1 " } ) ) ; <nl> + assert . commandWorked ( db . runCommand ( { testDeprecation : 1 , apiVersion : " 1 " , apiStrict : true } ) ) ; <nl> + / / If the client passed apiDeprecationErrors : true , but the command is <nl> + / / deprecated in API Version 1 , reply with APIDeprecationError . <nl> + assert . commandFailedWithCode ( <nl> + db . runCommand ( { testDeprecation : 1 , apiVersion : " 1 " , apiDeprecationErrors : true } ) , <nl> + ErrorCodes . APIDeprecationError , <nl> + " Provided apiDeprecationErrors : true , but the invoked command ' s deprecatedApiVersions ( ) does not include \ " 1 \ " " ) ; <nl> } ) ( ) ; <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . 7364990f48e6 <nl> mmm / dev / null <nl> ppp b / jstests / core / version_api_v1_command_coverage . js <nl> <nl> + / * * <nl> + * Checks that commands included / omitted in API V1 behave correctly with various combinations of API <nl> + * parameters . <nl> + * <nl> + * @ tags : [ requires_fcv_46 , requires_non_retryable_commands ] <nl> + * / <nl> + <nl> + ( function ( ) { <nl> + " use strict " ; <nl> + <nl> + let counter = 0 ; <nl> + const counter_fun = function ( ) { <nl> + return ` APIV1 - $ { counter } ` ; <nl> + } ; <nl> + <nl> + const testDB = db . getSiblingDB ( jsTestName ( ) ) ; <nl> + const testColl = testDB . getCollection ( " test " ) ; <nl> + <nl> + function runTest ( { cmd , apiVersion1 , apiStrict , apiDeprecationErrors } ) { <nl> + / / Instantiate " cmd " so we can modify it . <nl> + let copy = cmd ( ) ; <nl> + jsTestLog ( <nl> + ` Test $ { tojson ( copy ) } , which is $ { apiVersion1 ? " in " : " not in " } API V1 , with apiStrict = $ { <nl> + apiStrict } and apiDeprecationErrors = $ { apiDeprecationErrors } ` ) ; <nl> + copy . apiVersion = " 1 " ; <nl> + copy . apiStrict = apiStrict ; <nl> + copy . apiDeprecationErrors = apiDeprecationErrors ; <nl> + if ( ! apiVersion1 & & apiStrict ) { <nl> + assert . commandFailedWithCode ( <nl> + testDB . runCommand ( copy ) , <nl> + ErrorCodes . APIStrictError , <nl> + " Provided apiStrict : true , but the invoked command ' s apiVersions ( ) does not include \ " 1 \ " " ) ; <nl> + } else { <nl> + assert . commandWorked ( testDB . runCommand ( copy ) ) ; <nl> + } <nl> + } <nl> + <nl> + const commands = [ <nl> + { cmd : ( ) = > ( { buildInfo : 1 } ) , apiVersion1 : false } , <nl> + { cmd : ( ) = > ( { createUser : counter_fun ( ) , pwd : " pwd " , roles : [ ] } ) , apiVersion1 : false } , <nl> + { cmd : ( ) = > ( { dropUser : counter_fun ( ) } ) , apiVersion1 : false } , <nl> + { cmd : ( ) = > ( { getLastError : 1 } ) , apiVersion1 : false } , <nl> + { cmd : ( ) = > ( { serverStatus : 1 } ) , apiVersion1 : false } , <nl> + { cmd : ( ) = > ( { usersInfo : 1 } ) , apiVersion1 : false } , <nl> + { cmd : ( ) = > ( { aggregate : testColl . getName ( ) , pipeline : [ ] , cursor : { } } ) , apiVersion1 : true } , <nl> + { cmd : ( ) = > ( { count : " system . js " } ) , apiVersion1 : true } , <nl> + { cmd : ( ) = > ( { create : counter_fun ( ) } ) , apiVersion1 : true } , <nl> + { cmd : ( ) = > ( { find : counter_fun ( ) } ) , apiVersion1 : true } , <nl> + { <nl> + cmd : ( ) = > ( { insert : " APIV1 - 0 " , documents : [ { _id : counter_fun ( ) , cast : " jonSnow " } ] } ) , <nl> + apiVersion1 : true <nl> + } , <nl> + { <nl> + cmd : ( ) = > ( { <nl> + update : " APIV1 - 0 " , <nl> + updates : [ { q : { _id : counter_fun ( ) } , u : { $ set : { cast : " aryaStark " } } } ] <nl> + } ) , <nl> + apiVersion1 : true , <nl> + } , <nl> + { <nl> + cmd : ( ) = > ( { delete : " APIV1 - 0 " , deletes : [ { q : { _id : counter_fun ( ) } , limit : 1 } ] } ) , <nl> + apiVersion1 : true <nl> + } , <nl> + { cmd : ( ) = > ( { drop : counter_fun ( ) } ) , apiVersion1 : true } <nl> + ] ; <nl> + <nl> + for ( let { cmd , apiVersion1 } of commands ) { <nl> + counter = 0 ; <nl> + for ( let apiStrict of [ false , true ] ) { <nl> + for ( let apiDeprecationErrors of [ false , true ] ) { <nl> + runTest ( { <nl> + cmd : cmd , <nl> + apiVersion1 : apiVersion1 , <nl> + apiStrict : apiStrict , <nl> + apiDeprecationErrors : apiDeprecationErrors <nl> + } ) ; <nl> + counter + = 1 ; <nl> + } <nl> + } <nl> + } <nl> + } ) ( ) ; <nl> \ No newline at end of file <nl> mmm a / jstests / core / views / views_all_commands . js <nl> ppp b / jstests / core / views / views_all_commands . js <nl> let viewsCommandTests = { <nl> startRecordingTraffic : { skip : isUnrelated } , <nl> startSession : { skip : isAnInternalCommand } , <nl> stopRecordingTraffic : { skip : isUnrelated } , <nl> + testDeprecation : { skip : isAnInternalCommand } , <nl> top : { skip : " tested in views / views_stats . js " } , <nl> touch : { skip : wasRemovedInBinaryVersion44 } , <nl> unsetSharding : { skip : isAnInternalCommand } , <nl> mmm a / jstests / replsets / db_reads_while_recovering_all_commands . js <nl> ppp b / jstests / replsets / db_reads_while_recovering_all_commands . js <nl> const allCommands = { <nl> startRecordingTraffic : { skip : isNotAUserDataRead } , <nl> startSession : { skip : isNotAUserDataRead } , <nl> stopRecordingTraffic : { skip : isNotAUserDataRead } , <nl> + testDeprecation : { skip : isNotAUserDataRead } , <nl> top : { skip : isNotAUserDataRead } , <nl> unsetSharding : { skip : isNotAUserDataRead } , <nl> update : { skip : isPrimaryOnly } , <nl> mmm a / jstests / sharding / database_versioning_all_commands . js <nl> ppp b / jstests / sharding / database_versioning_all_commands . js <nl> let testCases = { <nl> startRecordingTraffic : { skip : " executes locally on mongos ( not sent to any remote node ) " } , <nl> startSession : { skip : " executes locally on mongos ( not sent to any remote node ) " } , <nl> stopRecordingTraffic : { skip : " executes locally on mongos ( not sent to any remote node ) " } , <nl> + testDeprecation : { skip : " executes locally on mongos ( not sent to any remote node ) " } , <nl> update : { <nl> run : { <nl> sendsDbVersion : true , <nl> mmm a / jstests / sharding / libs / last_lts_mongos_commands . js <nl> ppp b / jstests / sharding / libs / last_lts_mongos_commands . js <nl> const commandsRemovedFromMongosSinceLastLTS = [ ] ; <nl> / / These commands were added in mongos since the last LTS version , so will not appear in the <nl> / / listCommands output of a last LTS version mongos . We will allow these commands to have a test <nl> / / defined without always existing on the mongos being used . <nl> - const commandsAddedToMongosSinceLastLTS = [ " reshardCollection " , " rotateCertificates " ] ; <nl> + const commandsAddedToMongosSinceLastLTS = <nl> + [ " reshardCollection " , " rotateCertificates " , " testDeprecation " ] ; <nl> mmm a / jstests / sharding / read_write_concern_defaults_application . js <nl> ppp b / jstests / sharding / read_write_concern_defaults_application . js <nl> let testCases = { <nl> startRecordingTraffic : { skip : " does not accept read or write concern " } , <nl> startSession : { skip : " does not accept read or write concern " } , <nl> stopRecordingTraffic : { skip : " does not accept read or write concern " } , <nl> + testDeprecation : { skip : " does not accept read or write concern " } , <nl> top : { skip : " does not accept read or write concern " } , <nl> unsetSharding : { skip : " internal command " } , <nl> update : { <nl> mmm a / jstests / sharding / safe_secondary_reads_drop_recreate . js <nl> ppp b / jstests / sharding / safe_secondary_reads_drop_recreate . js <nl> let testCases = { <nl> startRecordingTraffic : { skip : " does not return user data " } , <nl> startSession : { skip : " does not return user data " } , <nl> stopRecordingTraffic : { skip : " does not return user data " } , <nl> + testDeprecation : { skip : " does not return user data " } , <nl> top : { skip : " does not return user data " } , <nl> unsetSharding : { skip : " does not return user data " } , <nl> update : { skip : " primary only " } , <nl> mmm a / jstests / sharding / safe_secondary_reads_single_migration_suspend_range_deletion . js <nl> ppp b / jstests / sharding / safe_secondary_reads_single_migration_suspend_range_deletion . js <nl> let testCases = { <nl> startRecordingTraffic : { skip : " does not return user data " } , <nl> startSession : { skip : " does not return user data " } , <nl> stopRecordingTraffic : { skip : " does not return user data " } , <nl> + testDeprecation : { skip : " does not return user data " } , <nl> top : { skip : " does not return user data " } , <nl> unsetSharding : { skip : " does not return user data " } , <nl> update : { skip : " primary only " } , <nl> mmm a / jstests / sharding / safe_secondary_reads_single_migration_waitForDelete . js <nl> ppp b / jstests / sharding / safe_secondary_reads_single_migration_waitForDelete . js <nl> let testCases = { <nl> startRecordingTraffic : { skip : " does not return user data " } , <nl> startSession : { skip : " does not return user data " } , <nl> stopRecordingTraffic : { skip : " does not return user data " } , <nl> + testDeprecation : { skip : " does not return user data " } , <nl> top : { skip : " does not return user data " } , <nl> unsetSharding : { skip : " does not return user data " } , <nl> update : { skip : " primary only " } , <nl> mmm a / src / mongo / db / auth / sasl_commands . cpp <nl> ppp b / src / mongo / db / auth / sasl_commands . cpp <nl> class CmdSaslStart : public BasicCommand { <nl> CmdSaslStart ( ) ; <nl> virtual ~ CmdSaslStart ( ) ; <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> virtual void addRequiredPrivileges ( const std : : string & , <nl> const BSONObj & , <nl> std : : vector < Privilege > * ) const { } <nl> class CmdSaslContinue : public BasicCommand { <nl> CmdSaslContinue ( ) ; <nl> virtual ~ CmdSaslContinue ( ) ; <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> virtual void addRequiredPrivileges ( const std : : string & , <nl> const BSONObj & , <nl> std : : vector < Privilege > * ) const { } <nl> mmm a / src / mongo / db / command_generic_argument . cpp <nl> ppp b / src / mongo / db / command_generic_argument . cpp <nl> struct SpecialArgRecord { <nl> / / If that changes , it should be added . When you add to this list , consider whether you <nl> / / should also change the filterCommandRequestForPassthrough ( ) function . <nl> / / clang - format off <nl> - static constexpr std : : array < SpecialArgRecord , 31 > specials { { <nl> + static constexpr std : : array < SpecialArgRecord , 34 > specials { { <nl> / / / - isGeneric <nl> / / | / - stripFromRequest <nl> / / | | / - stripFromReply <nl> + { " apiVersion " _sd , 1 , 0 , 0 } , <nl> + { " apiStrict " _sd , 1 , 0 , 0 } , <nl> + { " apiDeprecationErrors " _sd , 1 , 0 , 0 } , <nl> { " $ audit " _sd , 1 , 1 , 0 } , <nl> { " $ client " _sd , 1 , 1 , 0 } , <nl> { " $ configServerState " _sd , 1 , 1 , 1 } , <nl> mmm a / src / mongo / db / commands . h <nl> ppp b / src / mongo / db / commands . h <nl> class Command { <nl> / / List of API versions that include this command . <nl> virtual const std : : set < std : : string > & apiVersions ( ) const { <nl> return kNoApiVersions ; <nl> - } ; <nl> + } <nl> <nl> / / API versions in which this command is deprecated . <nl> virtual const std : : set < std : : string > & deprecatedApiVersions ( ) const { <nl> return kNoApiVersions ; <nl> - } ; <nl> + } <nl> <nl> / * * <nl> * Like adminOnly , but even stricter : we must either be authenticated for admin db , <nl> mmm a / src / mongo / db / commands / SConscript <nl> ppp b / src / mongo / db / commands / SConscript <nl> env . Library ( <nl> ' logical_session_server_status_section . cpp ' , <nl> ' mr_common . cpp ' , <nl> ' reap_logical_session_cache_now . cpp ' , <nl> + ' test_deprecation_command . cpp ' , <nl> ' traffic_recording_cmds . cpp ' , <nl> ' user_management_commands_common . cpp ' , <nl> env . Idlc ( ' drop_connections . idl ' ) [ 0 ] , <nl> env . Library ( <nl> ' $ BUILD_DIR / mongo / db / repl / isself ' , <nl> ' $ BUILD_DIR / mongo / db / repl / repl_coordinator_interface ' , <nl> ' $ BUILD_DIR / mongo / db / session_catalog ' , <nl> + ' $ BUILD_DIR / mongo / db / shared_request_handling ' , <nl> ' $ BUILD_DIR / mongo / db / traffic_recorder ' , <nl> ' $ BUILD_DIR / mongo / executor / egress_tag_closer_manager ' , <nl> ' $ BUILD_DIR / mongo / executor / task_executor_pool ' , <nl> mmm a / src / mongo / db / commands / authentication_commands . cpp <nl> ppp b / src / mongo / db / commands / authentication_commands . cpp <nl> Status _authenticateX509 ( OperationContext * opCtx , const UserName & user , const BS <nl> <nl> class CmdAuthenticate : public BasicCommand { <nl> public : <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> mmm a / src / mongo / db / commands / count_cmd . cpp <nl> ppp b / src / mongo / db / commands / count_cmd . cpp <nl> class CmdCount : public BasicCommand { <nl> public : <nl> CmdCount ( ) : BasicCommand ( " count " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> std : : string help ( ) const override { <nl> return " count objects in collection " ; <nl> } <nl> mmm a / src / mongo / db / commands / create_indexes . cpp <nl> ppp b / src / mongo / db / commands / create_indexes . cpp <nl> class CmdCreateIndex : public ErrmsgCommandDeprecated { <nl> public : <nl> CmdCreateIndex ( ) : ErrmsgCommandDeprecated ( kCommandName ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> bool supportsWriteConcern ( const BSONObj & cmd ) const override { <nl> return true ; <nl> } <nl> mmm a / src / mongo / db / commands / dbcommands . cpp <nl> ppp b / src / mongo / db / commands / dbcommands . cpp <nl> namespace { <nl> <nl> class CmdDropDatabase : public BasicCommand { <nl> public : <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> std : : string help ( ) const override { <nl> return " drop ( delete ) this database " ; <nl> } <nl> class CmdRepairDatabase : public ErrmsgCommandDeprecated { <nl> class CmdDrop : public ErrmsgCommandDeprecated { <nl> public : <nl> CmdDrop ( ) : ErrmsgCommandDeprecated ( " drop " ) { } <nl> + <nl> + virtual const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> class CmdCreate : public BasicCommand { <nl> public : <nl> CmdCreate ( ) : BasicCommand ( " create " ) { } <nl> <nl> + virtual const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> class CollectionModCommand : public BasicCommand { <nl> public : <nl> CollectionModCommand ( ) : BasicCommand ( " collMod " ) { } <nl> <nl> + virtual const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> mmm a / src / mongo / db / commands / drop_indexes . cpp <nl> ppp b / src / mongo / db / commands / drop_indexes . cpp <nl> MONGO_FAIL_POINT_DEFINE ( reIndexCrashAfterDrop ) ; <nl> / * " dropIndexes " is now the preferred form - " deleteIndexes " deprecated * / <nl> class CmdDropIndexes : public BasicCommand { <nl> public : <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> + <nl> virtual bool supportsWriteConcern ( const BSONObj & cmd ) const override { <nl> return true ; <nl> } <nl> mmm a / src / mongo / db / commands / end_sessions_command . cpp <nl> ppp b / src / mongo / db / commands / end_sessions_command . cpp <nl> class EndSessionsCommand final : public BasicCommand { <nl> public : <nl> EndSessionsCommand ( ) : BasicCommand ( " endSessions " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> mmm a / src / mongo / db / commands / explain_cmd . cpp <nl> ppp b / src / mongo / db / commands / explain_cmd . cpp <nl> class CmdExplain final : public Command { <nl> public : <nl> CmdExplain ( ) : Command ( " explain " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> std : : unique_ptr < CommandInvocation > parse ( OperationContext * opCtx , <nl> const OpMsgRequest & request ) override ; <nl> <nl> mmm a / src / mongo / db / commands / find_and_modify . cpp <nl> ppp b / src / mongo / db / commands / find_and_modify . cpp <nl> class CmdFindAndModify : public BasicCommand { <nl> CmdFindAndModify ( ) <nl> : BasicCommand ( " findAndModify " , " findandmodify " ) , _updateMetrics { " findAndModify " } { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> std : : string help ( ) const override { <nl> return " { findAndModify : \ " collection \ " , query : { processed : false } , update : { $ set : " <nl> " { processed : true } } , new : true } \ n " <nl> mmm a / src / mongo / db / commands / find_cmd . cpp <nl> ppp b / src / mongo / db / commands / find_cmd . cpp <nl> class FindCmd final : public Command { <nl> public : <nl> FindCmd ( ) : Command ( " find " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> std : : unique_ptr < CommandInvocation > parse ( OperationContext * opCtx , <nl> const OpMsgRequest & opMsgRequest ) override { <nl> / / TODO : Parse into a QueryRequest here . <nl> mmm a / src / mongo / db / commands / generic . cpp <nl> ppp b / src / mongo / db / commands / generic . cpp <nl> class PingCommand : public BasicCommand { <nl> public : <nl> PingCommand ( ) : BasicCommand ( " ping " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> mmm a / src / mongo / db / commands / getmore_cmd . cpp <nl> ppp b / src / mongo / db / commands / getmore_cmd . cpp <nl> class GetMoreCmd final : public Command { <nl> public : <nl> GetMoreCmd ( ) : Command ( " getMore " ) { } <nl> <nl> + / / Do not currently use apiVersions because clients are prohibited from calling <nl> + / / getMore with apiVersion . <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> std : : unique_ptr < CommandInvocation > parse ( OperationContext * opCtx , <nl> const OpMsgRequest & opMsgRequest ) override { <nl> return std : : make_unique < Invocation > ( this , opMsgRequest ) ; <nl> mmm a / src / mongo / db / commands / killcursors_cmd . cpp <nl> ppp b / src / mongo / db / commands / killcursors_cmd . cpp <nl> class KillCursorsCmd final : public KillCursorsCmdBase { <nl> public : <nl> KillCursorsCmd ( ) = default ; <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> bool run ( OperationContext * opCtx , <nl> const std : : string & dbname , <nl> const BSONObj & cmdObj , <nl> mmm a / src / mongo / db / commands / list_collections . cpp <nl> ppp b / src / mongo / db / commands / list_collections . cpp <nl> BSONObj buildCollectionBson ( OperationContext * opCtx , <nl> <nl> class CmdListCollections : public BasicCommand { <nl> public : <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const final { <nl> return AllowedOnSecondary : : kOptIn ; <nl> } <nl> mmm a / src / mongo / db / commands / list_databases . cpp <nl> ppp b / src / mongo / db / commands / list_databases . cpp <nl> intmax_t dbSize ( const string & database ) ; <nl> <nl> class CmdListDatabases : public BasicCommand { <nl> public : <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const final { <nl> return AllowedOnSecondary : : kOptIn ; <nl> } <nl> mmm a / src / mongo / db / commands / list_indexes . cpp <nl> ppp b / src / mongo / db / commands / list_indexes . cpp <nl> class CmdListIndexes : public BasicCommand { <nl> public : <nl> CmdListIndexes ( ) : BasicCommand ( " listIndexes " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kOptIn ; <nl> } <nl> mmm a / src / mongo / db / commands / pipeline_command . cpp <nl> ppp b / src / mongo / db / commands / pipeline_command . cpp <nl> class PipelineCommand final : public Command { <nl> public : <nl> PipelineCommand ( ) : Command ( " aggregate " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> / * * <nl> * It ' s not known until after parsing whether or not an aggregation command is an explain <nl> * request , because it might include the ` explain : true ` field ( ie . aggregation explains do not <nl> mmm a / src / mongo / db / commands / refresh_sessions_command . cpp <nl> ppp b / src / mongo / db / commands / refresh_sessions_command . cpp <nl> class RefreshSessionsCommand final : public BasicCommand { <nl> public : <nl> RefreshSessionsCommand ( ) : BasicCommand ( " refreshSessions " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> new file mode 100644 <nl> index 000000000000 . . 2ec6060bbe3e <nl> mmm / dev / null <nl> ppp b / src / mongo / db / commands / test_deprecation_command . cpp <nl> <nl> + / * * <nl> + * Copyright ( C ) 2020 - present MongoDB , Inc . <nl> + * <nl> + * This program is free software : you can redistribute it and / or modify <nl> + * it under the terms of the Server Side Public License , version 1 , <nl> + * as published by MongoDB , Inc . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * Server Side Public License for more details . <nl> + * <nl> + * You should have received a copy of the Server Side Public License <nl> + * along with this program . If not , see <nl> + * < http : / / www . mongodb . com / licensing / server - side - public - license > . <nl> + * <nl> + * As a special exception , the copyright holders give permission to link the <nl> + * code of portions of this program with the OpenSSL library under certain <nl> + * conditions as described in each individual source file and distribute <nl> + * linked combinations including the program with the OpenSSL library . You <nl> + * must comply with the Server Side Public License in all respects for <nl> + * all of the code used other than as permitted herein . If you modify file ( s ) <nl> + * with this exception , you may extend this exception to your version of the <nl> + * file ( s ) , but you are not obligated to do so . If you do not wish to do so , <nl> + * delete this exception statement from your version . If you delete this <nl> + * exception statement from all source files in the program , then also delete <nl> + * it in the license file . <nl> + * / <nl> + <nl> + # include " mongo / db / commands . h " <nl> + # include " mongo / db / initialize_api_parameters . h " <nl> + <nl> + namespace mongo { <nl> + <nl> + / * * <nl> + * Command for testing API Version deprecation logic . The command replies with the values of the <nl> + * OperationContext ' s API parameters . <nl> + * / <nl> + class TestDeprecationCmd : public BasicCommand { <nl> + public : <nl> + TestDeprecationCmd ( ) : BasicCommand ( " testDeprecation " ) { } <nl> + <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> + const std : : set < std : : string > & deprecatedApiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> + AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> + return AllowedOnSecondary : : kAlways ; <nl> + } <nl> + <nl> + bool supportsWriteConcern ( const BSONObj & cmd ) const override { <nl> + return false ; <nl> + } <nl> + <nl> + bool requiresAuth ( ) const override { <nl> + return false ; <nl> + } <nl> + <nl> + void addRequiredPrivileges ( const std : : string & dbname , <nl> + const BSONObj & cmdObj , <nl> + std : : vector < Privilege > * out ) const override { } <nl> + <nl> + std : : string help ( ) const override { <nl> + return " replies with the values of the OperationContext ' s API parameters " ; <nl> + } <nl> + <nl> + bool run ( OperationContext * opCtx , <nl> + const std : : string & dbname , <nl> + const BSONObj & cmdObj , <nl> + BSONObjBuilder & result ) override { <nl> + result . append ( " apiVersion " , APIParameters : : get ( opCtx ) . getAPIVersion ( ) ) ; <nl> + result . append ( " apiStrict " , APIParameters : : get ( opCtx ) . getAPIStrict ( ) ) ; <nl> + result . append ( " apiDeprecationErrors " , APIParameters : : get ( opCtx ) . getAPIDeprecationErrors ( ) ) ; <nl> + return true ; <nl> + } <nl> + } ; <nl> + <nl> + MONGO_REGISTER_TEST_COMMAND ( TestDeprecationCmd ) ; <nl> + <nl> + <nl> + } / / namespace mongo <nl> \ No newline at end of file <nl> mmm a / src / mongo / db / commands / txn_cmds . cpp <nl> ppp b / src / mongo / db / commands / txn_cmds . cpp <nl> class CmdCommitTxn : public BasicCommand { <nl> public : <nl> CmdCommitTxn ( ) : BasicCommand ( " commitTransaction " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> class CmdAbortTxn : public BasicCommand { <nl> public : <nl> CmdAbortTxn ( ) : BasicCommand ( " abortTransaction " ) { } <nl> <nl> + virtual const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } ; <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> mmm a / src / mongo / db / commands / write_commands / write_commands . cpp <nl> ppp b / src / mongo / db / commands / write_commands / write_commands . cpp <nl> class CmdInsert final : public WriteCommand { <nl> public : <nl> CmdInsert ( ) : WriteCommand ( " insert " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> private : <nl> class Invocation final : public InvocationBase { <nl> public : <nl> class CmdUpdate final : public WriteCommand { <nl> public : <nl> CmdUpdate ( ) : WriteCommand ( " update " ) , _updateMetrics { " update " } { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> private : <nl> class Invocation final : public InvocationBase { <nl> public : <nl> class CmdDelete final : public WriteCommand { <nl> public : <nl> CmdDelete ( ) : WriteCommand ( " delete " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> private : <nl> class Invocation final : public InvocationBase { <nl> public : <nl> Invocation ( const WriteCommand * cmd , const OpMsgRequest & request ) <nl> : InvocationBase ( cmd , request ) , _batch ( DeleteOp : : parse ( request ) ) { } <nl> <nl> + <nl> private : <nl> NamespaceString ns ( ) const override { <nl> return _batch . getNamespace ( ) ; <nl> mmm a / src / mongo / db / initialize_api_parameters . cpp <nl> ppp b / src / mongo / db / initialize_api_parameters . cpp <nl> <nl> <nl> namespace mongo { <nl> <nl> - const APIParametersFromClient initializeAPIParameters ( const BSONObj & requestBody ) { <nl> + const APIParametersFromClient initializeAPIParameters ( const BSONObj & requestBody , <nl> + Command * command ) { <nl> <nl> auto apiParamsFromClient = <nl> APIParametersFromClient : : parse ( " APIParametersFromClient " _sd , requestBody ) ; <nl> const APIParametersFromClient initializeAPIParameters ( const BSONObj & requestBody <nl> " 1 " = = apiParamsFromClient . getApiVersion ( ) . value ( ) ) ; <nl> } <nl> <nl> + if ( apiParamsFromClient . getApiStrict ( ) . get_value_or ( false ) ) { <nl> + auto cmdApiVersions = command - > apiVersions ( ) ; <nl> + bool strictAssert = ( cmdApiVersions . find ( " 1 " ) ! = cmdApiVersions . end ( ) ) ; <nl> + uassert ( ErrorCodes : : APIStrictError , <nl> + str : : stream ( ) < < " Provided apiStrict : true , but the command " < < command - > getName ( ) <nl> + < < " is not in API Version \ " 1 \ " " , <nl> + strictAssert ) ; <nl> + } <nl> + <nl> + if ( apiParamsFromClient . getApiDeprecationErrors ( ) . get_value_or ( false ) ) { <nl> + auto cmdDepApiVersions = command - > deprecatedApiVersions ( ) ; <nl> + bool deprecationAssert = ( cmdDepApiVersions . find ( " 1 " ) = = cmdDepApiVersions . end ( ) ) ; <nl> + uassert ( ErrorCodes : : APIDeprecationError , <nl> + str : : stream ( ) < < " Provided apiDeprecationErrors : true , but the command " <nl> + < < command - > getName ( ) < < " is deprecated in API Version \ " 1 \ " " , <nl> + deprecationAssert ) ; <nl> + } <nl> + <nl> return apiParamsFromClient ; <nl> } <nl> <nl> mmm a / src / mongo / db / initialize_api_parameters . h <nl> ppp b / src / mongo / db / initialize_api_parameters . h <nl> <nl> <nl> # pragma once <nl> <nl> + # include " mongo / db / commands . h " <nl> # include " mongo / db / initialize_api_parameters_gen . h " <nl> # include " mongo / db / operation_context . h " <nl> <nl> namespace mongo { <nl> * Parses a command ' s API Version parameters from a request and stores the apiVersion , apiStrict , <nl> * and apiDeprecationErrors fields . <nl> * / <nl> - const APIParametersFromClient initializeAPIParameters ( const BSONObj & requestBody ) ; <nl> + const APIParametersFromClient initializeAPIParameters ( const BSONObj & requestBody , Command * command ) ; <nl> <nl> / * * <nl> * Decorates operation context with methods to retrieve apiVersion , apiStrict , and <nl> mmm a / src / mongo / db / repl / replication_info . cpp <nl> ppp b / src / mongo / db / repl / replication_info . cpp <nl> class CmdIsMaster final : public BasicCommandWithReplyBuilderInterface { <nl> public : <nl> CmdIsMaster ( ) : BasicCommandWithReplyBuilderInterface ( " isMaster " , " ismaster " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> bool requiresAuth ( ) const final { <nl> return false ; <nl> } <nl> mmm a / src / mongo / db / s / config / configsvr_drop_collection_command . cpp <nl> ppp b / src / mongo / db / s / config / configsvr_drop_collection_command . cpp <nl> class ConfigSvrDropCollectionCommand : public BasicCommand { <nl> public : <nl> ConfigSvrDropCollectionCommand ( ) : BasicCommand ( " _configsvrDropCollection " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> mmm a / src / mongo / db / s / config / configsvr_drop_database_command . cpp <nl> ppp b / src / mongo / db / s / config / configsvr_drop_database_command . cpp <nl> class ConfigSvrDropDatabaseCommand : public BasicCommand { <nl> public : <nl> ConfigSvrDropDatabaseCommand ( ) : BasicCommand ( " _configsvrDropDatabase " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> mmm a / src / mongo / db / service_entry_point_common . cpp <nl> ppp b / src / mongo / db / service_entry_point_common . cpp <nl> void execCommandDatabase ( OperationContext * opCtx , <nl> <nl> auto const replCoord = repl : : ReplicationCoordinator : : get ( opCtx ) ; <nl> <nl> - auto const apiParamsFromClient = initializeAPIParameters ( request . body ) ; <nl> + auto const apiParamsFromClient = initializeAPIParameters ( request . body , command ) ; <nl> APIParameters : : get ( opCtx ) = APIParameters : : fromClient ( apiParamsFromClient ) ; <nl> <nl> sessionOptions = initializeOperationSessionInfo ( <nl> mmm a / src / mongo / embedded / mongo_embedded / mongo_embedded_test . cpp <nl> ppp b / src / mongo / embedded / mongo_embedded / mongo_embedded_test . cpp <nl> TEST_F ( MongodbCAPITest , RunListCommands ) { <nl> " setParameter " , <nl> " sleep " , <nl> " startSession " , <nl> + " testDeprecation " , <nl> " update " , <nl> " validate " , <nl> " waitForFailPoint " , <nl> mmm a / src / mongo / s / commands / cluster_abort_transaction_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_abort_transaction_cmd . cpp <nl> class ClusterAbortTransactionCmd : public BasicCommand { <nl> public : <nl> ClusterAbortTransactionCmd ( ) : BasicCommand ( " abortTransaction " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_collection_mod_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_collection_mod_cmd . cpp <nl> class CollectionModCmd : public ErrmsgCommandDeprecated { <nl> public : <nl> CollectionModCmd ( ) : ErrmsgCommandDeprecated ( " collMod " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_commit_transaction_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_commit_transaction_cmd . cpp <nl> class ClusterCommitTransactionCmd : public BasicCommand { <nl> public : <nl> ClusterCommitTransactionCmd ( ) : BasicCommand ( " commitTransaction " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_count_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_count_cmd . cpp <nl> class ClusterCountCmd : public ErrmsgCommandDeprecated { <nl> public : <nl> ClusterCountCmd ( ) : ErrmsgCommandDeprecated ( " count " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_create_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_create_cmd . cpp <nl> class CreateCmd : public BasicCommand { <nl> public : <nl> CreateCmd ( ) : BasicCommand ( " create " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_create_indexes_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_create_indexes_cmd . cpp <nl> class CreateIndexesCmd : public ErrmsgCommandDeprecated { <nl> public : <nl> CreateIndexesCmd ( ) : ErrmsgCommandDeprecated ( " createIndexes " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kNever ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_drop_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_drop_cmd . cpp <nl> class DropCmd : public BasicCommand { <nl> public : <nl> DropCmd ( ) : BasicCommand ( " drop " ) { } <nl> <nl> + virtual const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_drop_database_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_drop_database_cmd . cpp <nl> class DropDatabaseCmd : public BasicCommand { <nl> public : <nl> DropDatabaseCmd ( ) : BasicCommand ( " dropDatabase " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_drop_indexes_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_drop_indexes_cmd . cpp <nl> void updateStateForStaleConfigRetry ( OperationContext * opCtx , <nl> <nl> class DropIndexesCmd : public ErrmsgCommandDeprecated { <nl> public : <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> DropIndexesCmd ( ) : ErrmsgCommandDeprecated ( " dropIndexes " , " deleteIndexes " ) { } <nl> <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> mmm a / src / mongo / s / commands / cluster_explain_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_explain_cmd . cpp <nl> class ClusterExplainCmd final : public Command { <nl> public : <nl> ClusterExplainCmd ( ) : Command ( " explain " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> std : : unique_ptr < CommandInvocation > parse ( OperationContext * opCtx , <nl> const OpMsgRequest & request ) override ; <nl> <nl> mmm a / src / mongo / s / commands / cluster_find_and_modify_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_find_and_modify_cmd . cpp <nl> class FindAndModifyCmd : public BasicCommand { <nl> FindAndModifyCmd ( ) <nl> : BasicCommand ( " findAndModify " , " findandmodify " ) , _updateMetrics { " findAndModify " } { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_find_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_find_cmd . cpp <nl> class ClusterFindCmd final : public Command { <nl> public : <nl> ClusterFindCmd ( ) : Command ( " find " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> std : : unique_ptr < CommandInvocation > parse ( OperationContext * opCtx , <nl> const OpMsgRequest & opMsgRequest ) override { <nl> / / TODO : Parse into a QueryRequest here . <nl> mmm a / src / mongo / s / commands / cluster_getmore_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_getmore_cmd . cpp <nl> class ClusterGetMoreCmd final : public Command { <nl> public : <nl> ClusterGetMoreCmd ( ) : Command ( " getMore " ) { } <nl> <nl> + / / Do not currently use apiVersions because clients are prohibited from calling <nl> + / / getMore with apiVersion . <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> std : : unique_ptr < CommandInvocation > parse ( OperationContext * opCtx , <nl> const OpMsgRequest & opMsgRequest ) override { <nl> return std : : make_unique < Invocation > ( this , opMsgRequest ) ; <nl> mmm a / src / mongo / s / commands / cluster_is_master_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_is_master_cmd . cpp <nl> class CmdIsMaster : public BasicCommandWithReplyBuilderInterface { <nl> public : <nl> CmdIsMaster ( ) : BasicCommandWithReplyBuilderInterface ( " isMaster " , " ismaster " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> bool supportsWriteConcern ( const BSONObj & cmd ) const override { <nl> return false ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_killcursors_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_killcursors_cmd . cpp <nl> class ClusterKillCursorsCmd final : public KillCursorsCmdBase { <nl> public : <nl> ClusterKillCursorsCmd ( ) = default ; <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> ReadConcernSupportResult supportsReadConcern ( const BSONObj & cmdObj , <nl> repl : : ReadConcernLevel level ) const final { <nl> / / killCursors must support read concerns in order to be run in transactions . <nl> mmm a / src / mongo / s / commands / cluster_list_collections_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_list_collections_cmd . cpp <nl> class CmdListCollections : public BasicCommand { <nl> public : <nl> CmdListCollections ( ) : BasicCommand ( " listCollections " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> bool supportsWriteConcern ( const BSONObj & cmd ) const override { <nl> return false ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_list_databases_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_list_databases_cmd . cpp <nl> class ListDatabasesCmd : public BasicCommand { <nl> public : <nl> ListDatabasesCmd ( ) : BasicCommand ( " listDatabases " , " listdatabases " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_list_indexes_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_list_indexes_cmd . cpp <nl> class CmdListIndexes : public BasicCommand { <nl> public : <nl> CmdListIndexes ( ) : BasicCommand ( " listIndexes " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> std : : string parseNs ( const std : : string & dbname , const BSONObj & cmdObj ) const override { <nl> return CommandHelpers : : parseNsCollectionRequired ( dbname , cmdObj ) . ns ( ) ; <nl> } <nl> mmm a / src / mongo / s / commands / cluster_pipeline_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_pipeline_cmd . cpp <nl> class ClusterPipelineCommand final : public Command { <nl> public : <nl> ClusterPipelineCommand ( ) : Command ( " aggregate " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> / * * <nl> * It ' s not known until after parsing whether or not an aggregation command is an explain <nl> * request , because it might include the ` explain : true ` field ( ie . aggregation explains do not <nl> mmm a / src / mongo / s / commands / cluster_write_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_write_cmd . cpp <nl> class ClusterInsertCmd final : public ClusterWriteCmd { <nl> public : <nl> ClusterInsertCmd ( ) : ClusterWriteCmd ( " insert " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> private : <nl> class Invocation final : public InvocationBase { <nl> public : <nl> class ClusterUpdateCmd final : public ClusterWriteCmd { <nl> public : <nl> ClusterUpdateCmd ( ) : ClusterWriteCmd ( " update " ) , _updateMetrics { " update " } { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> private : <nl> class Invocation final : public InvocationBase { <nl> public : <nl> class ClusterDeleteCmd final : public ClusterWriteCmd { <nl> public : <nl> ClusterDeleteCmd ( ) : ClusterWriteCmd ( " delete " ) { } <nl> <nl> + const std : : set < std : : string > & apiVersions ( ) const { <nl> + return kApiVersions1 ; <nl> + } <nl> + <nl> private : <nl> class Invocation final : public InvocationBase { <nl> public : <nl> mmm a / src / mongo / s / commands / strategy . cpp <nl> ppp b / src / mongo / s / commands / strategy . cpp <nl> void runCommand ( OperationContext * opCtx , <nl> / / Fill out all currentOp details . <nl> CurOp : : get ( opCtx ) - > setGenericOpRequestDetails ( opCtx , nss , command , request . body , opType ) ; <nl> <nl> - auto const apiParamsFromClient = initializeAPIParameters ( request . body ) ; <nl> + auto const apiParamsFromClient = initializeAPIParameters ( request . body , command ) ; <nl> APIParameters : : get ( opCtx ) = APIParameters : : fromClient ( apiParamsFromClient ) ; <nl> <nl> auto osi = initializeOperationSessionInfo ( opCtx , <nl>
SERVER - 49065 Mark API Version 1 commands
mongodb/mongo
4e0f81726fc11becd9c22d701e80ba2c8d988bb0
2020-07-28T23:56:02Z
mmm a / doc / classes / RigidBody . xml <nl> ppp b / doc / classes / RigidBody . xml <nl> <nl> < / brief_description > <nl> < description > <nl> This is the node that implements full 3D physics . This means that you do not control a RigidBody directly . Instead you can apply forces to it ( gravity , impulses , etc . ) , and the physics simulation will calculate the resulting movement , collision , bouncing , rotating , etc . <nl> - This node can use custom force integration , for writing complex physics motion behavior per node . <nl> - This node can shift state between regular Rigid body , Kinematic , Character or Static . <nl> - Character mode forbids this node from being rotated . <nl> - As a warning , don ' t change RigidBody ' s position every frame or very often . Sporadic changes work fine , but physics runs at a different granularity ( fixed hz ) than usual rendering ( process callback ) and maybe even in a separate thread , so changing this from a process loop will yield strange behavior . <nl> + A RigidBody has 4 behavior [ member mode ] s : Rigid , Static , Character , and Kinematic . <nl> + [ b ] Note : [ / b ] Don ' t change a RigidBody ' s position every frame or very often . Sporadic changes work fine , but physics runs at a different granularity ( fixed hz ) than usual rendering ( process callback ) and maybe even in a separate thread , so changing this from a process loop will yield strange behavior . If you need to directly affect the body ' s state , use [ method _integrate_forces ] , which allows you to directly access the physics state . <nl> + If you need to override the default physics behavior , you can write a custom force integration . See [ member custom_integrator ] . <nl> < / description > <nl> < tutorials > <nl> http : / / docs . godotengine . org / en / 3 . 0 / tutorials / physics / physics_introduction . html <nl> mmm a / doc / classes / RigidBody2D . xml <nl> ppp b / doc / classes / RigidBody2D . xml <nl> <nl> < / brief_description > <nl> < description > <nl> This node implements simulated 2D physics . You do not control a RigidBody2D directly . Instead you apply forces to it ( gravity , impulses , etc . ) and the physics simulation calculates the resulting movement based on its mass , friction , and other physical properties . <nl> - A RigidBody2D has 4 behavior modes ( see [ member mode ] ) : <nl> - - [ b ] Rigid [ / b ] : The body behaves as a physical object . It collides with other bodies and responds to forces applied to it . This is the default mode . <nl> - - [ b ] Static [ / b ] : The body behaves like a [ StaticBody2D ] and does not move . <nl> - - [ b ] Character [ / b ] : Similar to [ code ] Rigid [ / code ] mode , but the body can not rotate . <nl> - - [ b ] Kinematic [ / b ] : The body behaves like a [ KinematicBody2D ] , and must be moved by code . <nl> + A RigidBody2D has 4 behavior [ member mode ] s : Rigid , Static , Character , and Kinematic . <nl> [ b ] Note : [ / b ] You should not change a RigidBody2D ' s [ code ] position [ / code ] or [ code ] linear_velocity [ / code ] every frame or even very often . If you need to directly affect the body ' s state , use [ method _integrate_forces ] , which allows you to directly access the physics state . <nl> If you need to override the default physics behavior , you can write a custom force integration . See [ member custom_integrator ] . <nl> < / description > <nl>
Merge pull request from YeldhamDev / rigidbodies_descriptions
godotengine/godot
48850d4077f4a21ac27e6b1f969f6887440b3244
2018-02-19T19:29:53Z
mmm a / src / mongo / s / client / shard_registry . cpp <nl> ppp b / src / mongo / s / client / shard_registry . cpp <nl> ShardRegistry : : Cache : : LookupResult ShardRegistry : : _lookup ( OperationContext * opCt <nl> <nl> auto name = shard - > getConnString ( ) . getSetName ( ) ; <nl> ReplicaSetMonitor : : remove ( name ) ; <nl> + _removeReplicaSet ( name ) ; <nl> for ( auto & callback : _shardRemovalHooks ) { <nl> / / Run callbacks asynchronously . <nl> / / TODO SERVER - 50906 : Consider running these callbacks synchronously . <nl> ShardRegistry : : _getLatestConnStrings ( ) const { <nl> return { { _latestConnStrings . begin ( ) , _latestConnStrings . end ( ) } , _rsmIncrement . load ( ) } ; <nl> } <nl> <nl> + void ShardRegistry : : _removeReplicaSet ( const std : : string & setName ) { <nl> + stdx : : lock_guard < Latch > lk ( _mutex ) ; <nl> + _latestConnStrings . erase ( setName ) ; <nl> + } <nl> + <nl> void ShardRegistry : : updateReplSetHosts ( const ConnectionString & givenConnString , <nl> ConnectionStringUpdateType updateType ) { <nl> invariant ( givenConnString . type ( ) = = ConnectionString : : SET | | <nl> mmm a / src / mongo / s / client / shard_registry . h <nl> ppp b / src / mongo / s / client / shard_registry . h <nl> class ShardRegistry { <nl> <nl> std : : pair < std : : vector < LatestConnStrings : : value_type > , Increment > _getLatestConnStrings ( ) const ; <nl> <nl> + void _removeReplicaSet ( const std : : string & setName ) ; <nl> + <nl> void _initializeCacheIfNecessary ( ) const ; <nl> <nl> void _periodicReload ( const executor : : TaskExecutor : : CallbackArgs & cbArgs ) ; <nl>
SERVER - 51342 ShardRegistry should forget connection strings of removed shards
mongodb/mongo
bd1f707b4e981aeea09d3a0e0774973b9c223eb2
2020-10-11T13:24:44Z
mmm a / buildscripts / resmokeconfig / suites / sharding_last_stable_mongos_and_mixed_shards . yml <nl> ppp b / buildscripts / resmokeconfig / suites / sharding_last_stable_mongos_and_mixed_shards . yml <nl> selector : <nl> - jstests / sharding / geo_near_sharded . js <nl> # Enable when 4 . 2 becomes last - stable . <nl> - jstests / sharding / agg_error_reports_shard_host_and_port . js <nl> + - jstests / sharding / collation_lookup . js <nl> - jstests / sharding / collation_targeting . js <nl> - jstests / sharding / collation_targeting_inherited . js <nl> - jstests / sharding / failcommand_failpoint_not_parallel . js <nl> - jstests / sharding / failcommand_ignores_internal . js <nl> - jstests / sharding / geo_near_random1 . js <nl> - jstests / sharding / geo_near_random2 . js <nl> + - jstests / sharding / lookup . js <nl> + - jstests / sharding / lookup_mongod_unaware . js <nl> + - jstests / sharding / lookup_stale_mongos . js <nl> - jstests / sharding / out_cannot_run_on_mongos . js <nl> - jstests / sharding / out_command_options . js <nl> - jstests / sharding / out_from_stale_mongos . js <nl>
SERVER - 38635 Blacklist new $ lookup tests from running on old mongos
mongodb/mongo
00f36b305bdb92b31c07cb97af8236b58f237d7c
2018-12-14T16:18:08Z
new file mode 100644 <nl> index 000000000000 . . 7ae4edf4ce29 <nl> mmm / dev / null <nl> ppp b / spec / fixtures / pages / beforeunload - false . html <nl> <nl> + < html > <nl> + < body > <nl> + < script type = " text / javascript " charset = " utf - 8 " > <nl> + window . onbeforeunload = function ( ) { <nl> + setTimeout ( function ( ) { <nl> + var ipc = require ( ' ipc ' ) ; <nl> + ipc . sendToHost ( ' onbeforeunload ' ) ; <nl> + } , 0 ) ; <nl> + return false ; <nl> + } <nl> + < / script > <nl> + < / body > <nl> + < / html > <nl> mmm a / spec / webview - spec . coffee <nl> ppp b / spec / webview - spec . coffee <nl> describe ' < webview > tag ' , - > <nl> done ( ) <nl> webview . src = " file : / / # { fixtures } / pages / a . html " <nl> document . body . appendChild webview <nl> + <nl> + describe ' < webview > . reload ( ) ' , - > <nl> + it ' should emit beforeunload handler ' , ( done ) - > <nl> + webview . addEventListener ' did - finish - load ' , ( e ) - > <nl> + webview . reload ( ) <nl> + listener = ( e ) - > <nl> + assert . equal e . channel , ' onbeforeunload ' <nl> + webview . removeEventListener ' ipc - message ' , listener <nl> + done ( ) <nl> + webview . addEventListener ' console - message ' , ( e ) - > <nl> + console . log ( e ) <nl> + webview . addEventListener ' ipc - message ' , listener <nl> + webview . setAttribute ' nodeintegration ' , ' on ' <nl> + webview . src = " file : / / # { fixtures } / pages / beforeunload - false . html " <nl> + document . body . appendChild webview <nl>
spec : Test beforeunload handler in webview
electron/electron
36d2512ff88cbb11ee02c4500eaafc072377307f
2015-05-01T05:48:23Z
mmm a / buildroot / share / scripts / findMissingTranslations . sh <nl> ppp b / buildroot / share / scripts / findMissingTranslations . sh <nl> fi <nl> echo - n " Building list of missing strings . . . " <nl> <nl> for i in $ ( awk ' / # ifndef / { print $ 2 } ' language_en . h ) ; do <nl> - [ [ $ i = = " LANGUAGE_EN_H " ] ] & & continue <nl> + [ [ $ i = = " LANGUAGE_EN_H " | | $ i = = " CHARSIZE " ] ] & & continue <nl> LANG_LIST = " " <nl> for j in $ TEST_LANGS ; do <nl> [ [ $ ( grep - c " $ { i } " language_ $ { j } . h ) - eq 0 ] ] & & LANG_LIST = " $ LANG_LIST $ j " <nl>
Add CHARSIZE to ignorelist
MarlinFirmware/Marlin
d81e9ce7cbef4889d6fe8ec9a50612fa00de8b59
2018-02-15T19:23:02Z
mmm a / CocosDenshion / proj . linux / Makefile <nl> ppp b / CocosDenshion / proj . linux / Makefile <nl> <nl> CC = gcc <nl> CXX = g + + <nl> TARGET = libcocosdenshion . so <nl> - CCFLAGS = - Wall - g - O2 <nl> - CXXFLAGS = - Wall - g - O2 <nl> + CCFLAGS = - Wall - g - O2 - fPIC <nl> + CXXFLAGS = - Wall - g - O2 - fPIC <nl> VISIBILITY = <nl> <nl> INCLUDES = - I . . \ <nl> new file mode 100644 <nl> index 000000000000 . . 4a89718bfc87 <nl> mmm / dev / null <nl> ppp b / cocos2dx / platform / third_party / linux / libraries / lib64 / libcurl . a . REMOVED . git - id <nl> @ @ - 0 , 0 + 1 @ @ <nl> + 16aa53d20c3f675cf94eb63ee029a3ca655e849a <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . d59d453354a1 <nl> mmm / dev / null <nl> ppp b / cocos2dx / platform / third_party / linux / libraries / lib64 / libfreetype . a . REMOVED . git - id <nl> @ @ - 0 , 0 + 1 @ @ <nl> + 605d56a7423e747f13034756e21bf64e0ad94a43 <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . e9f19c488e1f <nl> mmm / dev / null <nl> ppp b / cocos2dx / platform / third_party / linux / libraries / lib64 / libjpeg . a . REMOVED . git - id <nl> @ @ - 0 , 0 + 1 @ @ <nl> + 26c9923522213ccf69d7934d31376fcb28216b29 <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . b078584e813b <nl> mmm / dev / null <nl> ppp b / cocos2dx / platform / third_party / linux / libraries / lib64 / libpng . a . REMOVED . git - id <nl> @ @ - 0 , 0 + 1 @ @ <nl> + d582ee99eb4cf5b1a3e1010535d3ad0e02b07d15 <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . d4818a8baa1e <nl> mmm / dev / null <nl> ppp b / cocos2dx / platform / third_party / linux / libraries / lib64 / libxml2 . a . REMOVED . git - id <nl> @ @ - 0 , 0 + 1 @ @ <nl> + f4d59c12129476e3e34083f0b6dc9953821da854 <nl> \ No newline at end of file <nl> mmm a / cocos2dx / proj . linux / Makefile <nl> ppp b / cocos2dx / proj . linux / Makefile <nl> OBJECTS = . . / actions / CCAction . o \ <nl> . . / CCScheduler . o \ <nl> . . / cocos2d . o <nl> <nl> + LBITS : = $ ( shell getconf LONG_BIT ) <nl> + ifeq ( $ ( LBITS ) , 64 ) <nl> + STATICLIBS_DIR = . . / platform / third_party / linux / libraries / lib64 <nl> + else <nl> STATICLIBS_DIR = . . / platform / third_party / linux / libraries <nl> - # STATICLIBS = $ ( STATICLIBS_DIR ) / libfreetype . a \ <nl> - # $ ( STATICLIBS_DIR ) / libcurl . a \ <nl> - # $ ( STATICLIBS_DIR ) / libxml2 . a \ <nl> - # $ ( STATICLIBS_DIR ) / libpng . a \ <nl> - # $ ( STATICLIBS_DIR ) / libjpeg . a <nl> - <nl> + endif <nl> + STATICLIBS = $ ( STATICLIBS_DIR ) / libfreetype . a \ <nl> + $ ( STATICLIBS_DIR ) / libcurl . a \ <nl> + $ ( STATICLIBS_DIR ) / libxml2 . a \ <nl> + $ ( STATICLIBS_DIR ) / libpng . a \ <nl> + $ ( STATICLIBS_DIR ) / libjpeg . a <nl> + <nl> SHAREDLIBS = - lglfw - lGL <nl> <nl> # # # # # # # Build rules <nl>
bundle 64 bit linux static libs
cocos2d/cocos2d-x
b7f0385a2b3d6eb009b16a4aad6d4a0b611bbae5
2011-10-28T04:19:26Z
mmm a / cocos / 2d / platform / ios / CCDevice . mm <nl> ppp b / cocos / 2d / platform / ios / CCDevice . mm <nl> - ( void ) accelerometer : ( CMAccelerometerData * ) accelerometerData <nl> } <nl> <nl> cocos2d : : EventAcceleration event ( * _acceleration ) ; <nl> - cocos2d : : _eventDispatcherdispatchEvent ( & event ) ; <nl> + auto dispatcher = cocos2d : : Director : : getInstance ( ) - > getEventDispatcher ( ) ; <nl> + dispatcher - > dispatchEvent ( & event ) ; <nl> } <nl> <nl> @ end <nl>
issue : Update device . mm for iOS .
cocos2d/cocos2d-x
e2ce7144636ca0b7430dfa01fca302f2bd04a8a2
2013-10-29T08:20:42Z
mmm a / modules / planning / common / planning_gflags . cc <nl> ppp b / modules / planning / common / planning_gflags . cc <nl> DEFINE_double ( stgraph_max_deceleration_divide_factor_level_2 , 2 . 0 , <nl> / / Decision Part <nl> DEFINE_double ( static_decision_ignore_range , 3 . 0 , <nl> " threshold for judging nudge in dp path computing decision " ) ; <nl> - DEFINE_double ( static_decision_stop_buffer , 0 . 5 , <nl> - " added distance to vehicle width for static decision collision judgement " ) ; <nl> + DEFINE_double ( <nl> + static_decision_stop_buffer , 0 . 5 , <nl> + " added distance to vehicle width for static decision collision judgement " ) ; <nl> DEFINE_double ( dynamic_decision_follow_range , 1 . 0 , <nl> " threshold for judging follow in dp path computing decision for " <nl> " static obstacles " ) ; <nl> DEFINE_double ( nudge_distance_obstacle , 0 . 3 , <nl> " minimum distance to nudge a obstacle ( meters ) " ) ; <nl> DEFINE_double ( follow_min_distance , 3 , <nl> " min follow distance for vehicles / bicycles / moving objects " ) ; <nl> + DEFINE_double ( st_follow_max_start_t , 1 . 0 , <nl> + " A threshold to judge whether we should issue a follow decision " <nl> + " instead of yield decision . To issue a follow decision , " <nl> + " the obstacle ' s t in S - T boundary must be smaller or equal to " <nl> + " this value . Unit : seconds " ) ; <nl> + DEFINE_double ( st_follow_min_end_t , 3 . 0 , <nl> + " A threshold to judge whether we should issue a follow decision " <nl> + " instead of yield decision . To issue a follow decision , " <nl> + " the obstacle ' s t in S - T boundary must be larger or equal to " <nl> + " this value . Unit : seconds " ) ; <nl> <nl> / / Prediction Part <nl> <nl> mmm a / modules / planning / common / planning_gflags . h <nl> ppp b / modules / planning / common / planning_gflags . h <nl> DECLARE_double ( nudge_distance_vehicle ) ; <nl> DECLARE_double ( nudge_distance_bicycle ) ; <nl> DECLARE_double ( nudge_distance_obstacle ) ; <nl> DECLARE_double ( follow_min_distance ) ; <nl> + DECLARE_double ( st_follow_max_start_t ) ; <nl> + DECLARE_double ( st_follow_min_end_t ) ; <nl> <nl> / / Predeciton Part <nl> DECLARE_int32 ( adc_id ) ; <nl> mmm a / modules / planning / optimizer / dp_st_speed / dp_st_graph . cc <nl> ppp b / modules / planning / optimizer / dp_st_speed / dp_st_graph . cc <nl> <nl> <nl> # include " modules / common / log . h " <nl> # include " modules / common / proto / pnc_point . pb . h " <nl> + # include " modules / planning / common / planning_gflags . h " <nl> # include " modules / planning / math / double . h " <nl> <nl> namespace apollo { <nl> using apollo : : common : : ErrorCode ; <nl> using apollo : : common : : SpeedPoint ; <nl> using apollo : : common : : Status ; <nl> <nl> - DpStGraph : : DpStGraph ( const DpStSpeedConfig & dp_config ) <nl> - : dp_st_speed_config_ ( dp_config ) , dp_st_cost_ ( dp_config ) { } <nl> + DpStGraph : : DpStGraph ( const DpStSpeedConfig & dp_config , <nl> + const PathData & path_data ) <nl> + : dp_st_speed_config_ ( dp_config ) , <nl> + path_data_ ( path_data ) , <nl> + dp_st_cost_ ( dp_config ) { } <nl> <nl> Status DpStGraph : : Search ( const StGraphData & st_graph_data , <nl> PathDecision * const path_decision , <nl> Status DpStGraph : : get_object_decision ( const StGraphData & st_graph_data , <nl> boundary_it - > GetBoundaryTimeScope ( & start_t , & end_t ) ; <nl> <nl> bool go_down = true ; <nl> + double min_t = speed_points . front ( ) . t ( ) ; <nl> + double max_t = speed_points . front ( ) . t ( ) ; <nl> for ( std : : vector < SpeedPoint > : : const_iterator st_it = speed_points . begin ( ) ; <nl> st_it ! = speed_points . end ( ) ; + + st_it ) { <nl> + min_t = std : : min ( min_t , st_it - > t ( ) ) ; <nl> + max_t = std : : max ( max_t , st_it - > t ( ) ) ; <nl> if ( st_it - > t ( ) < start_t ) { <nl> continue ; <nl> } <nl> Status DpStGraph : : get_object_decision ( const StGraphData & st_graph_data , <nl> } <nl> } <nl> if ( go_down ) { <nl> - ObjectDecisionType yield_decision ; <nl> - yield_decision . mutable_yield ( ) ; <nl> - if ( ! path_decision - > AddDecision ( " dp_st_graph " , boundary_it - > id ( ) , <nl> - yield_decision ) ) { <nl> - AERROR < < " Failed to add yield decision to object " <nl> - < < boundary_it - > id ( ) ; <nl> - return Status ( ErrorCode : : PLANNING_ERROR , " faind to add yield decision " ) ; <nl> + if ( CheckIsFollowByT ( * boundary_it ) ) { <nl> + ObjectDecisionType follow_decision ; <nl> + if ( ! CreateFollowDecision ( * boundary_it , & follow_decision ) ) { <nl> + AERROR < < " Failed to create follow decision for boundary with id " <nl> + < < boundary_it - > id ( ) ; <nl> + return Status ( ErrorCode : : PLANNING_ERROR , <nl> + " faind to create follow decision " ) ; <nl> + } <nl> + if ( ! path_decision - > AddDecision ( " dp_st_graph " , boundary_it - > id ( ) , <nl> + follow_decision ) ) { <nl> + AERROR < < " Failed to add follow decision to object " <nl> + < < boundary_it - > id ( ) ; <nl> + return Status ( ErrorCode : : PLANNING_ERROR , <nl> + " faind to add follow decision " ) ; <nl> + } <nl> + } else { <nl> + ObjectDecisionType yield_decision ; <nl> + yield_decision . mutable_yield ( ) ; <nl> + / / TODO ( all ) set yield point here . <nl> + if ( ! path_decision - > AddDecision ( " dp_st_graph " , boundary_it - > id ( ) , <nl> + yield_decision ) ) { <nl> + AERROR < < " Failed to add yield decision to object " <nl> + < < boundary_it - > id ( ) ; <nl> + return Status ( ErrorCode : : PLANNING_ERROR , <nl> + " faind to add yield decision " ) ; <nl> + } <nl> } <nl> } else { <nl> ObjectDecisionType overtake_decision ; <nl> Status DpStGraph : : get_object_decision ( const StGraphData & st_graph_data , <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> + bool DpStGraph : : CreateFollowDecision ( <nl> + const StGraphBoundary & boundary , <nl> + ObjectDecisionType * const follow_decision ) const { <nl> + DCHECK_NOTNULL ( follow_decision ) ; <nl> + auto * follow = follow_decision - > mutable_follow ( ) ; <nl> + const double follow_distance_s = - 1 . 0 * boundary . characteristic_length ( ) ; <nl> + follow - > set_distance_s ( follow_distance_s ) ; <nl> + const double reference_line_fence_s = <nl> + boundary . path_obstacle ( ) - > sl_boundary ( ) . start_s ( ) + follow_distance_s ; <nl> + common : : PathPoint path_point ; <nl> + if ( ! path_data_ . get_path_point_with_ref_s ( reference_line_fence_s , <nl> + & path_point ) ) { <nl> + AERROR < < " Failed to get path point from reference line s " <nl> + < < reference_line_fence_s ; <nl> + return false ; <nl> + } <nl> + auto * follow_point = follow - > mutable_follow_point ( ) ; <nl> + follow_point - > set_x ( path_point . x ( ) ) ; <nl> + follow_point - > set_y ( path_point . y ( ) ) ; <nl> + follow_point - > set_z ( 0 . 0 ) ; <nl> + return true ; <nl> + } <nl> + <nl> double DpStGraph : : CalculateEdgeCost ( const STPoint & first , const STPoint & second , <nl> const STPoint & third , const STPoint & forth , <nl> const double speed_limit ) const { <nl> double DpStGraph : : CalculateEdgeCostForThirdCol ( const uint32_t curr_row , <nl> dp_st_cost_ . GetJerkCostByThreePoints ( init_speed , first , second , third ) ; <nl> } <nl> <nl> + bool DpStGraph : : CheckIsFollowByT ( const StGraphBoundary & boundary ) const { <nl> + return boundary . min_t ( ) < FLAGS_st_follow_max_start_t & & <nl> + boundary . max_t ( ) > FLAGS_st_follow_min_end_t ; <nl> + } <nl> + <nl> } / / namespace planning <nl> } / / namespace apollo <nl> mmm a / modules / planning / optimizer / dp_st_speed / dp_st_graph . h <nl> ppp b / modules / planning / optimizer / dp_st_speed / dp_st_graph . h <nl> namespace planning { <nl> <nl> class DpStGraph { <nl> public : <nl> - explicit DpStGraph ( const DpStSpeedConfig & dp_config ) ; <nl> + DpStGraph ( const DpStSpeedConfig & dp_config , const PathData & path_data ) ; <nl> <nl> apollo : : common : : Status Search ( const StGraphData & st_graph_data , <nl> PathDecision * const path_decision , <nl> class DpStGraph { <nl> uint32_t * const lower_bound , <nl> uint32_t * const upper_bound ) const ; <nl> <nl> + / * * <nl> + * @ brief check if the ADC should follow an obstacle by examing the <nl> + * StGraphBoundary of the obstacle . <nl> + * @ param boundary The boundary of the obstacle . <nl> + * @ return true if the ADC believe it should follow the obstacle , and <nl> + * false otherwise . <nl> + * * / <nl> + bool CheckIsFollowByT ( const StGraphBoundary & boundary ) const ; <nl> + <nl> + / * * <nl> + * @ brief create follow decision based on the boundary <nl> + * @ return true if the follow decision is created successfully , and <nl> + * false otherwise . <nl> + * * / <nl> + bool CreateFollowDecision ( const StGraphBoundary & boundary , <nl> + ObjectDecisionType * const follow_decision ) const ; <nl> + <nl> private : <nl> / / dp st configuration <nl> DpStSpeedConfig dp_st_speed_config_ ; <nl> <nl> + const PathData & path_data_ ; <nl> + <nl> / / cost utility with configuration ; <nl> DpStCost dp_st_cost_ ; <nl> <nl> mmm a / modules / planning / optimizer / dp_st_speed / dp_st_graph_test . cc <nl> ppp b / modules / planning / optimizer / dp_st_speed / dp_st_graph_test . cc <nl> class DpStSpeedTest : public PlanningTestBase { <nl> <nl> FrenetFramePath path ( points ) ; <nl> path_data_ . set_frenet_path ( path ) ; <nl> + path_data_ . set_reference_line ( reference_line_ ) ; <nl> } <nl> <nl> virtual void SetUp ( ) { <nl> google : : InitGoogleLogging ( " DpStSpeedTest " ) ; <nl> PlanningTestBase : : SetUp ( ) ; <nl> - SetPathDataWithStraightLine ( ) ; <nl> const auto * frame = planning_ . GetFrame ( ) ; <nl> reference_line_ = & ( frame - > reference_line ( ) ) ; <nl> + SetPathDataWithStraightLine ( ) ; <nl> } <nl> <nl> protected : <nl> class DpStSpeedTest : public PlanningTestBase { <nl> <nl> TEST_F ( DpStSpeedTest , dp_st_graph_test ) { <nl> DpStSpeedConfig dp_st_speed_config ; <nl> - DpStGraph dp_st_graph ( dp_st_speed_config ) ; <nl> + DpStGraph dp_st_graph ( dp_st_speed_config , path_data_ ) ; <nl> } <nl> <nl> } / / namespace planning <nl> mmm a / modules / planning / optimizer / dp_st_speed / dp_st_speed_optimizer . cc <nl> ppp b / modules / planning / optimizer / dp_st_speed / dp_st_speed_optimizer . cc <nl> Status DpStSpeedOptimizer : : Process ( const PathData & path_data , <nl> return Status ( ErrorCode : : PLANNING_ERROR , " Not inited . " ) ; <nl> } <nl> <nl> - StBoundaryMapper boundary_mapper ( st_boundary_config_ , <nl> - reference_line , <nl> + StBoundaryMapper boundary_mapper ( st_boundary_config_ , reference_line , <nl> path_data , <nl> dp_st_speed_config_ . total_path_length ( ) , <nl> dp_st_speed_config_ . total_time ( ) ) ; <nl> Status DpStSpeedOptimizer : : Process ( const PathData & path_data , <nl> const double path_length = path_data . discretized_path ( ) . length ( ) ; <nl> StGraphData st_graph_data ( boundaries , init_point , speed_limit , path_length ) ; <nl> <nl> - DpStGraph st_graph ( dp_st_speed_config_ ) ; <nl> + DpStGraph st_graph ( dp_st_speed_config_ , path_data ) ; <nl> if ( ! st_graph . Search ( st_graph_data , path_decision , speed_data ) . ok ( ) ) { <nl> const std : : string msg = " Failed to search graph with dynamic programming . " ; <nl> AERROR < < msg ; <nl>
planning : added code to make follow decision in dp_st_speed
ApolloAuto/apollo
fd07488c1a46da5954457b70896cc0a05167c120
2017-08-08T05:59:55Z
mmm a / include / swift / IRGen / Linking . h <nl> ppp b / include / swift / IRGen / Linking . h <nl> class ApplyIRLinkage { <nl> public : <nl> ApplyIRLinkage ( IRLinkage IRL ) : IRL ( IRL ) { } <nl> void to ( llvm : : GlobalValue * GV ) const { <nl> + llvm : : Module * M = GV - > getParent ( ) ; <nl> + const llvm : : Triple Triple ( M - > getTargetTriple ( ) ) ; <nl> + <nl> GV - > setLinkage ( IRL . Linkage ) ; <nl> GV - > setVisibility ( IRL . Visibility ) ; <nl> - GV - > setDLLStorageClass ( IRL . DLLStorage ) ; <nl> - <nl> - if ( IRL . Linkage = = llvm : : GlobalValue : : LinkOnceODRLinkage | | <nl> - IRL . Linkage = = llvm : : GlobalValue : : WeakODRLinkage ) { <nl> - llvm : : Module * M = GV - > getParent ( ) ; <nl> - const llvm : : Triple Triple ( M - > getTargetTriple ( ) ) ; <nl> + if ( Triple . isOSBinFormatCOFF ( ) & & ! Triple . isOSCygMing ( ) ) <nl> + GV - > setDLLStorageClass ( IRL . DLLStorage ) ; <nl> <nl> - / / TODO : BFD and gold do not handle COMDATs properly <nl> - if ( Triple . isOSBinFormatELF ( ) ) <nl> - return ; <nl> + / / TODO : BFD and gold do not handle COMDATs properly <nl> + if ( Triple . isOSBinFormatELF ( ) ) <nl> + return ; <nl> <nl> + if ( IRL . Linkage = = llvm : : GlobalValue : : LinkOnceODRLinkage | | <nl> + IRL . Linkage = = llvm : : GlobalValue : : WeakODRLinkage ) <nl> if ( Triple . supportsCOMDAT ( ) ) <nl> if ( llvm : : GlobalObject * GO = dyn_cast < llvm : : GlobalObject > ( GV ) ) <nl> GO - > setComdat ( M - > getOrInsertComdat ( GV - > getName ( ) ) ) ; <nl> - } <nl> } <nl> } ; <nl> <nl>
IRGen : only apply DLLStorage if appropriate
apple/swift
e187c6584e676bc151eff9208e7d97968ca66cf4
2019-01-04T18:39:03Z
mmm a / fdbserver / OldTLogServer_6_0 . actor . cpp <nl> ppp b / fdbserver / OldTLogServer_6_0 . actor . cpp <nl> ACTOR Future < Void > tLogCommit ( <nl> wait ( delayJittered ( . 005 , TaskTLogCommit ) ) ; <nl> } <nl> <nl> - if ( logData - > stopped ) { <nl> - req . reply . sendError ( tlog_stopped ( ) ) ; <nl> - return Void ( ) ; <nl> - } <nl> - <nl> / / while exec op is being committed , no new transactions will be admitted . <nl> / / This property is useful for snapshot kind of operations which wants to <nl> / / take a snap of the disk image at a particular version ( no data from <nl> ACTOR Future < Void > tLogCommit ( <nl> execOpLockTaken = true ; <nl> } <nl> <nl> + if ( logData - > stopped ) { <nl> + req . reply . sendError ( tlog_stopped ( ) ) ; <nl> + return Void ( ) ; <nl> + } <nl> + <nl> state Version execVersion = invalidVersion ; <nl> state ExecCmdValueString execArg ( ) ; <nl> state TLogQueueEntryRef qe ; <nl> mmm a / fdbserver / TLogServer . actor . cpp <nl> ppp b / fdbserver / TLogServer . actor . cpp <nl> ACTOR Future < Void > tLogCommit ( <nl> wait ( delayJittered ( . 005 , TaskTLogCommit ) ) ; <nl> } <nl> <nl> - if ( logData - > stopped ) { <nl> - req . reply . sendError ( tlog_stopped ( ) ) ; <nl> - return Void ( ) ; <nl> - } <nl> - <nl> / / while exec op is being committed , no new transactions will be admitted . <nl> / / This property is useful for snapshot kind of operations which wants to <nl> / / take a snap of the disk image at a particular version ( not data from <nl> ACTOR Future < Void > tLogCommit ( <nl> execOpLockTaken = true ; <nl> } <nl> <nl> + if ( logData - > stopped ) { <nl> + req . reply . sendError ( tlog_stopped ( ) ) ; <nl> + return Void ( ) ; <nl> + } <nl> + <nl> state Version execVersion = invalidVersion ; <nl> state ExecCmdValueString execArg ( ) ; <nl> state TLogQueueEntryRef qe ; <nl>
logData - > stop check right after execOpHold wait
apple/foundationdb
b1b96946afe7033f3ebc7e0280923e1ba185481f
2019-05-29T05:07:46Z
mmm a / tensorflow / contrib / tensorrt / convert / convert_nodes . cc <nl> ppp b / tensorflow / contrib / tensorrt / convert / convert_nodes . cc <nl> tensorflow : : Status ConvertSqueeze ( OpConverterParams * params ) { <nl> tensorflow : : Status GetStridedSliceBound ( const std : : vector < int > & input_dims , <nl> const TRT_ShapedWeights & bound_weights , <nl> string bound_name , string node_name , <nl> - std : : vector < int > & output_bound ) { <nl> - const int * weights_ptr = <nl> - static_cast < int * > ( const_cast < void * > ( bound_weights . GetValues ( ) ) ) ; <nl> - output_bound = <nl> + std : : vector < int > * output_bound ) { <nl> + const int * weights_ptr = static_cast < int * > ( bound_weights . GetValues ( ) ) ; <nl> + * output_bound = <nl> std : : vector < int > ( weights_ptr , weights_ptr + bound_weights . count ( ) ) ; <nl> - if ( output_bound . size ( ) ! = input_dims . size ( ) ) { <nl> + if ( output_bound - > size ( ) ! = input_dims . size ( ) ) { <nl> return tensorflow : : errors : : InvalidArgument ( <nl> " StridedSlice \ " " , bound_name , " \ " specified " , <nl> - std : : to_string ( output_bound . size ( ) ) , " dimensions , but input rank is " , <nl> + std : : to_string ( output_bound - > size ( ) ) , " dimensions , but input rank is " , <nl> std : : to_string ( input_dims . size ( ) ) , " , at " , node_name ) ; <nl> } <nl> - for ( int i = 0 ; i < output_bound . size ( ) ; i + + ) { <nl> + for ( int i = 0 ; i < output_bound - > size ( ) ; i + + ) { <nl> / / Make sure bound is valid . <nl> - if ( ( output_bound [ i ] < - input_dims [ i ] ) | | <nl> - ( output_bound [ i ] > input_dims [ i ] ) ) { <nl> + if ( ( ( * output_bound ) [ i ] < - input_dims [ i ] ) | | <nl> + ( ( * output_bound ) [ i ] > input_dims [ i ] ) ) { <nl> return tensorflow : : errors : : InvalidArgument ( <nl> bound_name , <nl> - " for StridedSlice is invalid , must be in the range " <nl> - " [ - rank ( input ) , rank ( input ) ] , at " , <nl> + " value for StridedSlice is invalid , must be in the range " <nl> + " [ - dim_size ( i ) , dim_size ( i ) ] , at " , <nl> node_name ) ; <nl> } <nl> / / Convert negative values to their positive equivalent . <nl> - if ( output_bound [ i ] < 0 ) { <nl> - output_bound [ i ] + = input_dims [ i ] ; <nl> + if ( ( * output_bound ) [ i ] < 0 ) { <nl> + ( * output_bound ) [ i ] + = input_dims [ i ] ; <nl> } <nl> } <nl> return tensorflow : : Status : : OK ( ) ; <nl> tensorflow : : Status ConvertStridedSlice ( OpConverterParams * params ) { <nl> / / Get begin and end bounds per axis . <nl> std : : vector < int > begin , end ; <nl> TF_RETURN_IF_ERROR ( GetStridedSliceBound ( input_dims , inputs . at ( 1 ) . weights ( ) , <nl> - " begin " , node_def . name ( ) , begin ) ) ; <nl> + " begin " , node_def . name ( ) , & begin ) ) ; <nl> TF_RETURN_IF_ERROR ( GetStridedSliceBound ( input_dims , inputs . at ( 2 ) . weights ( ) , <nl> - " end " , node_def . name ( ) , end ) ) ; <nl> + " end " , node_def . name ( ) , & end ) ) ; <nl> int begin_mask = attrs . get < int > ( " begin_mask " ) ; <nl> for ( int i = 0 ; i < begin . size ( ) ; i + + ) { <nl> if ( ( 1 < < i ) & begin_mask ) { <nl> tensorflow : : Status ConvertStridedSlice ( OpConverterParams * params ) { <nl> } <nl> / / Get strides per axis ( must all be 1 ) . <nl> TRT_ShapedWeights stride_weights = inputs . at ( 3 ) . weights ( ) ; <nl> - const int * stride_weights_ptr = <nl> - static_cast < int * > ( const_cast < void * > ( stride_weights . GetValues ( ) ) ) ; <nl> + const int * stride_weights_ptr = static_cast < int * > ( stride_weights . GetValues ( ) ) ; <nl> std : : vector < int > strides ( stride_weights_ptr , <nl> stride_weights_ptr + stride_weights . count ( ) ) ; <nl> for ( int x : strides ) { <nl> tensorflow : : Status ConvertStridedSlice ( OpConverterParams * params ) { <nl> } <nl> } <nl> / / Unsupported mask options . <nl> - for ( string attr : { " ellipsis_mask " , " new_axis_mask " , " shrink_axis_mask " } ) { <nl> + for ( const string & attr : <nl> + { " ellipsis_mask " , " new_axis_mask " , " shrink_axis_mask " } ) { <nl> int attr_val = attrs . get < int > ( attr ) ; <nl> if ( attr_val ! = 0 ) { <nl> return tensorflow : : errors : : Unimplemented ( <nl> - attr , " is not implemented for StridedSlice , at " , node_def . name ( ) ) ; <nl> + attr , " is not supported for StridedSlice , at " , node_def . name ( ) ) ; <nl> } <nl> } <nl> <nl> nvinfer1 : : ITensor * tensor = <nl> const_cast < nvinfer1 : : ITensor * > ( inputs . at ( 0 ) . tensor ( ) ) ; <nl> - / / Reshape if necessary to 4 - D . <nl> + / / Reshape if necessary to 4 - D , since IPaddingLayer requires a 4 - D input . <nl> const bool need_reshape = ( input_dims . size ( ) ! = 4 ) ; <nl> int reshape_dims_added = 0 ; <nl> nvinfer1 : : Dims reshape_dims ; <nl> tensorflow : : Status ConvertStridedSlice ( OpConverterParams * params ) { <nl> / / Find dimensions which need to be sliced . <nl> std : : vector < int > pad_dims ; <nl> for ( int i = 0 ; i < input_dims . size ( ) ; i + + ) { <nl> - if ( begin [ i ] ! = 0 | | ( end [ i ] - input_dims [ i ] ) ! = 0 ) { <nl> + if ( ( begin [ i ] ! = 0 ) | | ( end [ i ] ! = input_dims [ i ] ) ) { <nl> if ( i = = 0 ) { <nl> return tensorflow : : errors : : Unimplemented ( <nl> " StridedSlice can ' t modify batch dim , at " , node_def . name ( ) ) ; <nl> tensorflow : : Status ConvertStridedSlice ( OpConverterParams * params ) { <nl> return tensorflow : : Status : : OK ( ) ; <nl> } else if ( pad_dims . size ( ) = = 1 ) { <nl> / / Only one dim is modified but we have to have 2 , mark a second dim which <nl> - / / will have padding of 0 . <nl> - if ( pad_dims [ 0 ] = = 1 | | pad_dims [ 0 ] = = 3 ) { <nl> + / / will have padding of 0 . The dim we add is chosen to avoid an unecessary <nl> + / / transpose . <nl> + if ( pad_dims [ 0 ] ! = 2 ) { <nl> pad_dims . push_back ( 2 ) ; <nl> - } else if ( pad_dims [ 0 ] = = 2 ) { <nl> + } else { <nl> pad_dims . push_back ( 3 ) ; <nl> } <nl> } else if ( pad_dims . size ( ) > 2 ) { <nl> tensorflow : : Status ConvertStridedSlice ( OpConverterParams * params ) { <nl> " StridedSlice can only modify 2 dimensions , at " , node_def . name ( ) ) ; <nl> } <nl> std : : sort ( pad_dims . begin ( ) , pad_dims . end ( ) ) ; <nl> - / / Convert to pre / post padding values . <nl> + / / Convert to pre / post padding values . Since TRT does not have a StridedSlice <nl> + / / or Slice layer , we instead create an IPaddingLayer with negative padding . <nl> nvinfer1 : : DimsHW pre_padding , post_padding ; <nl> for ( int i = 0 ; i < pad_dims . size ( ) ; i + + ) { <nl> const int axis = pad_dims [ i ] ; <nl> mmm a / tensorflow / contrib / tensorrt / convert / convert_nodes_test . cc <nl> ppp b / tensorflow / contrib / tensorrt / convert / convert_nodes_test . cc <nl> TEST_F ( OpConverterTest , ConvertStridedSlice ) { <nl> } <nl> <nl> / / Get nodedef for StridedSlice layer . <nl> - auto get_strided_slice_nodedef = [ ] ( int begin_mask = 0 , int ellipsis_mask = 0 , <nl> - int end_mask = 0 , int new_axis_mask = 0 , <nl> + auto get_strided_slice_nodedef = [ ] ( int begin_mask = 0 , int end_mask = 0 , <nl> + int ellipsis_mask = 0 , <nl> + int new_axis_mask = 0 , <nl> int shrink_axis_mask = 0 ) - > NodeDef { <nl> Scope s = Scope : : NewRootScope ( ) ; <nl> auto input = ops : : Placeholder ( s . WithOpName ( " input " ) , DT_FLOAT ) ; <nl> auto begin = ops : : Placeholder ( s . WithOpName ( " begin " ) , DT_INT32 ) ; <nl> auto end = ops : : Placeholder ( s . WithOpName ( " end " ) , DT_INT32 ) ; <nl> auto strides = ops : : Placeholder ( s . WithOpName ( " strides " ) , DT_INT32 ) ; <nl> - ops : : StridedSlice : : Attrs strided_slice_attrs ; <nl> - strided_slice_attrs . begin_mask_ = begin_mask ; <nl> - strided_slice_attrs . ellipsis_mask_ = ellipsis_mask ; <nl> - strided_slice_attrs . end_mask_ = end_mask ; <nl> - strided_slice_attrs . new_axis_mask_ = new_axis_mask ; <nl> - strided_slice_attrs . shrink_axis_mask_ = shrink_axis_mask ; <nl> + ops : : StridedSlice : : Attrs attrs = ops : : StridedSlice : : Attrs ( ) <nl> + . BeginMask ( begin_mask ) . EndMask ( end_mask ) . EllipsisMask ( ellipsis_mask ) <nl> + . NewAxisMask ( new_axis_mask ) . ShrinkAxisMask ( shrink_axis_mask ) ; <nl> auto strided_slice = <nl> ops : : StridedSlice ( s . WithOpName ( " my_strided_slice " ) , input , begin , end , <nl> - strides , strided_slice_attrs ) ; <nl> + strides , attrs ) ; <nl> return strided_slice . operation . node ( ) - > def ( ) ; <nl> } ; <nl> <nl> TEST_F ( OpConverterTest , ConvertStridedSlice ) { <nl> / / Non - zero ellipsis_mask , should fail . <nl> Reset ( ) ; <nl> NodeDef node_def = get_strided_slice_nodedef ( <nl> - / * begin_mask = * / 0 , / * ellipsis_mask = * / 2 , / * end_mask = * / 0 , <nl> + / * begin_mask = * / 0 , / * end_mask = * / 0 , / * ellipsis_mask = * / 2 , <nl> / * new_axis_mask = * / 0 , / * shrink_axis_mask = * / 0 ) ; <nl> AddTestTensor ( " input " , { 1 , 2 , 3 } ) ; <nl> AddTestWeights < int32 > ( " begin " , { 4 } , { 0 , 0 , 0 , 0 } ) ; <nl> TEST_F ( OpConverterTest , ConvertStridedSlice ) { <nl> AddTestWeights < int32 > ( " strides " , { 4 } , { 1 , 1 , 1 , 1 } ) ; <nl> RunValidationAndConversion ( <nl> node_def , error : : UNIMPLEMENTED , <nl> - " ellipsis_mask is not implemented for StridedSlice , at " <nl> - " my_strided_slice " ) ; <nl> - } <nl> - { <nl> - / / Non - zero ellipsis_mask , should fail . <nl> - Reset ( ) ; <nl> - NodeDef node_def = get_strided_slice_nodedef ( <nl> - / * begin_mask = * / 0 , / * ellipsis_mask = * / 0 , / * end_mask = * / 0 , <nl> - / * new_axis_mask = * / 2 , / * shrink_axis_mask = * / 0 ) ; <nl> - AddTestTensor ( " input " , { 1 , 2 , 3 } ) ; <nl> - AddTestWeights < int32 > ( " begin " , { 4 } , { 0 , 0 , 0 , 0 } ) ; <nl> - AddTestWeights < int32 > ( " end " , { 4 } , { 1 , 1 , 2 , 3 } ) ; <nl> - AddTestWeights < int32 > ( " strides " , { 4 } , { 1 , 1 , 1 , 1 } ) ; <nl> - RunValidationAndConversion ( <nl> - node_def , error : : UNIMPLEMENTED , <nl> - " new_axis_mask is not implemented for StridedSlice , at " <nl> - " my_strided_slice " ) ; <nl> - } <nl> - { <nl> - / / Non - zero shrink_axis_mask , should fail . <nl> - Reset ( ) ; <nl> - NodeDef node_def = get_strided_slice_nodedef ( <nl> - / * begin_mask = * / 0 , / * ellipsis_mask = * / 0 , / * end_mask = * / 0 , <nl> - / * new_axis_mask = * / 0 , / * shrink_axis_mask = * / 2 ) ; <nl> - AddTestTensor ( " input " , { 1 , 2 , 3 } ) ; <nl> - AddTestWeights < int32 > ( " begin " , { 4 } , { 0 , 0 , 0 , 0 } ) ; <nl> - AddTestWeights < int32 > ( " end " , { 4 } , { 1 , 1 , 2 , 3 } ) ; <nl> - AddTestWeights < int32 > ( " strides " , { 4 } , { 1 , 1 , 1 , 1 } ) ; <nl> - RunValidationAndConversion ( <nl> - node_def , error : : UNIMPLEMENTED , <nl> - " shrink_axis_mask is not implemented for StridedSlice , at " <nl> + " ellipsis_mask is not supported for StridedSlice , at " <nl> " my_strided_slice " ) ; <nl> } <nl> { <nl> TEST_F ( OpConverterTest , ConvertStridedSlice ) { <nl> AddTestWeights < int32 > ( " strides " , { 4 } , { 1 , 1 , 1 , 1 } ) ; <nl> RunValidationAndConversion ( <nl> node_def , error : : INVALID_ARGUMENT , <nl> - " begin for StridedSlice is invalid , must be in the range " <nl> - " [ - rank ( input ) , rank ( input ) ] , at my_strided_slice " ) ; <nl> + " begin value for StridedSlice is invalid , must be in the range " <nl> + " [ - dim_size ( i ) , dim_size ( i ) ] , at my_strided_slice " ) ; <nl> } <nl> { <nl> / / End out of bounds , should fail . <nl> TEST_F ( OpConverterTest , ConvertStridedSlice ) { <nl> AddTestWeights < int32 > ( " strides " , { 4 } , { 1 , 1 , 1 , 1 } ) ; <nl> RunValidationAndConversion ( <nl> node_def , error : : INVALID_ARGUMENT , <nl> - " end for StridedSlice is invalid , must be in the range " <nl> - " [ - rank ( input ) , rank ( input ) ] , at my_strided_slice " ) ; <nl> + " end value for StridedSlice is invalid , must be in the range " <nl> + " [ - dim_size ( i ) , dim_size ( i ) ] , at my_strided_slice " ) ; <nl> } <nl> { <nl> / / Size of sliced dim is negative , should fail . <nl> TEST_F ( OpConverterTest , ConvertStridedSlice ) { <nl> <nl> for ( int i = 0 ; i < kStridedSliceOKCases ; i + + ) { <nl> Reset ( ) ; <nl> - NodeDef node_def = get_strided_slice_nodedef ( ok_params [ i ] . begin_mask , 0 , <nl> + NodeDef node_def = get_strided_slice_nodedef ( ok_params [ i ] . begin_mask , <nl> ok_params [ i ] . end_mask ) ; <nl> AddTestTensor ( " input " , ok_params [ i ] . input_dims ) ; <nl> AddTestWeights < int32 > ( " begin " , { ok_params [ i ] . begin . size ( ) } , <nl>
Apply smit - hinsu ' s suggestions
tensorflow/tensorflow
296b83f13346fb70fc7ee70ae256b96a6366896a
2018-12-13T00:50:45Z
mmm a / tests / integration / WatchmanTestCase . py <nl> ppp b / tests / integration / WatchmanTestCase . py <nl> def __init__ ( self , methodName = " run " ) : <nl> self . attempt = 0 <nl> # ASAN - enabled builds can be slower enough that we hit timeouts <nl> # with the default of 1 second <nl> - self . socketTimeout = 10 . 0 <nl> + self . socketTimeout = 20 . 0 <nl> <nl> def requiresPersistentSession ( self ) : <nl> return False <nl> def _waitForCheck ( self , cond , res_check , timeout ) : <nl> # is reached . Returns a tuple of [ bool , result ] where the <nl> # first element of the tuple indicates success / failure and <nl> # the second element is the return value from the condition <nl> - def waitFor ( self , cond , timeout = 10 ) : <nl> + def waitFor ( self , cond , timeout = None ) : <nl> + timeout = self . getTimeout ( timeout ) <nl> return self . _waitForCheck ( cond , lambda res : res , timeout ) <nl> <nl> - def waitForEqual ( self , expected , actual_cond , timeout = 10 ) : <nl> + def waitForEqual ( self , expected , actual_cond , timeout = None ) : <nl> + timeout = self . getTimeout ( timeout ) <nl> return self . _waitForCheck ( actual_cond , lambda res : res = = expected , timeout ) <nl> <nl> - def assertWaitFor ( self , cond , timeout = 10 , message = None ) : <nl> + def getTimeout ( self , timeout = None ) : <nl> + return timeout or self . socketTimeout <nl> + <nl> + def assertWaitFor ( self , cond , timeout = None , message = None ) : <nl> + timeout = self . getTimeout ( timeout ) <nl> status , res = self . waitFor ( cond , timeout ) <nl> if status : <nl> return res <nl> def assertWaitFor ( self , cond , timeout = 10 , message = None ) : <nl> message = " % s was not met in % s seconds : % s " % ( cond , timeout , res ) <nl> self . fail ( message ) <nl> <nl> - def assertWaitForEqual ( self , expected , actual_cond , timeout = 10 , message = None ) : <nl> + def assertWaitForEqual ( self , expected , actual_cond , timeout = None , message = None ) : <nl> + timeout = self . getTimeout ( timeout ) <nl> status , res = self . waitForEqual ( expected , actual_cond , timeout ) <nl> if status : <nl> return res <nl> def assertWatchListContains ( self , roots , message = None ) : <nl> ) <nl> self . assertFileListContains ( self . last_root_list , roots , message ) <nl> <nl> - def waitForSub ( self , name , root , accept = None , timeout = 10 , remove = True ) : <nl> + def waitForSub ( self , name , root , accept = None , timeout = None , remove = True ) : <nl> + timeout = self . getTimeout ( timeout ) <nl> client = self . getClient ( ) <nl> <nl> def default_accept ( dat ) : <nl>
watchman : increase test timeout in debug builds
facebook/watchman
e1df3f46e0f25f17e1ad6ea15ed1dd91300ac5cc
2020-12-04T23:59:49Z
mmm a / src / db . cpp <nl> ppp b / src / db . cpp <nl> CDB : : CDB ( const char * pszFile , const char * pszMode ) : <nl> { <nl> delete pdb ; <nl> pdb = NULL ; <nl> - { <nl> - LOCK ( bitdb . cs_db ) ; <nl> - - - bitdb . mapFileUseCount [ strFile ] ; <nl> - } <nl> + - - bitdb . mapFileUseCount [ strFile ] ; <nl> strFile = " " ; <nl> throw runtime_error ( strprintf ( " CDB ( ) : can ' t open database file % s , error % d " , pszFile , ret ) ) ; <nl> } <nl>
Removed duplicated lock
bitcoin/bitcoin
028ec224b8acb9273e79c1c10c5278a102e3f305
2012-08-27T12:08:20Z
mmm a / modules / java / test / src / org / opencv / test / OpenCVTestRunner . java <nl> ppp b / modules / java / test / src / org / opencv / test / OpenCVTestRunner . java <nl> <nl> <nl> import java . io . File ; <nl> import java . io . IOException ; <nl> - import junit . framework . Assert ; <nl> <nl> import org . opencv . core . Mat ; <nl> <nl>
Merge pull request from SpecLad : java - deprecated - assert
opencv/opencv
b420c0b160c732cbf361f5d285caf2919ed709ca
2013-10-15T14:36:15Z
mmm a / src / global - handles . cc <nl> ppp b / src / global - handles . cc <nl> EternalHandles : : EternalHandles ( ) : size_ ( 0 ) { <nl> <nl> <nl> EternalHandles : : ~ EternalHandles ( ) { <nl> - for ( int i = 0 ; i < blocks_ . length ( ) ; i + + ) delete blocks_ [ i ] ; <nl> + for ( int i = 0 ; i < blocks_ . length ( ) ; i + + ) delete [ ] blocks_ [ i ] ; <nl> } <nl> <nl> <nl>
delete eternal handle blocks correctly
v8/v8
982fa4d3819b312ba929cc2913d79024c7425f8a
2013-08-06T06:34:54Z
mmm a / tensorflow / lite / experimental / micro / kernels / floor_test . cc <nl> ppp b / tensorflow / lite / experimental / micro / kernels / floor_test . cc <nl> namespace tflite { <nl> namespace testing { <nl> namespace { <nl> <nl> - void TestFloor ( std : : initializer_list < int > input_dims_data , <nl> - std : : initializer_list < float > input_data , <nl> - std : : initializer_list < float > expected_output_data , <nl> - std : : initializer_list < int > output_dims_data , <nl> + void TestFloor ( const int * input_dims_data , const float * input_data , <nl> + const float * expected_output_data , const int * output_dims_data , <nl> float * output_data ) { <nl> - TfLiteIntArray * input_dims = IntArrayFromInitializer ( input_dims_data ) ; <nl> - TfLiteIntArray * output_dims = IntArrayFromInitializer ( output_dims_data ) ; <nl> + TfLiteIntArray * input_dims = IntArrayFromInts ( input_dims_data ) ; <nl> + TfLiteIntArray * output_dims = IntArrayFromInts ( output_dims_data ) ; <nl> const int output_dims_count = ElementCount ( * output_dims ) ; <nl> constexpr int inputs_size = 1 ; <nl> constexpr int outputs_size = 1 ; <nl> void TestFloor ( std : : initializer_list < int > input_dims_data , <nl> TfLiteIntArray * inputs_array = IntArrayFromInts ( inputs_array_data ) ; <nl> int outputs_array_data [ ] = { 1 , 1 } ; <nl> TfLiteIntArray * outputs_array = IntArrayFromInts ( outputs_array_data ) ; <nl> - TfLiteIntArray * temporaries_array = IntArrayFromInitializer ( { 0 } ) ; <nl> + int intermediates_array_data [ ] = { 0 } ; <nl> + TfLiteIntArray * temporaries_array = <nl> + IntArrayFromInts ( intermediates_array_data ) ; <nl> TfLiteNode node ; <nl> node . inputs = inputs_array ; <nl> node . outputs = outputs_array ; <nl> void TestFloor ( std : : initializer_list < int > input_dims_data , <nl> TF_LITE_MICRO_EXPECT_NE ( nullptr , registration - > invoke ) ; <nl> TF_LITE_MICRO_EXPECT_EQ ( kTfLiteOk , registration - > invoke ( & context , & node ) ) ; <nl> for ( int i = 0 ; i < output_dims_count ; + + i ) { <nl> - TF_LITE_MICRO_EXPECT_NEAR ( expected_output_data . begin ( ) [ i ] , output_data [ i ] , <nl> - 1e - 5f ) ; <nl> + TF_LITE_MICRO_EXPECT_NEAR ( expected_output_data [ i ] , output_data [ i ] , 1e - 5f ) ; <nl> } <nl> } <nl> <nl> void TestFloor ( std : : initializer_list < int > input_dims_data , <nl> TF_LITE_MICRO_TESTS_BEGIN <nl> <nl> TF_LITE_MICRO_TEST ( FloorOpSingleDimFloat32 ) { <nl> + const int dims [ ] = { 1 , 2 } ; <nl> + const float input [ ] = { 8 . 5f , 0 . 0f } ; <nl> + const float golden [ ] = { 8 , 0 } ; <nl> float output_data [ 2 ] ; <nl> - tflite : : testing : : TestFloor ( / * input_dims_data = * / { 1 , 2 } , <nl> - / * input_data = * / { 8 . 5f , 0 . 0f } , <nl> - / * expected_output_data = * / { 8 , 0 } , <nl> - / * output_dims_data * / { 1 , 2 } , <nl> - / * output_data = * / output_data ) ; <nl> + tflite : : testing : : TestFloor ( dims , input , golden , dims , output_data ) ; <nl> } <nl> <nl> TF_LITE_MICRO_TEST ( FloorOpMultiDimFloat32 ) { <nl> + const int dims [ ] = { 4 , 2 , 1 , 1 , 5 } ; <nl> + const float input [ ] = { 0 . 0001f , 8 . 0001f , 0 . 9999f , 9 . 9999f , 0 . 5f , <nl> + - 0 . 0001f , - 8 . 0001f , - 0 . 9999f , - 9 . 9999f , - 0 . 5f } ; <nl> + const float golden [ ] = { 0 . 0f , 8 . 0f , 0 . 0f , 9 . 0f , 0 . 0f , <nl> + - 1 . 0f , - 9 . 0f , - 1 . 0f , - 10 . 0f , - 1 . 0f } ; <nl> float output_data [ 10 ] ; <nl> - tflite : : testing : : TestFloor ( <nl> - / * input_dims_data = * / { 4 , 2 , 1 , 1 , 5 } , <nl> - / * input_data = * / <nl> - { 0 . 0001f , 8 . 0001f , 0 . 9999f , 9 . 9999f , 0 . 5f , - 0 . 0001f , - 8 . 0001f , - 0 . 9999f , <nl> - - 9 . 9999f , - 0 . 5f } , <nl> - / * expected_output_data = * / <nl> - { 0 . 0f , 8 . 0f , 0 . 0f , 9 . 0f , 0 . 0f , - 1 . 0f , - 9 . 0f , - 1 . 0f , - 10 . 0f , - 1 . 0f } , <nl> - / * output_dims_data = * / { 4 , 2 , 1 , 1 , 5 } , <nl> - / * output_data = * / output_data ) ; <nl> + tflite : : testing : : TestFloor ( dims , input , golden , dims , output_data ) ; <nl> } <nl> <nl> TF_LITE_MICRO_TESTS_END <nl>
Refactor floor test
tensorflow/tensorflow
b02379906be24e6ae1eef0a5bfde2d20be7b4468
2019-10-29T23:16:14Z
mmm a / ChangeLog <nl> ppp b / ChangeLog <nl> <nl> + 2008 - 05 - 13 Tatsuhiro Tsujikawa < tujikawa at rednoah dot com > <nl> + <nl> + Made string literal to static const std : : string <nl> + * src / DHTAbstractMessage . cc <nl> + * src / DHTAnnouncePeerMessage . cc <nl> + * src / DHTAnnouncePeerMessage . h <nl> + * src / DHTAnnouncePeerReplyMessage . cc <nl> + * src / DHTAnnouncePeerReplyMessage . h <nl> + * src / DHTFindNodeMessage . cc <nl> + * src / DHTFindNodeMessage . h <nl> + * src / DHTFindNodeReplyMessage . cc <nl> + * src / DHTFindNodeReplyMessage . h <nl> + * src / DHTGetPeersMessage . cc <nl> + * src / DHTGetPeersMessage . h <nl> + * src / DHTGetPeersReplyMessage . cc <nl> + * src / DHTGetPeersReplyMessage . h <nl> + * src / DHTMessage . cc <nl> + * src / DHTMessage . h <nl> + * src / DHTMessageFactoryImpl . cc <nl> + * src / DHTMessageReceiver . cc <nl> + * src / DHTPingMessage . cc <nl> + * src / DHTPingMessage . h <nl> + * src / DHTPingReplyMessage . cc <nl> + * src / DHTPingReplyMessage . h <nl> + * src / DHTQueryMessage . cc <nl> + * src / DHTQueryMessage . h <nl> + * src / DHTResponseMessage . cc <nl> + * src / DHTResponseMessage . h <nl> + * src / DHTUnknownMessage . cc <nl> + * src / DHTUnknownMessage . h <nl> + <nl> 2008 - 05 - 13 Tatsuhiro Tsujikawa < tujikawa at rednoah dot com > <nl> <nl> Made string literal to static const std : : string <nl> mmm a / src / DHTAbstractMessage . cc <nl> ppp b / src / DHTAbstractMessage . cc <nl> DHTAbstractMessage : : ~ DHTAbstractMessage ( ) { } <nl> std : : string DHTAbstractMessage : : getBencodedMessage ( ) <nl> { <nl> SharedHandle < Dictionary > msg ( new Dictionary ( ) ) ; <nl> - msg - > put ( std : : string ( " t " ) , new Data ( _transactionID ) ) ; <nl> - msg - > put ( std : : string ( " y " ) , new Data ( getType ( ) ) ) ; <nl> + msg - > put ( DHTMessage : : T , new Data ( _transactionID ) ) ; <nl> + msg - > put ( DHTMessage : : Y , new Data ( getType ( ) ) ) ; <nl> fillMessage ( msg . get ( ) ) ; <nl> <nl> BencodeVisitor v ; <nl> mmm a / src / DHTAnnouncePeerMessage . cc <nl> ppp b / src / DHTAnnouncePeerMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTAnnouncePeerMessage : : ANNOUNCE_PEER ( " announce_peer " ) ; <nl> + <nl> + const std : : string DHTAnnouncePeerMessage : : INFO_HASH ( " info_hash " ) ; <nl> + <nl> + const std : : string DHTAnnouncePeerMessage : : PORT ( " port " ) ; <nl> + <nl> + const std : : string DHTAnnouncePeerMessage : : TOKEN ( " token " ) ; <nl> + <nl> DHTAnnouncePeerMessage : : DHTAnnouncePeerMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const unsigned char * infoHash , <nl> void DHTAnnouncePeerMessage : : doReceivedAction ( ) <nl> Dictionary * DHTAnnouncePeerMessage : : getArgument ( ) <nl> { <nl> Dictionary * a = new Dictionary ( ) ; <nl> - a - > put ( " id " , new Data ( reinterpret_cast < const char * > ( _localNode - > getID ( ) ) , <nl> + a - > put ( DHTMessage : : ID , new Data ( reinterpret_cast < const char * > ( _localNode - > getID ( ) ) , <nl> DHT_ID_LENGTH ) ) ; <nl> - a - > put ( " info_hash " , new Data ( reinterpret_cast < const char * > ( _infoHash ) , <nl> + a - > put ( INFO_HASH , new Data ( reinterpret_cast < const char * > ( _infoHash ) , <nl> DHT_ID_LENGTH ) ) ; <nl> - a - > put ( " port " , new Data ( Util : : uitos ( _tcpPort ) , true ) ) ; <nl> - a - > put ( " token " , new Data ( _token ) ) ; <nl> + a - > put ( PORT , new Data ( Util : : uitos ( _tcpPort ) , true ) ) ; <nl> + a - > put ( TOKEN , new Data ( _token ) ) ; <nl> <nl> return a ; <nl> } <nl> <nl> std : : string DHTAnnouncePeerMessage : : getMessageType ( ) const <nl> { <nl> - return " announce_peer " ; <nl> + return ANNOUNCE_PEER ; <nl> } <nl> <nl> void DHTAnnouncePeerMessage : : validate ( ) const <nl> mmm a / src / DHTAnnouncePeerMessage . h <nl> ppp b / src / DHTAnnouncePeerMessage . h <nl> class DHTAnnouncePeerMessage : public DHTQueryMessage { <nl> void setPeerAnnounceStorage ( const WeakHandle < DHTPeerAnnounceStorage > & storage ) ; <nl> <nl> void setTokenTracker ( const WeakHandle < DHTTokenTracker > & tokenTracker ) ; <nl> + <nl> + static const std : : string ANNOUNCE_PEER ; <nl> + <nl> + static const std : : string INFO_HASH ; <nl> + <nl> + static const std : : string PORT ; <nl> + <nl> + static const std : : string TOKEN ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTAnnouncePeerReplyMessage . cc <nl> ppp b / src / DHTAnnouncePeerReplyMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTAnnouncePeerReplyMessage : : ANNOUNCE_PEER ( " announce_peer " ) ; <nl> + <nl> DHTAnnouncePeerReplyMessage : : DHTAnnouncePeerReplyMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const std : : string & transactionID ) : <nl> void DHTAnnouncePeerReplyMessage : : doReceivedAction ( ) { } <nl> Dictionary * DHTAnnouncePeerReplyMessage : : getResponse ( ) <nl> { <nl> Dictionary * r = new Dictionary ( ) ; <nl> - r - > put ( " id " , new Data ( _localNode - > getID ( ) , DHT_ID_LENGTH ) ) ; <nl> + r - > put ( DHTMessage : : ID , new Data ( _localNode - > getID ( ) , DHT_ID_LENGTH ) ) ; <nl> return r ; <nl> } <nl> <nl> std : : string DHTAnnouncePeerReplyMessage : : getMessageType ( ) const <nl> { <nl> - return " announce_peer " ; <nl> + return ANNOUNCE_PEER ; <nl> } <nl> <nl> void DHTAnnouncePeerReplyMessage : : validate ( ) const { } <nl> mmm a / src / DHTAnnouncePeerReplyMessage . h <nl> ppp b / src / DHTAnnouncePeerReplyMessage . h <nl> class DHTAnnouncePeerReplyMessage : public DHTResponseMessage { <nl> virtual std : : string getMessageType ( ) const ; <nl> <nl> virtual void validate ( ) const ; <nl> + <nl> + static const std : : string ANNOUNCE_PEER ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTFindNodeMessage . cc <nl> ppp b / src / DHTFindNodeMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTFindNodeMessage : : FIND_NODE ( " find_node " ) ; <nl> + <nl> + const std : : string DHTFindNodeMessage : : TARGET_NODE ( " target " ) ; <nl> + <nl> DHTFindNodeMessage : : DHTFindNodeMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const unsigned char * targetNodeID , <nl> void DHTFindNodeMessage : : doReceivedAction ( ) <nl> Dictionary * DHTFindNodeMessage : : getArgument ( ) <nl> { <nl> Dictionary * a = new Dictionary ( ) ; <nl> - a - > put ( " id " , new Data ( reinterpret_cast < const char * > ( _localNode - > getID ( ) ) , <nl> + a - > put ( DHTMessage : : ID , new Data ( reinterpret_cast < const char * > ( _localNode - > getID ( ) ) , <nl> DHT_ID_LENGTH ) ) ; <nl> - a - > put ( " target " , new Data ( reinterpret_cast < const char * > ( _targetNodeID ) , <nl> + a - > put ( TARGET_NODE , new Data ( reinterpret_cast < const char * > ( _targetNodeID ) , <nl> DHT_ID_LENGTH ) ) ; <nl> return a ; <nl> } <nl> <nl> std : : string DHTFindNodeMessage : : getMessageType ( ) const <nl> { <nl> - return " find_node " ; <nl> + return FIND_NODE ; <nl> } <nl> <nl> void DHTFindNodeMessage : : validate ( ) const { } <nl> mmm a / src / DHTFindNodeMessage . h <nl> ppp b / src / DHTFindNodeMessage . h <nl> class DHTFindNodeMessage : public DHTQueryMessage { <nl> { <nl> return _targetNodeID ; <nl> } <nl> + <nl> + static const std : : string FIND_NODE ; <nl> + <nl> + / / We want " TARGET " , but it is defined by macro . <nl> + static const std : : string TARGET_NODE ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTFindNodeReplyMessage . cc <nl> ppp b / src / DHTFindNodeReplyMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTFindNodeReplyMessage : : FIND_NODE ( " find_node " ) ; <nl> + <nl> + const std : : string DHTFindNodeReplyMessage : : NODES ( " nodes " ) ; <nl> + <nl> DHTFindNodeReplyMessage : : DHTFindNodeReplyMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const std : : string & transactionID ) : <nl> void DHTFindNodeReplyMessage : : doReceivedAction ( ) <nl> Dictionary * DHTFindNodeReplyMessage : : getResponse ( ) <nl> { <nl> Dictionary * a = new Dictionary ( ) ; <nl> - a - > put ( " id " , new Data ( _localNode - > getID ( ) , DHT_ID_LENGTH ) ) ; <nl> + a - > put ( DHTMessage : : ID , new Data ( _localNode - > getID ( ) , DHT_ID_LENGTH ) ) ; <nl> size_t offset = 0 ; <nl> unsigned char buffer [ DHTBucket : : K * 26 ] ; <nl> / / TODO if _closestKNodes . size ( ) > DHTBucket : : K ? ? <nl> Dictionary * DHTFindNodeReplyMessage : : getResponse ( ) <nl> offset + = 26 ; <nl> } <nl> } <nl> - a - > put ( " nodes " , new Data ( buffer , offset ) ) ; <nl> + a - > put ( NODES , new Data ( buffer , offset ) ) ; <nl> return a ; <nl> } <nl> <nl> std : : string DHTFindNodeReplyMessage : : getMessageType ( ) const <nl> { <nl> - return " find_node " ; <nl> + return FIND_NODE ; <nl> } <nl> <nl> void DHTFindNodeReplyMessage : : validate ( ) const { } <nl> mmm a / src / DHTFindNodeReplyMessage . h <nl> ppp b / src / DHTFindNodeReplyMessage . h <nl> class DHTFindNodeReplyMessage : public DHTResponseMessage { <nl> const std : : deque < SharedHandle < DHTNode > > & getClosestKNodes ( ) const ; <nl> <nl> void setClosestKNodes ( const std : : deque < SharedHandle < DHTNode > > & closestKNodes ) ; <nl> + <nl> + static const std : : string FIND_NODE ; <nl> + <nl> + static const std : : string NODES ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTGetPeersMessage . cc <nl> ppp b / src / DHTGetPeersMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTGetPeersMessage : : GET_PEERS ( " get_peers " ) ; <nl> + <nl> + const std : : string DHTGetPeersMessage : : INFO_HASH ( " info_hash " ) ; <nl> + <nl> DHTGetPeersMessage : : DHTGetPeersMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const unsigned char * infoHash , <nl> void DHTGetPeersMessage : : doReceivedAction ( ) <nl> Dictionary * DHTGetPeersMessage : : getArgument ( ) <nl> { <nl> Dictionary * a = new Dictionary ( ) ; <nl> - a - > put ( " id " , new Data ( _localNode - > getID ( ) , DHT_ID_LENGTH ) ) ; <nl> - a - > put ( " info_hash " , new Data ( _infoHash , DHT_ID_LENGTH ) ) ; <nl> + a - > put ( DHTMessage : : ID , new Data ( _localNode - > getID ( ) , DHT_ID_LENGTH ) ) ; <nl> + a - > put ( INFO_HASH , new Data ( _infoHash , DHT_ID_LENGTH ) ) ; <nl> return a ; <nl> } <nl> <nl> std : : string DHTGetPeersMessage : : getMessageType ( ) const <nl> { <nl> - return " get_peers " ; <nl> + return GET_PEERS ; <nl> } <nl> <nl> void DHTGetPeersMessage : : validate ( ) const { } <nl> mmm a / src / DHTGetPeersMessage . h <nl> ppp b / src / DHTGetPeersMessage . h <nl> class DHTGetPeersMessage : public DHTQueryMessage { <nl> <nl> <nl> void setTokenTracker ( const WeakHandle < DHTTokenTracker > & tokenTracker ) ; <nl> + <nl> + static const std : : string GET_PEERS ; <nl> + <nl> + static const std : : string INFO_HASH ; <nl> + <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTGetPeersReplyMessage . cc <nl> ppp b / src / DHTGetPeersReplyMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTGetPeersReplyMessage : : GET_PEERS ( " get_peers " ) ; <nl> + <nl> + const std : : string DHTGetPeersReplyMessage : : TOKEN ( " token " ) ; <nl> + <nl> + const std : : string DHTGetPeersReplyMessage : : VALUES ( " values " ) ; <nl> + <nl> + const std : : string DHTGetPeersReplyMessage : : NODES ( " nodes " ) ; <nl> + <nl> DHTGetPeersReplyMessage : : DHTGetPeersReplyMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const std : : string & token , <nl> void DHTGetPeersReplyMessage : : doReceivedAction ( ) <nl> Dictionary * DHTGetPeersReplyMessage : : getResponse ( ) <nl> { <nl> Dictionary * r = new Dictionary ( ) ; <nl> - r - > put ( " id " , new Data ( _localNode - > getID ( ) , DHT_ID_LENGTH ) ) ; <nl> - r - > put ( " token " , new Data ( _token ) ) ; <nl> + r - > put ( DHTMessage : : ID , new Data ( _localNode - > getID ( ) , DHT_ID_LENGTH ) ) ; <nl> + r - > put ( TOKEN , new Data ( _token ) ) ; <nl> if ( _values . size ( ) ) { <nl> List * valuesList = new List ( ) ; <nl> - r - > put ( " values " , valuesList ) ; <nl> + r - > put ( VALUES , valuesList ) ; <nl> for ( std : : deque < SharedHandle < Peer > > : : const_iterator i = _values . begin ( ) ; i ! = _values . end ( ) ; + + i ) { <nl> const SharedHandle < Peer > & peer = * i ; <nl> unsigned char buffer [ 6 ] ; <nl> Dictionary * DHTGetPeersReplyMessage : : getResponse ( ) <nl> offset + = 26 ; <nl> } <nl> } <nl> - r - > put ( " nodes " , new Data ( buffer , offset ) ) ; <nl> + r - > put ( NODES , new Data ( buffer , offset ) ) ; <nl> } <nl> return r ; <nl> } <nl> <nl> std : : string DHTGetPeersReplyMessage : : getMessageType ( ) const <nl> { <nl> - return " get_peers " ; <nl> + return GET_PEERS ; <nl> } <nl> <nl> void DHTGetPeersReplyMessage : : validate ( ) const { } <nl> mmm a / src / DHTGetPeersReplyMessage . h <nl> ppp b / src / DHTGetPeersReplyMessage . h <nl> class DHTGetPeersReplyMessage : public DHTResponseMessage { <nl> { <nl> return _token ; <nl> } <nl> + <nl> + static const std : : string GET_PEERS ; <nl> + <nl> + static const std : : string TOKEN ; <nl> + <nl> + static const std : : string VALUES ; <nl> + <nl> + static const std : : string NODES ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTMessage . cc <nl> ppp b / src / DHTMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTMessage : : Y ( " y " ) ; <nl> + <nl> + const std : : string DHTMessage : : T ( " t " ) ; <nl> + <nl> + const std : : string DHTMessage : : ID ( " id " ) ; <nl> + <nl> DHTMessage : : DHTMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const std : : string & transactionID ) : <nl> SharedHandle < DHTNode > DHTMessage : : getRemoteNode ( ) const <nl> return _remoteNode ; <nl> } <nl> <nl> - <nl> } / / namespace aria2 <nl> mmm a / src / DHTMessage . h <nl> ppp b / src / DHTMessage . h <nl> class DHTMessage { <nl> virtual std : : string getMessageType ( ) const = 0 ; <nl> <nl> virtual std : : string toString ( ) const = 0 ; <nl> + <nl> + static const std : : string Y ; <nl> + <nl> + static const std : : string T ; <nl> + <nl> + static const std : : string ID ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTMessageFactoryImpl . cc <nl> ppp b / src / DHTMessageFactoryImpl . cc <nl> SharedHandle < DHTMessage > DHTMessageFactoryImpl : : createQueryMessage ( const Diction <nl> const std : : string & ipaddr , <nl> uint16_t port ) <nl> { <nl> - const Data * q = getData ( d , " q " ) ; <nl> - const Data * t = getData ( d , " t " ) ; <nl> - const Data * y = getData ( d , " y " ) ; <nl> - const Dictionary * a = getDictionary ( d , " a " ) ; <nl> - if ( y - > toString ( ) ! = " q " ) { <nl> + const Data * q = getData ( d , DHTQueryMessage : : Q ) ; <nl> + const Data * t = getData ( d , DHTMessage : : T ) ; <nl> + const Data * y = getData ( d , DHTMessage : : Y ) ; <nl> + const Dictionary * a = getDictionary ( d , DHTQueryMessage : : A ) ; <nl> + if ( y - > toString ( ) ! = DHTQueryMessage : : Q ) { <nl> throw DlAbortEx ( " Malformed DHT message . y ! = q " ) ; <nl> } <nl> - const Data * id = getData ( getDictionary ( d , " a " ) , " id " ) ; <nl> + const Data * id = getData ( getDictionary ( d , DHTQueryMessage : : A ) , DHTMessage : : ID ) ; <nl> validateID ( id ) ; <nl> SharedHandle < DHTNode > remoteNode = getRemoteNode ( id - > getData ( ) , ipaddr , port ) ; <nl> std : : string messageType = q - > toString ( ) ; <nl> std : : string transactionID = t - > toString ( ) ; <nl> - if ( messageType = = " ping " ) { <nl> + if ( messageType = = DHTPingMessage : : PING ) { <nl> return createPingMessage ( remoteNode , transactionID ) ; <nl> - } else if ( messageType = = " find_node " ) { <nl> - const Data * targetNodeID = getData ( a , " target " ) ; <nl> + } else if ( messageType = = DHTFindNodeMessage : : FIND_NODE ) { <nl> + const Data * targetNodeID = getData ( a , DHTFindNodeMessage : : TARGET_NODE ) ; <nl> validateID ( targetNodeID ) ; <nl> return createFindNodeMessage ( remoteNode , targetNodeID - > getData ( ) , <nl> transactionID ) ; <nl> - } else if ( messageType = = " get_peers " ) { <nl> - const Data * infoHash = getData ( a , " info_hash " ) ; <nl> + } else if ( messageType = = DHTGetPeersMessage : : GET_PEERS ) { <nl> + const Data * infoHash = getData ( a , DHTGetPeersMessage : : INFO_HASH ) ; <nl> validateID ( infoHash ) ; <nl> return createGetPeersMessage ( remoteNode , <nl> infoHash - > getData ( ) , transactionID ) ; <nl> - } else if ( messageType = = " announce_peer " ) { <nl> - const Data * infoHash = getData ( a , " info_hash " ) ; <nl> + } else if ( messageType = = DHTAnnouncePeerMessage : : ANNOUNCE_PEER ) { <nl> + const Data * infoHash = getData ( a , DHTAnnouncePeerMessage : : INFO_HASH ) ; <nl> validateID ( infoHash ) ; <nl> - const Data * port = getData ( a , " port " ) ; <nl> + const Data * port = getData ( a , DHTAnnouncePeerMessage : : PORT ) ; <nl> validatePort ( port ) ; <nl> - const Data * token = getData ( a , " token " ) ; <nl> + const Data * token = getData ( a , DHTAnnouncePeerMessage : : TOKEN ) ; <nl> return createAnnouncePeerMessage ( remoteNode , infoHash - > getData ( ) , <nl> static_cast < uint16_t > ( port - > toInt ( ) ) , <nl> token - > toString ( ) , transactionID ) ; <nl> DHTMessageFactoryImpl : : createResponseMessage ( const std : : string & messageType , <nl> const Dictionary * d , <nl> const SharedHandle < DHTNode > & remoteNode ) <nl> { <nl> - const Data * t = getData ( d , " t " ) ; <nl> - const Data * y = getData ( d , " y " ) ; <nl> - if ( y - > toString ( ) = = " e " ) { <nl> + const Data * t = getData ( d , DHTMessage : : T ) ; <nl> + const Data * y = getData ( d , DHTMessage : : Y ) ; <nl> + if ( y - > toString ( ) = = DHTUnknownMessage : : E ) { <nl> / / for now , just report error message arrived and throw exception . <nl> - const List * e = getList ( d , " e " ) ; <nl> + const List * e = getList ( d , DHTUnknownMessage : : E ) ; <nl> if ( e - > getList ( ) . size ( ) = = 2 ) { <nl> _logger - > info ( " Received Error DHT message . code = % s , msg = % s " , <nl> Util : : urlencode ( getData ( e , 0 ) - > toString ( ) ) . c_str ( ) , <nl> DHTMessageFactoryImpl : : createResponseMessage ( const std : : string & messageType , <nl> _logger - > debug ( " e doesn ' t have 2 elements . " ) ; <nl> } <nl> throw DlAbortEx ( " Received Error DHT message . " ) ; <nl> - } else if ( y - > toString ( ) ! = " r " ) { <nl> + } else if ( y - > toString ( ) ! = DHTResponseMessage : : R ) { <nl> throw DlAbortEx <nl> ( StringFormat ( " Malformed DHT message . y ! = r : y = % s " , <nl> Util : : urlencode ( y - > toString ( ) ) . c_str ( ) ) . str ( ) ) ; <nl> } <nl> - const Dictionary * r = getDictionary ( d , " r " ) ; <nl> - const Data * id = getData ( r , " id " ) ; <nl> + const Dictionary * r = getDictionary ( d , DHTResponseMessage : : R ) ; <nl> + const Data * id = getData ( r , DHTMessage : : ID ) ; <nl> validateID ( id ) ; <nl> validateIDMatch ( remoteNode - > getID ( ) , id - > getData ( ) ) ; <nl> std : : string transactionID = t - > toString ( ) ; <nl> - if ( messageType = = " ping " ) { <nl> + if ( messageType = = DHTPingReplyMessage : : PING ) { <nl> return createPingReplyMessage ( remoteNode , <nl> id - > getData ( ) , transactionID ) ; <nl> - } else if ( messageType = = " find_node " ) { <nl> + } else if ( messageType = = DHTFindNodeReplyMessage : : FIND_NODE ) { <nl> return createFindNodeReplyMessage ( remoteNode , d , transactionID ) ; <nl> - } else if ( messageType = = " get_peers " ) { <nl> - const List * values = dynamic_cast < const List * > ( r - > get ( " values " ) ) ; <nl> + } else if ( messageType = = DHTGetPeersReplyMessage : : GET_PEERS ) { <nl> + const List * values = <nl> + dynamic_cast < const List * > ( r - > get ( DHTGetPeersReplyMessage : : VALUES ) ) ; <nl> if ( values ) { <nl> return createGetPeersReplyMessageWithValues ( remoteNode , d , transactionID ) ; <nl> } else { <nl> - const Data * nodes = dynamic_cast < const Data * > ( r - > get ( " nodes " ) ) ; <nl> + const Data * nodes = dynamic_cast < const Data * > ( r - > get ( DHTGetPeersReplyMessage : : NODES ) ) ; <nl> if ( nodes ) { <nl> return createGetPeersReplyMessageWithNodes ( remoteNode , d , transactionID ) ; <nl> } else { <nl> throw DlAbortEx ( " Malformed DHT message : missing nodes / values " ) ; <nl> } <nl> } <nl> - } else if ( messageType = = " announce_peer " ) { <nl> + } else if ( messageType = = DHTAnnouncePeerReplyMessage : : ANNOUNCE_PEER ) { <nl> return createAnnouncePeerReplyMessage ( remoteNode , transactionID ) ; <nl> } else { <nl> throw DlAbortEx <nl> DHTMessageFactoryImpl : : createFindNodeReplyMessage ( const SharedHandle < DHTNode > & r <nl> const Dictionary * d , <nl> const std : : string & transactionID ) <nl> { <nl> - const Data * nodesData = getData ( getDictionary ( d , " r " ) , " nodes " ) ; <nl> + const Data * nodesData = getData ( getDictionary ( d , DHTResponseMessage : : R ) , DHTFindNodeReplyMessage : : NODES ) ; <nl> std : : deque < SharedHandle < DHTNode > > nodes = extractNodes ( nodesData - > getData ( ) , nodesData - > getLen ( ) ) ; <nl> return createFindNodeReplyMessage ( remoteNode , nodes , transactionID ) ; <nl> } <nl> DHTMessageFactoryImpl : : createGetPeersReplyMessageWithNodes ( const SharedHandle < DH <nl> const Dictionary * d , <nl> const std : : string & transactionID ) <nl> { <nl> - const Dictionary * r = getDictionary ( d , " r " ) ; <nl> - const Data * nodesData = getData ( r , " nodes " ) ; <nl> + const Dictionary * r = getDictionary ( d , DHTResponseMessage : : R ) ; <nl> + const Data * nodesData = getData ( r , DHTGetPeersReplyMessage : : NODES ) ; <nl> std : : deque < SharedHandle < DHTNode > > nodes = extractNodes ( nodesData - > getData ( ) , nodesData - > getLen ( ) ) ; <nl> - const Data * token = getData ( r , " token " ) ; <nl> + const Data * token = getData ( r , DHTGetPeersReplyMessage : : TOKEN ) ; <nl> return createGetPeersReplyMessage ( remoteNode , nodes , token - > toString ( ) , <nl> transactionID ) ; <nl> } <nl> DHTMessageFactoryImpl : : createGetPeersReplyMessageWithValues ( const SharedHandle < D <nl> const Dictionary * d , <nl> const std : : string & transactionID ) <nl> { <nl> - const Dictionary * r = getDictionary ( d , " r " ) ; <nl> - const List * valuesList = getList ( r , " values " ) ; <nl> + const Dictionary * r = getDictionary ( d , DHTResponseMessage : : R ) ; <nl> + const List * valuesList = getList ( r , DHTGetPeersReplyMessage : : VALUES ) ; <nl> std : : deque < SharedHandle < Peer > > peers ; <nl> for ( std : : deque < MetaEntry * > : : const_iterator i = valuesList - > getList ( ) . begin ( ) ; i ! = valuesList - > getList ( ) . end ( ) ; + + i ) { <nl> const Data * data = dynamic_cast < const Data * > ( * i ) ; <nl> DHTMessageFactoryImpl : : createGetPeersReplyMessageWithValues ( const SharedHandle < D <nl> peers . push_back ( peer ) ; <nl> } <nl> } <nl> - const Data * token = getData ( r , " token " ) ; <nl> + const Data * token = getData ( r , DHTGetPeersReplyMessage : : TOKEN ) ; <nl> return createGetPeersReplyMessage ( remoteNode , peers , token - > toString ( ) , <nl> transactionID ) ; <nl> } <nl> mmm a / src / DHTMessageReceiver . cc <nl> ppp b / src / DHTMessageReceiver . cc <nl> <nl> # include " DHTMessageTracker . h " <nl> # include " DHTConnection . h " <nl> # include " DHTMessage . h " <nl> + # include " DHTResponseMessage . h " <nl> + # include " DHTUnknownMessage . h " <nl> # include " DHTMessageFactory . h " <nl> # include " DHTRoutingTable . h " <nl> # include " DHTNode . h " <nl> SharedHandle < DHTMessage > DHTMessageReceiver : : receiveMessage ( ) <nl> MetaEntryHandle msgroot ( MetaFileUtil : : bdecoding ( data , length ) ) ; <nl> const Dictionary * d = dynamic_cast < const Dictionary * > ( msgroot . get ( ) ) ; <nl> if ( d ) { <nl> - const Data * y = dynamic_cast < const Data * > ( d - > get ( " y " ) ) ; <nl> + const Data * y = dynamic_cast < const Data * > ( d - > get ( DHTMessage : : Y ) ) ; <nl> if ( y ) { <nl> - if ( y - > toString ( ) = = " r " | | y - > toString ( ) = = " e " ) { <nl> + if ( y - > toString ( ) = = DHTResponseMessage : : R | | <nl> + y - > toString ( ) = = DHTUnknownMessage : : E ) { <nl> isReply = true ; <nl> } <nl> } else { <nl> mmm a / src / DHTPingMessage . cc <nl> ppp b / src / DHTPingMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTPingMessage : : PING ( " ping " ) ; <nl> + <nl> DHTPingMessage : : DHTPingMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const std : : string & transactionID ) : <nl> void DHTPingMessage : : doReceivedAction ( ) <nl> Dictionary * DHTPingMessage : : getArgument ( ) <nl> { <nl> Dictionary * a = new Dictionary ( ) ; <nl> - a - > put ( " id " , new Data ( reinterpret_cast < const char * > ( _localNode - > getID ( ) ) , <nl> + a - > put ( DHTMessage : : ID , new Data ( reinterpret_cast < const char * > ( _localNode - > getID ( ) ) , <nl> DHT_ID_LENGTH ) ) ; <nl> return a ; <nl> } <nl> <nl> std : : string DHTPingMessage : : getMessageType ( ) const <nl> { <nl> - return " ping " ; <nl> + return PING ; <nl> } <nl> <nl> void DHTPingMessage : : validate ( ) const { } <nl> mmm a / src / DHTPingMessage . h <nl> ppp b / src / DHTPingMessage . h <nl> class DHTPingMessage : public DHTQueryMessage { <nl> virtual std : : string getMessageType ( ) const ; <nl> <nl> virtual void validate ( ) const ; <nl> + <nl> + static const std : : string PING ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTPingReplyMessage . cc <nl> ppp b / src / DHTPingReplyMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTPingReplyMessage : : PING ( " ping " ) ; <nl> + <nl> DHTPingReplyMessage : : DHTPingReplyMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const unsigned char * id , <nl> void DHTPingReplyMessage : : doReceivedAction ( ) { } <nl> Dictionary * DHTPingReplyMessage : : getResponse ( ) <nl> { <nl> Dictionary * r = new Dictionary ( ) ; <nl> - r - > put ( " id " , new Data ( _id , DHT_ID_LENGTH ) ) ; <nl> + r - > put ( DHTMessage : : ID , new Data ( _id , DHT_ID_LENGTH ) ) ; <nl> return r ; <nl> } <nl> <nl> std : : string DHTPingReplyMessage : : getMessageType ( ) const <nl> { <nl> - return " ping " ; <nl> + return PING ; <nl> } <nl> <nl> void DHTPingReplyMessage : : validate ( ) const { } <nl> mmm a / src / DHTPingReplyMessage . h <nl> ppp b / src / DHTPingReplyMessage . h <nl> class DHTPingReplyMessage : public DHTResponseMessage { <nl> { <nl> return _id ; <nl> } <nl> + <nl> + static const std : : string PING ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTQueryMessage . cc <nl> ppp b / src / DHTQueryMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTQueryMessage : : Q ( " q " ) ; <nl> + <nl> + const std : : string DHTQueryMessage : : A ( " a " ) ; <nl> + <nl> DHTQueryMessage : : DHTQueryMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const std : : string & transactionID ) : <nl> DHTQueryMessage : : ~ DHTQueryMessage ( ) { } <nl> <nl> std : : string DHTQueryMessage : : getType ( ) const <nl> { <nl> - return " q " ; <nl> + return Q ; <nl> } <nl> <nl> void DHTQueryMessage : : fillMessage ( Dictionary * message ) <nl> { <nl> - message - > put ( " q " , new Data ( getMessageType ( ) ) ) ; <nl> - message - > put ( " a " , getArgument ( ) ) ; <nl> + message - > put ( Q , new Data ( getMessageType ( ) ) ) ; <nl> + message - > put ( A , getArgument ( ) ) ; <nl> } <nl> <nl> bool DHTQueryMessage : : isReply ( ) const <nl> mmm a / src / DHTQueryMessage . h <nl> ppp b / src / DHTQueryMessage . h <nl> class DHTQueryMessage : public DHTAbstractMessage { <nl> virtual bool isReply ( ) const ; <nl> <nl> virtual std : : string toString ( ) const ; <nl> + <nl> + static const std : : string Q ; <nl> + <nl> + static const std : : string A ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTResponseMessage . cc <nl> ppp b / src / DHTResponseMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTResponseMessage : : R ( " r " ) ; <nl> + <nl> DHTResponseMessage : : DHTResponseMessage ( const SharedHandle < DHTNode > & localNode , <nl> const SharedHandle < DHTNode > & remoteNode , <nl> const std : : string & transactionID ) : <nl> DHTResponseMessage : : ~ DHTResponseMessage ( ) { } <nl> <nl> std : : string DHTResponseMessage : : getType ( ) const <nl> { <nl> - return " r " ; <nl> + return R ; <nl> } <nl> <nl> void DHTResponseMessage : : fillMessage ( Dictionary * message ) <nl> { <nl> - message - > put ( " r " , getResponse ( ) ) ; <nl> + message - > put ( R , getResponse ( ) ) ; <nl> } <nl> <nl> bool DHTResponseMessage : : isReply ( ) const <nl> mmm a / src / DHTResponseMessage . h <nl> ppp b / src / DHTResponseMessage . h <nl> class DHTResponseMessage : public DHTAbstractMessage { <nl> virtual bool isReply ( ) const ; <nl> <nl> virtual std : : string toString ( ) const ; <nl> + <nl> + static const std : : string R ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl> mmm a / src / DHTUnknownMessage . cc <nl> ppp b / src / DHTUnknownMessage . cc <nl> <nl> <nl> namespace aria2 { <nl> <nl> + const std : : string DHTUnknownMessage : : E ( " e " ) ; <nl> + <nl> + const std : : string DHTUnknownMessage : : UNKNOWN ( " unknown " ) ; <nl> + <nl> DHTUnknownMessage : : DHTUnknownMessage ( const SharedHandle < DHTNode > & localNode , <nl> const unsigned char * data , size_t length , <nl> const std : : string & ipaddr , uint16_t port ) : <nl> void DHTUnknownMessage : : validate ( ) const { } <nl> <nl> std : : string DHTUnknownMessage : : getMessageType ( ) const <nl> { <nl> - return " unknown " ; <nl> + return UNKNOWN ; <nl> } <nl> <nl> std : : string DHTUnknownMessage : : toString ( ) const <nl> mmm a / src / DHTUnknownMessage . h <nl> ppp b / src / DHTUnknownMessage . h <nl> class DHTUnknownMessage : public DHTMessage { <nl> <nl> / / show some sample bytes <nl> virtual std : : string toString ( ) const ; <nl> + <nl> + static const std : : string E ; <nl> + <nl> + static const std : : string UNKNOWN ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl>
2008 - 05 - 13 Tatsuhiro Tsujikawa < tujikawa at rednoah dot com >
aria2/aria2
898b807ba2cf2c1ec1e64848c560e9dc09a903ce
2008-05-13T15:55:05Z
mmm a / db / c . cc <nl> ppp b / db / c . cc <nl> rocksdb_backup_engine_t * rocksdb_backup_engine_open ( <nl> const rocksdb_options_t * options , const char * path , char * * errptr ) { <nl> BackupEngine * be ; <nl> if ( SaveError ( errptr , BackupEngine : : Open ( options - > rep . env , <nl> - BackupableDBOptions ( path ) , & be ) ) ) { <nl> + BackupableDBOptions ( path , <nl> + nullptr , <nl> + true , <nl> + options - > rep . info_log . get ( ) ) , <nl> + & be ) ) ) { <nl> return nullptr ; <nl> } <nl> rocksdb_backup_engine_t * result = new rocksdb_backup_engine_t ; <nl> mmm a / utilities / backupable / backupable_db . cc <nl> ppp b / utilities / backupable / backupable_db . cc <nl> Status BackupEngineImpl : : CreateNewBackupWithMetadata ( <nl> manifest_fname . size ( ) , 0 / * size_limit * / , false / * shared_checksum * / , <nl> progress_callback , manifest_fname . substr ( 1 ) + " \ n " ) ; <nl> } <nl> - <nl> - / / Pre - fetch sizes for WAL files <nl> - std : : unordered_map < std : : string , uint64_t > wal_path_to_size ; <nl> - if ( s . ok ( ) ) { <nl> - if ( db - > GetOptions ( ) . wal_dir ! = " " ) { <nl> - s = InsertPathnameToSizeBytes ( db - > GetOptions ( ) . wal_dir , db_env_ , <nl> - & wal_path_to_size ) ; <nl> - } else { <nl> - wal_path_to_size = std : : move ( data_path_to_size ) ; <nl> - } <nl> - } <nl> - <nl> + Log ( options_ . info_log , " begin add wal files for backup - - % " ROCKSDB_PRIszt , <nl> + live_wal_files . size ( ) ) ; <nl> / / Add a CopyOrCreateWorkItem to the channel for each WAL file <nl> for ( size_t i = 0 ; s . ok ( ) & & i < live_wal_files . size ( ) ; + + i ) { <nl> - auto wal_path_to_size_iter = <nl> - wal_path_to_size . find ( live_wal_files [ i ] - > PathName ( ) ) ; <nl> - uint64_t size_bytes = wal_path_to_size_iter = = wal_path_to_size . end ( ) <nl> - ? port : : kMaxUint64 <nl> - : wal_path_to_size_iter - > second ; <nl> + uint64_t size_bytes = live_wal_files [ i ] - > SizeFileBytes ( ) ; <nl> if ( live_wal_files [ i ] - > Type ( ) = = kAliveLogFile ) { <nl> + Log ( options_ . info_log , " add wal file for backup % s - - % " PRIu64 , <nl> + live_wal_files [ i ] - > PathName ( ) . c_str ( ) , size_bytes ) ; <nl> / / we only care about live log files <nl> / / copy the file into backup_dir / files / < new backup > / <nl> s = AddBackupFileWorkItem ( live_dst_paths , backup_items_to_finish , <nl> new_backup_id , false , / * not shared * / <nl> db - > GetOptions ( ) . wal_dir , <nl> live_wal_files [ i ] - > PathName ( ) , rate_limiter , <nl> - size_bytes ) ; <nl> + size_bytes , size_bytes ) ; <nl> } <nl> } <nl> - <nl> + Log ( options_ . info_log , " add files for backup done , wait finish . " ) ; <nl> Status item_status ; <nl> for ( auto & item : backup_items_to_finish ) { <nl> item . result . wait ( ) ; <nl>
utilities / backupable : backup should limit the copy size of wal .
facebook/rocksdb
e425ec1162d37afdd63f6bfd25f1927abbc765aa
2016-12-31T18:54:20Z
mmm a / android / sdk / src / main / java / com / taobao / weex / ui / component / list / WXListComponent . java <nl> ppp b / android / sdk / src / main / java / com / taobao / weex / ui / component / list / WXListComponent . java <nl> public void addChild ( WXComponent child ) { <nl> @ Override <nl> public void addChild ( WXComponent child , int index ) { <nl> super . addChild ( child , index ) ; <nl> - int adapterPosition = index = = - 1 ? getView ( ) . getAdapter ( ) . getItemCount ( ) - 1 : index ; <nl> - getView ( ) . getAdapter ( ) . notifyItemInserted ( adapterPosition ) ; <nl> - checkRefreshOrLoading ( child ) ; <nl> + <nl> + int adapterPosition = index = = - 1 ? mChildren . size ( ) - 1 : index ; <nl> if ( child . getDomObject ( ) . containsEvent ( WXEventType . APPEAR ) | | child . getDomObject ( ) . containsEvent ( WXEventType . DISAPPEAR ) ) { <nl> mAppearComponents . put ( adapterPosition , child ) ; <nl> child . registerAppearEvent = true ; <nl> public void addChild ( WXComponent child , int index ) { <nl> * / <nl> @ Override <nl> protected void addSubView ( View child , int index ) { <nl> + BounceRecyclerView view = getView ( ) ; <nl> + if ( view = = null ) { <nl> + return ; <nl> + } <nl> + <nl> + int pos = index = = - 1 ? view . getAdapter ( ) . getItemCount ( ) - 1 : index ; <nl> + view . getAdapter ( ) . notifyItemInserted ( pos ) ; <nl> + checkRefreshOrLoading ( mChildren . get ( pos ) ) ; <nl> } <nl> <nl> / * * <nl>
* [ android ] fix crash when list append tree
apache/incubator-weex
686e4508e8c2ee94baff4a9a3ea9e6bc2e8a5c5b
2016-06-22T03:05:36Z
new file mode 100644 <nl> index 000000000000 . . f849ed4b619a <nl> mmm / dev / null <nl> ppp b / validation - test / Evolution / Inputs / struct_add_property . swift <nl> <nl> + <nl> + public func getVersion ( ) - > Int { <nl> + # if BEFORE <nl> + return 0 <nl> + # else <nl> + return 1 <nl> + # endif <nl> + } <nl> + <nl> + # if BEFORE <nl> + <nl> + public struct AddStoredProperty { <nl> + public init ( ) { <nl> + forth = " Chuck Moore " <nl> + } <nl> + <nl> + public var forth : String <nl> + <nl> + public var languageDesigners : [ String ] { <nl> + return [ forth ] <nl> + } <nl> + } <nl> + <nl> + # else <nl> + <nl> + public struct AddStoredProperty { <nl> + public init ( ) { <nl> + forth = " Chuck Moore " <nl> + lisp = " John McCarthy " <nl> + c = " Dennis Ritchie " <nl> + } <nl> + <nl> + public var forth : String <nl> + public var lisp : String <nl> + public var c : String <nl> + <nl> + public var languageDesigners : [ String ] { <nl> + return [ forth , lisp , c ] <nl> + } <nl> + } <nl> + <nl> + # endif <nl> + <nl> + # if BEFORE <nl> + <nl> + var global : Int = 0 <nl> + <nl> + public struct ChangeEmptyToNonEmpty { <nl> + public init ( ) { } <nl> + <nl> + public var property : Int { <nl> + get { return global } <nl> + set { global = newValue } <nl> + } <nl> + } <nl> + <nl> + # else <nl> + <nl> + public struct ChangeEmptyToNonEmpty { <nl> + public init ( ) { <nl> + property = 0 <nl> + } <nl> + <nl> + public var property : Int <nl> + } <nl> + <nl> + # endif <nl> + <nl> + public func getProperty ( c : ChangeEmptyToNonEmpty ) - > Int { <nl> + return c . property <nl> + } <nl> + <nl> deleted file mode 100644 <nl> index 0e052c559449 . . 000000000000 <nl> mmm a / validation - test / Evolution / Inputs / struct_add_remove_properties . swift <nl> ppp / dev / null <nl> <nl> - <nl> - # if BEFORE <nl> - <nl> - public struct ChangeStoredToComputed { <nl> - public init ( ) { <nl> - celsius = 0 <nl> - } <nl> - <nl> - public var celsius : Int <nl> - <nl> - public var fahrenheit : Int { <nl> - get { <nl> - return ( celsius * 9 ) / 5 + 32 <nl> - } <nl> - set { <nl> - celsius = ( ( newValue - 32 ) * 5 ) / 9 <nl> - } <nl> - } <nl> - } <nl> - <nl> - # else <nl> - <nl> - public struct ChangeStoredToComputed { <nl> - public init ( ) { <nl> - fahrenheit = 32 <nl> - } <nl> - <nl> - public var celsius : Int { <nl> - get { <nl> - return ( ( fahrenheit - 32 ) * 5 ) / 9 <nl> - } <nl> - set { <nl> - fahrenheit = ( newValue * 9 ) / 5 + 32 <nl> - } <nl> - } <nl> - <nl> - public var fahrenheit : Int = 32 <nl> - } <nl> - <nl> - # endif <nl> - <nl> - <nl> - # if BEFORE <nl> - <nl> - var global : Int = 0 <nl> - <nl> - public struct ChangeEmptyToNonEmpty { <nl> - public init ( ) { } <nl> - <nl> - public var property : Int { <nl> - get { return global } <nl> - set { global = newValue } <nl> - } <nl> - } <nl> - <nl> - # else <nl> - <nl> - public struct ChangeEmptyToNonEmpty { <nl> - public init ( ) { <nl> - property = 0 <nl> - } <nl> - <nl> - public var property : Int <nl> - } <nl> - <nl> - # endif <nl> - <nl> - public func getProperty ( c : ChangeEmptyToNonEmpty ) - > Int { <nl> - return c . property <nl> - } <nl> - <nl> - <nl> - # if BEFORE <nl> - <nl> - public struct AddStoredProperty { <nl> - public init ( ) { <nl> - count = 0 <nl> - } <nl> - <nl> - public var count : Int <nl> - } <nl> - <nl> - # else <nl> - <nl> - public struct AddStoredProperty { <nl> - public init ( ) { <nl> - _count = 0 <nl> - _sign = 0 <nl> - } <nl> - <nl> - public var count : Int { <nl> - get { return _count * _sign } <nl> - set { <nl> - if newValue < 0 { <nl> - _count = - newValue <nl> - _sign = - 1 <nl> - } else { <nl> - _count = newValue <nl> - _sign = 1 <nl> - } <nl> - } <nl> - } <nl> - <nl> - private var _count : Int <nl> - private var _sign : Int <nl> - } <nl> - <nl> - # endif <nl> mmm a / validation - test / Evolution / Inputs / struct_change_size . swift <nl> ppp b / validation - test / Evolution / Inputs / struct_change_size . swift <nl> <nl> <nl> public struct ChangeSize { <nl> - public init ( ) { <nl> - _value = 0 <nl> + public init ( version : Int32 ) { <nl> + self . _version = T ( version ) <nl> } <nl> <nl> - public var value : Int32 { <nl> - get { return Int32 ( _value ) } <nl> - set { _value = T ( newValue ) } <nl> + public var version : Int32 { <nl> + get { return Int32 ( _version ) } <nl> + set { _version = T ( newValue ) } <nl> } <nl> <nl> # if BEFORE <nl> public struct ChangeSize { <nl> typealias T = Int64 <nl> # endif <nl> <nl> - private var _value : T <nl> + private var _version : T <nl> } <nl> <nl> @ _fixed_layout public struct ChangeFieldOffsetsOfFixedLayout { <nl> - public init ( ) { <nl> - v1 = ChangeSize ( ) <nl> - v2 = ChangeSize ( ) <nl> + public init ( major : Int32 , minor : Int32 , patch : Int32 ) { <nl> + self . major = ChangeSize ( version : major ) <nl> + self . minor = ChangeSize ( version : minor ) <nl> + self . patch = ChangeSize ( version : patch ) <nl> } <nl> <nl> - public var v1 : ChangeSize <nl> - public var v2 : ChangeSize <nl> + public var major : ChangeSize <nl> + public var minor : ChangeSize <nl> + public var patch : ChangeSize <nl> <nl> - public func getTotal ( ) - > Int32 { <nl> - return v1 . value + v2 . value <nl> + public func getVersion ( ) - > String { <nl> + return " \ ( major . version ) . \ ( minor . version ) . \ ( patch . version ) " <nl> } <nl> } <nl> new file mode 100644 <nl> index 000000000000 . . ac8eb1724bb9 <nl> mmm / dev / null <nl> ppp b / validation - test / Evolution / Inputs / struct_change_stored_to_computed . swift <nl> <nl> + <nl> + # if BEFORE <nl> + <nl> + public struct ChangeStoredToComputed { <nl> + public init ( ) { <nl> + celsius = 0 <nl> + } <nl> + <nl> + public var celsius : Int <nl> + <nl> + public var fahrenheit : Int { <nl> + get { <nl> + return ( celsius * 9 ) / 5 + 32 <nl> + } <nl> + set { <nl> + celsius = ( ( newValue - 32 ) * 5 ) / 9 <nl> + } <nl> + } <nl> + } <nl> + <nl> + # else <nl> + <nl> + public struct ChangeStoredToComputed { <nl> + public init ( ) { <nl> + fahrenheit = 32 <nl> + } <nl> + <nl> + public var celsius : Int { <nl> + get { <nl> + return ( ( fahrenheit - 32 ) * 5 ) / 9 <nl> + } <nl> + set { <nl> + fahrenheit = ( newValue * 9 ) / 5 + 32 <nl> + } <nl> + } <nl> + <nl> + public var fahrenheit : Int = 32 <nl> + } <nl> + <nl> + # endif <nl> new file mode 100644 <nl> index 000000000000 . . 8f73654217f9 <nl> mmm / dev / null <nl> ppp b / validation - test / Evolution / Inputs / struct_remove_property . swift <nl> <nl> + <nl> + # if BEFORE <nl> + <nl> + public struct RemoveStoredProperty { <nl> + public init ( first : String , middle : String , last : String ) { <nl> + self . first = first <nl> + self . middle = middle <nl> + self . last = last <nl> + } <nl> + <nl> + public var first : String <nl> + public var middle : String <nl> + public var last : String <nl> + <nl> + public var name : String { <nl> + return " \ ( first ) \ ( middle ) \ ( last ) " <nl> + } <nl> + } <nl> + <nl> + # else <nl> + <nl> + public struct RemoveStoredProperty { <nl> + public init ( first : String , middle : String , last : String ) { <nl> + self . name = " \ ( first ) \ ( middle ) \ ( last ) " <nl> + } <nl> + <nl> + public var name : String <nl> + } <nl> + <nl> + # endif <nl> + <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . 9caa85cd5986 <nl> mmm / dev / null <nl> ppp b / validation - test / Evolution / test_struct_add_property . swift <nl> <nl> + / / RUN : rm - rf % t & & mkdir - p % t / before & & mkdir - p % t / after <nl> + <nl> + / / RUN : % target - build - swift - emit - library - Xfrontend - enable - resilience - D BEFORE - c % S / Inputs / struct_add_property . swift - o % t / before / struct_add_property . o <nl> + / / RUN : % target - build - swift - emit - module - Xfrontend - enable - resilience - D BEFORE - c % S / Inputs / struct_add_property . swift - o % t / before / struct_add_property . o <nl> + <nl> + / / RUN : % target - build - swift - emit - library - Xfrontend - enable - resilience - D AFTER - c % S / Inputs / struct_add_property . swift - o % t / after / struct_add_property . o <nl> + / / RUN : % target - build - swift - emit - module - Xfrontend - enable - resilience - D AFTER - c % S / Inputs / struct_add_property . swift - o % t / after / struct_add_property . o <nl> + <nl> + / / RUN : % target - build - swift - D BEFORE - c % s - I % t / before - o % t / before / main . o <nl> + / / RUN : % target - build - swift - D AFTER - c % s - I % t / after - o % t / after / main . o <nl> + <nl> + / / RUN : % target - build - swift % t / before / struct_add_property . o % t / before / main . o - o % t / before_before <nl> + / / RUN : % target - build - swift % t / before / struct_add_property . o % t / after / main . o - o % t / before_after <nl> + / / RUN : % target - build - swift % t / after / struct_add_property . o % t / before / main . o - o % t / after_before <nl> + / / RUN : % target - build - swift % t / after / struct_add_property . o % t / after / main . o - o % t / after_after <nl> + <nl> + / / RUN : % target - run % t / before_before <nl> + / / RUN : % target - run % t / before_after <nl> + / / RUN : % target - run % t / after_before <nl> + / / RUN : % target - run % t / after_after <nl> + <nl> + import StdlibUnittest <nl> + import struct_add_property <nl> + <nl> + var StructAddPropertyTest = TestSuite ( " StructAddProperty " ) <nl> + <nl> + StructAddPropertyTest . test ( " AddStoredProperty " ) { <nl> + var t1 = AddStoredProperty ( ) <nl> + var t2 = AddStoredProperty ( ) <nl> + <nl> + do { <nl> + expectEqual ( t1 . forth , " Chuck Moore " ) <nl> + expectEqual ( t2 . forth , " Chuck Moore " ) <nl> + } <nl> + <nl> + do { <nl> + t1 . forth = " Elizabeth Rather " <nl> + expectEqual ( t1 . forth , " Elizabeth Rather " ) <nl> + expectEqual ( t2 . forth , " Chuck Moore " ) <nl> + } <nl> + <nl> + <nl> + do { <nl> + if getVersion ( ) > 0 { <nl> + expectEqual ( t1 . languageDesigners , [ " Elizabeth Rather " , <nl> + " John McCarthy " , <nl> + " Dennis Ritchie " ] ) <nl> + expectEqual ( t2 . languageDesigners , [ " Chuck Moore " , <nl> + " John McCarthy " , <nl> + " Dennis Ritchie " ] ) <nl> + } else { <nl> + expectEqual ( t1 . languageDesigners , [ " Elizabeth Rather " ] ) <nl> + expectEqual ( t2 . languageDesigners , [ " Chuck Moore " ] ) <nl> + } <nl> + } <nl> + } <nl> + <nl> + StructAddPropertyTest . test ( " ChangeEmptyToNonEmpty " ) { <nl> + var t = ChangeEmptyToNonEmpty ( ) <nl> + <nl> + do { <nl> + expectEqual ( t . property , 0 ) <nl> + t . property + = 1 <nl> + expectEqual ( t . property , 1 ) <nl> + } <nl> + <nl> + do { <nl> + func increment ( inout t : Int ) { <nl> + t + = 1 <nl> + } <nl> + <nl> + increment ( & t . property ) <nl> + expectEqual ( t . property , 2 ) <nl> + } <nl> + <nl> + do { <nl> + expectEqual ( getProperty ( t ) , 2 ) <nl> + } <nl> + } <nl> + <nl> + runAllTests ( ) <nl> deleted file mode 100644 <nl> index e1339d458b8a . . 000000000000 <nl> mmm a / validation - test / Evolution / test_struct_add_remove_properties . swift <nl> ppp / dev / null <nl> <nl> - / / RUN : rm - rf % t & & mkdir - p % t / before & & mkdir - p % t / after <nl> - <nl> - / / RUN : % target - build - swift - emit - library - Xfrontend - enable - resilience - D BEFORE - c % S / Inputs / struct_add_remove_properties . swift - o % t / before / struct_add_remove_properties . o <nl> - / / RUN : % target - build - swift - emit - module - Xfrontend - enable - resilience - D BEFORE - c % S / Inputs / struct_add_remove_properties . swift - o % t / before / struct_add_remove_properties . o <nl> - <nl> - / / RUN : % target - build - swift - emit - library - Xfrontend - enable - resilience - D AFTER - c % S / Inputs / struct_add_remove_properties . swift - o % t / after / struct_add_remove_properties . o <nl> - / / RUN : % target - build - swift - emit - module - Xfrontend - enable - resilience - D AFTER - c % S / Inputs / struct_add_remove_properties . swift - o % t / after / struct_add_remove_properties . o <nl> - <nl> - / / RUN : % target - build - swift - D BEFORE - c % s - I % t / before - o % t / before / main . o <nl> - / / RUN : % target - build - swift - D AFTER - c % s - I % t / after - o % t / after / main . o <nl> - <nl> - / / RUN : % target - build - swift % t / before / struct_add_remove_properties . o % t / before / main . o - o % t / before_before <nl> - / / RUN : % target - build - swift % t / before / struct_add_remove_properties . o % t / after / main . o - o % t / before_after <nl> - / / RUN : % target - build - swift % t / after / struct_add_remove_properties . o % t / before / main . o - o % t / after_before <nl> - / / RUN : % target - build - swift % t / after / struct_add_remove_properties . o % t / after / main . o - o % t / after_after <nl> - <nl> - / / RUN : % target - run % t / before_before <nl> - / / RUN : % target - run % t / before_after <nl> - / / RUN : % target - run % t / after_before <nl> - / / RUN : % target - run % t / after_after <nl> - <nl> - import StdlibUnittest <nl> - import struct_add_remove_properties <nl> - <nl> - var StructAddRemovePropertiesTest = TestSuite ( " StructAddRemoveProperties " ) <nl> - <nl> - StructAddRemovePropertiesTest . test ( " ChangeStoredToComputed " ) { <nl> - var t = ChangeStoredToComputed ( ) <nl> - <nl> - do { <nl> - expectEqual ( t . celsius , 0 ) <nl> - expectEqual ( t . fahrenheit , 32 ) <nl> - } <nl> - <nl> - do { <nl> - t . celsius = 10 <nl> - expectEqual ( t . celsius , 10 ) <nl> - expectEqual ( t . fahrenheit , 50 ) <nl> - } <nl> - <nl> - do { <nl> - func increaseTemperature ( inout t : Int ) { <nl> - t + = 10 <nl> - } <nl> - <nl> - increaseTemperature ( & t . celsius ) <nl> - <nl> - expectEqual ( t . celsius , 20 ) <nl> - expectEqual ( t . fahrenheit , 68 ) <nl> - } <nl> - } <nl> - <nl> - StructAddRemovePropertiesTest . test ( " ChangeEmptyToNonEmpty " ) { <nl> - var t = ChangeEmptyToNonEmpty ( ) <nl> - <nl> - do { <nl> - expectEqual ( t . property , 0 ) <nl> - t . property + = 1 <nl> - expectEqual ( t . property , 1 ) <nl> - } <nl> - <nl> - do { <nl> - func increment ( inout t : Int ) { <nl> - t + = 1 <nl> - } <nl> - <nl> - increment ( & t . property ) <nl> - expectEqual ( t . property , 2 ) <nl> - } <nl> - <nl> - do { <nl> - expectEqual ( getProperty ( t ) , 2 ) <nl> - } <nl> - } <nl> - <nl> - StructAddRemovePropertiesTest . test ( " AddStoredProperty " ) { <nl> - var t = AddStoredProperty ( ) <nl> - <nl> - do { <nl> - expectEqual ( t . count , 0 ) <nl> - t . count = 100 <nl> - expectEqual ( t . count , 100 ) <nl> - } <nl> - <nl> - do { <nl> - t . count = - 1000 <nl> - expectEqual ( t . count , - 1000 ) <nl> - } <nl> - } <nl> - <nl> - runAllTests ( ) <nl> mmm a / validation - test / Evolution / test_struct_change_size . swift <nl> ppp b / validation - test / Evolution / test_struct_change_size . swift <nl> <nl> import StdlibUnittest <nl> import struct_change_size <nl> <nl> - var StructChangeSizeTest = TestSuite ( " StructChangeSize " ) <nl> + var ClassChangeSizeTest = TestSuite ( " ClassChangeSize " ) <nl> <nl> - StructChangeSizeTest . test ( " ChangeSize " ) { <nl> - var t = ChangeSize ( ) <nl> + func increment ( inout c : ChangeSize ) { <nl> + c . version + = 1 <nl> + } <nl> + <nl> + ClassChangeSizeTest . test ( " ChangeFieldOffsetsOfFixedLayout " ) { <nl> + var t = ChangeFieldOffsetsOfFixedLayout ( major : 7 , minor : 5 , patch : 3 ) <nl> <nl> do { <nl> - expectEqual ( t . value , 0 ) <nl> - t . value = 101 <nl> - expectEqual ( t . value , 101 ) <nl> + expectEqual ( t . getVersion ( ) , " 7 . 5 . 3 " ) <nl> } <nl> - } <nl> - <nl> - StructChangeSizeTest . test ( " ChangeFieldOffsetsOfFixedLayout " ) { <nl> - var t = ChangeFieldOffsetsOfFixedLayout ( ) <nl> <nl> do { <nl> - expectEqual ( t . getTotal ( ) , 0 ) <nl> + t . minor . version = 1 <nl> + t . patch . version = 2 <nl> + expectEqual ( t . getVersion ( ) , " 7 . 1 . 2 " ) <nl> } <nl> <nl> do { <nl> - t . v1 . value = 12 <nl> - expectEqual ( t . getTotal ( ) , 12 ) <nl> - t . v2 . value = - 24 <nl> - expectEqual ( t . getTotal ( ) , - 12 ) <nl> + increment ( & t . patch ) <nl> + expectEqual ( t . getVersion ( ) , " 7 . 1 . 3 " ) <nl> } <nl> } <nl> <nl> struct ChangeFieldOffsetsOfMyFixedLayout { <nl> - var v1 : ChangeSize = ChangeSize ( ) <nl> - var v2 : ChangeSize = ChangeSize ( ) <nl> + init ( major : Int32 , minor : Int32 , patch : Int32 ) { <nl> + self . major = ChangeSize ( version : major ) <nl> + self . minor = ChangeSize ( version : minor ) <nl> + self . patch = ChangeSize ( version : patch ) <nl> + } <nl> <nl> - func getTotal ( ) - > Int32 { <nl> - return v1 . value + v2 . value <nl> + var major : ChangeSize <nl> + var minor : ChangeSize <nl> + var patch : ChangeSize <nl> + <nl> + func getVersion ( ) - > String { <nl> + return " \ ( major . version ) . \ ( minor . version ) . \ ( patch . version ) " <nl> } <nl> } <nl> <nl> - StructChangeSizeTest . test ( " ChangeFieldOffsetsOfMyFixedLayout " ) { <nl> - var t = ChangeFieldOffsetsOfMyFixedLayout ( ) <nl> + ClassChangeSizeTest . test ( " ChangeFieldOffsetsOfMyFixedLayout " ) { <nl> + var t = ChangeFieldOffsetsOfMyFixedLayout ( major : 9 , minor : 2 , patch : 1 ) <nl> <nl> do { <nl> - expectEqual ( t . getTotal ( ) , 0 ) <nl> + expectEqual ( t . getVersion ( ) , " 9 . 2 . 1 " ) <nl> } <nl> <nl> do { <nl> - t . v1 . value = 12 <nl> - expectEqual ( t . getTotal ( ) , 12 ) <nl> - t . v2 . value = - 24 <nl> - expectEqual ( t . getTotal ( ) , - 12 ) <nl> + t . major . version = 7 <nl> + t . minor . version = 6 <nl> + t . patch . version = 1 <nl> + expectEqual ( t . getVersion ( ) , " 7 . 6 . 1 " ) <nl> + } <nl> + <nl> + do { <nl> + increment ( & t . patch ) <nl> + expectEqual ( t . getVersion ( ) , " 7 . 6 . 2 " ) <nl> } <nl> } <nl> <nl> runAllTests ( ) <nl> - <nl> new file mode 100644 <nl> index 000000000000 . . 388a9e3dfe26 <nl> mmm / dev / null <nl> ppp b / validation - test / Evolution / test_struct_change_stored_to_computed . swift <nl> <nl> + / / RUN : rm - rf % t & & mkdir - p % t / before & & mkdir - p % t / after <nl> + <nl> + / / RUN : % target - build - swift - emit - library - Xfrontend - enable - resilience - D BEFORE - c % S / Inputs / struct_change_stored_to_computed . swift - o % t / before / struct_change_stored_to_computed . o <nl> + / / RUN : % target - build - swift - emit - module - Xfrontend - enable - resilience - D BEFORE - c % S / Inputs / struct_change_stored_to_computed . swift - o % t / before / struct_change_stored_to_computed . o <nl> + <nl> + / / RUN : % target - build - swift - emit - library - Xfrontend - enable - resilience - D AFTER - c % S / Inputs / struct_change_stored_to_computed . swift - o % t / after / struct_change_stored_to_computed . o <nl> + / / RUN : % target - build - swift - emit - module - Xfrontend - enable - resilience - D AFTER - c % S / Inputs / struct_change_stored_to_computed . swift - o % t / after / struct_change_stored_to_computed . o <nl> + <nl> + / / RUN : % target - build - swift - D BEFORE - c % s - I % t / before - o % t / before / main . o <nl> + / / RUN : % target - build - swift - D AFTER - c % s - I % t / after - o % t / after / main . o <nl> + <nl> + / / RUN : % target - build - swift % t / before / struct_change_stored_to_computed . o % t / before / main . o - o % t / before_before <nl> + / / RUN : % target - build - swift % t / before / struct_change_stored_to_computed . o % t / after / main . o - o % t / before_after <nl> + / / RUN : % target - build - swift % t / after / struct_change_stored_to_computed . o % t / before / main . o - o % t / after_before <nl> + / / RUN : % target - build - swift % t / after / struct_change_stored_to_computed . o % t / after / main . o - o % t / after_after <nl> + <nl> + / / RUN : % target - run % t / before_before <nl> + / / RUN : % target - run % t / before_after <nl> + / / RUN : % target - run % t / after_before <nl> + / / RUN : % target - run % t / after_after <nl> + <nl> + import StdlibUnittest <nl> + import struct_change_stored_to_computed <nl> + <nl> + var ChangeStoredToComputedTest = TestSuite ( " ChangeStoredToComputed " ) <nl> + <nl> + ChangeStoredToComputedTest . test ( " ChangeStoredToComputed " ) { <nl> + var t = ChangeStoredToComputed ( ) <nl> + <nl> + do { <nl> + expectEqual ( t . celsius , 0 ) <nl> + expectEqual ( t . fahrenheit , 32 ) <nl> + } <nl> + <nl> + do { <nl> + t . celsius = 10 <nl> + expectEqual ( t . celsius , 10 ) <nl> + expectEqual ( t . fahrenheit , 50 ) <nl> + } <nl> + <nl> + do { <nl> + func increaseTemperature ( inout t : Int ) { <nl> + t + = 10 <nl> + } <nl> + <nl> + increaseTemperature ( & t . celsius ) <nl> + <nl> + expectEqual ( t . celsius , 20 ) <nl> + expectEqual ( t . fahrenheit , 68 ) <nl> + } <nl> + } <nl> + <nl> + runAllTests ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 5ee5a0c904dc <nl> mmm / dev / null <nl> ppp b / validation - test / Evolution / test_struct_remove_property . swift <nl> <nl> + / / RUN : rm - rf % t & & mkdir - p % t / before & & mkdir - p % t / after <nl> + <nl> + / / RUN : % target - build - swift - emit - library - Xfrontend - enable - resilience - D BEFORE - c % S / Inputs / struct_remove_property . swift - o % t / before / struct_remove_property . o <nl> + / / RUN : % target - build - swift - emit - module - Xfrontend - enable - resilience - D BEFORE - c % S / Inputs / struct_remove_property . swift - o % t / before / struct_remove_property . o <nl> + <nl> + / / RUN : % target - build - swift - emit - library - Xfrontend - enable - resilience - D AFTER - c % S / Inputs / struct_remove_property . swift - o % t / after / struct_remove_property . o <nl> + / / RUN : % target - build - swift - emit - module - Xfrontend - enable - resilience - D AFTER - c % S / Inputs / struct_remove_property . swift - o % t / after / struct_remove_property . o <nl> + <nl> + / / RUN : % target - build - swift - D BEFORE - c % s - I % t / before - o % t / before / main . o <nl> + / / RUN : % target - build - swift - D AFTER - c % s - I % t / after - o % t / after / main . o <nl> + <nl> + / / RUN : % target - build - swift % t / before / struct_remove_property . o % t / before / main . o - o % t / before_before <nl> + / / RUN : % target - build - swift % t / before / struct_remove_property . o % t / after / main . o - o % t / before_after <nl> + / / RUN : % target - build - swift % t / after / struct_remove_property . o % t / before / main . o - o % t / after_before <nl> + / / RUN : % target - build - swift % t / after / struct_remove_property . o % t / after / main . o - o % t / after_after <nl> + <nl> + / / RUN : % target - run % t / before_before <nl> + / / RUN : % target - run % t / before_after <nl> + / / RUN : % target - run % t / after_before <nl> + / / RUN : % target - run % t / after_after <nl> + <nl> + import StdlibUnittest <nl> + import struct_remove_property <nl> + <nl> + var StructRemovePropertyTest = TestSuite ( " StructRemoveProperty " ) <nl> + <nl> + StructRemovePropertyTest . test ( " RemoveStoredProperty " ) { <nl> + var dog = RemoveStoredProperty ( first : " Barnaby " , <nl> + middle : " Winston " , <nl> + last : " Fluffington " ) <nl> + <nl> + do { <nl> + expectEqual ( dog . name , " Barnaby Winston Fluffington " ) <nl> + } <nl> + } <nl> + <nl> + runAllTests ( ) <nl>
Library evolution tests : split up struct_add_remove_properties into multiple tests
apple/swift
c5592e63ffd4416e1d625c14001347fc72227597
2016-01-23T00:04:29Z
mmm a / src / core / ext / filters / client_channel / client_channel_channelz . cc <nl> ppp b / src / core / ext / filters / client_channel / client_channel_channelz . cc <nl> grpc_json * ClientChannelNode : : RenderJson ( ) { <nl> GPR_ASSERT ( target_view ( ) ! = nullptr ) ; <nl> grpc_json_create_child ( nullptr , json , " target " , target_view ( ) , <nl> GRPC_JSON_STRING , false ) ; <nl> - / / as CallCountingAndTracingNode to populate trace and call count data . <nl> - counter_and_tracer ( ) - > PopulateTrace ( json ) ; <nl> - counter_and_tracer ( ) - > PopulateCallData ( json ) ; <nl> + / / fill in the channel trace if applicable <nl> + grpc_json * trace_json = trace ( ) - > RenderJson ( ) ; <nl> + if ( trace_json ! = nullptr ) { <nl> + trace_json - > key = " trace " ; / / this object is named trace in channelz . proto <nl> + grpc_json_link_child ( json , trace_json , nullptr ) ; <nl> + } <nl> + / / ask CallCountingHelper to populate trace and call count data . <nl> + call_counter ( ) - > PopulateCallData ( json ) ; <nl> / / reset to the top level <nl> json = top_level_json ; <nl> PopulateChildRefs ( json ) ; <nl> SubchannelNode : : SubchannelNode ( grpc_subchannel * subchannel , <nl> size_t channel_tracer_max_nodes ) <nl> : BaseNode ( EntityType : : kSubchannel ) , <nl> subchannel_ ( subchannel ) , <nl> - target_ ( <nl> - UniquePtr < char > ( gpr_strdup ( grpc_subchannel_get_target ( subchannel_ ) ) ) ) , <nl> - counter_and_tracer_ ( channel_tracer_max_nodes ) { } <nl> + target_ ( UniquePtr < char > ( <nl> + gpr_strdup ( grpc_subchannel_get_target ( subchannel_ ) ) ) ) { <nl> + trace_ . Init ( channel_tracer_max_nodes ) ; <nl> + } <nl> <nl> - SubchannelNode : : ~ SubchannelNode ( ) { } <nl> + SubchannelNode : : ~ SubchannelNode ( ) { trace_ . Destroy ( ) ; } <nl> <nl> void SubchannelNode : : PopulateConnectivityState ( grpc_json * json ) { <nl> grpc_connectivity_state state ; <nl> grpc_json * SubchannelNode : : RenderJson ( ) { <nl> GPR_ASSERT ( target_ . get ( ) ! = nullptr ) ; <nl> grpc_json_create_child ( nullptr , json , " target " , target_ . get ( ) , <nl> GRPC_JSON_STRING , false ) ; <nl> - counter_and_tracer_ . PopulateTrace ( json ) ; <nl> - counter_and_tracer_ . PopulateCallData ( json ) ; <nl> + / / fill in the channel trace if applicable <nl> + grpc_json * trace_json = trace_ - > RenderJson ( ) ; <nl> + if ( trace_json ! = nullptr ) { <nl> + trace_json - > key = " trace " ; / / this object is named trace in channelz . proto <nl> + grpc_json_link_child ( json , trace_json , nullptr ) ; <nl> + } <nl> + / / ask CallCountingHelper to populate trace and call count data . <nl> + call_counter_ . PopulateCallData ( json ) ; <nl> return top_level_json ; <nl> } <nl> <nl> mmm a / src / core / ext / filters / client_channel / client_channel_channelz . h <nl> ppp b / src / core / ext / filters / client_channel / client_channel_channelz . h <nl> class SubchannelNode : public BaseNode { <nl> <nl> grpc_json * RenderJson ( ) override ; <nl> <nl> - CallCountingAndTracingNode * counter_and_tracer ( ) { <nl> - return & counter_and_tracer_ ; <nl> - } <nl> + / / proxy methods to composed classes . <nl> + ChannelTrace * trace ( ) { return trace_ . get ( ) ; } <nl> + void RecordCallStarted ( ) { call_counter_ . RecordCallStarted ( ) ; } <nl> + void RecordCallFailed ( ) { call_counter_ . RecordCallFailed ( ) ; } <nl> + void RecordCallSucceeded ( ) { call_counter_ . RecordCallSucceeded ( ) ; } <nl> <nl> private : <nl> grpc_subchannel * subchannel_ ; <nl> UniquePtr < char > target_ ; <nl> - CallCountingAndTracingNode counter_and_tracer_ ; <nl> + CallCountingHelper call_counter_ ; <nl> + ManualConstructor < ChannelTrace > trace_ ; <nl> <nl> void PopulateConnectivityState ( grpc_json * json ) ; <nl> } ; <nl> mmm a / src / core / ext / filters / client_channel / subchannel . cc <nl> ppp b / src / core / ext / filters / client_channel / subchannel . cc <nl> static void connection_destroy ( void * arg , grpc_error * error ) { <nl> static void subchannel_destroy ( void * arg , grpc_error * error ) { <nl> grpc_subchannel * c = static_cast < grpc_subchannel * > ( arg ) ; <nl> if ( c - > channelz_subchannel ! = nullptr ) { <nl> - c - > channelz_subchannel - > counter_and_tracer ( ) - > trace ( ) - > AddTraceEvent ( <nl> + c - > channelz_subchannel - > trace ( ) - > AddTraceEvent ( <nl> grpc_core : : channelz : : ChannelTrace : : Severity : : Info , <nl> grpc_slice_from_static_string ( " Subchannel destroyed " ) ) ; <nl> c - > channelz_subchannel - > MarkSubchannelDestroyed ( ) ; <nl> grpc_subchannel * grpc_subchannel_create ( grpc_connector * connector , <nl> c - > channelz_subchannel = <nl> grpc_core : : MakeRefCounted < grpc_core : : channelz : : SubchannelNode > ( <nl> c , channel_tracer_max_nodes ) ; <nl> - c - > channelz_subchannel - > counter_and_tracer ( ) - > trace ( ) - > AddTraceEvent ( <nl> + c - > channelz_subchannel - > trace ( ) - > AddTraceEvent ( <nl> grpc_core : : channelz : : ChannelTrace : : Severity : : Info , <nl> grpc_slice_from_static_string ( " Subchannel created " ) ) ; <nl> } <nl> mmm a / src / core / lib / channel / channelz . cc <nl> ppp b / src / core / lib / channel / channelz . cc <nl> char * BaseNode : : RenderJsonString ( ) { <nl> return json_str ; <nl> } <nl> <nl> - CallCountingAndTracingNode : : CallCountingAndTracingNode ( <nl> - size_t channel_tracer_max_nodes ) { <nl> - trace_ . Init ( channel_tracer_max_nodes ) ; <nl> + CallCountingHelper : : CallCountingHelper ( ) { <nl> gpr_atm_no_barrier_store ( & last_call_started_millis_ , <nl> ( gpr_atm ) ExecCtx : : Get ( ) - > Now ( ) ) ; <nl> } <nl> <nl> - CallCountingAndTracingNode : : ~ CallCountingAndTracingNode ( ) { trace_ . Destroy ( ) ; } <nl> + CallCountingHelper : : ~ CallCountingHelper ( ) { } <nl> <nl> - void CallCountingAndTracingNode : : RecordCallStarted ( ) { <nl> + void CallCountingHelper : : RecordCallStarted ( ) { <nl> gpr_atm_no_barrier_fetch_add ( & calls_started_ , ( gpr_atm ) 1 ) ; <nl> gpr_atm_no_barrier_store ( & last_call_started_millis_ , <nl> ( gpr_atm ) ExecCtx : : Get ( ) - > Now ( ) ) ; <nl> } <nl> <nl> - void CallCountingAndTracingNode : : PopulateTrace ( grpc_json * json ) { <nl> - / / fill in the channel trace if applicable <nl> - grpc_json * trace_json = trace_ - > RenderJson ( ) ; <nl> - if ( trace_json ! = nullptr ) { <nl> - / / we manually link up and fill the child since it was created for us in <nl> - / / ChannelTrace : : RenderJson <nl> - trace_json - > key = " trace " ; / / this object is named trace in channelz . proto <nl> - grpc_json_link_child ( json , trace_json , nullptr ) ; <nl> - } <nl> - } <nl> - <nl> - void CallCountingAndTracingNode : : PopulateCallData ( grpc_json * json ) { <nl> + void CallCountingHelper : : PopulateCallData ( grpc_json * json ) { <nl> grpc_json * json_iterator = nullptr ; <nl> if ( calls_started_ ! = 0 ) { <nl> json_iterator = grpc_json_add_number_string_child ( <nl> ChannelNode : : ChannelNode ( grpc_channel * channel , size_t channel_tracer_max_nodes , <nl> : BaseNode ( is_top_level_channel ? EntityType : : kTopLevelChannel <nl> : EntityType : : kInternalChannel ) , <nl> channel_ ( channel ) , <nl> - target_ ( UniquePtr < char > ( grpc_channel_get_target ( channel_ ) ) ) , <nl> - counter_and_tracer_ ( channel_tracer_max_nodes ) { } <nl> + target_ ( UniquePtr < char > ( grpc_channel_get_target ( channel_ ) ) ) { <nl> + trace_ . Init ( channel_tracer_max_nodes ) ; <nl> + } <nl> <nl> - ChannelNode : : ~ ChannelNode ( ) { } <nl> + ChannelNode : : ~ ChannelNode ( ) { trace_ . Destroy ( ) ; } <nl> <nl> grpc_json * ChannelNode : : RenderJson ( ) { <nl> / / We need to track these three json objects to build our object <nl> grpc_json * ChannelNode : : RenderJson ( ) { <nl> GPR_ASSERT ( target_ . get ( ) ! = nullptr ) ; <nl> grpc_json_create_child ( nullptr , json , " target " , target_ . get ( ) , <nl> GRPC_JSON_STRING , false ) ; <nl> - / / as CallCountingAndTracingNode to populate trace and call count data . <nl> - counter_and_tracer_ . PopulateTrace ( json ) ; <nl> - counter_and_tracer_ . PopulateCallData ( json ) ; <nl> + / / fill in the channel trace if applicable <nl> + grpc_json * trace_json = trace_ - > RenderJson ( ) ; <nl> + if ( trace_json ! = nullptr ) { <nl> + trace_json - > key = " trace " ; / / this object is named trace in channelz . proto <nl> + grpc_json_link_child ( json , trace_json , nullptr ) ; <nl> + } <nl> + / / ask CallCountingHelper to populate trace and call count data . <nl> + call_counter_ . PopulateCallData ( json ) ; <nl> return top_level_json ; <nl> } <nl> <nl> mmm a / src / core / lib / channel / channelz . h <nl> ppp b / src / core / lib / channel / channelz . h <nl> namespace grpc_core { <nl> namespace channelz { <nl> <nl> namespace testing { <nl> - class CallCountingAndTracingNodePeer ; <nl> + class CallCountingHelperPeer ; <nl> } <nl> <nl> / / base class for all channelz entities <nl> class BaseNode : public RefCounted < BaseNode > { <nl> kSocket , <nl> } ; <nl> <nl> - BaseNode ( EntityType type ) ; <nl> + explicit BaseNode ( EntityType type ) ; <nl> virtual ~ BaseNode ( ) ; <nl> <nl> / / All children must implement this function . <nl> class BaseNode : public RefCounted < BaseNode > { <nl> intptr_t uuid ( ) const { return uuid_ ; } <nl> <nl> private : <nl> - friend class ChannelTrace ; <nl> - EntityType type_ ; <nl> + const EntityType type_ ; <nl> const intptr_t uuid_ ; <nl> } ; <nl> <nl> - / / This class is the parent for the channelz entities that deal with Channels <nl> + / / This class is a helper class for channelz entities that deal with Channels <nl> / / Subchannels , and Servers , since those have similar proto definitions . <nl> / / This class has the ability to : <nl> / / - track calls_ { started , succeeded , failed } <nl> / / - track last_call_started_timestamp <nl> - / / - hold the channel trace . <nl> - / / - perform common rendering . <nl> - class CallCountingAndTracingNode { <nl> + / / - perform rendering of the above items <nl> + class CallCountingHelper { <nl> public : <nl> - CallCountingAndTracingNode ( size_t channel_tracer_max_nodes ) ; <nl> - ~ CallCountingAndTracingNode ( ) ; <nl> + CallCountingHelper ( ) ; <nl> + ~ CallCountingHelper ( ) ; <nl> <nl> void RecordCallStarted ( ) ; <nl> void RecordCallFailed ( ) { <nl> class CallCountingAndTracingNode { <nl> void RecordCallSucceeded ( ) { <nl> gpr_atm_no_barrier_fetch_add ( & calls_succeeded_ , ( gpr_atm ( 1 ) ) ) ; <nl> } <nl> - ChannelTrace * trace ( ) { return trace_ . get ( ) ; } <nl> - <nl> - / / Common rendering of the channel trace . <nl> - void PopulateTrace ( grpc_json * json ) ; <nl> <nl> / / Common rendering of the call count data and last_call_started_timestamp . <nl> void PopulateCallData ( grpc_json * json ) ; <nl> <nl> private : <nl> / / testing peer friend . <nl> - friend class testing : : CallCountingAndTracingNodePeer ; <nl> + friend class testing : : CallCountingHelperPeer ; <nl> <nl> gpr_atm calls_started_ = 0 ; <nl> gpr_atm calls_succeeded_ = 0 ; <nl> gpr_atm calls_failed_ = 0 ; <nl> gpr_atm last_call_started_millis_ = 0 ; <nl> - ManualConstructor < ChannelTrace > trace_ ; <nl> } ; <nl> <nl> / / Handles channelz bookkeeping for channels <nl> class ChannelNode : public BaseNode { <nl> <nl> bool ChannelIsDestroyed ( ) { return channel_ = = nullptr ; } <nl> <nl> - CallCountingAndTracingNode * counter_and_tracer ( ) { <nl> - return & counter_and_tracer_ ; <nl> - } <nl> + / / proxy methods to composed classes . <nl> + ChannelTrace * trace ( ) { return trace_ . get ( ) ; } <nl> + void RecordCallStarted ( ) { call_counter_ . RecordCallStarted ( ) ; } <nl> + void RecordCallFailed ( ) { call_counter_ . RecordCallFailed ( ) ; } <nl> + void RecordCallSucceeded ( ) { call_counter_ . RecordCallSucceeded ( ) ; } <nl> <nl> protected : <nl> / / provides view of target for child . <nl> char * target_view ( ) { return target_ . get ( ) ; } <nl> + / / provides access to call_counter_ for child . <nl> + CallCountingHelper * call_counter ( ) { return & call_counter_ ; } <nl> <nl> private : <nl> grpc_channel * channel_ = nullptr ; <nl> UniquePtr < char > target_ ; <nl> - CallCountingAndTracingNode counter_and_tracer_ ; <nl> + CallCountingHelper call_counter_ ; <nl> + ManualConstructor < ChannelTrace > trace_ ; <nl> } ; <nl> <nl> / / Handles channelz bookkeeping for servers <nl> / / TODO ( ncteisen ) : implement in subsequent PR . <nl> class ServerNode : public BaseNode { <nl> public : <nl> - ServerNode ( size_t channel_tracer_max_nodes ) : BaseNode ( EntityType : : kServer ) { } <nl> + explicit ServerNode ( size_t channel_tracer_max_nodes ) <nl> + : BaseNode ( EntityType : : kServer ) { } <nl> ~ ServerNode ( ) override { } <nl> } ; <nl> <nl> mmm a / src / core / lib / surface / call . cc <nl> ppp b / src / core / lib / surface / call . cc <nl> grpc_error * grpc_call_create ( const grpc_call_create_args * args , <nl> grpc_core : : channelz : : ChannelNode * channelz_channel = <nl> grpc_channel_get_channelz_node ( call - > channel ) ; <nl> if ( channelz_channel ! = nullptr ) { <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallStarted ( ) ; <nl> + channelz_channel - > RecordCallStarted ( ) ; <nl> } <nl> <nl> grpc_slice_unref_internal ( path ) ; <nl> static void post_batch_completion ( batch_control * bctl ) { <nl> grpc_channel_get_channelz_node ( call - > channel ) ; <nl> if ( channelz_channel ! = nullptr ) { <nl> if ( * call - > final_op . client . status ! = GRPC_STATUS_OK ) { <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallFailed ( ) ; <nl> + channelz_channel - > RecordCallFailed ( ) ; <nl> } else { <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallSucceeded ( ) ; <nl> + channelz_channel - > RecordCallSucceeded ( ) ; <nl> } <nl> } <nl> GRPC_ERROR_UNREF ( error ) ; <nl> mmm a / src / core / lib / surface / channel . cc <nl> ppp b / src / core / lib / surface / channel . cc <nl> grpc_channel * grpc_channel_create_with_builder ( <nl> bool is_top_level_channel = channel - > is_client & & ! internal_channel ; <nl> channel - > channelz_channel = channel_node_create_func ( <nl> channel , channel_tracer_max_nodes , is_top_level_channel ) ; <nl> - channel - > channelz_channel - > counter_and_tracer ( ) - > trace ( ) - > AddTraceEvent ( <nl> + channel - > channelz_channel - > trace ( ) - > AddTraceEvent ( <nl> grpc_core : : channelz : : ChannelTrace : : Severity : : Info , <nl> grpc_slice_from_static_string ( " Channel created " ) ) ; <nl> } <nl> void grpc_channel_internal_unref ( grpc_channel * c REF_ARG ) { <nl> static void destroy_channel ( void * arg , grpc_error * error ) { <nl> grpc_channel * channel = static_cast < grpc_channel * > ( arg ) ; <nl> if ( channel - > channelz_channel ! = nullptr ) { <nl> - channel - > channelz_channel - > counter_and_tracer ( ) - > trace ( ) - > AddTraceEvent ( <nl> + channel - > channelz_channel - > trace ( ) - > AddTraceEvent ( <nl> grpc_core : : channelz : : ChannelTrace : : Severity : : Info , <nl> grpc_slice_from_static_string ( " Channel destroyed " ) ) ; <nl> channel - > channelz_channel - > MarkChannelDestroyed ( ) ; <nl> mmm a / test / core / channel / channel_trace_test . cc <nl> ppp b / test / core / channel / channel_trace_test . cc <nl> void ValidateChannelTrace ( ChannelTrace * tracer , <nl> grpc_json * json = tracer - > RenderJson ( ) ; <nl> EXPECT_NE ( json , nullptr ) ; <nl> char * json_str = grpc_json_dump_to_string ( json , 0 ) ; <nl> - gpr_log ( GPR_ERROR , " % s " , json_str ) ; <nl> grpc_json_destroy ( json ) ; <nl> grpc : : testing : : ValidateChannelTraceProtoJsonTranslation ( json_str ) ; <nl> grpc_json * parsed_json = grpc_json_parse_string ( json_str ) ; <nl> TEST_P ( ChannelTracerTest , ComplexTest ) { <nl> ChannelTrace : : Severity : : Info , <nl> grpc_slice_from_static_string ( " subchannel one created " ) , sc1 ) ; <nl> ValidateChannelTrace ( & tracer , 3 , GetParam ( ) ) ; <nl> - AddSimpleTrace ( sc1 - > counter_and_tracer ( ) - > trace ( ) ) ; <nl> - AddSimpleTrace ( sc1 - > counter_and_tracer ( ) - > trace ( ) ) ; <nl> - AddSimpleTrace ( sc1 - > counter_and_tracer ( ) - > trace ( ) ) ; <nl> - ValidateChannelTrace ( sc1 - > counter_and_tracer ( ) - > trace ( ) , 3 , GetParam ( ) ) ; <nl> - AddSimpleTrace ( sc1 - > counter_and_tracer ( ) - > trace ( ) ) ; <nl> - AddSimpleTrace ( sc1 - > counter_and_tracer ( ) - > trace ( ) ) ; <nl> - AddSimpleTrace ( sc1 - > counter_and_tracer ( ) - > trace ( ) ) ; <nl> - ValidateChannelTrace ( sc1 - > counter_and_tracer ( ) - > trace ( ) , 6 , GetParam ( ) ) ; <nl> + AddSimpleTrace ( sc1 - > trace ( ) ) ; <nl> + AddSimpleTrace ( sc1 - > trace ( ) ) ; <nl> + AddSimpleTrace ( sc1 - > trace ( ) ) ; <nl> + ValidateChannelTrace ( sc1 - > trace ( ) , 3 , GetParam ( ) ) ; <nl> + AddSimpleTrace ( sc1 - > trace ( ) ) ; <nl> + AddSimpleTrace ( sc1 - > trace ( ) ) ; <nl> + AddSimpleTrace ( sc1 - > trace ( ) ) ; <nl> + ValidateChannelTrace ( sc1 - > trace ( ) , 6 , GetParam ( ) ) ; <nl> AddSimpleTrace ( & tracer ) ; <nl> AddSimpleTrace ( & tracer ) ; <nl> ValidateChannelTrace ( & tracer , 5 , GetParam ( ) ) ; <nl> TEST_P ( ChannelTracerTest , TestNesting ) { <nl> ChannelTrace : : Severity : : Info , <nl> grpc_slice_from_static_string ( " subchannel one created " ) , sc1 ) ; <nl> ValidateChannelTrace ( & tracer , 3 , GetParam ( ) ) ; <nl> - AddSimpleTrace ( sc1 - > counter_and_tracer ( ) - > trace ( ) ) ; <nl> + AddSimpleTrace ( sc1 - > trace ( ) ) ; <nl> ChannelFixture channel2 ( GetParam ( ) ) ; <nl> RefCountedPtr < ChannelNode > conn1 = <nl> MakeRefCounted < ChannelNode > ( channel2 . channel ( ) , GetParam ( ) , true ) ; <nl> / / nesting one level deeper . <nl> - sc1 - > counter_and_tracer ( ) - > trace ( ) - > AddTraceEventWithReference ( <nl> + sc1 - > trace ( ) - > AddTraceEventWithReference ( <nl> ChannelTrace : : Severity : : Info , <nl> grpc_slice_from_static_string ( " connection one created " ) , conn1 ) ; <nl> ValidateChannelTrace ( & tracer , 3 , GetParam ( ) ) ; <nl> - AddSimpleTrace ( conn1 - > counter_and_tracer ( ) - > trace ( ) ) ; <nl> + AddSimpleTrace ( conn1 - > trace ( ) ) ; <nl> AddSimpleTrace ( & tracer ) ; <nl> AddSimpleTrace ( & tracer ) ; <nl> ValidateChannelTrace ( & tracer , 5 , GetParam ( ) ) ; <nl> - ValidateChannelTrace ( conn1 - > counter_and_tracer ( ) - > trace ( ) , 1 , GetParam ( ) ) ; <nl> + ValidateChannelTrace ( conn1 - > trace ( ) , 1 , GetParam ( ) ) ; <nl> ChannelFixture channel3 ( GetParam ( ) ) ; <nl> RefCountedPtr < ChannelNode > sc2 = <nl> MakeRefCounted < ChannelNode > ( channel3 . channel ( ) , GetParam ( ) , true ) ; <nl> mmm a / test / core / channel / channelz_test . cc <nl> ppp b / test / core / channel / channelz_test . cc <nl> namespace channelz { <nl> namespace testing { <nl> <nl> / / testing peer to access channel internals <nl> - class CallCountingAndTracingNodePeer { <nl> + class CallCountingHelperPeer { <nl> public : <nl> - CallCountingAndTracingNodePeer ( CallCountingAndTracingNode * node ) <nl> - : node_ ( node ) { } <nl> + CallCountingHelperPeer ( CallCountingHelper * node ) : node_ ( node ) { } <nl> grpc_millis last_call_started_millis ( ) { <nl> return ( grpc_millis ) gpr_atm_no_barrier_load ( <nl> & node_ - > last_call_started_millis_ ) ; <nl> } <nl> <nl> private : <nl> - CallCountingAndTracingNode * node_ ; <nl> + CallCountingHelper * node_ ; <nl> } ; <nl> <nl> namespace { <nl> void ValidateChannel ( ChannelNode * channel , validate_channel_data_args args ) { <nl> gpr_free ( core_api_json_str ) ; <nl> } <nl> <nl> - grpc_millis GetLastCallStartedMillis ( CallCountingAndTracingNode * channel ) { <nl> - CallCountingAndTracingNodePeer peer ( channel ) ; <nl> + grpc_millis GetLastCallStartedMillis ( CallCountingHelper * channel ) { <nl> + CallCountingHelperPeer peer ( channel ) ; <nl> return peer . last_call_started_millis ( ) ; <nl> } <nl> <nl> TEST_P ( ChannelzChannelTest , BasicChannelAPIFunctionality ) { <nl> ChannelFixture channel ( GetParam ( ) ) ; <nl> ChannelNode * channelz_channel = <nl> grpc_channel_get_channelz_node ( channel . channel ( ) ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallStarted ( ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallFailed ( ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallSucceeded ( ) ; <nl> + channelz_channel - > RecordCallStarted ( ) ; <nl> + channelz_channel - > RecordCallFailed ( ) ; <nl> + channelz_channel - > RecordCallSucceeded ( ) ; <nl> ValidateChannel ( channelz_channel , { 1 , 1 , 1 } ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallStarted ( ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallFailed ( ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallSucceeded ( ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallStarted ( ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallFailed ( ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallSucceeded ( ) ; <nl> + channelz_channel - > RecordCallStarted ( ) ; <nl> + channelz_channel - > RecordCallFailed ( ) ; <nl> + channelz_channel - > RecordCallSucceeded ( ) ; <nl> + channelz_channel - > RecordCallStarted ( ) ; <nl> + channelz_channel - > RecordCallFailed ( ) ; <nl> + channelz_channel - > RecordCallSucceeded ( ) ; <nl> ValidateChannel ( channelz_channel , { 3 , 3 , 3 } ) ; <nl> } <nl> <nl> TEST_P ( ChannelzChannelTest , LastCallStartedMillis ) { <nl> grpc_core : : ExecCtx exec_ctx ; <nl> - ChannelFixture channel ( GetParam ( ) ) ; <nl> - ChannelNode * channelz_channel = <nl> - grpc_channel_get_channelz_node ( channel . channel ( ) ) ; <nl> + CallCountingHelper counter ; <nl> / / start a call to set the last call started timestamp <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallStarted ( ) ; <nl> - grpc_millis millis1 = <nl> - GetLastCallStartedMillis ( channelz_channel - > counter_and_tracer ( ) ) ; <nl> + counter . RecordCallStarted ( ) ; <nl> + grpc_millis millis1 = GetLastCallStartedMillis ( & counter ) ; <nl> / / time gone by should not affect the timestamp <nl> ChannelzSleep ( 100 ) ; <nl> - grpc_millis millis2 = <nl> - GetLastCallStartedMillis ( channelz_channel - > counter_and_tracer ( ) ) ; <nl> + grpc_millis millis2 = GetLastCallStartedMillis ( & counter ) ; <nl> EXPECT_EQ ( millis1 , millis2 ) ; <nl> / / calls succeeded or failed should not affect the timestamp <nl> ChannelzSleep ( 100 ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallFailed ( ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallSucceeded ( ) ; <nl> - grpc_millis millis3 = <nl> - GetLastCallStartedMillis ( channelz_channel - > counter_and_tracer ( ) ) ; <nl> + counter . RecordCallFailed ( ) ; <nl> + counter . RecordCallSucceeded ( ) ; <nl> + grpc_millis millis3 = GetLastCallStartedMillis ( & counter ) ; <nl> EXPECT_EQ ( millis1 , millis3 ) ; <nl> / / another call started should affect the timestamp <nl> / / sleep for extra long to avoid flakes ( since we cache Now ( ) ) <nl> ChannelzSleep ( 5000 ) ; <nl> - channelz_channel - > counter_and_tracer ( ) - > RecordCallStarted ( ) ; <nl> - grpc_millis millis4 = <nl> - GetLastCallStartedMillis ( channelz_channel - > counter_and_tracer ( ) ) ; <nl> + counter . RecordCallStarted ( ) ; <nl> + grpc_millis millis4 = GetLastCallStartedMillis ( & counter ) ; <nl> EXPECT_NE ( millis1 , millis4 ) ; <nl> } <nl> <nl>
reviewer comments
grpc/grpc
58db94e5d9f3e55f14760f936a42e5e6ddb6bd5b
2018-07-30T03:30:05Z
mmm a / src / code - stub - assembler . cc <nl> ppp b / src / code - stub - assembler . cc <nl> Node * ToDirectStringAssembler : : TryToDirect ( Label * if_bailout ) { <nl> Label if_isthin ( this ) ; <nl> Label out ( this ) ; <nl> <nl> - Goto ( & dispatch ) ; <nl> + Branch ( IsSequentialStringInstanceType ( var_instance_type_ . value ( ) ) , & out , <nl> + & dispatch ) ; <nl> <nl> / / Dispatch based on string representation . <nl> Bind ( & dispatch ) ; <nl> Node * ToDirectStringAssembler : : TryToSequential ( StringPointerKind ptr_kind , <nl> CHECK ( ptr_kind = = PTR_TO_DATA | | ptr_kind = = PTR_TO_STRING ) ; <nl> <nl> Variable var_result ( this , MachineType : : PointerRepresentation ( ) ) ; <nl> - Label out ( this ) , if_issequential ( this ) , if_isexternal ( this ) ; <nl> + Label out ( this ) , if_issequential ( this ) , if_isexternal ( this , Label : : kDeferred ) ; <nl> Branch ( is_external ( ) , & if_isexternal , & if_issequential ) ; <nl> <nl> Bind ( & if_issequential ) ; <nl>
[ string ] Optimize ToDirectStringAssembler for sequential strings
v8/v8
338257509d7f5ec8ea0a16ba3eb263265efa06f9
2017-03-17T12:19:29Z
mmm a / Marlin / src / lcd / language / language_es . h <nl> ppp b / Marlin / src / lcd / language / language_es . h <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT ( " Calent . cama fallido " ) ; <nl> PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT ( " Calent . Cám . fallido " ) ; <nl> PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT ( " Err : TEMP . REDUN . " ) ; <nl> - PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT ( " ESCAPE TERMICO " ) ; <nl> - PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT ( " ESC . TERMICO CAMA " ) ; <nl> - PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT ( " ESC . TERMICO CAMARA " ) ; <nl> + PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT ( " FUGA TÉRMICA " ) ; <nl> + PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT ( " FUGA TÉRMICA CAMA " ) ; <nl> + PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT ( " FUGA TÉRMICA CAMARA " ) ; <nl> PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT ( " Err : TEMP . MÁX " ) ; <nl> PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT ( " Err : TEMP . MIN " ) ; <nl> PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT ( " Err : TEMP . MÁX CAMA " ) ; <nl>
Update Spanish Translation ( )
MarlinFirmware/Marlin
d57a66809750130392cabe31f170b7a2833d8ebc
2019-10-15T16:38:57Z
mmm a / hphp / hack / src / typing / tast_check / type_test_hint_check . ml <nl> ppp b / hphp / hack / src / typing / tast_check / type_test_hint_check . ml <nl> let visitor = object ( this ) <nl> | Aast . Tvoid <nl> | Aast . Tnoreturn - > update acc @ @ Invalid ( r , Tprim prim ) <nl> | _ - > acc <nl> - method ! on_tfun acc r fun_type = update acc @ @ Invalid ( r , Tfun fun_type ) <nl> + method ! on_tfun acc r fun_type = update acc @ @ Invalid ( r , Tfun fun_type ) <nl> method ! on_tvar acc r id = update acc @ @ Invalid ( r , Tvar id ) <nl> method ! on_tabstract acc r ak ty_opt = <nl> match ak with <nl> let visitor = object ( this ) <nl> | _ - > <nl> let acc = super # on_tclass acc r cls tyl in <nl> begin match acc . validity with <nl> - | Valid - > update acc @ @ Partial ( r , Tclass ( cls , tyl ) ) <nl> + | Valid - > update acc @ @ Partial ( r , Tclass ( cls , tyl ) ) <nl> | _ - > acc <nl> end <nl> + method ! on_tapply acc r ( ( _ , name ) as id ) tyl = <nl> + if tyl < > [ ] & & Typing_env . is_typedef name <nl> + then update acc @ @ Invalid ( r , Tapply ( id , tyl ) ) <nl> + else acc <nl> method ! on_tarraykind acc r array_kind = <nl> - update acc @ @ Invalid ( r , Tarraykind array_kind ) <nl> + update acc @ @ Invalid ( r , Tarraykind array_kind ) <nl> method is_wildcard = function <nl> | _ , Tabstract ( AKgeneric name , _ ) - > <nl> Env . is_fresh_generic_parameter name <nl> end <nl> let print_type : type a . a ty_ - > string = function <nl> | Tclass ( _ , tyl ) when tyl < > [ ] - > <nl> " a type with generics , because generics are erased at runtime " <nl> + | Tapply ( _ , tyl ) when tyl < > [ ] - > <nl> + " a type with generics , because generics are erased at runtime " <nl> | ty_ - > Typing_print . error ty_ <nl> <nl> let validate_hint env hint op = <nl> let hint_ty = Env . hint_to_ty env hint in <nl> - let env , hint_ty = Env . localize_with_self env hint_ty in <nl> - let state = visitor # on_type { env = env ; validity = Valid } hint_ty in <nl> - match state . validity with <nl> - | Invalid ( r , ty_ ) - > <nl> - Errors . invalid_is_as_expression_hint <nl> - ( Reason . to_pos r ) op ( print_type ty_ ) <nl> - | Partial ( r , ty_ ) - > <nl> - Errors . partially_valid_is_as_expression_hint <nl> - ( Reason . to_pos r ) op ( print_type ty_ ) <nl> - | Valid - > ( ) <nl> + let validate_type env ty = <nl> + let state = visitor # on_type { env = env ; validity = Valid } ty in <nl> + match state . validity with <nl> + | Invalid ( r , ty_ ) - > <nl> + Errors . invalid_is_as_expression_hint <nl> + ( Reason . to_pos r ) op ( print_type ty_ ) <nl> + | Partial ( r , ty_ ) - > <nl> + Errors . partially_valid_is_as_expression_hint <nl> + ( Reason . to_pos r ) op ( print_type ty_ ) <nl> + | Valid - > ( ) <nl> + in <nl> + let env , hint_ty = Env . localize_with_dty_validator <nl> + env hint_ty ( validate_type env ) in <nl> + validate_type env hint_ty <nl> <nl> let handler = object <nl> inherit Tast_visitor . handler_base <nl> mmm a / hphp / hack / src / typing / tast_env . ml <nl> ppp b / hphp / hack / src / typing / tast_env . ml <nl> let assert_nullable = Typing_equality_check . assert_nullable <nl> let hint_to_ty env = Decl_hint . hint env . Typing_env . decl_env <nl> <nl> let localize_with_self = Typing_phase . localize_with_self <nl> + let localize_with_dty_validator = Typing_phase . localize_with_dty_validator <nl> <nl> let get_upper_bounds = Typing_env . get_upper_bounds <nl> <nl> mmm a / hphp / hack / src / typing / tast_env . mli <nl> ppp b / hphp / hack / src / typing / tast_env . mli <nl> val localize_with_self : env - > Typing_defs . decl Typing_defs . ty - > env * Tast . ty <nl> should not be considered a general mechanism for transforming a { decl ty } to <nl> a { ! Tast . ty } . * ) <nl> <nl> + val localize_with_dty_validator : <nl> + env - > <nl> + Typing_defs . decl Typing_defs . ty - > <nl> + ( Typing_defs . decl Typing_defs . ty - > unit ) - > <nl> + env * Tast . ty <nl> + ( * * Identical to localize_with_self , but also takes a validator that is applied <nl> + to every expanded decl type on the way to becoming a locl type . * ) <nl> + <nl> val get_upper_bounds : env - > string - > Type_parameter_env . tparam_bounds <nl> ( * * Get the upper bounds of the type parameter with the given name . * ) <nl> <nl> mmm a / hphp / hack / src / typing / typing . ml <nl> ppp b / hphp / hack / src / typing / typing . ml <nl> and expr_ <nl> substs = SMap . empty ; <nl> this_ty = cid_ty ; <nl> from_class = Some cid ; <nl> + validate_dty = None ; <nl> } in <nl> match ty with <nl> | ( r , Tfun ft ) - > <nl> and new_object ~ expected ~ check_parent ~ check_not_abstract ~ is_using_clause p en <nl> substs = SMap . empty ; <nl> this_ty = obj_ty ; <nl> from_class = None ; <nl> + validate_dty = None ; <nl> } in <nl> let _ , ctor_fty = Phase . localize ~ ety_env env ty in <nl> check_abstract_parent_meth SN . Members . __construct p ctor_fty <nl> and class_get ~ is_method ~ is_const ? ( explicit_tparams = [ ] ) ? ( incl_tc = false ) <nl> this_ty = this_ty ; <nl> substs = SMap . empty ; <nl> from_class = Some cid ; <nl> + validate_dty = None ; <nl> } in <nl> class_get_ ~ is_method ~ is_const ~ ety_env ~ explicit_tparams ~ incl_tc <nl> ~ pos_params env cid cty ( p , mid ) <nl> and obj_get_concrete_ty ~ is_method ~ valkind ~ pos_params ? ( explicit_tparams = [ ] ) <nl> this_ty = this_ty ; <nl> substs = Subst . make class_info . tc_tparams paraml ; <nl> from_class = Some class_id ; <nl> + validate_dty = None ; <nl> } in <nl> let env , ft = Phase . localize_ft ~ use_pos : id_pos ~ ety_env env ft in <nl> <nl> and obj_get_concrete_ty ~ is_method ~ valkind ~ pos_params ? ( explicit_tparams = [ ] ) <nl> this_ty = this_ty ; <nl> substs = Subst . make class_info . tc_tparams paraml ; <nl> from_class = Some class_id ; <nl> + validate_dty = None ; <nl> } in <nl> let env , member_ty = <nl> begin match member_ty with <nl> and call_construct p env class_ params el uel cid = <nl> this_ty = cid_ty ; <nl> substs = Subst . make class_ . tc_tparams params ; <nl> from_class = Some cid ; <nl> + validate_dty = None ; <nl> } in <nl> let env = Phase . check_tparams_constraints ~ use_pos : p ~ ety_env env class_ . tc_tparams in <nl> if class_ . tc_is_xhp then env , tcid , [ ] , [ ] , ( Reason . Rnone , TUtils . tany env ) else <nl> and safely_refine_class_type <nl> substs = Subst . make class_info . tc_tparams tyl_fresh ; <nl> this_ty = obj_ty ; ( * In case ` this ` appears in constraints * ) <nl> from_class = None ; <nl> + validate_dty = None ; <nl> } in <nl> let add_bounds env ( ( _ , _ , cstr_list ) , ty_fresh ) = <nl> List . fold_left cstr_list ~ init : env ~ f : begin fun env ( ck , ty ) - > <nl> mmm a / hphp / hack / src / typing / typing_defs . ml <nl> ppp b / hphp / hack / src / typing / typing_defs . ml <nl> type expand_env = { <nl> * dependent types for type constants . <nl> * ) <nl> from_class : Nast . class_id_ option ; <nl> + validate_dty : ( decl ty - > unit ) option ; <nl> } <nl> <nl> type ety = expand_env * locl ty <nl> mmm a / hphp / hack / src / typing / typing_phase . ml <nl> ppp b / hphp / hack / src / typing / typing_phase . ml <nl> let env_with_self env = <nl> substs = SMap . empty ; <nl> this_ty = Reason . none , TUtils . this_of ( Env . get_self env ) ; <nl> from_class = None ; <nl> + validate_dty = None ; <nl> } <nl> ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> ( * Transforms a declaration phase type into a localized type . This performs <nl> let env_with_self env = <nl> ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> <nl> let rec localize_with_env ~ ety_env env ( dty : decl ty ) = <nl> + Option . iter ety_env . validate_dty ( fun validate_dty - > validate_dty dty ) ; <nl> match dty with <nl> | r , Terr - > <nl> env , ( ety_env , ( r , TUtils . terr env ) ) <nl> and check_where_constraints ~ use_pos ~ ety_env ~ definition_pos env cstrl = <nl> and localize_with_self env ty = <nl> localize env ty ~ ety_env : ( env_with_self env ) <nl> <nl> + and localize_with_dty_validator env ty validate_dty = <nl> + let ety_env = { ( env_with_self env ) with validate_dty = Some validate_dty ; } in <nl> + localize ~ ety_env env ty <nl> + <nl> and hint_locl env h = <nl> let h = Decl_hint . hint env . Env . decl_env h in <nl> localize_with_self env h <nl> mmm a / hphp / hack / src / typing / typing_subtype . ml <nl> ppp b / hphp / hack / src / typing / typing_subtype . ml <nl> let rec simplify_subtype <nl> ( * TODO : do we need this ? * ) <nl> this_ty = Option . value this_ty ~ default : ty_sub ; <nl> from_class = None ; <nl> + validate_dty = None ; <nl> } in <nl> let up_obj = SMap . get cid_super class_sub . tc_ancestors in <nl> match up_obj with <nl> and sub_type_with_uenv_helper env ( uenv_sub , ty_sub ) ( uenv_super , ty_super ) = <nl> substs = Subst . make class_ . tc_tparams tyl_sub ; <nl> this_ty = Option . value uenv_sub . TUEnv . this_ty ~ default : ty_sub ; <nl> from_class = None ; <nl> + validate_dty = None ; <nl> } in <nl> let rec try_reqs reqs = <nl> match reqs with <nl> mmm a / hphp / hack / src / typing / typing_xhp . ml <nl> ppp b / hphp / hack / src / typing / typing_xhp . ml <nl> and get_spread_attributes env pos onto_xhp cty = <nl> this_ty = xhp_ty ; <nl> substs = Subst . make xhp_info . tc_tparams tparams ; <nl> from_class = None ; <nl> + validate_dty = None ; <nl> } in <nl> List . map_env ~ f : begin fun env ( k , ce ) - > <nl> let lazy ty = ce . ce_type in <nl> mmm a / hphp / hack / test / typecheck / as_expression / tuple4 . php . exp <nl> ppp b / hphp / hack / test / typecheck / as_expression / tuple4 . php . exp <nl> Invalid argument ( Typing [ 4110 ] ) <nl> It is incompatible with a tuple <nl> File " tuple4 . php " , line 6 , characters 10 - 30 : <nl> The " as " operator cannot be used with a function ( Typing [ 4195 ] ) <nl> + File " tuple4 . php " , line 6 , characters 33 - 53 : <nl> + The " as " operator cannot be used with a function ( Typing [ 4195 ] ) <nl> + File " tuple4 . php " , line 6 , characters 10 - 30 : <nl> + The " as " operator cannot be used with a function ( Typing [ 4195 ] ) <nl> new file mode 100644 <nl> index 00000000000 . . 5ba694f1ba0 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / is_expression / talias . php <nl> <nl> + < ? hh <nl> + <nl> + type Foo < T > = ( int , T ) ; <nl> + <nl> + function f ( mixed $ x ) : void { <nl> + if ( $ x is Foo < string > ) { <nl> + expect_tuple ( $ x ) ; <nl> + } <nl> + } <nl> + <nl> + function expect_tuple ( ( int , string ) $ x ) : void { } <nl> new file mode 100644 <nl> index 00000000000 . . ff375039035 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / is_expression / talias . php . exp <nl> <nl> + File " talias . php " , line 6 , characters 13 - 23 : <nl> + The " is " operator cannot be used with a type with generics , because generics are erased at runtime ( Typing [ 4195 ] ) <nl> new file mode 100644 <nl> index 00000000000 . . 8668ffdf6b6 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / is_expression / talias2 . php <nl> <nl> + < ? hh <nl> + <nl> + type Foo < T > = ( int , T ) ; <nl> + type Bar = Foo < string > ; <nl> + <nl> + function f ( mixed $ x ) : void { <nl> + if ( $ x is Bar ) { <nl> + expect_tuple ( $ x ) ; <nl> + } <nl> + } <nl> + <nl> + function expect_tuple ( ( int , string ) $ x ) : void { } <nl> new file mode 100644 <nl> index 00000000000 . . 1956a65a647 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / is_expression / talias2 . php . exp <nl> <nl> + File " talias2 . php " , line 4 , characters 12 - 22 : <nl> + The " is " operator cannot be used with a type with generics , because generics are erased at runtime ( Typing [ 4195 ] ) <nl> new file mode 100644 <nl> index 00000000000 . . 09a67d61c72 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / is_expression / talias3 . php <nl> <nl> + < ? hh <nl> + <nl> + final class Foo < T > { } <nl> + type Bar = Foo < string > ; <nl> + <nl> + function f ( mixed $ x ) : void { <nl> + if ( $ x is Bar ) { <nl> + expect_foo ( $ x ) ; <nl> + } <nl> + } <nl> + <nl> + function expect_foo ( Foo < string > $ x ) : void { } <nl> new file mode 100644 <nl> index 00000000000 . . e856c4490af <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / is_expression / talias3 . php . exp <nl> <nl> + File " talias3 . php " , line 7 , characters 13 - 15 : <nl> + The " is " operator should not be used with a type with generics , because generics are erased at runtime ( Typing [ 4199 ] ) <nl> new file mode 100644 <nl> index 00000000000 . . 492446cece9 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / is_expression / talias4 . php <nl> <nl> + < ? hh <nl> + <nl> + type Foo = ( int , string ) ; <nl> + <nl> + function f ( mixed $ x ) : void { <nl> + if ( $ x is Foo ) { <nl> + expect_tuple ( $ x ) ; <nl> + } <nl> + } <nl> + <nl> + function expect_tuple ( ( int , string ) $ x ) : void { } <nl> new file mode 100644 <nl> index 00000000000 . . 4269126fceb <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / is_expression / talias4 . php . exp <nl> @ @ - 0 , 0 + 1 @ @ <nl> + No errors <nl> mmm a / hphp / hack / test / typecheck / is_expression / tconst3 . php . exp <nl> ppp b / hphp / hack / test / typecheck / is_expression / tconst3 . php . exp <nl> <nl> + File " tconst3 . php " , line 4 , characters 28 - 45 : <nl> + The " is " operator cannot be used with a function ( Typing [ 4195 ] ) <nl> + File " tconst3 . php " , line 4 , characters 41 - 44 : <nl> + The " is " operator cannot be used with void ( Typing [ 4195 ] ) <nl> File " tconst3 . php " , line 7 , characters 15 - 21 : <nl> The " is " operator cannot be used with a function ( Typing [ 4195 ] ) <nl> mmm a / hphp / hack / test / typecheck / is_expression / tuple4 . php . exp <nl> ppp b / hphp / hack / test / typecheck / is_expression / tuple4 . php . exp <nl> Invalid argument ( Typing [ 4110 ] ) <nl> It is incompatible with a tuple <nl> File " tuple4 . php " , line 6 , characters 14 - 34 : <nl> The " is " operator cannot be used with a function ( Typing [ 4195 ] ) <nl> + File " tuple4 . php " , line 6 , characters 37 - 57 : <nl> + The " is " operator cannot be used with a function ( Typing [ 4195 ] ) <nl> + File " tuple4 . php " , line 6 , characters 14 - 34 : <nl> + The " is " operator cannot be used with a function ( Typing [ 4195 ] ) <nl>
Validate type aliases in is / as - expressions
facebook/hhvm
d1b5bdad6c577439a5a6915b89b3f188840e8c28
2018-05-24T21:03:01Z
mmm a / src / codegen - ia32 . cc <nl> ppp b / src / codegen - ia32 . cc <nl> void CodeGenerator : : Comparison ( Condition cc , bool strict ) { <nl> __ pop ( edx ) ; <nl> } <nl> <nl> + / / Check for the smi case . <nl> Label is_smi , done ; <nl> - CompareStub stub ( cc , strict ) ; <nl> - <nl> __ mov ( ecx , Operand ( eax ) ) ; <nl> __ or_ ( ecx , Operand ( edx ) ) ; <nl> __ test ( ecx , Immediate ( kSmiTagMask ) ) ; <nl> void CodeGenerator : : Comparison ( Condition cc , bool strict ) { <nl> <nl> / / When non - smi , call out to the compare stub . " parameters " setup by <nl> / / calling code in edx and eax and " result " is returned in the flags . <nl> + CompareStub stub ( cc , strict ) ; <nl> __ CallStub ( & stub ) ; <nl> - __ cmp ( eax , 0 ) ; <nl> + if ( cc = = equal ) { <nl> + __ test ( eax , Operand ( eax ) ) ; <nl> + } else { <nl> + __ cmp ( eax , 0 ) ; <nl> + } <nl> __ jmp ( & done ) ; <nl> <nl> / / Test smi equality by pointer comparison . <nl> void ArgumentsAccessStub : : GenerateNewObject ( MacroAssembler * masm ) { <nl> <nl> void CompareStub : : Generate ( MacroAssembler * masm ) { <nl> Label call_builtin , done ; <nl> + <nl> + / / If we ' re doing a strict equality comparison , we generate code <nl> + / / to do fast comparison for objects and oddballs . Numbers and <nl> + / / strings still go through the usual slow - case code . <nl> + if ( strict_ ) { <nl> + Label slow ; <nl> + __ test ( eax , Immediate ( kSmiTagMask ) ) ; <nl> + __ j ( zero , & slow ) ; <nl> + <nl> + / / Get the type of the first operand . <nl> + __ mov ( ecx , FieldOperand ( eax , HeapObject : : kMapOffset ) ) ; <nl> + __ movzx_b ( ecx , FieldOperand ( ecx , Map : : kInstanceTypeOffset ) ) ; <nl> + <nl> + / / If the first object is an object , we do pointer comparison . <nl> + ASSERT ( LAST_TYPE = = JS_FUNCTION_TYPE ) ; <nl> + Label non_object ; <nl> + __ cmp ( ecx , FIRST_JS_OBJECT_TYPE ) ; <nl> + __ j ( less , & non_object ) ; <nl> + __ sub ( eax , Operand ( edx ) ) ; <nl> + __ ret ( 0 ) ; <nl> + <nl> + / / Check for oddballs : true , false , null , undefined . <nl> + __ bind ( & non_object ) ; <nl> + __ cmp ( ecx , ODDBALL_TYPE ) ; <nl> + __ j ( not_equal , & slow ) ; <nl> + <nl> + / / If the oddball isn ' t undefined , we do pointer comparison . For <nl> + / / the undefined value , we have to be careful and check for <nl> + / / ' undetectable ' objects too . <nl> + Label undefined ; <nl> + __ cmp ( Operand ( eax ) , Immediate ( Factory : : undefined_value ( ) ) ) ; <nl> + __ j ( equal , & undefined ) ; <nl> + __ sub ( eax , Operand ( edx ) ) ; <nl> + __ ret ( 0 ) ; <nl> + <nl> + / / Undefined case : If the other operand isn ' t undefined too , we <nl> + / / have to check if it ' s ' undetectable ' . <nl> + Label check_undetectable ; <nl> + __ bind ( & undefined ) ; <nl> + __ cmp ( Operand ( edx ) , Immediate ( Factory : : undefined_value ( ) ) ) ; <nl> + __ j ( not_equal , & check_undetectable ) ; <nl> + __ Set ( eax , Immediate ( 0 ) ) ; <nl> + __ ret ( 0 ) ; <nl> + <nl> + / / Check for undetectability of the other operand . <nl> + Label not_strictly_equal ; <nl> + __ bind ( & check_undetectable ) ; <nl> + __ test ( edx , Immediate ( kSmiTagMask ) ) ; <nl> + __ j ( zero , & not_strictly_equal ) ; <nl> + __ mov ( ecx , FieldOperand ( edx , HeapObject : : kMapOffset ) ) ; <nl> + __ movzx_b ( ecx , FieldOperand ( ecx , Map : : kBitFieldOffset ) ) ; <nl> + __ and_ ( ecx , 1 < < Map : : kIsUndetectable ) ; <nl> + __ cmp ( ecx , 1 < < Map : : kIsUndetectable ) ; <nl> + __ j ( not_equal , & not_strictly_equal ) ; <nl> + __ Set ( eax , Immediate ( 0 ) ) ; <nl> + __ ret ( 0 ) ; <nl> + <nl> + / / No cigar : Objects aren ' t strictly equal . Register eax contains <nl> + / / a non - smi value so it can ' t be 0 . Just return . <nl> + ASSERT ( kHeapTag ! = 0 ) ; <nl> + __ bind ( & not_strictly_equal ) ; <nl> + __ ret ( 0 ) ; <nl> + <nl> + / / Fall through to the general case . <nl> + __ bind ( & slow ) ; <nl> + } <nl> + <nl> / / Save the return address ( and get it off the stack ) . <nl> __ pop ( ecx ) ; <nl> <nl> mmm a / src / runtime . js <nl> ppp b / src / runtime . js <nl> function EQUALS ( y ) { <nl> <nl> / / ECMA - 262 , section 11 . 9 . 4 , page 56 . <nl> function STRICT_EQUALS ( x ) { <nl> - if ( IS_NUMBER ( this ) ) { <nl> - if ( ! IS_NUMBER ( x ) ) return 1 ; / / not equal <nl> - return % NumberEquals ( this , x ) ; <nl> - } <nl> - <nl> if ( IS_STRING ( this ) ) { <nl> if ( ! IS_STRING ( x ) ) return 1 ; / / not equal <nl> return % StringEquals ( this , x ) ; <nl> - } <nl> + } <nl> <nl> - if ( IS_BOOLEAN ( this ) ) { <nl> - if ( ! IS_BOOLEAN ( x ) ) return 1 ; / / not equal <nl> - if ( this ) return x ? 0 : 1 ; <nl> - else return x ? 1 : 0 ; <nl> - } <nl> + if ( IS_NUMBER ( this ) ) { <nl> + if ( ! IS_NUMBER ( x ) ) return 1 ; / / not equal <nl> + return % NumberEquals ( this , x ) ; <nl> + } <nl> <nl> - if ( IS_UNDEFINED ( this ) ) { / / both undefined and undetectable <nl> + if ( IS_UNDEFINED ( this ) ) { <nl> + / / Both undefined and undetectable . <nl> return IS_UNDEFINED ( x ) ? 0 : 1 ; <nl> } <nl> <nl> + / / Objects , null , booleans and functions are all that ' s left . <nl> + / / They can all be compared with a simple identity check . <nl> return % _ObjectEquals ( this , x ) ? 0 : 1 ; <nl> } <nl> <nl>
Make strict equality checks faster on IA32 by doing
v8/v8
1c89cef32d5ddef600aaa1df62a635fcda374c27
2008-10-10T06:26:35Z
mmm a / atom / browser / api / atom_api_menu_mac . mm <nl> ppp b / atom / browser / api / atom_api_menu_mac . mm <nl> <nl> <nl> # import " atom / browser / api / atom_api_menu_mac . h " <nl> <nl> + # include " atom / browser / native_window . h " <nl> # include " base / message_loop / message_loop . h " <nl> # include " base / strings / sys_string_conversions . h " <nl> - # include " atom / browser / native_window . h " <nl> - # include " atom / common / node_includes . h " <nl> - # include " atom / common / v8 / native_type_conversions . h " <nl> # include " content / public / browser / web_contents . h " <nl> # include " content / public / browser / web_contents_view . h " <nl> <nl> + # include " atom / common / node_includes . h " <nl> + <nl> namespace atom { <nl> <nl> namespace api { <nl> mmm a / atom / common / node_bindings . cc <nl> ppp b / atom / common / node_bindings . cc <nl> <nl> # include < vector > <nl> <nl> # include " atom / common / browser_v8_locker . h " <nl> - # include " atom / common / v8 / native_type_conversions . h " <nl> # include " base / command_line . h " <nl> - # include " base / message_loop / message_loop . h " <nl> # include " base / base_paths . h " <nl> + # include " base / files / file_path . h " <nl> + # include " base / message_loop / message_loop . h " <nl> # include " base / path_service . h " <nl> # include " content / public / browser / browser_thread . h " <nl> <nl> mmm a / atom / renderer / api / atom_renderer_bindings . cc <nl> ppp b / atom / renderer / api / atom_renderer_bindings . cc <nl> <nl> <nl> # include < vector > <nl> <nl> - # include " atom / common / v8 / native_type_conversions . h " <nl> + # include " atom / common / native_mate_converters / string16_converter . h " <nl> + # include " atom / common / native_mate_converters / v8_value_converter . h " <nl> + # include " base / memory / scoped_ptr . h " <nl> + # include " base / values . h " <nl> # include " content / public / renderer / render_view . h " <nl> # include " third_party / WebKit / public / web / WebFrame . h " <nl> # include " third_party / WebKit / public / web / WebView . h " <nl> void AtomRendererBindings : : OnBrowserMessage ( content : : RenderView * render_view , <nl> <nl> std : : vector < v8 : : Handle < v8 : : Value > > arguments ; <nl> arguments . reserve ( 1 + args . GetSize ( ) ) ; <nl> - arguments . push_back ( ToV8Value ( channel ) ) ; <nl> + arguments . push_back ( mate : : ConvertToV8 ( node_isolate , channel ) ) ; <nl> <nl> for ( size_t i = 0 ; i < args . GetSize ( ) ; i + + ) { <nl> const base : : Value * value ; <nl>
Remove use of native_type_conversions . h when possible .
electron/electron
7e1c86a1051c374b650de74398ffb6ee5cd12f24
2014-04-21T15:49:53Z
mmm a / src / core / ext / transport / chttp2 / transport / frame_settings . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_settings . c <nl> grpc_error * grpc_chttp2_settings_parser_parse ( grpc_exec_ctx * exec_ctx , void * p , <nl> } <nl> parser - > incoming_settings [ id ] = parser - > value ; <nl> if ( grpc_http_trace ) { <nl> - gpr_log ( GPR_DEBUG , " CHTTP2 : % s : % s : got setting % d = % d " , <nl> - t - > is_client ? " CLI " : " SVR " , t - > peer_string , parser - > id , <nl> + gpr_log ( GPR_DEBUG , " CHTTP2 : % s : % s : got setting % s = % d " , <nl> + t - > is_client ? " CLI " : " SVR " , t - > peer_string , sp - > name , <nl> parser - > value ) ; <nl> } <nl> } else if ( grpc_http_trace ) { <nl>
better logging
grpc/grpc
f408784ae9c3aebb7c76ea66708ef985dc466be1
2017-04-03T23:50:14Z
mmm a / src / gui / Src / Gui / CPUMultiDump . cpp <nl> ppp b / src / gui / Src / Gui / CPUMultiDump . cpp <nl> CPUMultiDump : : CPUMultiDump ( CPUDisassembly * disas , int nbCpuDumpTabs , QWidget * pa <nl> mWatch - > loadColumnFromConfig ( " Watch1 " ) ; <nl> <nl> mLocalVars = new LocalVarsView ( this ) ; <nl> - this - > addTabEx ( mLocalVars , DIcon ( " localvars . png " ) , tr ( " Locals " ) , " LocalVar " ) ; <nl> + this - > addTabEx ( mLocalVars , DIcon ( " localvars . png " ) , tr ( " Locals " ) , " Locals " ) ; <nl> <nl> mStructWidget = new StructWidget ( this ) ; <nl> this - > addTabEx ( mStructWidget , mStructWidget - > windowIcon ( ) , mStructWidget - > windowTitle ( ) , " Struct " ) ; <nl> mmm a / src / gui / Src / Gui / LocalVarsView . cpp <nl> ppp b / src / gui / Src / Gui / LocalVarsView . cpp <nl> <nl> # include " MiscUtil . h " <nl> # include " WordEditDialog . h " <nl> <nl> + / / Gets the address from an expression like " [ EBP - 7c ] " <nl> + static bool getAddress ( QString addrText , duint & output ) <nl> + { <nl> + if ( ! ( addrText . startsWith ( " [ " ) & & addrText . endsWith ( " ] " ) ) ) <nl> + return false ; / / Unable to get address of the expression <nl> + addrText . truncate ( addrText . size ( ) - 1 ) ; <nl> + addrText = addrText . right ( addrText . size ( ) - 1 ) ; <nl> + QByteArray utf8 = addrText . toUtf8 ( ) ; <nl> + if ( ! DbgIsValidExpression ( utf8 . constData ( ) ) ) <nl> + return false ; <nl> + output = DbgValFromString ( utf8 . constData ( ) ) ; <nl> + return true ; <nl> + } <nl> + <nl> LocalVarsView : : LocalVarsView ( CPUMultiDump * parent ) : StdTable ( parent ) <nl> { <nl> - currentFunc = 0 ; <nl> + configUpdatedSlot ( ) ; <nl> <nl> int charWidth = getCharWidth ( ) ; <nl> addColumnAt ( 8 + 20 * charWidth , tr ( " Name " ) , false ) ; <nl> LocalVarsView : : LocalVarsView ( CPUMultiDump * parent ) : StdTable ( parent ) <nl> <nl> setupContextMenu ( ) ; <nl> connect ( Bridge : : getBridge ( ) , SIGNAL ( updateWatch ( ) ) , this , SLOT ( updateSlot ( ) ) ) ; <nl> + connect ( Config ( ) , SIGNAL ( tokenizerConfigUpdated ( ) ) , this , SLOT ( configUpdatedSlot ( ) ) ) ; <nl> connect ( this , SIGNAL ( doubleClickedSignal ( ) ) , this , SLOT ( editSlot ( ) ) ) ; <nl> } <nl> <nl> void LocalVarsView : : setupContextMenu ( ) <nl> { <nl> return DbgIsDebugging ( ) ; <nl> } ) ; <nl> + mMenu - > addAction ( makeAction ( DIcon ( " dump . png " ) , tr ( " & Follow in Dump " ) , SLOT ( followDumpSlot ( ) ) ) , [ this ] ( QMenu * ) <nl> + { <nl> + return getCellContent ( getInitialSelection ( ) , 2 ) ! = tr ( " [ Error ] " ) ; <nl> + } ) ; <nl> + mMenu - > addAction ( makeAction ( DIcon ( " dump . png " ) , ArchValue ( tr ( " Follow DWORD in Dump " ) , tr ( " Follow QWORD in Dump " ) ) , SLOT ( followWordInDumpSlot ( ) ) ) , [ this ] ( QMenu * ) <nl> + { <nl> + duint start ; <nl> + if ( getAddress ( getCellContent ( getInitialSelection ( ) , 1 ) , start ) ) <nl> + { <nl> + DbgMemRead ( start , & start , sizeof ( start ) ) ; <nl> + return DbgMemIsValidReadPtr ( start ) ; <nl> + } <nl> + else <nl> + return false ; <nl> + } ) ; <nl> + mMenu - > addAction ( makeShortcutAction ( DIcon ( " stack . png " ) , tr ( " Follow in Stack " ) , SLOT ( followStackSlot ( ) ) , " ActionFollowStack " ) , [ this ] ( QMenu * ) <nl> + { <nl> + duint start ; <nl> + if ( getAddress ( getCellContent ( getInitialSelection ( ) , 1 ) , start ) ) <nl> + return ( DbgMemIsValidReadPtr ( start ) & & DbgMemFindBaseAddr ( start , 0 ) = = DbgMemFindBaseAddr ( DbgValFromString ( " csp " ) , 0 ) ) ; <nl> + else <nl> + return false ; <nl> + } ) ; <nl> + mMenu - > addAction ( makeAction ( DIcon ( " stack . png " ) , ArchValue ( tr ( " Follow DWORD in Stack " ) , tr ( " Follow QWORD in Stack " ) ) , SLOT ( followWordInStackSlot ( ) ) ) , [ this ] ( QMenu * ) <nl> + { <nl> + duint start ; <nl> + if ( getAddress ( getCellContent ( getInitialSelection ( ) , 1 ) , start ) ) <nl> + { <nl> + DbgMemRead ( start , & start , sizeof ( start ) ) ; <nl> + return ( DbgMemIsValidReadPtr ( start ) & & DbgMemFindBaseAddr ( start , 0 ) = = DbgMemFindBaseAddr ( DbgValFromString ( " csp " ) , 0 ) ) ; <nl> + } <nl> + else <nl> + return false ; <nl> + } ) ; <nl> + mMenu - > addAction ( makeShortcutAction ( DIcon ( " memmap_find_address_page . png " ) , tr ( " Follow in Memory Map " ) , SLOT ( followMemMapSlot ( ) ) , " ActionFollowMemMap " ) , [ this ] ( QMenu * ) <nl> + { <nl> + return getCellContent ( getInitialSelection ( ) , 2 ) ! = tr ( " [ Error ] " ) ; <nl> + } ) ; <nl> + mMenu - > addAction ( makeShortcutAction ( DIcon ( " modify . png " ) , tr ( " & Modify Value " ) , SLOT ( editSlot ( ) ) , " ActionModifyValue " ) , [ this ] ( QMenu * ) <nl> + { <nl> + return getCellContent ( getInitialSelection ( ) , 2 ) ! = tr ( " [ Error ] " ) ; <nl> + } ) ; <nl> + mMenu - > addSeparator ( ) ; <nl> mMenu - > addAction ( makeAction ( tr ( " & Rename " ) , SLOT ( renameSlot ( ) ) ) ) ; <nl> + MenuBuilder * copyMenu = new MenuBuilder ( this ) ; <nl> + setupCopyMenu ( copyMenu ) ; <nl> + mMenu - > addMenu ( makeMenu ( DIcon ( " copy . png " ) , tr ( " & Copy " ) ) , copyMenu ) ; <nl> + mMenu - > addSeparator ( ) ; <nl> MenuBuilder * mBaseRegisters = new MenuBuilder ( this ) ; <nl> # ifdef _WIN64 <nl> baseRegisters [ 0 ] = new QAction ( " RAX " , this ) ; <nl> void LocalVarsView : : setupContextMenu ( ) <nl> connect ( this , SIGNAL ( contextMenuSignal ( QPoint ) ) , this , SLOT ( contextMenuSlot ( QPoint ) ) ) ; <nl> } <nl> <nl> + void LocalVarsView : : mousePressEvent ( QMouseEvent * event ) <nl> + { <nl> + if ( event - > buttons ( ) = = Qt : : MiddleButton & & getRowCount ( ) > 0 ) <nl> + { <nl> + duint addr ; <nl> + if ( getAddress ( getCellContent ( getInitialSelection ( ) , 1 ) , addr ) ) <nl> + Bridge : : CopyToClipboard ( ToPtrString ( addr ) ) ; <nl> + } <nl> + else <nl> + StdTable : : mousePressEvent ( event ) ; <nl> + } <nl> + <nl> void LocalVarsView : : contextMenuSlot ( const QPoint & pos ) <nl> { <nl> QMenu wMenu ( this ) ; <nl> void LocalVarsView : : baseChangedSlot ( ) <nl> updateSlot ( ) ; <nl> } <nl> <nl> + void LocalVarsView : : configUpdatedSlot ( ) <nl> + { <nl> + currentFunc = 0 ; <nl> + HexPrefixValues = Config ( ) - > getBool ( " Disassembler " , " 0xPrefixValues " ) ; <nl> + MemorySpaces = Config ( ) - > getBool ( " Disassembler " , " MemorySpaces " ) ; <nl> + } <nl> + <nl> void LocalVarsView : : updateSlot ( ) <nl> { <nl> if ( ! DbgIsDebugging ( ) ) <nl> void LocalVarsView : : updateSlot ( ) <nl> duint address = start ; <nl> while ( address < end ) <nl> { <nl> + ENCODETYPE codeType = DbgGetEncodeTypeAt ( address , 1 ) ; <nl> + if ( codeType ! = enc_code & & codeType ! = enc_unknown ) / / Skip data bytes <nl> + { <nl> + address + = DbgGetEncodeSizeAt ( address , 1 ) ; <nl> + continue ; <nl> + } <nl> dis . Disassemble ( address , buffer + address - start , end + 16 - address ) ; <nl> - if ( dis . IsNop ( ) ) <nl> + if ( dis . IsNop ( ) ) / / Skip junk instructions <nl> { <nl> address + = dis . Size ( ) ; <nl> continue ; <nl> void LocalVarsView : : updateSlot ( ) <nl> { <nl> QString expr ; <nl> QString name ; <nl> + if ( j < 0 ) <nl> + { <nl> + expr = QString ( " % 1 " ) . arg ( - j , 0 , 16 ) ; <nl> + if ( HexPrefixValues ) <nl> + expr = " 0x " + expr ; <nl> + if ( ! MemorySpaces ) <nl> + expr = " - " + expr ; <nl> + else <nl> + expr = " - " + expr ; <nl> + } <nl> + else <nl> + { <nl> + expr = QString ( " % 1 " ) . arg ( j , 0 , 16 ) ; <nl> + if ( HexPrefixValues ) <nl> + expr = " 0x " + expr ; <nl> + if ( ! MemorySpaces ) <nl> + expr = " + " + expr ; <nl> + else <nl> + expr = " + " + expr ; <nl> + } <nl> + expr = QString ( " [ % 1 % 2 ] " ) . arg ( baseRegisters [ i ] - > text ( ) ) . arg ( expr ) ; <nl> if ( i = = 4 ) / / CBP <nl> { <nl> if ( j < 0 ) <nl> - { <nl> - expr = QString ( " - 0x % 1 " ) . arg ( - j , 0 , 16 ) ; <nl> name = tr ( " Local % 1 " ) . arg ( - j / sizeof ( dsint ) ) ; / / EBP - C : Local3 <nl> - } <nl> else <nl> - { <nl> - expr = QString ( " + 0x % 1 " ) . arg ( j , 0 , 16 ) ; <nl> name = tr ( " Arg % 1 " ) . arg ( j / sizeof ( dsint ) - 1 ) ; / / EBP + C : Arg2 <nl> - } <nl> - expr = QString ( ArchValue ( " [ EBP % 1 ] " , " [ RBP % 1 ] " ) ) . arg ( expr ) ; <nl> } <nl> else <nl> { <nl> if ( j < 0 ) <nl> - { <nl> - expr = QString ( " - 0x % 1 " ) . arg ( - j , 0 , 16 ) ; <nl> - name = QString ( " _ % 1_ % 2 " ) . arg ( - j , 0 , 16 ) ; / / ECX - C : _ECX_C <nl> - } <nl> + name = QString ( " _ % 2_ % 1 " ) . arg ( - j , 0 , 16 ) ; / / ECX - C : _ECX_C <nl> else <nl> - { <nl> - expr = QString ( " + 0x % 1 " ) . arg ( j , 0 , 16 ) ; <nl> name = QString ( " % 2_ % 1 " ) . arg ( j , 0 , 16 ) ; / / ECX + C : ECX_C <nl> - } <nl> name = name . arg ( baseRegisters [ i ] - > text ( ) ) ; <nl> - expr = QString ( " [ % 1 % 2 ] " ) . arg ( baseRegisters [ i ] - > text ( ) ) . arg ( expr ) ; <nl> } <nl> setCellContent ( rows , 0 , name ) ; <nl> setCellContent ( rows , 1 , expr ) ; <nl> void LocalVarsView : : editSlot ( ) <nl> if ( getRowCount ( ) < = 0 ) <nl> return ; <nl> QString expr = getCellContent ( getInitialSelection ( ) , 1 ) ; <nl> - if ( ! ( expr . startsWith ( " [ " ) & & expr . endsWith ( " ] " ) ) ) <nl> - return ; / / Unable to get address of the expression <nl> - expr . truncate ( expr . size ( ) - 1 ) ; <nl> - expr = expr . right ( expr . size ( ) - 1 ) ; <nl> - QByteArray utf8 = expr . toUtf8 ( ) ; <nl> - if ( ! DbgIsValidExpression ( utf8 . constData ( ) ) ) <nl> + duint addr ; <nl> + if ( ! getAddress ( expr , addr ) ) <nl> return ; <nl> - duint addr = DbgValFromString ( utf8 . constData ( ) ) ; <nl> WordEditDialog editor ( this ) ; <nl> duint current = 0 ; <nl> if ( ! DbgMemRead ( addr , & current , sizeof ( duint ) ) ) <nl> void LocalVarsView : : editSlot ( ) <nl> emit updateSlot ( ) ; <nl> } <nl> } <nl> + <nl> + void LocalVarsView : : followDumpSlot ( ) <nl> + { <nl> + duint addr ; <nl> + if ( getAddress ( getCellContent ( getInitialSelection ( ) , 1 ) , addr ) ) <nl> + DbgCmdExec ( QString ( " dump % 1 " ) . arg ( ToPtrString ( addr ) ) . toUtf8 ( ) . constData ( ) ) ; <nl> + } <nl> + <nl> + void LocalVarsView : : followStackSlot ( ) <nl> + { <nl> + duint addr ; <nl> + if ( getAddress ( getCellContent ( getInitialSelection ( ) , 1 ) , addr ) ) <nl> + DbgCmdExec ( QString ( " sdump % 1 " ) . arg ( ToPtrString ( addr ) ) . toUtf8 ( ) . constData ( ) ) ; <nl> + } <nl> + <nl> + void LocalVarsView : : followMemMapSlot ( ) <nl> + { <nl> + duint addr ; <nl> + if ( getAddress ( getCellContent ( getInitialSelection ( ) , 1 ) , addr ) ) <nl> + DbgCmdExec ( QString ( " memmapdump % 1 " ) . arg ( ToPtrString ( addr ) ) . toUtf8 ( ) . constData ( ) ) ; <nl> + } <nl> + <nl> + void LocalVarsView : : followWordInDumpSlot ( ) <nl> + { <nl> + duint addr ; <nl> + if ( getAddress ( getCellContent ( getInitialSelection ( ) , 1 ) , addr ) ) <nl> + DbgCmdExec ( QString ( " dump [ % 1 ] " ) . arg ( ToPtrString ( addr ) ) . toUtf8 ( ) . constData ( ) ) ; <nl> + } <nl> + <nl> + void LocalVarsView : : followWordInStackSlot ( ) <nl> + { <nl> + duint addr ; <nl> + if ( getAddress ( getCellContent ( getInitialSelection ( ) , 1 ) , addr ) ) <nl> + DbgCmdExec ( QString ( " sdump [ % 1 ] " ) . arg ( ToPtrString ( addr ) ) . toUtf8 ( ) . constData ( ) ) ; <nl> + } <nl> mmm a / src / gui / Src / Gui / LocalVarsView . h <nl> ppp b / src / gui / Src / Gui / LocalVarsView . h <nl> class LocalVarsView : public StdTable <nl> <nl> public slots : <nl> void contextMenuSlot ( const QPoint & pos ) ; <nl> - void updateSlot ( ) ; <nl> + void mousePressEvent ( QMouseEvent * event ) ; <nl> + <nl> + void followDumpSlot ( ) ; <nl> + void followStackSlot ( ) ; <nl> + void followMemMapSlot ( ) ; <nl> + void followWordInDumpSlot ( ) ; <nl> + void followWordInStackSlot ( ) ; <nl> void baseChangedSlot ( ) ; <nl> void renameSlot ( ) ; <nl> + <nl> + void updateSlot ( ) ; <nl> + void configUpdatedSlot ( ) ; <nl> void editSlot ( ) ; <nl> <nl> private : <nl> duint currentFunc ; <nl> void setupContextMenu ( ) ; <nl> MenuBuilder * mMenu ; <nl> + <nl> + bool HexPrefixValues ; <nl> + bool MemorySpaces ; <nl> # ifdef _WIN64 <nl> QAction * baseRegisters [ 16 ] ; <nl> # else / / x86 <nl>
Local variables view improved ( )
x64dbg/x64dbg
2312ba0460fee77181d13211a15f5f8091a776e7
2017-04-21T09:06:14Z
mmm a / lib / AST / ASTScopeCreation . cpp <nl> ppp b / lib / AST / ASTScopeCreation . cpp <nl> class ScopeCreator final { <nl> ASTScopeAssert ( ! n . isDecl ( DeclKind : : Accessor ) , <nl> " Should not see accessors here " ) ; <nl> / / Can occur in illegal code <nl> + / / non - empty brace stmt could define a new insertion point <nl> if ( auto * const s = n . dyn_cast < Stmt * > ( ) ) { <nl> if ( auto * const bs = dyn_cast < BraceStmt > ( s ) ) <nl> - ASTScopeAssert ( bs - > empty ( ) , " Might mess up insertion point " ) ; <nl> + return ! bs - > empty ( ) ; <nl> } <nl> return ! n . isDecl ( DeclKind : : Var ) ; <nl> } <nl> new file mode 100644 <nl> index 000000000000 . . e40de9cc5100 <nl> mmm / dev / null <nl> ppp b / test / NameLookup / nonempty - brace - in - brace . swift <nl> <nl> + / / RUN : not % target - swift - frontend - typecheck % s 2 > & 1 | % FileCheck % s - - check - prefix = CHECK - NO - ASSERTION <nl> + <nl> + / / Used to trip an assertion <nl> + <nl> + public struct Foo { <nl> + func bar ( ) { <nl> + var copySelf = self <nl> + repeat { copySelf <nl> + <nl> + private extension String { } <nl> + <nl> + / / CHECK - NO - ASSERTION - NOT : Assertion <nl>
Merge pull request from davidungar / rdar - 61461187 - tolerate - nonempty - brace - in - brace
apple/swift
4c4bf088dc29cf4c06fe92e4a1fc3769895fd2b4
2020-04-11T17:12:03Z
mmm a / hphp / runtime / ext / pdo / ext_pdo . cpp <nl> ppp b / hphp / runtime / ext / pdo / ext_pdo . cpp <nl> static Variant HHVM_METHOD ( PDOStatement , fetchobject , <nl> bool error = false ; <nl> <nl> data - > m_stmt - > fetch . clsname = class_name ; <nl> - if ( class_name . isNull ( ) ) { <nl> + if ( class_name . empty ( ) ) { <nl> data - > m_stmt - > fetch . clsname = " stdclass " ; <nl> } <nl> if ( ! HHVM_FN ( class_exists ) ( data - > m_stmt - > fetch . clsname ) ) { <nl> new file mode 100644 <nl> index 00000000000 . . d86b3bedc4a <nl> mmm / dev / null <nl> ppp b / hphp / test / quick / ext_pdo_fetchobject_no_class_name . php <nl> <nl> + < ? php <nl> + $ tmp_sqllite = tempnam ( sys_get_temp_dir ( ) , ' vmpdotest ' ) ; <nl> + $ source = " sqlite : $ tmp_sqllite " ; <nl> + $ db = new PDO ( $ source ) ; <nl> + $ rows = $ db - > query ( ' SELECT LENGTH ( " 123456 " ) as col ; ' ) - > fetchObject ( ) ; <nl> + var_dump ( $ rows ) ; <nl> new file mode 100644 <nl> index 00000000000 . . e97e554b33f <nl> mmm / dev / null <nl> ppp b / hphp / test / quick / ext_pdo_fetchobject_no_class_name . php . expect <nl> <nl> + object ( stdClass ) # 3 ( 1 ) { <nl> + [ " col " ] = > <nl> + string ( 1 ) " 6 " <nl> + } <nl>
Fix call to fetchObject without class name
facebook/hhvm
4bc22c9afd09a5cca0058d04f857b2342c2c9e73
2014-11-20T17:30:41Z
deleted file mode 100644 <nl> index 02c038d929 . . 0000000000 <nl> mmm a / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / ATLEntities . h <nl> ppp / dev / null <nl> <nl> - / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> - <nl> - # pragma once <nl> - <nl> - # include " GlobalData . h " <nl> - # include " Common . h " <nl> - <nl> - # include < SharedAudioData . h > <nl> - # include < IAudioImpl . h > <nl> - # include < PoolObject . h > <nl> - # include < AK / SoundEngine / Common / AkTypes . h > <nl> - # include < AK / SoundEngine / Common / AkSoundEngine . h > <nl> - <nl> - namespace CryAudio <nl> - { <nl> - namespace Impl <nl> - { <nl> - namespace Wwise <nl> - { <nl> - class CEvent ; <nl> - <nl> - enum class EObjectFlags : EnumFlagsType <nl> - { <nl> - None = 0 , <nl> - MovingOrDecaying = BIT ( 0 ) , <nl> - TrackAbsoluteVelocity = BIT ( 1 ) , <nl> - TrackRelativeVelocity = BIT ( 2 ) , <nl> - UpdateVirtualStates = BIT ( 3 ) , <nl> - } ; <nl> - CRY_CREATE_ENUM_FLAG_OPERATORS ( EObjectFlags ) ; <nl> - <nl> - class CObject final : public IObject , public CPoolObject < CObject , stl : : PSyncNone > <nl> - { <nl> - public : <nl> - <nl> - using AuxSendValues = std : : vector < AkAuxSendValue > ; <nl> - <nl> - explicit CObject ( AkGameObjectID const id , CObjectTransformation const & transformation ) ; <nl> - virtual ~ CObject ( ) override ; <nl> - <nl> - CObject ( ) = delete ; <nl> - CObject ( CObject const & ) = delete ; <nl> - CObject ( CObject & & ) = delete ; <nl> - CObject & operator = ( CObject const & ) = delete ; <nl> - CObject & operator = ( CObject & & ) = delete ; <nl> - <nl> - / / CryAudio : : Impl : : IObject <nl> - virtual void Update ( float const deltaTime ) override ; <nl> - virtual void SetTransformation ( CObjectTransformation const & transformation ) override ; <nl> - virtual CObjectTransformation const & GetTransformation ( ) const override { return m_transformation ; } <nl> - virtual void SetEnvironment ( IEnvironment const * const pIEnvironment , float const amount ) override ; <nl> - virtual void SetParameter ( IParameter const * const pIParameter , float const value ) override ; <nl> - virtual void SetSwitchState ( ISwitchState const * const pISwitchState ) override ; <nl> - virtual void SetObstructionOcclusion ( float const obstruction , float const occlusion ) override ; <nl> - virtual void SetOcclusionType ( EOcclusionType const occlusionType ) override ; <nl> - virtual ERequestStatus ExecuteTrigger ( ITrigger const * const pITrigger , IEvent * const pIEvent ) override ; <nl> - virtual void StopAllTriggers ( ) override ; <nl> - virtual ERequestStatus PlayFile ( IStandaloneFile * const pIStandaloneFile ) override ; <nl> - virtual ERequestStatus StopFile ( IStandaloneFile * const pIStandaloneFile ) override ; <nl> - virtual ERequestStatus SetName ( char const * const szName ) override ; <nl> - virtual void ToggleFunctionality ( EObjectFunctionality const type , bool const enable ) override ; <nl> - <nl> - / / Below data is only used when INCLUDE_WWISE_IMPL_PRODUCTION_CODE is defined ! <nl> - virtual void DrawDebugInfo ( IRenderAuxGeom & auxGeom , float const posX , float posY , char const * const szTextFilter ) override ; <nl> - / / ~ CryAudio : : Impl : : IObject <nl> - <nl> - void RemoveEvent ( CEvent * const pEvent ) ; <nl> - <nl> - AkGameObjectID const m_id ; <nl> - <nl> - private : <nl> - <nl> - void PostEnvironmentAmounts ( ) ; <nl> - void UpdateVelocities ( float const deltaTime ) ; <nl> - void TryToSetRelativeVelocity ( float const relativeVelocity ) ; <nl> - <nl> - std : : vector < CEvent * > m_events ; <nl> - bool m_needsToUpdateEnvironments ; <nl> - bool m_needsToUpdateVirtualStates ; <nl> - AuxSendValues m_auxSendValues ; <nl> - <nl> - EObjectFlags m_flags ; <nl> - float m_distanceToListener ; <nl> - float m_previousRelativeVelocity ; <nl> - float m_previousAbsoluteVelocity ; <nl> - CObjectTransformation m_transformation ; <nl> - Vec3 m_position ; <nl> - Vec3 m_previousPosition ; <nl> - Vec3 m_velocity ; <nl> - <nl> - # if defined ( INCLUDE_WWISE_IMPL_PRODUCTION_CODE ) <nl> - std : : map < char const * const , float > m_parameterInfo ; <nl> - # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> - } ; <nl> - <nl> - class CListener final : public IListener <nl> - { <nl> - public : <nl> - <nl> - CListener ( ) = delete ; <nl> - CListener ( CListener const & ) = delete ; <nl> - CListener ( CListener & & ) = delete ; <nl> - CListener & operator = ( CListener const & ) = delete ; <nl> - CListener & operator = ( CListener & & ) = delete ; <nl> - <nl> - explicit CListener ( CObjectTransformation const & transformation , AkGameObjectID const id ) ; <nl> - <nl> - / / CryAudio : : Impl : : IListener <nl> - virtual void Update ( float const deltaTime ) override ; <nl> - virtual void SetName ( char const * const szName ) override ; <nl> - virtual void SetTransformation ( CObjectTransformation const & transformation ) override ; <nl> - virtual CObjectTransformation const & GetTransformation ( ) const override { return m_transformation ; } <nl> - / / ~ CryAudio : : Impl : : IListener <nl> - <nl> - AkGameObjectID GetId ( ) const { return m_id ; } <nl> - bool HasMoved ( ) const { return m_hasMoved ; } <nl> - Vec3 const & GetPosition ( ) const { return m_position ; } <nl> - Vec3 const & GetVelocity ( ) const { return m_velocity ; } <nl> - <nl> - # if defined ( INCLUDE_WWISE_IMPL_PRODUCTION_CODE ) <nl> - char const * GetName ( ) const { return m_name . c_str ( ) ; } <nl> - # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> - <nl> - private : <nl> - <nl> - AkGameObjectID const m_id ; <nl> - bool m_hasMoved ; <nl> - bool m_isMovingOrDecaying ; <nl> - Vec3 m_velocity ; <nl> - Vec3 m_position ; <nl> - Vec3 m_previousPosition ; <nl> - CObjectTransformation m_transformation ; <nl> - <nl> - # if defined ( INCLUDE_WWISE_IMPL_PRODUCTION_CODE ) <nl> - CryFixedStringT < MaxObjectNameLength > m_name ; <nl> - # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> - } ; <nl> - <nl> - class CTrigger final : public ITrigger <nl> - { <nl> - public : <nl> - <nl> - explicit CTrigger ( AkUniqueID const id , float const maxAttenuation ) <nl> - : m_id ( id ) <nl> - , m_maxAttenuation ( maxAttenuation ) <nl> - { } <nl> - <nl> - CTrigger ( CTrigger const & ) = delete ; <nl> - CTrigger ( CTrigger & & ) = delete ; <nl> - CTrigger & operator = ( CTrigger const & ) = delete ; <nl> - CTrigger & operator = ( CTrigger & & ) = delete ; <nl> - <nl> - / / CryAudio : : Impl : : ITrigger <nl> - virtual ERequestStatus Load ( ) const override ; <nl> - virtual ERequestStatus Unload ( ) const override ; <nl> - virtual ERequestStatus LoadAsync ( IEvent * const pIEvent ) const override ; <nl> - virtual ERequestStatus UnloadAsync ( IEvent * const pIEvent ) const override ; <nl> - / / ~ CryAudio : : Impl : : ITrigger <nl> - <nl> - AkUniqueID const m_id ; <nl> - float const m_maxAttenuation ; <nl> - <nl> - private : <nl> - <nl> - ERequestStatus SetLoaded ( bool const bLoad ) const ; <nl> - ERequestStatus SetLoadedAsync ( IEvent * const pIEvent , bool const bLoad ) const ; <nl> - } ; <nl> - <nl> - struct SParameter final : public IParameter <nl> - { <nl> - explicit SParameter ( AkRtpcID const id_ , float const mult_ , float const shift_ ) <nl> - : mult ( mult_ ) <nl> - , shift ( shift_ ) <nl> - , id ( id_ ) <nl> - { } <nl> - <nl> - SParameter ( SParameter const & ) = delete ; <nl> - SParameter ( SParameter & & ) = delete ; <nl> - SParameter & operator = ( SParameter const & ) = delete ; <nl> - SParameter & operator = ( SParameter & & ) = delete ; <nl> - <nl> - float const mult ; <nl> - float const shift ; <nl> - AkRtpcID const id ; <nl> - } ; <nl> - <nl> - enum class ESwitchType : EnumFlagsType <nl> - { <nl> - None , <nl> - Rtpc , <nl> - StateGroup , <nl> - SwitchGroup , <nl> - } ; <nl> - <nl> - struct SSwitchState final : public ISwitchState <nl> - { <nl> - explicit SSwitchState ( <nl> - ESwitchType const type_ , <nl> - AkUInt32 const stateOrSwitchGroupId_ , <nl> - AkUInt32 const stateOrSwitchId_ , <nl> - float const rtpcValue_ = s_defaultStateValue ) <nl> - : type ( type_ ) <nl> - , stateOrSwitchGroupId ( stateOrSwitchGroupId_ ) <nl> - , stateOrSwitchId ( stateOrSwitchId_ ) <nl> - , rtpcValue ( rtpcValue_ ) <nl> - { } <nl> - <nl> - SSwitchState ( SSwitchState const & ) = delete ; <nl> - SSwitchState ( SSwitchState & & ) = delete ; <nl> - SSwitchState & operator = ( SSwitchState const & ) = delete ; <nl> - SSwitchState & operator = ( SSwitchState & & ) = delete ; <nl> - <nl> - ESwitchType const type ; <nl> - AkUInt32 const stateOrSwitchGroupId ; <nl> - AkUInt32 const stateOrSwitchId ; <nl> - float const rtpcValue ; <nl> - } ; <nl> - <nl> - enum class EEnvironmentType : EnumFlagsType <nl> - { <nl> - None , <nl> - AuxBus , <nl> - Rtpc , <nl> - } ; <nl> - <nl> - struct SEnvironment final : public IEnvironment <nl> - { <nl> - explicit SEnvironment ( EEnvironmentType const type_ , AkAuxBusID const busId_ ) <nl> - : type ( type_ ) <nl> - , busId ( busId_ ) <nl> - { <nl> - CRY_ASSERT ( type_ = = EEnvironmentType : : AuxBus ) ; <nl> - } <nl> - <nl> - explicit SEnvironment ( <nl> - EEnvironmentType const type_ , <nl> - AkRtpcID const rtpcId_ , <nl> - float const multiplier_ , <nl> - float const shift_ ) <nl> - : type ( type_ ) <nl> - , rtpcId ( rtpcId_ ) <nl> - , multiplier ( multiplier_ ) <nl> - , shift ( shift_ ) <nl> - { <nl> - CRY_ASSERT ( type_ = = EEnvironmentType : : Rtpc ) ; <nl> - } <nl> - <nl> - SEnvironment ( SEnvironment const & ) = delete ; <nl> - SEnvironment ( SEnvironment & & ) = delete ; <nl> - SEnvironment & operator = ( SEnvironment const & ) = delete ; <nl> - SEnvironment & operator = ( SEnvironment & & ) = delete ; <nl> - <nl> - EEnvironmentType const type ; <nl> - <nl> - union <nl> - { <nl> - / / Aux Bus implementation <nl> - struct <nl> - { <nl> - AkAuxBusID const busId ; <nl> - } ; <nl> - <nl> - / / Rtpc implementation <nl> - struct <nl> - { <nl> - AkRtpcID const rtpcId ; <nl> - float const multiplier ; <nl> - float const shift ; <nl> - } ; <nl> - } ; <nl> - } ; <nl> - <nl> - class CEvent final : public IEvent , public CPoolObject < CEvent , stl : : PSyncNone > <nl> - { <nl> - public : <nl> - <nl> - explicit CEvent ( CATLEvent & atlEvent_ ) <nl> - : m_state ( EEventState : : None ) <nl> - , m_id ( AK_INVALID_UNIQUE_ID ) <nl> - , m_atlEvent ( atlEvent_ ) <nl> - , m_pObject ( nullptr ) <nl> - , m_maxAttenuation ( 0 . 0f ) <nl> - { } <nl> - <nl> - virtual ~ CEvent ( ) override ; <nl> - <nl> - CEvent ( ) = delete ; <nl> - CEvent ( CEvent const & ) = delete ; <nl> - CEvent ( CEvent & & ) = delete ; <nl> - CEvent & operator = ( CEvent const & ) = delete ; <nl> - CEvent & operator = ( CEvent & & ) = delete ; <nl> - <nl> - / / CryAudio : : Impl : : IEvent <nl> - virtual ERequestStatus Stop ( ) override ; <nl> - / / ~ CryAudio : : Impl : : IEvent <nl> - <nl> - void UpdateVirtualState ( float const distance ) ; <nl> - <nl> - EEventState m_state ; <nl> - AkUniqueID m_id ; <nl> - CATLEvent & m_atlEvent ; <nl> - CObject * m_pObject ; <nl> - float m_maxAttenuation ; <nl> - } ; <nl> - <nl> - struct SFile final : public IFile <nl> - { <nl> - SFile ( ) = default ; <nl> - <nl> - SFile ( SFile const & ) = delete ; <nl> - SFile ( SFile & & ) = delete ; <nl> - SFile & operator = ( SFile const & ) = delete ; <nl> - SFile & operator = ( SFile & & ) = delete ; <nl> - <nl> - AkBankID bankId = AK_INVALID_BANK_ID ; <nl> - } ; <nl> - <nl> - struct SStandaloneFile final : public IStandaloneFile <nl> - { <nl> - SStandaloneFile ( ) = default ; <nl> - SStandaloneFile ( SStandaloneFile const & ) = delete ; <nl> - SStandaloneFile ( SStandaloneFile & & ) = delete ; <nl> - SStandaloneFile & operator = ( SStandaloneFile const & ) = delete ; <nl> - SStandaloneFile & operator = ( SStandaloneFile & & ) = delete ; <nl> - } ; <nl> - <nl> - class CSetting final : public ISetting <nl> - { <nl> - public : <nl> - <nl> - CSetting ( ) = default ; <nl> - CSetting ( CSetting const & ) = delete ; <nl> - CSetting ( CSetting & & ) = delete ; <nl> - CSetting & operator = ( CSetting const & ) = delete ; <nl> - CSetting & operator = ( CSetting & & ) = delete ; <nl> - <nl> - / / ISetting <nl> - virtual void Load ( ) const override { } <nl> - virtual void Unload ( ) const override { } <nl> - / / ~ ISetting <nl> - } ; <nl> - <nl> - struct SEnvPairCompare <nl> - { <nl> - bool operator ( ) ( std : : pair < AkAuxBusID , float > const & pair1 , std : : pair < AkAuxBusID , float > const & pair2 ) const <nl> - { <nl> - return ( pair1 . second > pair2 . second ) ; <nl> - } <nl> - } ; <nl> - } / / namespace Wwise <nl> - } / / namespace Impl <nl> - } / / namespace CryAudio <nl> mmm a / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / CMakeLists . txt <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / CMakeLists . txt <nl> start_sources ( ) <nl> sources_platform ( ALL ) <nl> add_sources ( " CryAudioImpl_uber_0 . cpp " <nl> SOURCE_GROUP " Header Files " <nl> - " ATLEntities . h " <nl> - " AudioImpl . h " <nl> - " AudioImplCVars . h " <nl> " Common . h " <nl> + " CVars . h " <nl> " Debug . h " <nl> + " Environment . h " <nl> + " Event . h " <nl> + " File . h " <nl> " FileIOHandler . h " <nl> " GlobalData . h " <nl> + " Impl . h " <nl> + " Listener . h " <nl> + " Object . h " <nl> + " Parameter . h " <nl> " resource . h " <nl> + " Setting . h " <nl> + " StandaloneFile . h " <nl> " stdafx . h " <nl> + " SwitchState . h " <nl> + " Trigger . h " <nl> SOURCE_GROUP " Source Files " <nl> - " AudioImpl . cpp " <nl> - " AudioImplCVars . cpp " <nl> " Common . cpp " <nl> " CryAudioImpl . cpp " <nl> + " CVars . cpp " <nl> " Debug . cpp " <nl> + " Environment . cpp " <nl> + " Event . cpp " <nl> + " File . cpp " <nl> " FileIOHandler . cpp " <nl> - " ATLEntities . cpp " <nl> + " Impl . cpp " <nl> + " Listener . cpp " <nl> + " Object . cpp " <nl> + " Parameter . cpp " <nl> + " Setting . cpp " <nl> + " StandaloneFile . cpp " <nl> + " SwitchState . cpp " <nl> + " Trigger . cpp " <nl> ) <nl> <nl> add_sources ( " NoUberFile " <nl> similarity index 99 % <nl> rename from Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / AudioImplCVars . cpp <nl> rename to Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / CVars . cpp <nl> mmm a / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / AudioImplCVars . cpp <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / CVars . cpp <nl> <nl> / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> <nl> # include " stdafx . h " <nl> - # include " AudioImplCVars . h " <nl> + # include " CVars . h " <nl> <nl> # include " Common . h " <nl> - # include " AudioImpl . h " <nl> + # include " Impl . h " <nl> # include < CrySystem / IConsole . h > <nl> <nl> namespace CryAudio <nl> similarity index 95 % <nl> rename from Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / AudioImplCVars . h <nl> rename to Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / CVars . h <nl> mmm a / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / AudioImplCVars . h <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / CVars . h <nl> class CCVars final <nl> { <nl> public : <nl> <nl> - CCVars ( ) = default ; <nl> CCVars ( CCVars const & ) = delete ; <nl> CCVars ( CCVars & & ) = delete ; <nl> CCVars & operator = ( CCVars const & ) = delete ; <nl> CCVars & operator = ( CCVars & & ) = delete ; <nl> <nl> - void RegisterVariables ( ) ; <nl> - void UnregisterVariables ( ) ; <nl> + CCVars ( ) = default ; <nl> + <nl> + void RegisterVariables ( ) ; <nl> + void UnregisterVariables ( ) ; <nl> <nl> float m_velocityTrackingThreshold = 0 . 0f ; <nl> float m_positionUpdateThresholdMultiplier = 0 . 02f ; <nl> mmm a / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Common . cpp <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Common . cpp <nl> <nl> # include " stdafx . h " <nl> # include " Common . h " <nl> <nl> - # include " AudioImpl . h " <nl> + # include " Impl . h " <nl> <nl> namespace CryAudio <nl> { <nl> mmm a / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / CryAudioImpl . cpp <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / CryAudioImpl . cpp <nl> <nl> / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> <nl> # include " stdafx . h " <nl> - # include " AudioImpl . h " <nl> - # include " AudioImplCVars . h " <nl> + # include " Impl . h " <nl> + # include " CVars . h " <nl> # include < Logger . h > <nl> # include < CryAudio / IAudioSystem . h > <nl> # include < CryCore / Platform / platform_impl . inl > <nl> new file mode 100644 <nl> index 0000000000 . . 2fe9308c58 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Environment . cpp <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " stdafx . h " <nl> + # include " Environment . h " <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + CEnvironment : : CEnvironment ( EEnvironmentType const type_ , AkAuxBusID const busId_ ) <nl> + : type ( type_ ) <nl> + , busId ( busId_ ) <nl> + { <nl> + CRY_ASSERT ( type_ = = EEnvironmentType : : AuxBus ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + CEnvironment : : CEnvironment ( <nl> + EEnvironmentType const type_ , <nl> + AkRtpcID const rtpcId_ , <nl> + float const multiplier_ , <nl> + float const shift_ ) <nl> + : type ( type_ ) <nl> + , rtpcId ( rtpcId_ ) <nl> + , multiplier ( multiplier_ ) <nl> + , shift ( shift_ ) <nl> + { <nl> + CRY_ASSERT ( type_ = = EEnvironmentType : : Rtpc ) ; <nl> + } <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . d1ee8a8f4a <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Environment . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < ATLEntityData . h > <nl> + # include < AK / SoundEngine / Common / AkTypes . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + enum class EEnvironmentType : EnumFlagsType <nl> + { <nl> + None , <nl> + AuxBus , <nl> + Rtpc , <nl> + } ; <nl> + <nl> + class CEnvironment final : public IEnvironment <nl> + { <nl> + public : <nl> + <nl> + CEnvironment ( ) = delete ; <nl> + CEnvironment ( CEnvironment const & ) = delete ; <nl> + CEnvironment ( CEnvironment & & ) = delete ; <nl> + CEnvironment & operator = ( CEnvironment const & ) = delete ; <nl> + CEnvironment & operator = ( CEnvironment & & ) = delete ; <nl> + <nl> + explicit CEnvironment ( EEnvironmentType const type_ , AkAuxBusID const busId_ ) ; <nl> + <nl> + explicit CEnvironment ( <nl> + EEnvironmentType const type_ , <nl> + AkRtpcID const rtpcId_ , <nl> + float const multiplier_ , <nl> + float const shift_ ) ; <nl> + <nl> + virtual ~ CEnvironment ( ) override = default ; <nl> + <nl> + EEnvironmentType const type ; <nl> + <nl> + union <nl> + { <nl> + / / Aux Bus implementation <nl> + struct <nl> + { <nl> + AkAuxBusID const busId ; <nl> + } ; <nl> + <nl> + / / Rtpc implementation <nl> + struct <nl> + { <nl> + AkRtpcID const rtpcId ; <nl> + float const multiplier ; <nl> + float const shift ; <nl> + } ; <nl> + } ; <nl> + } ; <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . 7aeba291ad <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Event . cpp <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " stdafx . h " <nl> + # include " Event . h " <nl> + # include " Object . h " <nl> + <nl> + # include < AK / SoundEngine / Common / AkSoundEngine . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + CEvent : : CEvent ( CATLEvent & atlEvent_ ) <nl> + : m_state ( EEventState : : None ) <nl> + , m_id ( AK_INVALID_UNIQUE_ID ) <nl> + , m_atlEvent ( atlEvent_ ) <nl> + , m_pObject ( nullptr ) <nl> + , m_maxAttenuation ( 0 . 0f ) <nl> + { <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + CEvent : : ~ CEvent ( ) <nl> + { <nl> + if ( m_pObject ! = nullptr ) <nl> + { <nl> + m_pObject - > RemoveEvent ( this ) ; <nl> + } <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + ERequestStatus CEvent : : Stop ( ) <nl> + { <nl> + switch ( m_state ) <nl> + { <nl> + case EEventState : : Playing : <nl> + case EEventState : : Virtual : <nl> + { <nl> + AK : : SoundEngine : : StopPlayingID ( m_id , 10 ) ; <nl> + break ; <nl> + } <nl> + default : <nl> + { <nl> + / / Stopping an event of this type is not supported ! <nl> + CRY_ASSERT ( false ) ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + return ERequestStatus : : Success ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + void CEvent : : UpdateVirtualState ( float const distance ) <nl> + { <nl> + EEventState const state = ( ( m_maxAttenuation > 0 . 0f ) & & ( m_maxAttenuation < distance ) ) ? EEventState : : Virtual : EEventState : : Playing ; <nl> + <nl> + if ( m_state ! = state ) <nl> + { <nl> + m_state = state ; <nl> + <nl> + if ( m_state = = EEventState : : Virtual ) <nl> + { <nl> + gEnv - > pAudioSystem - > ReportVirtualizedEvent ( m_atlEvent ) ; <nl> + } <nl> + else <nl> + { <nl> + gEnv - > pAudioSystem - > ReportPhysicalizedEvent ( m_atlEvent ) ; <nl> + } <nl> + } <nl> + } <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . 66e3190706 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Event . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < ATLEntityData . h > <nl> + # include < SharedAudioData . h > <nl> + # include < PoolObject . h > <nl> + # include < AK / SoundEngine / Common / AkTypes . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + class CObject ; <nl> + <nl> + class CEvent final : public IEvent , public CPoolObject < CEvent , stl : : PSyncNone > <nl> + { <nl> + public : <nl> + <nl> + CEvent ( ) = delete ; <nl> + CEvent ( CEvent const & ) = delete ; <nl> + CEvent ( CEvent & & ) = delete ; <nl> + CEvent & operator = ( CEvent const & ) = delete ; <nl> + CEvent & operator = ( CEvent & & ) = delete ; <nl> + <nl> + explicit CEvent ( CATLEvent & atlEvent_ ) ; <nl> + virtual ~ CEvent ( ) override ; <nl> + <nl> + / / CryAudio : : Impl : : IEvent <nl> + virtual ERequestStatus Stop ( ) override ; <nl> + / / ~ CryAudio : : Impl : : IEvent <nl> + <nl> + void UpdateVirtualState ( float const distance ) ; <nl> + <nl> + EEventState m_state ; <nl> + AkUniqueID m_id ; <nl> + CATLEvent & m_atlEvent ; <nl> + CObject * m_pObject ; <nl> + float m_maxAttenuation ; <nl> + } ; <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . f0728dc1c7 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / File . cpp <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " stdafx . h " <nl> + # include " File . h " <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . 75b7d6fe6c <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / File . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < ATLEntityData . h > <nl> + # include < AK / SoundEngine / Common / AkTypes . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + class CFile final : public IFile <nl> + { <nl> + public : <nl> + <nl> + CFile ( CFile const & ) = delete ; <nl> + CFile ( CFile & & ) = delete ; <nl> + CFile & operator = ( CFile const & ) = delete ; <nl> + CFile & operator = ( CFile & & ) = delete ; <nl> + <nl> + CFile ( ) = default ; <nl> + virtual ~ CFile ( ) override = default ; <nl> + <nl> + AkBankID bankId = AK_INVALID_BANK_ID ; <nl> + } ; <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> similarity index 96 % <nl> rename from Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / AudioImpl . cpp <nl> rename to Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Impl . cpp <nl> mmm a / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / AudioImpl . cpp <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Impl . cpp <nl> <nl> / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> <nl> # include " stdafx . h " <nl> - # include " AudioImpl . h " <nl> - # include " AudioImplCVars . h " <nl> + # include " Impl . h " <nl> + # include " CVars . h " <nl> # include " FileIOHandler . h " <nl> # include " Common . h " <nl> # include " GlobalData . h " <nl> + # include " Environment . h " <nl> + # include " Event . h " <nl> + # include " File . h " <nl> + # include " Listener . h " <nl> + # include " Object . h " <nl> + # include " Parameter . h " <nl> + # include " Setting . h " <nl> + # include " StandaloneFile . h " <nl> + # include " SwitchState . h " <nl> + # include " Trigger . h " <nl> # include < Logger . h > <nl> # include < SharedAudioData . h > <nl> # include < CrySystem / File / ICryPak . h > <nl> void LoadEventsMaxAttenuations ( const string & soundbanksPath ) <nl> } <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + CSwitchState const * ParseWwiseRtpcSwitch ( XmlNodeRef const pNode ) <nl> + { <nl> + CSwitchState * pSwitchStateImpl = nullptr ; <nl> + <nl> + char const * const szName = pNode - > getAttr ( s_szNameAttribute ) ; <nl> + <nl> + if ( ( szName ! = nullptr ) & & ( szName [ 0 ] ! = ' \ 0 ' ) ) <nl> + { <nl> + float value = s_defaultStateValue ; <nl> + <nl> + if ( pNode - > getAttr ( s_szValueAttribute , value ) ) <nl> + { <nl> + AkUniqueID const rtpcId = AK : : SoundEngine : : GetIDFromString ( szName ) ; <nl> + pSwitchStateImpl = new CSwitchState ( ESwitchType : : Rtpc , rtpcId , rtpcId , value ) ; <nl> + } <nl> + } <nl> + else <nl> + { <nl> + Cry : : Audio : : Log ( <nl> + ELogType : : Warning , <nl> + " The Wwise Rtpc % s inside ATLSwitchState does not have a valid name . " , <nl> + szName ) ; <nl> + } <nl> + <nl> + return pSwitchStateImpl ; <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> CImpl : : CImpl ( ) <nl> : m_gameObjectId ( 1 ) <nl> ERequestStatus CImpl : : RegisterInMemoryFile ( SFileInfo * const pFileInfo ) <nl> <nl> if ( pFileInfo ! = nullptr ) <nl> { <nl> - auto const pFileData = static_cast < SFile * > ( pFileInfo - > pImplData ) ; <nl> + auto const pFileData = static_cast < CFile * > ( pFileInfo - > pImplData ) ; <nl> <nl> if ( pFileData ! = nullptr ) <nl> { <nl> ERequestStatus CImpl : : UnregisterInMemoryFile ( SFileInfo * const pFileInfo ) <nl> <nl> if ( pFileInfo ! = nullptr ) <nl> { <nl> - auto const pFileData = static_cast < SFile * > ( pFileInfo - > pImplData ) ; <nl> + auto const pFileData = static_cast < CFile * > ( pFileInfo - > pImplData ) ; <nl> <nl> if ( pFileData ! = nullptr ) <nl> { <nl> ERequestStatus CImpl : : ConstructFile ( XmlNodeRef const pRootNode , SFileInfo * const <nl> pFileInfo - > bLocalized = ( szLocalized ! = nullptr ) & & ( _stricmp ( szLocalized , s_szTrueValue ) = = 0 ) ; <nl> pFileInfo - > szFileName = szFileName ; <nl> pFileInfo - > memoryBlockAlignment = AK_BANK_PLATFORM_DATA_ALIGNMENT ; <nl> - pFileInfo - > pImplData = new SFile ( ) ; <nl> + pFileInfo - > pImplData = new CFile ( ) ; <nl> result = ERequestStatus : : Success ; <nl> } <nl> else <nl> void CImpl : : DestructEvent ( IEvent const * const pIEvent ) <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> IStandaloneFile * CImpl : : ConstructStandaloneFile ( CATLStandaloneFile & standaloneFile , char const * const szFile , bool const bLocalized , ITrigger const * pITrigger / * = nullptr * / ) <nl> { <nl> - return static_cast < IStandaloneFile * > ( new SStandaloneFile ) ; <nl> + return static_cast < IStandaloneFile * > ( new CStandaloneFile ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CImpl : : DestructTrigger ( ITrigger const * const pITrigger ) <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> IParameter const * CImpl : : ConstructParameter ( XmlNodeRef const pRootNode ) <nl> { <nl> - SParameter * pParameter = nullptr ; <nl> + CParameter * pParameter = nullptr ; <nl> <nl> AkRtpcID rtpcId = AK_INVALID_RTPC_ID ; <nl> float multiplier = s_defaultParamMultiplier ; <nl> IParameter const * CImpl : : ConstructParameter ( XmlNodeRef const pRootNode ) <nl> <nl> if ( rtpcId ! = AK_INVALID_RTPC_ID ) <nl> { <nl> - pParameter = new SParameter ( rtpcId , multiplier , shift ) ; <nl> + pParameter = new CParameter ( rtpcId , multiplier , shift ) ; <nl> } <nl> <nl> return static_cast < IParameter * > ( pParameter ) ; <nl> void CImpl : : DestructParameter ( IParameter const * const pIParameter ) <nl> ISwitchState const * CImpl : : ConstructSwitchState ( XmlNodeRef const pRootNode ) <nl> { <nl> char const * const szTag = pRootNode - > getTag ( ) ; <nl> - SSwitchState const * pSwitchState = nullptr ; <nl> + CSwitchState const * pSwitchState = nullptr ; <nl> <nl> if ( _stricmp ( szTag , s_szStateGroupTag ) = = 0 ) <nl> { <nl> ISwitchState const * CImpl : : ConstructSwitchState ( XmlNodeRef const pRootNode ) <nl> <nl> if ( ParseSwitchOrState ( pRootNode , stateOrSwitchGroupId , stateOrSwitchId ) ) <nl> { <nl> - pSwitchState = new SSwitchState ( ESwitchType : : StateGroup , stateOrSwitchGroupId , stateOrSwitchId ) ; <nl> + pSwitchState = new CSwitchState ( ESwitchType : : StateGroup , stateOrSwitchGroupId , stateOrSwitchId ) ; <nl> } <nl> } <nl> else if ( _stricmp ( szTag , s_szSwitchGroupTag ) = = 0 ) <nl> ISwitchState const * CImpl : : ConstructSwitchState ( XmlNodeRef const pRootNode ) <nl> <nl> if ( ParseSwitchOrState ( pRootNode , stateOrSwitchGroupId , stateOrSwitchId ) ) <nl> { <nl> - pSwitchState = new SSwitchState ( ESwitchType : : SwitchGroup , stateOrSwitchGroupId , stateOrSwitchId ) ; <nl> + pSwitchState = new CSwitchState ( ESwitchType : : SwitchGroup , stateOrSwitchGroupId , stateOrSwitchId ) ; <nl> } <nl> } <nl> else if ( _stricmp ( szTag , s_szParameterTag ) = = 0 ) <nl> void CImpl : : DestructSwitchState ( ISwitchState const * const pISwitchState ) <nl> IEnvironment const * CImpl : : ConstructEnvironment ( XmlNodeRef const pRootNode ) <nl> { <nl> char const * const szTag = pRootNode - > getTag ( ) ; <nl> - SEnvironment const * pEnvironment = nullptr ; <nl> + CEnvironment const * pEnvironment = nullptr ; <nl> <nl> if ( _stricmp ( szTag , s_szAuxBusTag ) = = 0 ) <nl> { <nl> IEnvironment const * CImpl : : ConstructEnvironment ( XmlNodeRef const pRootNode ) <nl> <nl> if ( busId ! = AK_INVALID_AUX_ID ) <nl> { <nl> - pEnvironment = new SEnvironment ( EEnvironmentType : : AuxBus , static_cast < AkAuxBusID > ( busId ) ) ; <nl> + pEnvironment = new CEnvironment ( EEnvironmentType : : AuxBus , static_cast < AkAuxBusID > ( busId ) ) ; <nl> } <nl> else <nl> { <nl> IEnvironment const * CImpl : : ConstructEnvironment ( XmlNodeRef const pRootNode ) <nl> <nl> if ( rtpcId ! = AK_INVALID_RTPC_ID ) <nl> { <nl> - pEnvironment = new SEnvironment ( EEnvironmentType : : Rtpc , rtpcId , multiplier , shift ) ; <nl> + pEnvironment = new CEnvironment ( EEnvironmentType : : Rtpc , rtpcId , multiplier , shift ) ; <nl> } <nl> else <nl> { <nl> bool CImpl : : ParseSwitchOrState ( XmlNodeRef const pNode , AkUInt32 & outStateOrSwitc <nl> return bSuccess ; <nl> } <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - SSwitchState const * CImpl : : ParseWwiseRtpcSwitch ( XmlNodeRef const pNode ) <nl> - { <nl> - SSwitchState * pSwitchStateImpl = nullptr ; <nl> - <nl> - char const * const szName = pNode - > getAttr ( s_szNameAttribute ) ; <nl> - <nl> - if ( ( szName ! = nullptr ) & & ( szName [ 0 ] ! = ' \ 0 ' ) ) <nl> - { <nl> - float value = s_defaultStateValue ; <nl> - <nl> - if ( pNode - > getAttr ( s_szValueAttribute , value ) ) <nl> - { <nl> - AkUniqueID const rtpcId = AK : : SoundEngine : : GetIDFromString ( szName ) ; <nl> - pSwitchStateImpl = new SSwitchState ( ESwitchType : : Rtpc , rtpcId , rtpcId , value ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - Cry : : Audio : : Log ( <nl> - ELogType : : Warning , <nl> - " The Wwise Rtpc % s inside ATLSwitchState does not have a valid name . " , <nl> - szName ) ; <nl> - } <nl> - <nl> - return pSwitchStateImpl ; <nl> - } <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CImpl : : ParseRtpcImpl ( XmlNodeRef const pNode , AkRtpcID & rtpcId , float & multiplier , float & shift ) <nl> { <nl> void CImpl : : DrawDebugInfo ( IRenderAuxGeom & auxGeom , float const posX , float & posY <nl> auxGeom . Draw2dLabel ( posX , posY , g_debugSystemFontSize , g_debugSystemColorTextPrimary . data ( ) , false , " [ Object Pool ] In Use : % u | Constructed : % u ( % uKiB ) | Memory Pool : % uKiB " , <nl> memoryInfo . poolUsedObjects , memoryInfo . poolConstructedObjects , memoryInfo . poolUsedMemory , memoryInfo . poolAllocatedMemory ) ; <nl> <nl> + if ( g_numObjectsWithRelativeVelocity > 0 ) <nl> + { <nl> + posY + = g_debugSystemLineHeight ; <nl> + auxGeom . Draw2dLabel ( posX , posY , g_debugSystemFontSize , g_debugSystemColorTextPrimary . data ( ) , false , " Objects with relative velocity calculation : % u " , g_numObjectsWithRelativeVelocity ) ; <nl> + } <nl> + <nl> Vec3 const & listenerPosition = g_pListener - > GetPosition ( ) ; <nl> Vec3 const & listenerDirection = g_pListener - > GetTransformation ( ) . GetForward ( ) ; <nl> + float const listenerVelocity = g_pListener - > GetVelocity ( ) . GetLength ( ) ; <nl> char const * const szName = g_pListener - > GetName ( ) ; <nl> <nl> posY + = g_debugSystemLineHeight ; <nl> + auxGeom . Draw2dLabel ( posX , posY , g_debugSystemFontSize , g_debugSystemColorListenerActive . data ( ) , false , " Listener : % s | PosXYZ : % . 2f % . 2f % . 2f | FwdXYZ : % . 2f % . 2f % . 2f | Velocity : % . 2f m / s " , <nl> + szName , listenerPosition . x , listenerPosition . y , listenerPosition . z , listenerDirection . x , listenerDirection . y , listenerDirection . z , listenerVelocity ) ; <nl> <nl> - if ( g_numObjectsWithRelativeVelocity > 0 ) <nl> - { <nl> - auxGeom . Draw2dLabel ( posX , posY , g_debugSystemFontSize , g_debugSystemColorTextPrimary . data ( ) , false , " Objects with relative velocity calculation : % u " , g_numObjectsWithRelativeVelocity ) ; <nl> - <nl> - float const listenerVelocity = g_pListener - > GetVelocity ( ) . GetLength ( ) ; <nl> - posY + = g_debugSystemLineHeight ; <nl> - auxGeom . Draw2dLabel ( posX , posY , g_debugSystemFontSize , g_debugSystemColorListenerActive . data ( ) , false , " Listener : % s | PosXYZ : % . 2f % . 2f % . 2f | FwdXYZ : % . 2f % . 2f % . 2f | Velocity : % . 2f m / s " , szName , listenerPosition . x , listenerPosition . y , listenerPosition . z , listenerDirection . x , listenerDirection . y , listenerDirection . z , listenerVelocity ) ; <nl> - } <nl> - else <nl> - { <nl> - auxGeom . Draw2dLabel ( posX , posY , g_debugSystemFontSize , g_debugSystemColorListenerActive . data ( ) , false , " Listener : % s | PosXYZ : % . 2f % . 2f % . 2f | FwdXYZ : % . 2f % . 2f % . 2f " , szName , listenerPosition . x , listenerPosition . y , listenerPosition . z , listenerDirection . x , listenerDirection . y , listenerDirection . z ) ; <nl> - } <nl> # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> } <nl> } / / namespace Wwise <nl> similarity index 92 % <nl> rename from Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / AudioImpl . h <nl> rename to Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Impl . h <nl> mmm a / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / AudioImpl . h <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Impl . h <nl> <nl> # pragma once <nl> <nl> # include " FileIOHandler . h " <nl> - # include " ATLEntities . h " <nl> + # include < IAudioImpl . h > <nl> <nl> namespace CryAudio <nl> { <nl> class CImpl final : public IImpl <nl> { <nl> public : <nl> <nl> - CImpl ( ) ; <nl> CImpl ( CImpl const & ) = delete ; <nl> + CImpl ( CImpl & & ) = delete ; <nl> CImpl & operator = ( CImpl const & ) = delete ; <nl> + CImpl & operator = ( CImpl & & ) = delete ; <nl> + <nl> + CImpl ( ) ; <nl> <nl> / / CryAudio : : Impl : : IImpl <nl> virtual void Update ( ) override ; <nl> class CImpl final : public IImpl <nl> <nl> private : <nl> <nl> - bool ParseSwitchOrState ( XmlNodeRef const pNode , AkUInt32 & outStateOrSwitchGroupId , AkUInt32 & outStateOrSwitchId ) ; <nl> - SSwitchState const * ParseWwiseRtpcSwitch ( XmlNodeRef pNode ) ; <nl> - void ParseRtpcImpl ( XmlNodeRef const pNode , AkRtpcID & rtpcId , float & multiplier , float & shift ) ; <nl> - void SignalAuxAudioThread ( ) ; <nl> - void WaitForAuxAudioThread ( ) ; <nl> + bool ParseSwitchOrState ( XmlNodeRef const pNode , AkUInt32 & outStateOrSwitchGroupId , AkUInt32 & outStateOrSwitchId ) ; <nl> + void ParseRtpcImpl ( XmlNodeRef const pNode , AkRtpcID & rtpcId , float & multiplier , float & shift ) ; <nl> + void SignalAuxAudioThread ( ) ; <nl> + void WaitForAuxAudioThread ( ) ; <nl> <nl> AkGameObjectID m_gameObjectId ; <nl> <nl> new file mode 100644 <nl> index 0000000000 . . 39da2f1b66 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Listener . cpp <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " stdafx . h " <nl> + # include " Listener . h " <nl> + # include " Common . h " <nl> + <nl> + # include < Logger . h > <nl> + # include < AK / SoundEngine / Common / AkSoundEngine . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + CListener : : CListener ( CObjectTransformation const & transformation , AkGameObjectID const id ) <nl> + : m_id ( id ) <nl> + , m_transformation ( transformation ) <nl> + , m_hasMoved ( false ) <nl> + , m_isMovingOrDecaying ( false ) <nl> + , m_velocity ( ZERO ) <nl> + , m_position ( transformation . GetPosition ( ) ) <nl> + , m_previousPosition ( transformation . GetPosition ( ) ) <nl> + { <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + void CListener : : Update ( float const deltaTime ) <nl> + { <nl> + if ( m_isMovingOrDecaying & & ( deltaTime > 0 . 0f ) ) <nl> + { <nl> + m_hasMoved = m_velocity . GetLengthSquared ( ) > FloatEpsilon ; <nl> + Vec3 const deltaPos ( m_position - m_previousPosition ) ; <nl> + <nl> + if ( ! deltaPos . IsZero ( ) ) <nl> + { <nl> + m_velocity = deltaPos / deltaTime ; <nl> + m_previousPosition = m_position ; <nl> + } <nl> + else if ( ! m_velocity . IsZero ( ) ) <nl> + { <nl> + / / We did not move last frame , begin exponential decay towards zero . <nl> + float const decay = std : : max ( 1 . 0f - deltaTime / 0 . 05f , 0 . 0f ) ; <nl> + m_velocity * = decay ; <nl> + <nl> + if ( m_velocity . GetLengthSquared ( ) < FloatEpsilon ) <nl> + { <nl> + m_velocity = ZERO ; <nl> + m_isMovingOrDecaying = false ; <nl> + } <nl> + } <nl> + else <nl> + { <nl> + m_isMovingOrDecaying = false ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + void CListener : : SetName ( char const * const szName ) <nl> + { <nl> + # if defined ( INCLUDE_WWISE_IMPL_PRODUCTION_CODE ) <nl> + m_name = szName ; <nl> + # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + void CListener : : SetTransformation ( CObjectTransformation const & transformation ) <nl> + { <nl> + m_transformation = transformation ; <nl> + m_position = transformation . GetPosition ( ) ; <nl> + <nl> + AkListenerPosition listenerPos ; <nl> + FillAKListenerPosition ( transformation , listenerPos ) ; <nl> + <nl> + # if defined ( INCLUDE_WWISE_IMPL_PRODUCTION_CODE ) <nl> + / / Always update velocity in non - release builds for debug draw . <nl> + m_isMovingOrDecaying = true ; <nl> + # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> + <nl> + if ( g_numObjectsWithRelativeVelocity > 0 ) <nl> + { <nl> + m_isMovingOrDecaying = true ; <nl> + } <nl> + else <nl> + { <nl> + m_previousPosition = m_position ; <nl> + } <nl> + <nl> + AKRESULT const wwiseResult = AK : : SoundEngine : : SetPosition ( m_id , listenerPos ) ; <nl> + <nl> + if ( ! IS_WWISE_OK ( wwiseResult ) ) <nl> + { <nl> + Cry : : Audio : : Log ( ELogType : : Warning , " Wwise - CListener : : SetTransformation failed with AKRESULT : % d " , wwiseResult ) ; <nl> + } <nl> + } <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . 60799fcce5 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Listener . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < ATLEntityData . h > <nl> + # include < AK / SoundEngine / Common / AkTypes . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + class CListener final : public IListener <nl> + { <nl> + public : <nl> + <nl> + CListener ( ) = delete ; <nl> + CListener ( CListener const & ) = delete ; <nl> + CListener ( CListener & & ) = delete ; <nl> + CListener & operator = ( CListener const & ) = delete ; <nl> + CListener & operator = ( CListener & & ) = delete ; <nl> + <nl> + explicit CListener ( CObjectTransformation const & transformation , AkGameObjectID const id ) ; <nl> + <nl> + virtual ~ CListener ( ) override = default ; <nl> + <nl> + / / CryAudio : : Impl : : IListener <nl> + virtual void Update ( float const deltaTime ) override ; <nl> + virtual void SetName ( char const * const szName ) override ; <nl> + virtual void SetTransformation ( CObjectTransformation const & transformation ) override ; <nl> + virtual CObjectTransformation const & GetTransformation ( ) const override { return m_transformation ; } <nl> + / / ~ CryAudio : : Impl : : IListener <nl> + <nl> + AkGameObjectID GetId ( ) const { return m_id ; } <nl> + bool HasMoved ( ) const { return m_hasMoved ; } <nl> + Vec3 const & GetPosition ( ) const { return m_position ; } <nl> + Vec3 const & GetVelocity ( ) const { return m_velocity ; } <nl> + <nl> + # if defined ( INCLUDE_WWISE_IMPL_PRODUCTION_CODE ) <nl> + char const * GetName ( ) const { return m_name . c_str ( ) ; } <nl> + # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> + <nl> + private : <nl> + <nl> + AkGameObjectID const m_id ; <nl> + bool m_hasMoved ; <nl> + bool m_isMovingOrDecaying ; <nl> + Vec3 m_velocity ; <nl> + Vec3 m_position ; <nl> + Vec3 m_previousPosition ; <nl> + CObjectTransformation m_transformation ; <nl> + <nl> + # if defined ( INCLUDE_WWISE_IMPL_PRODUCTION_CODE ) <nl> + CryFixedStringT < MaxObjectNameLength > m_name ; <nl> + # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> + } ; <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> similarity index 77 % <nl> rename from Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / ATLEntities . cpp <nl> rename to Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Object . cpp <nl> mmm a / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / ATLEntities . cpp <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Object . cpp <nl> <nl> / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> <nl> # include " stdafx . h " <nl> - # include " ATLEntities . h " <nl> - # include " AudioImplCVars . h " <nl> + # include " Object . h " <nl> + # include " Common . h " <nl> + # include " CVars . h " <nl> + # include " Environment . h " <nl> + # include " Event . h " <nl> + # include " Listener . h " <nl> + # include " Parameter . h " <nl> + # include " SwitchState . h " <nl> + # include " Trigger . h " <nl> + <nl> # include < Logger . h > <nl> + # include < AK / SoundEngine / Common / AkSoundEngine . h > <nl> <nl> # if defined ( INCLUDE_WWISE_IMPL_PRODUCTION_CODE ) <nl> # include " Debug . h " <nl> namespace Impl <nl> { <nl> namespace Wwise <nl> { <nl> - / / AK callbacks <nl> + static constexpr char const * s_szAbsoluteVelocityParameterName = " absolute_velocity " ; <nl> + static AkRtpcID const s_absoluteVelocityParameterId = AK : : SoundEngine : : GetIDFromString ( s_szAbsoluteVelocityParameterName ) ; <nl> + <nl> + static constexpr char const * s_szRelativeVelocityParameterName = " relative_velocity " ; <nl> + static AkRtpcID const s_relativeVelocityParameterId = AK : : SoundEngine : : GetIDFromString ( s_szRelativeVelocityParameterName ) ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void EndEventCallback ( AkCallbackType callbackType , AkCallbackInfo * pCallbackInfo ) <nl> { <nl> if ( callbackType = = AK_EndOfEvent ) <nl> void EndEventCallback ( AkCallbackType callbackType , AkCallbackInfo * pCallbackInfo <nl> } <nl> } <nl> <nl> - void PrepareEventCallback ( <nl> - AkUniqueID eventId , <nl> - void const * pBankPtr , <nl> - AKRESULT wwiseResult , <nl> - AkMemPoolId memPoolId , <nl> - void * pCookie ) <nl> - { <nl> - CEvent * const pEvent = static_cast < CEvent * const > ( pCookie ) ; <nl> - <nl> - if ( pEvent ! = nullptr ) <nl> - { <nl> - pEvent - > m_id = eventId ; <nl> - gEnv - > pAudioSystem - > ReportFinishedEvent ( pEvent - > m_atlEvent , wwiseResult = = AK_Success ) ; <nl> - } <nl> - } <nl> - <nl> - static constexpr char const * s_szAbsoluteVelocityParameterName = " absolute_velocity " ; <nl> - static AkRtpcID const s_absoluteVelocityParameterId = AK : : SoundEngine : : GetIDFromString ( s_szAbsoluteVelocityParameterName ) ; <nl> - <nl> - static constexpr char const * s_szRelativeVelocityParameterName = " relative_velocity " ; <nl> - static AkRtpcID const s_relativeVelocityParameterId = AK : : SoundEngine : : GetIDFromString ( s_szRelativeVelocityParameterName ) ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void SetParameterById ( AkRtpcID const rtpcId , AkRtpcValue const value , AkGameObjectID const objectId ) <nl> { <nl> void CObject : : SetTransformation ( CObjectTransformation const & transformation ) <nl> void CObject : : SetEnvironment ( IEnvironment const * const pIEnvironment , float const amount ) <nl> { <nl> static float const envEpsilon = 0 . 0001f ; <nl> - SEnvironment const * const pEnvironment = static_cast < SEnvironment const * const > ( pIEnvironment ) ; <nl> + CEnvironment const * const pEnvironment = static_cast < CEnvironment const * const > ( pIEnvironment ) ; <nl> <nl> if ( pEnvironment ! = nullptr ) <nl> { <nl> void CObject : : SetEnvironment ( IEnvironment const * const pIEnvironment , float cons <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CObject : : SetParameter ( IParameter const * const pIParameter , float const value ) <nl> { <nl> - SParameter const * const pParameter = static_cast < SParameter const * const > ( pIParameter ) ; <nl> + CParameter const * const pParameter = static_cast < CParameter const * const > ( pIParameter ) ; <nl> <nl> if ( pParameter ! = nullptr ) <nl> { <nl> void CObject : : SetParameter ( IParameter const * const pIParameter , float const valu <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void CObject : : SetSwitchState ( ISwitchState const * const pISwitchState ) <nl> { <nl> - SSwitchState const * const pSwitchState = static_cast < SSwitchState const * const > ( pISwitchState ) ; <nl> + CSwitchState const * const pSwitchState = static_cast < CSwitchState const * const > ( pISwitchState ) ; <nl> <nl> if ( pSwitchState ! = nullptr ) <nl> { <nl> void CObject : : DrawDebugInfo ( IRenderAuxGeom & auxGeom , float const posX , float pos <nl> <nl> # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - ERequestStatus CEvent : : Stop ( ) <nl> - { <nl> - switch ( m_state ) <nl> - { <nl> - case EEventState : : Playing : <nl> - case EEventState : : Virtual : <nl> - { <nl> - AK : : SoundEngine : : StopPlayingID ( m_id , 10 ) ; <nl> - break ; <nl> - } <nl> - default : <nl> - { <nl> - / / Stopping an event of this type is not supported ! <nl> - CRY_ASSERT ( false ) ; <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - return ERequestStatus : : Success ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - CEvent : : ~ CEvent ( ) <nl> - { <nl> - if ( m_pObject ! = nullptr ) <nl> - { <nl> - m_pObject - > RemoveEvent ( this ) ; <nl> - } <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CEvent : : UpdateVirtualState ( float const distance ) <nl> - { <nl> - EEventState const state = ( ( m_maxAttenuation > 0 . 0f ) & & ( m_maxAttenuation < distance ) ) ? EEventState : : Virtual : EEventState : : Playing ; <nl> - <nl> - if ( m_state ! = state ) <nl> - { <nl> - m_state = state ; <nl> - <nl> - if ( m_state = = EEventState : : Virtual ) <nl> - { <nl> - gEnv - > pAudioSystem - > ReportVirtualizedEvent ( m_atlEvent ) ; <nl> - } <nl> - else <nl> - { <nl> - gEnv - > pAudioSystem - > ReportPhysicalizedEvent ( m_atlEvent ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - CListener : : CListener ( CObjectTransformation const & transformation , AkGameObjectID const id ) <nl> - : m_id ( id ) <nl> - , m_transformation ( transformation ) <nl> - , m_hasMoved ( false ) <nl> - , m_isMovingOrDecaying ( false ) <nl> - , m_velocity ( ZERO ) <nl> - , m_position ( transformation . GetPosition ( ) ) <nl> - , m_previousPosition ( transformation . GetPosition ( ) ) <nl> - { <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CListener : : Update ( float const deltaTime ) <nl> - { <nl> - if ( m_isMovingOrDecaying & & ( deltaTime > 0 . 0f ) ) <nl> - { <nl> - m_hasMoved = m_velocity . GetLengthSquared ( ) > FloatEpsilon ; <nl> - Vec3 const deltaPos ( m_position - m_previousPosition ) ; <nl> - <nl> - if ( ! deltaPos . IsZero ( ) ) <nl> - { <nl> - m_velocity = deltaPos / deltaTime ; <nl> - m_previousPosition = m_position ; <nl> - } <nl> - else if ( ! m_velocity . IsZero ( ) ) <nl> - { <nl> - / / We did not move last frame , begin exponential decay towards zero . <nl> - float const decay = std : : max ( 1 . 0f - deltaTime / 0 . 05f , 0 . 0f ) ; <nl> - m_velocity * = decay ; <nl> - <nl> - if ( m_velocity . GetLengthSquared ( ) < FloatEpsilon ) <nl> - { <nl> - m_velocity = ZERO ; <nl> - m_isMovingOrDecaying = false ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - m_isMovingOrDecaying = false ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CListener : : SetName ( char const * const szName ) <nl> - { <nl> - # if defined ( INCLUDE_WWISE_IMPL_PRODUCTION_CODE ) <nl> - m_name = szName ; <nl> - # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - void CListener : : SetTransformation ( CObjectTransformation const & transformation ) <nl> - { <nl> - m_transformation = transformation ; <nl> - m_position = transformation . GetPosition ( ) ; <nl> - <nl> - AkListenerPosition listenerPos ; <nl> - FillAKListenerPosition ( transformation , listenerPos ) ; <nl> - <nl> - if ( g_numObjectsWithRelativeVelocity > 0 ) <nl> - { <nl> - m_isMovingOrDecaying = true ; <nl> - } <nl> - else <nl> - { <nl> - m_previousPosition = m_position ; <nl> - } <nl> - <nl> - AKRESULT const wwiseResult = AK : : SoundEngine : : SetPosition ( m_id , listenerPos ) ; <nl> - <nl> - if ( ! IS_WWISE_OK ( wwiseResult ) ) <nl> - { <nl> - Cry : : Audio : : Log ( ELogType : : Warning , " Wwise - CListener : : SetTransformation failed with AKRESULT : % d " , wwiseResult ) ; <nl> - } <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - ERequestStatus CTrigger : : Load ( ) const <nl> - { <nl> - return SetLoaded ( true ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - ERequestStatus CTrigger : : Unload ( ) const <nl> - { <nl> - return SetLoaded ( false ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - ERequestStatus CTrigger : : LoadAsync ( IEvent * const pIEvent ) const <nl> - { <nl> - return SetLoadedAsync ( pIEvent , true ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - ERequestStatus CTrigger : : UnloadAsync ( IEvent * const pIEvent ) const <nl> - { <nl> - return SetLoadedAsync ( pIEvent , false ) ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - ERequestStatus CTrigger : : SetLoaded ( bool const bLoad ) const <nl> - { <nl> - ERequestStatus result = ERequestStatus : : Failure ; <nl> - AkUniqueID id = m_id ; <nl> - AKRESULT const wwiseResult = AK : : SoundEngine : : PrepareEvent ( bLoad ? AK : : SoundEngine : : Preparation_Load : AK : : SoundEngine : : Preparation_Unload , & id , 1 ) ; <nl> - <nl> - if ( IS_WWISE_OK ( wwiseResult ) ) <nl> - { <nl> - result = ERequestStatus : : Success ; <nl> - } <nl> - else <nl> - { <nl> - Cry : : Audio : : Log ( <nl> - ELogType : : Warning , <nl> - " Wwise - PrepareEvent with % s failed for Wwise event % " PRISIZE_T " with AKRESULT : % d " , <nl> - bLoad ? " Preparation_Load " : " Preparation_Unload " , <nl> - m_id , <nl> - wwiseResult ) ; <nl> - } <nl> - <nl> - return result ; <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - ERequestStatus CTrigger : : SetLoadedAsync ( IEvent * const pIEvent , bool const bLoad ) const <nl> - { <nl> - ERequestStatus result = ERequestStatus : : Failure ; <nl> - <nl> - CEvent * const pEvent = static_cast < CEvent * > ( pIEvent ) ; <nl> - <nl> - if ( pEvent ! = nullptr ) <nl> - { <nl> - AkUniqueID id = m_id ; <nl> - AKRESULT const wwiseResult = AK : : SoundEngine : : PrepareEvent ( <nl> - bLoad ? AK : : SoundEngine : : Preparation_Load : AK : : SoundEngine : : Preparation_Unload , <nl> - & id , <nl> - 1 , <nl> - & PrepareEventCallback , <nl> - pEvent ) ; <nl> - <nl> - if ( IS_WWISE_OK ( wwiseResult ) ) <nl> - { <nl> - pEvent - > m_id = m_id ; <nl> - pEvent - > m_state = EEventState : : Unloading ; <nl> - result = ERequestStatus : : Success ; <nl> - } <nl> - else <nl> - { <nl> - Cry : : Audio : : Log ( <nl> - ELogType : : Warning , <nl> - " Wwise - PrepareEvent with % s failed for Wwise event % " PRISIZE_T " with AKRESULT : % d " , <nl> - bLoad ? " Preparation_Load " : " Preparation_Unload " , <nl> - m_id , <nl> - wwiseResult ) ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - Cry : : Audio : : Log ( ELogType : : Error , <nl> - " Wwise - Invalid IEvent passed to the Wwise implementation of % sTriggerAsync " , <nl> - bLoad ? " Load " : " Unprepare " ) ; <nl> - } <nl> - <nl> - return result ; <nl> - } <nl> } / / namespace Wwise <nl> } / / namespace Impl <nl> } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . 7043241965 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Object . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < ATLEntityData . h > <nl> + # include < PoolObject . h > <nl> + # include < AK / SoundEngine / Common / AkTypes . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + class CEvent ; <nl> + <nl> + enum class EObjectFlags : EnumFlagsType <nl> + { <nl> + None = 0 , <nl> + MovingOrDecaying = BIT ( 0 ) , <nl> + TrackAbsoluteVelocity = BIT ( 1 ) , <nl> + TrackRelativeVelocity = BIT ( 2 ) , <nl> + UpdateVirtualStates = BIT ( 3 ) , <nl> + } ; <nl> + CRY_CREATE_ENUM_FLAG_OPERATORS ( EObjectFlags ) ; <nl> + <nl> + class CObject final : public IObject , public CPoolObject < CObject , stl : : PSyncNone > <nl> + { <nl> + public : <nl> + <nl> + CObject ( ) = delete ; <nl> + CObject ( CObject const & ) = delete ; <nl> + CObject ( CObject & & ) = delete ; <nl> + CObject & operator = ( CObject const & ) = delete ; <nl> + CObject & operator = ( CObject & & ) = delete ; <nl> + <nl> + explicit CObject ( AkGameObjectID const id , CObjectTransformation const & transformation ) ; <nl> + virtual ~ CObject ( ) override ; <nl> + <nl> + / / CryAudio : : Impl : : IObject <nl> + virtual void Update ( float const deltaTime ) override ; <nl> + virtual void SetTransformation ( CObjectTransformation const & transformation ) override ; <nl> + virtual CObjectTransformation const & GetTransformation ( ) const override { return m_transformation ; } <nl> + virtual void SetEnvironment ( IEnvironment const * const pIEnvironment , float const amount ) override ; <nl> + virtual void SetParameter ( IParameter const * const pIParameter , float const value ) override ; <nl> + virtual void SetSwitchState ( ISwitchState const * const pISwitchState ) override ; <nl> + virtual void SetObstructionOcclusion ( float const obstruction , float const occlusion ) override ; <nl> + virtual void SetOcclusionType ( EOcclusionType const occlusionType ) override ; <nl> + virtual ERequestStatus ExecuteTrigger ( ITrigger const * const pITrigger , IEvent * const pIEvent ) override ; <nl> + virtual void StopAllTriggers ( ) override ; <nl> + virtual ERequestStatus PlayFile ( IStandaloneFile * const pIStandaloneFile ) override ; <nl> + virtual ERequestStatus StopFile ( IStandaloneFile * const pIStandaloneFile ) override ; <nl> + virtual ERequestStatus SetName ( char const * const szName ) override ; <nl> + virtual void ToggleFunctionality ( EObjectFunctionality const type , bool const enable ) override ; <nl> + <nl> + / / Below data is only used when INCLUDE_WWISE_IMPL_PRODUCTION_CODE is defined ! <nl> + virtual void DrawDebugInfo ( IRenderAuxGeom & auxGeom , float const posX , float posY , char const * const szTextFilter ) override ; <nl> + / / ~ CryAudio : : Impl : : IObject <nl> + <nl> + void RemoveEvent ( CEvent * const pEvent ) ; <nl> + <nl> + AkGameObjectID const m_id ; <nl> + <nl> + private : <nl> + <nl> + void PostEnvironmentAmounts ( ) ; <nl> + void UpdateVelocities ( float const deltaTime ) ; <nl> + void TryToSetRelativeVelocity ( float const relativeVelocity ) ; <nl> + <nl> + using AuxSendValues = std : : vector < AkAuxSendValue > ; <nl> + <nl> + std : : vector < CEvent * > m_events ; <nl> + bool m_needsToUpdateEnvironments ; <nl> + bool m_needsToUpdateVirtualStates ; <nl> + AuxSendValues m_auxSendValues ; <nl> + <nl> + EObjectFlags m_flags ; <nl> + float m_distanceToListener ; <nl> + float m_previousRelativeVelocity ; <nl> + float m_previousAbsoluteVelocity ; <nl> + CObjectTransformation m_transformation ; <nl> + Vec3 m_position ; <nl> + Vec3 m_previousPosition ; <nl> + Vec3 m_velocity ; <nl> + <nl> + # if defined ( INCLUDE_WWISE_IMPL_PRODUCTION_CODE ) <nl> + std : : map < char const * const , float > m_parameterInfo ; <nl> + # endif / / INCLUDE_WWISE_IMPL_PRODUCTION_CODE <nl> + } ; <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . fbcd089673 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Parameter . cpp <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " stdafx . h " <nl> + # include " Parameter . h " <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + CParameter : : CParameter ( AkRtpcID const id_ , float const mult_ , float const shift_ ) <nl> + : mult ( mult_ ) <nl> + , shift ( shift_ ) <nl> + , id ( id_ ) <nl> + { <nl> + } <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . c1254168d0 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Parameter . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < ATLEntityData . h > <nl> + # include < AK / SoundEngine / Common / AkTypes . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + class CParameter final : public IParameter <nl> + { <nl> + public : <nl> + <nl> + CParameter ( ) = delete ; <nl> + CParameter ( CParameter const & ) = delete ; <nl> + CParameter ( CParameter & & ) = delete ; <nl> + CParameter & operator = ( CParameter const & ) = delete ; <nl> + CParameter & operator = ( CParameter & & ) = delete ; <nl> + <nl> + explicit CParameter ( AkRtpcID const id_ , float const mult_ , float const shift_ ) ; <nl> + virtual ~ CParameter ( ) override = default ; <nl> + <nl> + float const mult ; <nl> + float const shift ; <nl> + AkRtpcID const id ; <nl> + } ; <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . c5e7ba0ef2 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Setting . cpp <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " stdafx . h " <nl> + # include " Setting . h " <nl> new file mode 100644 <nl> index 0000000000 . . b830cf80a5 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Setting . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < ATLEntityData . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + class CSetting final : public ISetting <nl> + { <nl> + public : <nl> + <nl> + CSetting ( CSetting const & ) = delete ; <nl> + CSetting ( CSetting & & ) = delete ; <nl> + CSetting & operator = ( CSetting const & ) = delete ; <nl> + CSetting & operator = ( CSetting & & ) = delete ; <nl> + <nl> + CSetting ( ) = default ; <nl> + virtual ~ CSetting ( ) override = default ; <nl> + <nl> + / / ISetting <nl> + virtual void Load ( ) const override { } <nl> + virtual void Unload ( ) const override { } <nl> + / / ~ ISetting <nl> + } ; <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . 51fee75021 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / StandaloneFile . cpp <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " stdafx . h " <nl> + # include " StandaloneFile . h " <nl> new file mode 100644 <nl> index 0000000000 . . 7e61d67427 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / StandaloneFile . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < ATLEntityData . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + class CStandaloneFile final : public IStandaloneFile <nl> + { <nl> + public : <nl> + <nl> + CStandaloneFile ( CStandaloneFile const & ) = delete ; <nl> + CStandaloneFile ( CStandaloneFile & & ) = delete ; <nl> + CStandaloneFile & operator = ( CStandaloneFile const & ) = delete ; <nl> + CStandaloneFile & operator = ( CStandaloneFile & & ) = delete ; <nl> + <nl> + CStandaloneFile ( ) = default ; <nl> + virtual ~ CStandaloneFile ( ) override = default ; <nl> + } ; <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . 773e12870e <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / SwitchState . cpp <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " stdafx . h " <nl> + # include " SwitchState . h " <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + CSwitchState : : CSwitchState ( <nl> + ESwitchType const type_ , <nl> + AkUInt32 const stateOrSwitchGroupId_ , <nl> + AkUInt32 const stateOrSwitchId_ , <nl> + float const rtpcValue_ / * = s_defaultStateValue * / ) <nl> + : type ( type_ ) <nl> + , stateOrSwitchGroupId ( stateOrSwitchGroupId_ ) <nl> + , stateOrSwitchId ( stateOrSwitchId_ ) <nl> + , rtpcValue ( rtpcValue_ ) <nl> + { <nl> + } <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . 11dd23eec7 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / SwitchState . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include " GlobalData . h " <nl> + # include < ATLEntityData . h > <nl> + # include < AK / SoundEngine / Common / AkTypes . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + enum class ESwitchType : EnumFlagsType <nl> + { <nl> + None , <nl> + Rtpc , <nl> + StateGroup , <nl> + SwitchGroup , <nl> + } ; <nl> + <nl> + class CSwitchState final : public ISwitchState <nl> + { <nl> + public : <nl> + <nl> + CSwitchState ( ) = delete ; <nl> + CSwitchState ( CSwitchState const & ) = delete ; <nl> + CSwitchState ( CSwitchState & & ) = delete ; <nl> + CSwitchState & operator = ( CSwitchState const & ) = delete ; <nl> + CSwitchState & operator = ( CSwitchState & & ) = delete ; <nl> + <nl> + explicit CSwitchState ( <nl> + ESwitchType const type_ , <nl> + AkUInt32 const stateOrSwitchGroupId_ , <nl> + AkUInt32 const stateOrSwitchId_ , <nl> + float const rtpcValue_ = s_defaultStateValue ) ; <nl> + <nl> + virtual ~ CSwitchState ( ) override = default ; <nl> + <nl> + ESwitchType const type ; <nl> + AkUInt32 const stateOrSwitchGroupId ; <nl> + AkUInt32 const stateOrSwitchId ; <nl> + float const rtpcValue ; <nl> + } ; <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . 31106f1c64 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Trigger . cpp <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " stdafx . h " <nl> + # include " Trigger . h " <nl> + # include " Common . h " <nl> + # include " Event . h " <nl> + <nl> + # include < Logger . h > <nl> + # include < AK / SoundEngine / Common / AkSoundEngine . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + void PrepareEventCallback ( <nl> + AkUniqueID eventId , <nl> + void const * pBankPtr , <nl> + AKRESULT wwiseResult , <nl> + AkMemPoolId memPoolId , <nl> + void * pCookie ) <nl> + { <nl> + auto const pEvent = static_cast < CEvent * > ( pCookie ) ; <nl> + <nl> + if ( pEvent ! = nullptr ) <nl> + { <nl> + pEvent - > m_id = eventId ; <nl> + gEnv - > pAudioSystem - > ReportFinishedEvent ( pEvent - > m_atlEvent , wwiseResult = = AK_Success ) ; <nl> + } <nl> + } <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + CTrigger : : CTrigger ( AkUniqueID const id , float const maxAttenuation ) <nl> + : m_id ( id ) <nl> + , m_maxAttenuation ( maxAttenuation ) <nl> + { <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + ERequestStatus CTrigger : : Load ( ) const <nl> + { <nl> + return SetLoaded ( true ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + ERequestStatus CTrigger : : Unload ( ) const <nl> + { <nl> + return SetLoaded ( false ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + ERequestStatus CTrigger : : LoadAsync ( IEvent * const pIEvent ) const <nl> + { <nl> + return SetLoadedAsync ( pIEvent , true ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + ERequestStatus CTrigger : : UnloadAsync ( IEvent * const pIEvent ) const <nl> + { <nl> + return SetLoadedAsync ( pIEvent , false ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + ERequestStatus CTrigger : : SetLoaded ( bool const bLoad ) const <nl> + { <nl> + ERequestStatus result = ERequestStatus : : Failure ; <nl> + AkUniqueID id = m_id ; <nl> + AKRESULT const wwiseResult = AK : : SoundEngine : : PrepareEvent ( bLoad ? AK : : SoundEngine : : Preparation_Load : AK : : SoundEngine : : Preparation_Unload , & id , 1 ) ; <nl> + <nl> + if ( IS_WWISE_OK ( wwiseResult ) ) <nl> + { <nl> + result = ERequestStatus : : Success ; <nl> + } <nl> + else <nl> + { <nl> + Cry : : Audio : : Log ( <nl> + ELogType : : Warning , <nl> + " Wwise - PrepareEvent with % s failed for Wwise event % " PRISIZE_T " with AKRESULT : % d " , <nl> + bLoad ? " Preparation_Load " : " Preparation_Unload " , <nl> + m_id , <nl> + wwiseResult ) ; <nl> + } <nl> + <nl> + return result ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + ERequestStatus CTrigger : : SetLoadedAsync ( IEvent * const pIEvent , bool const bLoad ) const <nl> + { <nl> + ERequestStatus result = ERequestStatus : : Failure ; <nl> + <nl> + CEvent * const pEvent = static_cast < CEvent * > ( pIEvent ) ; <nl> + <nl> + if ( pEvent ! = nullptr ) <nl> + { <nl> + AkUniqueID id = m_id ; <nl> + AKRESULT const wwiseResult = AK : : SoundEngine : : PrepareEvent ( <nl> + bLoad ? AK : : SoundEngine : : Preparation_Load : AK : : SoundEngine : : Preparation_Unload , <nl> + & id , <nl> + 1 , <nl> + & PrepareEventCallback , <nl> + pEvent ) ; <nl> + <nl> + if ( IS_WWISE_OK ( wwiseResult ) ) <nl> + { <nl> + pEvent - > m_id = m_id ; <nl> + pEvent - > m_state = EEventState : : Unloading ; <nl> + result = ERequestStatus : : Success ; <nl> + } <nl> + else <nl> + { <nl> + Cry : : Audio : : Log ( <nl> + ELogType : : Warning , <nl> + " Wwise - PrepareEvent with % s failed for Wwise event % " PRISIZE_T " with AKRESULT : % d " , <nl> + bLoad ? " Preparation_Load " : " Preparation_Unload " , <nl> + m_id , <nl> + wwiseResult ) ; <nl> + } <nl> + } <nl> + else <nl> + { <nl> + Cry : : Audio : : Log ( ELogType : : Error , <nl> + " Wwise - Invalid IEvent passed to the Wwise implementation of % sTriggerAsync " , <nl> + bLoad ? " Load " : " Unprepare " ) ; <nl> + } <nl> + <nl> + return result ; <nl> + } <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl> new file mode 100644 <nl> index 0000000000 . . 0cc0e0cd2a <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / Trigger . h <nl> <nl> + / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < ATLEntityData . h > <nl> + # include < AK / SoundEngine / Common / AkTypes . h > <nl> + <nl> + namespace CryAudio <nl> + { <nl> + namespace Impl <nl> + { <nl> + namespace Wwise <nl> + { <nl> + class CTrigger final : public ITrigger <nl> + { <nl> + public : <nl> + <nl> + CTrigger ( ) = delete ; <nl> + CTrigger ( CTrigger const & ) = delete ; <nl> + CTrigger ( CTrigger & & ) = delete ; <nl> + CTrigger & operator = ( CTrigger const & ) = delete ; <nl> + CTrigger & operator = ( CTrigger & & ) = delete ; <nl> + <nl> + explicit CTrigger ( AkUniqueID const id , float const maxAttenuation ) ; <nl> + virtual ~ CTrigger ( ) override = default ; <nl> + <nl> + / / CryAudio : : Impl : : ITrigger <nl> + virtual ERequestStatus Load ( ) const override ; <nl> + virtual ERequestStatus Unload ( ) const override ; <nl> + virtual ERequestStatus LoadAsync ( IEvent * const pIEvent ) const override ; <nl> + virtual ERequestStatus UnloadAsync ( IEvent * const pIEvent ) const override ; <nl> + / / ~ CryAudio : : Impl : : ITrigger <nl> + <nl> + AkUniqueID const m_id ; <nl> + float const m_maxAttenuation ; <nl> + <nl> + private : <nl> + <nl> + ERequestStatus SetLoaded ( bool const bLoad ) const ; <nl> + ERequestStatus SetLoadedAsync ( IEvent * const pIEvent , bool const bLoad ) const ; <nl> + } ; <nl> + } / / namespace Wwise <nl> + } / / namespace Impl <nl> + } / / namespace CryAudio <nl>
! R ( Audio ) Clean up Wwise implementation .
CRYTEK/CRYENGINE
836e2aa87d911fcca06bb620bee90e93ff91a381
2018-09-10T09:37:34Z
mmm a / xbmc / addons / kodi - addon - dev - kit / include / kodi / AddonBase . h <nl> ppp b / xbmc / addons / kodi - addon - dev - kit / include / kodi / AddonBase . h <nl> <nl> <nl> # pragma once <nl> <nl> + # include < assert . h > / * assert * / <nl> # include < stdarg . h > / * va_list , va_start , va_arg , va_end * / <nl> # include < cstdlib > <nl> # include < cstring > <nl> class CSettingValue <nl> namespace kodi { <nl> namespace addon { <nl> <nl> + / * <nl> + * Internally used helper class to manage processing of a " C " structure in " CPP " <nl> + * class . <nl> + * <nl> + * At constant , the " C " structure is copied , otherwise the given pointer is <nl> + * superseded and is changeable . <nl> + * <nl> + * mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + * <nl> + * Example : <nl> + * <nl> + * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { . cpp } <nl> + * extern " C " typedef struct C_SAMPLE_DATA <nl> + * { <nl> + * unsigned int iUniqueId ; <nl> + * } C_SAMPLE_DATA ; <nl> + * <nl> + * class CPPSampleData : public CStructHdl < CPPSampleData , C_SAMPLE_DATA > <nl> + * { <nl> + * public : <nl> + * CPPSampleData ( ) = default ; <nl> + * CPPSampleData ( const CPPSampleData & sample ) : CStructHdl ( sample ) { } <nl> + * CPPSampleData ( const C_SAMPLE_DATA * sample ) : CStructHdl ( sample ) { } <nl> + * CPPSampleData ( C_SAMPLE_DATA * sample ) : CStructHdl ( sample ) { } <nl> + * <nl> + * void SetUniqueId ( unsigned int uniqueId ) { m_cStructure - > iUniqueId = uniqueId ; } <nl> + * unsigned int GetUniqueId ( ) const { return m_cStructure - > iUniqueId ; } <nl> + * } ; <nl> + * <nl> + * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ <nl> + * <nl> + * It also works with the following example : <nl> + * <nl> + * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { . cpp } <nl> + * CPPSampleData test ; <nl> + * / / Some work <nl> + * C_SAMPLE_DATA * data = test ; <nl> + * / / Give " data " to Kodi <nl> + * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ <nl> + * / <nl> + template < class CPP_CLASS , typename C_STRUCT > <nl> + class CStructHdl <nl> + { <nl> + public : <nl> + CStructHdl ( ) <nl> + : m_cStructure ( new C_STRUCT ) <nl> + , m_owner ( true ) <nl> + { <nl> + } <nl> + <nl> + CStructHdl ( const CPP_CLASS & cppClass ) <nl> + : m_cStructure ( new C_STRUCT ( * cppClass . m_cStructure ) ) <nl> + , m_owner ( true ) <nl> + { <nl> + } <nl> + <nl> + CStructHdl ( const C_STRUCT * cStructure ) <nl> + : m_cStructure ( new C_STRUCT ( { * cStructure } ) ) <nl> + , m_owner ( true ) <nl> + { <nl> + } <nl> + <nl> + CStructHdl ( C_STRUCT * cStructure ) <nl> + : m_cStructure ( cStructure ) <nl> + , m_owner ( false ) <nl> + { <nl> + assert ( cStructure ) ; <nl> + } <nl> + <nl> + const CPP_CLASS & operator = ( const CPP_CLASS & right ) <nl> + { <nl> + assert ( * right . m_cStructure ) ; <nl> + if ( m_owner ) <nl> + delete m_cStructure ; <nl> + m_owner = true ; <nl> + m_cStructure = new C_STRUCT ( * right . m_cStructure ) ; <nl> + return * this ; <nl> + } <nl> + <nl> + const CPP_CLASS & operator = ( const C_STRUCT & right ) <nl> + { <nl> + assert ( * right ) ; <nl> + if ( m_owner ) <nl> + delete m_cStructure ; <nl> + m_owner = true ; <nl> + m_cStructure = new C_STRUCT ( * right ) ; <nl> + return * this ; <nl> + } <nl> + <nl> + virtual ~ CStructHdl ( ) <nl> + { <nl> + if ( m_owner ) <nl> + delete m_cStructure ; <nl> + } <nl> + <nl> + operator C_STRUCT * ( ) { return m_cStructure ; } <nl> + <nl> + protected : <nl> + C_STRUCT * m_cStructure = nullptr ; <nl> + <nl> + private : <nl> + bool m_owner = false ; <nl> + } ; <nl> + <nl> / / / Add - on main instance class . <nl> class ATTRIBUTE_HIDDEN CAddonBase <nl> { <nl>
Merge pull request from AlwinEsch / add - c - to - cpp - handler
xbmc/xbmc
f126ec74865885a324792d9bfd37fa83e2036b36
2019-09-23T14:55:40Z
mmm a / src / cpp / common / channel_arguments . cc <nl> ppp b / src / cpp / common / channel_arguments . cc <nl> <nl> # include < grpc / impl / codegen / grpc_types . h > <nl> # include < grpc / support / log . h > <nl> # include < grpcpp / grpcpp . h > <nl> + # include < grpcpp / impl / grpc_library . h > <nl> # include < grpcpp / resource_quota . h > <nl> # include " src / core / ext / filters / client_channel / service_config . h " <nl> # include " src / core / lib / channel / channel_args . h " <nl> <nl> <nl> namespace grpc_impl { <nl> <nl> + namespace { <nl> + : : grpc : : internal : : GrpcLibraryInitializer g_gli_initializer ; <nl> + } / / namespace <nl> + <nl> ChannelArguments : : ChannelArguments ( ) { <nl> + g_gli_initializer . summon ( ) ; <nl> / / This will be ignored if used on the server side . <nl> SetString ( GRPC_ARG_PRIMARY_USER_AGENT_STRING , " grpc - c + + / " + grpc : : Version ( ) ) ; <nl> } <nl>
Add GrpcLibraryInitializer
grpc/grpc
f299391f15927561927282a495c50e8d97c1ea16
2019-05-14T17:36:49Z
mmm a / cocos / Android . mk <nl> ppp b / cocos / Android . mk <nl> LOCAL_WHOLE_STATIC_LIBRARIES + = chipmunk_static <nl> LOCAL_WHOLE_STATIC_LIBRARIES + = cocos2dxandroid_static <nl> <nl> # define the macro to compile through support / zip_support / ioapi . c <nl> - LOCAL_CFLAGS : = - Wno - psabi - DUSE_FILE32API <nl> - LOCAL_CPPFLAGS : = - Wno - literal - suffix - Wno - deprecated - declarations <nl> - LOCAL_EXPORT_CFLAGS : = - Wno - psabi - DUSE_FILE32API <nl> - LOCAL_EXPORT_CPPFLAGS : = - Wno - literal - suffix - Wno - deprecated - declarations <nl> + LOCAL_CFLAGS : = - DUSE_FILE32API <nl> + LOCAL_CPPFLAGS : = - Wno - deprecated - declarations <nl> + LOCAL_EXPORT_CFLAGS : = - DUSE_FILE32API <nl> + LOCAL_EXPORT_CPPFLAGS : = - Wno - deprecated - declarations <nl> <nl> include $ ( BUILD_STATIC_LIBRARY ) <nl> <nl> mmm a / cocos / audio / android / Android . mk <nl> ppp b / cocos / audio / android / Android . mk <nl> LOCAL_C_INCLUDES : = $ ( LOCAL_PATH ) / . . / include \ <nl> $ ( LOCAL_PATH ) / . . / . . \ <nl> $ ( LOCAL_PATH ) / . . / . . / platform / android <nl> <nl> - LOCAL_CFLAGS + = - Wno - psabi <nl> - LOCAL_EXPORT_CFLAGS + = - Wno - psabi <nl> - <nl> include $ ( BUILD_STATIC_LIBRARY ) <nl> mmm a / cocos / editor - support / cocosbuilder / Android . mk <nl> ppp b / cocos / editor - support / cocosbuilder / Android . mk <nl> LOCAL_C_INCLUDES : = $ ( LOCAL_PATH ) / . . / . . / 2d \ <nl> $ ( LOCAL_PATH ) \ <nl> $ ( LOCAL_PATH ) / . . / . . / . . <nl> <nl> - LOCAL_CFLAGS + = - Wno - psabi <nl> - LOCAL_EXPORT_CFLAGS + = - Wno - psabi <nl> <nl> LOCAL_WHOLE_STATIC_LIBRARIES : = cocos_extension_static <nl> <nl> mmm a / cocos / editor - support / cocostudio / Android . mk <nl> ppp b / cocos / editor - support / cocostudio / Android . mk <nl> $ ( LOCAL_PATH ) / . . / . . / . . / external \ <nl> $ ( LOCAL_PATH ) / . . \ <nl> $ ( LOCAL_PATH ) / . . / . . <nl> <nl> - LOCAL_CFLAGS + = - Wno - psabi - fexceptions <nl> - LOCAL_EXPORT_CFLAGS + = - Wno - psabi <nl> + LOCAL_CFLAGS + = - fexceptions <nl> + <nl> <nl> LOCAL_WHOLE_STATIC_LIBRARIES : = cocos2dx_static <nl> LOCAL_WHOLE_STATIC_LIBRARIES + = cocosdenshion_static <nl> mmm a / cocos / editor - support / spine / Android . mk <nl> ppp b / cocos / editor - support / spine / Android . mk <nl> LOCAL_EXPORT_C_INCLUDES : = $ ( LOCAL_PATH ) / . . <nl> LOCAL_C_INCLUDES : = $ ( LOCAL_PATH ) / . . / . . \ <nl> $ ( LOCAL_PATH ) / . . <nl> <nl> - LOCAL_CFLAGS + = - Wno - psabi <nl> - LOCAL_EXPORT_CFLAGS + = - Wno - psabi <nl> - <nl> LOCAL_WHOLE_STATIC_LIBRARIES : = cocos2dx_static <nl> <nl> include $ ( BUILD_STATIC_LIBRARY ) <nl> mmm a / cocos / network / Android . mk <nl> ppp b / cocos / network / Android . mk <nl> LOCAL_EXPORT_C_INCLUDES : = $ ( LOCAL_PATH ) / . . <nl> LOCAL_C_INCLUDES : = $ ( LOCAL_PATH ) / . . / . . \ <nl> $ ( LOCAL_PATH ) / . . <nl> <nl> - LOCAL_CFLAGS + = - Wno - psabi <nl> - LOCAL_EXPORT_CFLAGS + = - Wno - psabi <nl> <nl> LOCAL_WHOLE_STATIC_LIBRARIES : = cocos2dx_static <nl> LOCAL_WHOLE_STATIC_LIBRARIES + = cocos_curl_static <nl> mmm a / cocos / ui / Android . mk <nl> ppp b / cocos / ui / Android . mk <nl> $ ( LOCAL_PATH ) / . . \ <nl> $ ( LOCAL_PATH ) / . . / . . \ <nl> $ ( LOCAL_PATH ) / . . / editor - support <nl> <nl> - LOCAL_CFLAGS + = - Wno - psabi <nl> - LOCAL_EXPORT_CFLAGS + = - Wno - psabi <nl> <nl> LOCAL_WHOLE_STATIC_LIBRARIES : = cocos2dx_static <nl> LOCAL_WHOLE_STATIC_LIBRARIES + = cocos_extension_static <nl>
fix compiling warnings
cocos2d/cocos2d-x
6cc600cccec4e7f7992e099d53cb87100dbae9ba
2014-07-03T03:43:56Z
mmm a / modules / planning / common / planning_context . cc <nl> ppp b / modules / planning / common / planning_context . cc <nl> <nl> namespace apollo { <nl> namespace planning { <nl> <nl> - / / PlanningContext : : PlanningStatus PlanningContext : : planning_status_ ; <nl> - / / PlanningContext : : SidePassInfo PlanningContext : : side_pass_info_ ; <nl> - / / PlanningContext : : FallBackInfo PlanningContext : : fallback_info_ ; <nl> - / / PlanningContext : : OpenSpaceInfo PlanningContext : : open_space_info_ ; <nl> <nl> PlanningContext : : PlanningContext ( ) { } <nl> <nl> mmm a / modules / planning / proto / planning_status . proto <nl> ppp b / modules / planning / proto / planning_status . proto <nl> message PullOverStatus { <nl> optional double pull_over_x = 4 [ default = 0 . 0 ] ; <nl> optional double pull_over_y = 5 [ default = 0 . 0 ] ; <nl> optional double pull_over_theta = 6 [ default = 0 . 0 ] ; <nl> + optional double pull_over_length_front = 7 [ default = 0 . 0 ] ; <nl> + optional double pull_over_length_back = 8 [ default = 0 . 0 ] ; <nl> + optional double pull_over_width_left = 9 [ default = 0 . 0 ] ; <nl> + optional double pull_over_width_right = 10 [ default = 0 . 0 ] ; <nl> } <nl> <nl> message ReroutingStatus { <nl> mmm a / modules / planning / tasks / deciders / path_assessment_decider / path_assessment_decider . cc <nl> ppp b / modules / planning / tasks / deciders / path_assessment_decider / path_assessment_decider . cc <nl> Status PathAssessmentDecider : : Process ( <nl> } else { <nl> ADEBUG < < " There are " < < candidate_path_data . size ( ) < < " candidate paths " ; <nl> } <nl> - auto end_time0 = std : : chrono : : system_clock : : now ( ) ; <nl> + const auto & end_time0 = std : : chrono : : system_clock : : now ( ) ; <nl> <nl> / / 1 . Remove invalid path . <nl> std : : vector < PathData > valid_path_data ; <nl> Status PathAssessmentDecider : : Process ( <nl> } <nl> } <nl> } <nl> - auto end_time1 = std : : chrono : : system_clock : : now ( ) ; <nl> + const auto & end_time1 = std : : chrono : : system_clock : : now ( ) ; <nl> std : : chrono : : duration < double > diff = end_time1 - end_time0 ; <nl> ADEBUG < < " Time for path validity checking : " < < diff . count ( ) * 1000 <nl> < < " msec . " ; <nl> Status PathAssessmentDecider : : Process ( <nl> return Status ( ErrorCode : : PLANNING_ERROR , msg ) ; <nl> } <nl> ADEBUG < < " There are " < < valid_path_data . size ( ) < < " valid path data . " ; <nl> - auto end_time2 = std : : chrono : : system_clock : : now ( ) ; <nl> + const auto & end_time2 = std : : chrono : : system_clock : : now ( ) ; <nl> diff = end_time2 - end_time1 ; <nl> ADEBUG < < " Time for path info labeling : " < < diff . count ( ) * 1000 <nl> < < " msec . " ; <nl> Status PathAssessmentDecider : : Process ( <nl> * ( reference_line_info - > mutable_path_data ( ) ) = valid_path_data . front ( ) ; <nl> reference_line_info - > SetBlockingObstacleId ( <nl> valid_path_data . front ( ) . blocking_obstacle_id ( ) ) ; <nl> - auto end_time3 = std : : chrono : : system_clock : : now ( ) ; <nl> + const auto & end_time3 = std : : chrono : : system_clock : : now ( ) ; <nl> diff = end_time3 - end_time2 ; <nl> ADEBUG < < " Time for optimal path selection : " < < diff . count ( ) * 1000 <nl> < < " msec . " ; <nl> Status PathAssessmentDecider : : Process ( <nl> - > set_decided_side_pass_direction ( - 1 ) ; <nl> } <nl> } <nl> - auto end_time4 = std : : chrono : : system_clock : : now ( ) ; <nl> + const auto & end_time4 = std : : chrono : : system_clock : : now ( ) ; <nl> diff = end_time4 - end_time3 ; <nl> ADEBUG < < " Time for FSM state updating : " < < diff . count ( ) * 1000 <nl> < < " msec . " ; <nl> mmm a / modules / planning / tasks / deciders / path_bounds_decider / path_bounds_decider . cc <nl> ppp b / modules / planning / tasks / deciders / path_bounds_decider / path_bounds_decider . cc <nl> Status PathBoundsDecider : : Process ( <nl> pull_over_info - > set_pull_over_y ( std : : get < 3 > ( pull_over_configuration ) ) ; <nl> pull_over_info - > set_pull_over_theta ( <nl> std : : get < 4 > ( pull_over_configuration ) ) ; <nl> + / / TODO ( jiacheng ) : find - tune this . <nl> + pull_over_info - > set_pull_over_length_front ( <nl> + VehicleConfigHelper : : GetConfig ( ) . vehicle_param ( ) . length ( ) ) ; <nl> + pull_over_info - > set_pull_over_length_back ( <nl> + VehicleConfigHelper : : GetConfig ( ) . vehicle_param ( ) . length ( ) ) ; <nl> + pull_over_info - > set_pull_over_width_left ( <nl> + VehicleConfigHelper : : GetConfig ( ) . vehicle_param ( ) . width ( ) + 0 . 5 ) ; <nl> + pull_over_info - > set_pull_over_width_right ( <nl> + VehicleConfigHelper : : GetConfig ( ) . vehicle_param ( ) . width ( ) ) ; <nl> ADEBUG < < " pull over : s [ " < < std : : get < 0 > ( pull_over_configuration ) <nl> < < " ] l [ " < < std : : get < 1 > ( pull_over_configuration ) < < " ] x [ " <nl> < < std : : get < 2 > ( pull_over_configuration ) < < " ] y [ " <nl>
Planning : add pull - over bounding box length and width .
ApolloAuto/apollo
a623de0faa1c5e326a1ae9d45bf15f4a44b8d44a
2019-05-20T21:54:57Z