diff options
author | Li Jin <dragon-fly@qq.com> | 2022-11-16 10:53:09 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-11-16 10:53:09 +0800 |
commit | cfe8c31260fe2fabba1a3ce77adb6a85fc1fae47 (patch) | |
tree | 1ed31c2958a59ce1c33efda14119e0a7997d47f6 /src | |
parent | 7ecfd8f02bad9ebba7e32894da278a48ef9ecee9 (diff) | |
download | yuescript-cfe8c31260fe2fabba1a3ce77adb6a85fc1fae47.tar.gz yuescript-cfe8c31260fe2fabba1a3ce77adb6a85fc1fae47.tar.bz2 yuescript-cfe8c31260fe2fabba1a3ce77adb6a85fc1fae47.zip |
fix build. update doc.
Diffstat (limited to 'src')
-rwxr-xr-x | src/3rdParty/efsw/FileInfo.hpp | 4 | ||||
-rwxr-xr-x | src/3rdParty/efsw/FileWatcherFSEvents.cpp | 6 | ||||
-rwxr-xr-x | src/3rdParty/efsw/FileWatcherKqueue.cpp | 4 | ||||
-rwxr-xr-x | src/3rdParty/efsw/String.cpp | 16 | ||||
-rwxr-xr-x | src/3rdParty/efsw/Utf.inl | 6 | ||||
-rwxr-xr-x | src/3rdParty/efsw/WatcherFSEvents.cpp | 2 | ||||
-rw-r--r-- | src/yue.cpp | 11 |
7 files changed, 28 insertions, 21 deletions
diff --git a/src/3rdParty/efsw/FileInfo.hpp b/src/3rdParty/efsw/FileInfo.hpp index a8dd3d3..f1bcf4b 100755 --- a/src/3rdParty/efsw/FileInfo.hpp +++ b/src/3rdParty/efsw/FileInfo.hpp | |||
@@ -18,10 +18,12 @@ class FileInfo { | |||
18 | 18 | ||
19 | FileInfo(); | 19 | FileInfo(); |
20 | 20 | ||
21 | FileInfo( const std::string& filepath ); | 21 | explicit FileInfo( const std::string& filepath ); |
22 | 22 | ||
23 | FileInfo( const std::string& filepath, bool linkInfo ); | 23 | FileInfo( const std::string& filepath, bool linkInfo ); |
24 | 24 | ||
25 | FileInfo( const FileInfo& ) = default; | ||
26 | |||
25 | bool operator==( const FileInfo& Other ) const; | 27 | bool operator==( const FileInfo& Other ) const; |
26 | 28 | ||
27 | bool operator!=( const FileInfo& Other ) const; | 29 | bool operator!=( const FileInfo& Other ) const; |
diff --git a/src/3rdParty/efsw/FileWatcherFSEvents.cpp b/src/3rdParty/efsw/FileWatcherFSEvents.cpp index 970810d..bcfdbe6 100755 --- a/src/3rdParty/efsw/FileWatcherFSEvents.cpp +++ b/src/3rdParty/efsw/FileWatcherFSEvents.cpp | |||
@@ -41,7 +41,7 @@ bool FileWatcherFSEvents::isGranular() { | |||
41 | return getOSXReleaseNumber() >= 11; | 41 | return getOSXReleaseNumber() >= 11; |
42 | } | 42 | } |
43 | 43 | ||
44 | void FileWatcherFSEvents::FSEventCallback( ConstFSEventStreamRef streamRef, void* userData, | 44 | void FileWatcherFSEvents::FSEventCallback( ConstFSEventStreamRef /*streamRef*/, void* userData, |
45 | size_t numEvents, void* eventPaths, | 45 | size_t numEvents, void* eventPaths, |
46 | const FSEventStreamEventFlags eventFlags[], | 46 | const FSEventStreamEventFlags eventFlags[], |
47 | const FSEventStreamEventId eventIds[] ) { | 47 | const FSEventStreamEventId eventIds[] ) { |
@@ -208,8 +208,8 @@ void FileWatcherFSEvents::run() { | |||
208 | mRunLoopRef = NULL; | 208 | mRunLoopRef = NULL; |
209 | } | 209 | } |
210 | 210 | ||
211 | void FileWatcherFSEvents::handleAction( Watcher* watch, const std::string& filename, | 211 | void FileWatcherFSEvents::handleAction( Watcher* /*watch*/, const std::string& /*filename*/, |
212 | unsigned long action, std::string oldFilename ) { | 212 | unsigned long /*action*/, std::string /*oldFilename*/ ) { |
213 | /// Not used | 213 | /// Not used |
214 | } | 214 | } |
215 | 215 | ||
diff --git a/src/3rdParty/efsw/FileWatcherKqueue.cpp b/src/3rdParty/efsw/FileWatcherKqueue.cpp index 9c86755..38ffad9 100755 --- a/src/3rdParty/efsw/FileWatcherKqueue.cpp +++ b/src/3rdParty/efsw/FileWatcherKqueue.cpp | |||
@@ -181,8 +181,8 @@ void FileWatcherKqueue::run() { | |||
181 | } while ( mInitOK ); | 181 | } while ( mInitOK ); |
182 | } | 182 | } |
183 | 183 | ||
184 | void FileWatcherKqueue::handleAction( Watcher* watch, const std::string& filename, | 184 | void FileWatcherKqueue::handleAction( Watcher* /*watch*/, const std::string& /*filename*/, |
185 | unsigned long action, std::string oldFilename ) {} | 185 | unsigned long /*action*/, std::string /*oldFilename*/ ) {} |
186 | 186 | ||
187 | std::list<std::string> FileWatcherKqueue::directories() { | 187 | std::list<std::string> FileWatcherKqueue::directories() { |
188 | std::list<std::string> dirs; | 188 | std::list<std::string> dirs; |
diff --git a/src/3rdParty/efsw/String.cpp b/src/3rdParty/efsw/String.cpp index 8c9a3cc..e3ba68f 100755 --- a/src/3rdParty/efsw/String.cpp +++ b/src/3rdParty/efsw/String.cpp | |||
@@ -382,7 +382,7 @@ String& String::assign( const String& str, size_t pos, size_t n ) { | |||
382 | return *this; | 382 | return *this; |
383 | } | 383 | } |
384 | 384 | ||
385 | String& String::assign( const char* s, size_t n ) { | 385 | String& String::assign( const char* s, size_t /*n*/ ) { |
386 | String tmp( s ); | 386 | String tmp( s ); |
387 | 387 | ||
388 | mString.assign( tmp.mString ); | 388 | mString.assign( tmp.mString ); |
@@ -416,7 +416,7 @@ String& String::append( const String& str, size_t pos, size_t n ) { | |||
416 | return *this; | 416 | return *this; |
417 | } | 417 | } |
418 | 418 | ||
419 | String& String::append( const char* s, size_t n ) { | 419 | String& String::append( const char* s, size_t /*n*/ ) { |
420 | String tmp( s ); | 420 | String tmp( s ); |
421 | 421 | ||
422 | mString.append( tmp.mString ); | 422 | mString.append( tmp.mString ); |
@@ -510,7 +510,7 @@ std::size_t String::find( const String& str, std::size_t start ) const { | |||
510 | return mString.find( str.mString, start ); | 510 | return mString.find( str.mString, start ); |
511 | } | 511 | } |
512 | 512 | ||
513 | std::size_t String::find( const char* s, std::size_t pos, std::size_t n ) const { | 513 | std::size_t String::find( const char* s, std::size_t pos, std::size_t /*n*/ ) const { |
514 | return find( String( s ), pos ); | 514 | return find( String( s ), pos ); |
515 | } | 515 | } |
516 | 516 | ||
@@ -526,7 +526,7 @@ std::size_t String::rfind( const String& str, std::size_t pos ) const { | |||
526 | return mString.rfind( str.mString, pos ); | 526 | return mString.rfind( str.mString, pos ); |
527 | } | 527 | } |
528 | 528 | ||
529 | std::size_t String::rfind( const char* s, std::size_t pos, std::size_t n ) const { | 529 | std::size_t String::rfind( const char* s, std::size_t pos, std::size_t /*n*/ ) const { |
530 | return rfind( String( s ), pos ); | 530 | return rfind( String( s ), pos ); |
531 | } | 531 | } |
532 | 532 | ||
@@ -575,7 +575,7 @@ std::size_t String::find_first_of( const String& str, std::size_t pos ) const { | |||
575 | return mString.find_first_of( str.mString, pos ); | 575 | return mString.find_first_of( str.mString, pos ); |
576 | } | 576 | } |
577 | 577 | ||
578 | std::size_t String::find_first_of( const char* s, std::size_t pos, std::size_t n ) const { | 578 | std::size_t String::find_first_of( const char* s, std::size_t pos, std::size_t /*n*/ ) const { |
579 | return find_first_of( String( s ), pos ); | 579 | return find_first_of( String( s ), pos ); |
580 | } | 580 | } |
581 | 581 | ||
@@ -591,7 +591,7 @@ std::size_t String::find_last_of( const String& str, std::size_t pos ) const { | |||
591 | return mString.find_last_of( str.mString, pos ); | 591 | return mString.find_last_of( str.mString, pos ); |
592 | } | 592 | } |
593 | 593 | ||
594 | std::size_t String::find_last_of( const char* s, std::size_t pos, std::size_t n ) const { | 594 | std::size_t String::find_last_of( const char* s, std::size_t pos, std::size_t /*n*/ ) const { |
595 | return find_last_of( String( s ), pos ); | 595 | return find_last_of( String( s ), pos ); |
596 | } | 596 | } |
597 | 597 | ||
@@ -607,7 +607,7 @@ std::size_t String::find_first_not_of( const String& str, std::size_t pos ) cons | |||
607 | return mString.find_first_not_of( str.mString, pos ); | 607 | return mString.find_first_not_of( str.mString, pos ); |
608 | } | 608 | } |
609 | 609 | ||
610 | std::size_t String::find_first_not_of( const char* s, std::size_t pos, std::size_t n ) const { | 610 | std::size_t String::find_first_not_of( const char* s, std::size_t pos, std::size_t /*n*/ ) const { |
611 | return find_first_not_of( String( s ), pos ); | 611 | return find_first_not_of( String( s ), pos ); |
612 | } | 612 | } |
613 | 613 | ||
@@ -623,7 +623,7 @@ std::size_t String::find_last_not_of( const String& str, std::size_t pos ) const | |||
623 | return mString.find_last_not_of( str.mString, pos ); | 623 | return mString.find_last_not_of( str.mString, pos ); |
624 | } | 624 | } |
625 | 625 | ||
626 | std::size_t String::find_last_not_of( const char* s, std::size_t pos, std::size_t n ) const { | 626 | std::size_t String::find_last_not_of( const char* s, std::size_t pos, std::size_t /*n*/ ) const { |
627 | return find_last_not_of( String( s ), pos ); | 627 | return find_last_not_of( String( s ), pos ); |
628 | } | 628 | } |
629 | 629 | ||
diff --git a/src/3rdParty/efsw/Utf.inl b/src/3rdParty/efsw/Utf.inl index 7e3e9d6..5b6c2e0 100755 --- a/src/3rdParty/efsw/Utf.inl +++ b/src/3rdParty/efsw/Utf.inl | |||
@@ -375,17 +375,17 @@ template <typename In, typename Out> Out Utf<16>::ToUtf32( In begin, In end, Out | |||
375 | return output; | 375 | return output; |
376 | } | 376 | } |
377 | 377 | ||
378 | template <typename In> In Utf<32>::Decode( In begin, In end, Uint32& output, Uint32 ) { | 378 | template <typename In> In Utf<32>::Decode( In begin, In /*end*/, Uint32& output, Uint32 ) { |
379 | output = *begin++; | 379 | output = *begin++; |
380 | return begin; | 380 | return begin; |
381 | } | 381 | } |
382 | 382 | ||
383 | template <typename Out> Out Utf<32>::Encode( Uint32 input, Out output, Uint32 replacement ) { | 383 | template <typename Out> Out Utf<32>::Encode( Uint32 input, Out output, Uint32 /*replacement*/ ) { |
384 | *output++ = input; | 384 | *output++ = input; |
385 | return output; | 385 | return output; |
386 | } | 386 | } |
387 | 387 | ||
388 | template <typename In> In Utf<32>::Next( In begin, In end ) { | 388 | template <typename In> In Utf<32>::Next( In begin, In /*end*/ ) { |
389 | return ++begin; | 389 | return ++begin; |
390 | } | 390 | } |
391 | 391 | ||
diff --git a/src/3rdParty/efsw/WatcherFSEvents.cpp b/src/3rdParty/efsw/WatcherFSEvents.cpp index 6ccf527..b562d3c 100755 --- a/src/3rdParty/efsw/WatcherFSEvents.cpp +++ b/src/3rdParty/efsw/WatcherFSEvents.cpp | |||
@@ -11,7 +11,7 @@ WatcherFSEvents::WatcherFSEvents() : | |||
11 | Watcher(), FWatcher( NULL ), FSStream( NULL ), WatcherGen( NULL ), initializedAsync( false ) {} | 11 | Watcher(), FWatcher( NULL ), FSStream( NULL ), WatcherGen( NULL ), initializedAsync( false ) {} |
12 | 12 | ||
13 | WatcherFSEvents::WatcherFSEvents( WatchID id, std::string directory, FileWatchListener* listener, | 13 | WatcherFSEvents::WatcherFSEvents( WatchID id, std::string directory, FileWatchListener* listener, |
14 | bool recursive, WatcherFSEvents* parent ) : | 14 | bool recursive, WatcherFSEvents* /*parent*/ ) : |
15 | Watcher( id, directory, listener, recursive ), | 15 | Watcher( id, directory, listener, recursive ), |
16 | FWatcher( NULL ), | 16 | FWatcher( NULL ), |
17 | FSStream( NULL ), | 17 | FSStream( NULL ), |
diff --git a/src/yue.cpp b/src/yue.cpp index 49fa3e1..4f5be8d 100644 --- a/src/yue.cpp +++ b/src/yue.cpp | |||
@@ -196,7 +196,7 @@ static std::string compileFile(const fs::path& srcFile, yue::YueConfig conf, con | |||
196 | 196 | ||
197 | class UpdateListener : public efsw::FileWatchListener { | 197 | class UpdateListener : public efsw::FileWatchListener { |
198 | public: | 198 | public: |
199 | void handleFileAction(efsw::WatchID, const std::string& dir, const std::string& filename, efsw::Action action, std::string oldFilename) override { | 199 | void handleFileAction(efsw::WatchID, const std::string& dir, const std::string& filename, efsw::Action action, std::string) override { |
200 | switch(action) { | 200 | switch(action) { |
201 | case efsw::Actions::Add: | 201 | case efsw::Actions::Add: |
202 | if (auto res = compileFile(fs::path(dir) / filename, config, workPath); !res.empty()) { | 202 | if (auto res = compileFile(fs::path(dir) / filename, config, workPath); !res.empty()) { |
@@ -246,6 +246,7 @@ int main(int narg, const char** args) { | |||
246 | " -b Dump compile time (doesn't write output)\n" | 246 | " -b Dump compile time (doesn't write output)\n" |
247 | " -g Dump global variables used in NAME LINE COLUMN\n" | 247 | " -g Dump global variables used in NAME LINE COLUMN\n" |
248 | " -l Write line numbers from source codes\n" | 248 | " -l Write line numbers from source codes\n" |
249 | " -w path Watch changes and compile every file under directory\n" | ||
249 | " -v Print version\n" | 250 | " -v Print version\n" |
250 | #ifndef YUE_COMPILER_ONLY | 251 | #ifndef YUE_COMPILER_ONLY |
251 | " -- Read from standard in, print to standard out\n" | 252 | " -- Read from standard in, print to standard out\n" |
@@ -581,14 +582,18 @@ int main(int narg, const char** args) { | |||
581 | } | 582 | } |
582 | } | 583 | } |
583 | if (!watchFiles && files.empty()) { | 584 | if (!watchFiles && files.empty()) { |
584 | std::cout << help; | 585 | std::cout << "no input files\n"sv; |
585 | return 0; | 586 | return 0; |
586 | } | 587 | } |
587 | if (!resultFile.empty() && files.size() > 1) { | 588 | if (!resultFile.empty() && files.size() > 1) { |
588 | std::cout << "Error: -o can not be used with multiple input files\n"sv; | 589 | std::cout << "Error: -o can not be used with multiple input files\n"sv; |
589 | std::cout << help; | 590 | return 1; |
590 | } | 591 | } |
591 | if (watchFiles) { | 592 | if (watchFiles) { |
593 | if (!targetPath.empty()) { | ||
594 | std::cout << "Error: -t can not be used with watching mode\n"sv; | ||
595 | return 1; | ||
596 | } | ||
592 | auto fullWorkPath = fs::absolute(fs::path(workPath)).string(); | 597 | auto fullWorkPath = fs::absolute(fs::path(workPath)).string(); |
593 | std::list<std::future<std::string>> results; | 598 | std::list<std::future<std::string>> results; |
594 | for (const auto& file : files) { | 599 | for (const auto& file : files) { |