diff --git a/etc/codeTemplates/source/foamNewSource b/etc/codeTemplates/source/foamNewSource index 1ece48d5ada98aff29eb2d615b00476130008ad2..6469aa3b324c1f4aabe6a6e68b278e2b4b9e33c5 100755 --- a/etc/codeTemplates/source/foamNewSource +++ b/etc/codeTemplates/source/foamNewSource @@ -96,7 +96,7 @@ else fileName="$className$Type" - echo "$Script: Creating new interface file $fileName" + echo "$Script: Creating new code file $fileName" if [ -e "$fileName" ] then echo " Error: file exists" diff --git a/wmake/scripts/makeOptions b/wmake/scripts/makeOptions index 864f08f84e20f108a192ab6b35ce3158c7eb0a63..6101889ec5ac41b58aeaf1cc41155c05c2b2b9cc 100755 --- a/wmake/scripts/makeOptions +++ b/wmake/scripts/makeOptions @@ -32,9 +32,11 @@ rm -f Make/options echo "Creating Make/options" echo 'EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude' > Make/options + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude' > Make/options echo >> Make/options echo 'EXE_LIBS = \ - -lfiniteVolume' >> Make/options + -lfiniteVolume \ + -lmeshTools' >> Make/options #------------------------------------------------------------------------------ diff --git a/wmake/src/wmkdepend.cpp b/wmake/src/wmkdepend.cpp index 8cb2e39caad663aafe023437cc48f688dc43fdff..610af3ecdc9d9c040bf4910c1d994b1da5fa7397 100644 --- a/wmake/src/wmkdepend.cpp +++ b/wmake/src/wmkdepend.cpp @@ -73,7 +73,7 @@ Note #include <unordered_set> #include <vector> -// Ragel switchs may have several implicit fallthroughs +// Ragel switches may have several implicit fallthroughs #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" // Length of the input read buffer @@ -312,7 +312,7 @@ namespace Files // Can use 'variable p xxx;' etc to change these names -#line 337 "wmkdepend.rl" +#line 341 "wmkdepend.rl" @@ -328,15 +328,31 @@ static const int wmkdep_error = 0; static const int wmkdep_en_main = 21; -#line 345 "wmkdepend.rl" +#line 349 "wmkdepend.rl" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +void processFile(std::string fileName); + +// +// Open a file and process. +// The file name is given by the [first,last) range +// +void processFile(const char* first, const char* last) +{ + // Extra safety + if (first && last && last > first) + { + processFile(std::string(first, last)); + } +} + + // // Open a file and process // -void processFile(const std::string& fileName) +void processFile(std::string fileName) { FILE* infile = Files::open(fileName); if (optVerbose) @@ -351,7 +367,7 @@ void processFile(const std::string& fileName) int act, cs; -#line 355 "wmkdepend.cpp" +#line 371 "wmkdepend.cpp" { cs = wmkdep_start; ts = 0; @@ -359,7 +375,7 @@ void processFile(const std::string& fileName) act = 0; } -#line 366 "wmkdepend.rl" +#line 386 "wmkdepend.rl" /* ^^^ FSM initialization here ^^^ */; // Local token start @@ -404,7 +420,7 @@ void processFile(const std::string& fileName) } -#line 408 "wmkdepend.cpp" +#line 424 "wmkdepend.cpp" { if ( p == pe ) goto _test_eof; @@ -423,35 +439,35 @@ tr0: } goto st21; tr2: -#line 335 "wmkdepend.rl" +#line 339 "wmkdepend.rl" {te = p+1;} goto st21; tr17: -#line 335 "wmkdepend.rl" +#line 339 "wmkdepend.rl" {{p = ((te))-1;}} goto st21; tr21: -#line 330 "wmkdepend.rl" +#line 334 "wmkdepend.rl" {te = p+1;} goto st21; tr29: -#line 333 "wmkdepend.rl" +#line 337 "wmkdepend.rl" {te = p+1;} goto st21; tr31: -#line 332 "wmkdepend.rl" +#line 336 "wmkdepend.rl" {te = p+1;} goto st21; tr36: -#line 327 "wmkdepend.rl" +#line 331 "wmkdepend.rl" {te = p;p--;} goto st21; tr37: -#line 335 "wmkdepend.rl" +#line 339 "wmkdepend.rl" {te = p;p--;} goto st21; tr38: -#line 333 "wmkdepend.rl" +#line 337 "wmkdepend.rl" {te = p;p--;} goto st21; st21: @@ -464,7 +480,7 @@ st21: case 21: #line 1 "NONE" {ts = p;} -#line 468 "wmkdepend.cpp" +#line 484 "wmkdepend.cpp" switch( (*p) ) { case 10: goto st23; case 11: goto tr34; @@ -485,14 +501,14 @@ case 1: tr32: #line 1 "NONE" {te = p+1;} -#line 327 "wmkdepend.rl" +#line 331 "wmkdepend.rl" {act = 1;} goto st22; st22: if ( ++p == pe ) goto _test_eof22; case 22: -#line 496 "wmkdepend.cpp" +#line 512 "wmkdepend.cpp" switch( (*p) ) { case 10: goto st23; case 11: goto tr34; @@ -514,14 +530,14 @@ case 23: tr34: #line 1 "NONE" {te = p+1;} -#line 327 "wmkdepend.rl" +#line 331 "wmkdepend.rl" {act = 1;} goto st24; st24: if ( ++p == pe ) goto _test_eof24; case 24: -#line 525 "wmkdepend.cpp" +#line 541 "wmkdepend.cpp" switch( (*p) ) { case 10: goto st23; case 32: goto tr34; @@ -620,13 +636,13 @@ case 10: goto tr12; tr12: #line 315 "wmkdepend.rl" - { tok = p; /* Local token start */ } + { tok = p; /* Local token start */ } goto st11; st11: if ( ++p == pe ) goto _test_eof11; case 11: -#line 630 "wmkdepend.cpp" +#line 646 "wmkdepend.cpp" switch( (*p) ) { case 10: goto tr15; case 34: goto tr16; @@ -636,7 +652,7 @@ tr13: #line 1 "NONE" {te = p+1;} #line 315 "wmkdepend.rl" - { tok = p; /* Local token start */ } + { tok = p; /* Local token start */ } goto st25; tr15: #line 1 "NONE" @@ -646,7 +662,7 @@ st25: if ( ++p == pe ) goto _test_eof25; case 25: -#line 650 "wmkdepend.cpp" +#line 666 "wmkdepend.cpp" if ( (*p) == 34 ) goto tr19; goto st12; @@ -658,26 +674,32 @@ case 12: goto tr19; goto st12; tr19: -#line 316 "wmkdepend.rl" - { processFile(std::string(tok, (p - tok))); } +#line 317 "wmkdepend.rl" + { + processFile(tok, p); + tok = nullptr; /* Done with buffer */ + } goto st13; st13: if ( ++p == pe ) goto _test_eof13; case 13: -#line 669 "wmkdepend.cpp" +#line 688 "wmkdepend.cpp" if ( (*p) == 10 ) goto tr21; goto st13; tr16: -#line 316 "wmkdepend.rl" - { processFile(std::string(tok, (p - tok))); } +#line 317 "wmkdepend.rl" + { + processFile(tok, p); + tok = nullptr; /* Done with buffer */ + } goto st14; st14: if ( ++p == pe ) goto _test_eof14; case 14: -#line 681 "wmkdepend.cpp" +#line 703 "wmkdepend.cpp" if ( (*p) == 10 ) goto tr21; goto st14; @@ -708,7 +730,7 @@ st26: if ( ++p == pe ) goto _test_eof26; case 26: -#line 712 "wmkdepend.cpp" +#line 734 "wmkdepend.cpp" if ( (*p) == 42 ) goto st18; goto st17; @@ -741,14 +763,14 @@ case 19: tr30: #line 1 "NONE" {te = p+1;} -#line 333 "wmkdepend.rl" +#line 337 "wmkdepend.rl" {act = 4;} goto st27; st27: if ( ++p == pe ) goto _test_eof27; case 27: -#line 752 "wmkdepend.cpp" +#line 774 "wmkdepend.cpp" if ( (*p) == 10 ) goto tr2; goto st1; @@ -823,7 +845,7 @@ cs = 0; _out: {} } -#line 409 "wmkdepend.rl" +#line 429 "wmkdepend.rl" /* ^^^ FSM execution here ^^^ */; if (0 == cs) @@ -837,11 +859,23 @@ cs = 0; if (ts) { - // Preserve incomplete token + // Preserve incomplete token. + // We have the normal ragel range (ts, te) but potentially + // our own local buffer start as 'tok' + + if (tok && tok >= ts) + { + tok = inbuf + (tok - ts); + } + else + { + tok = nullptr; // safety + } + pending = pe - ts; memmove(inbuf, ts, pending); - te = inbuf + (te - ts); // token end (after memmove) - ts = inbuf; // token start + te = inbuf + (te - ts); // token end (after memmove) + ts = inbuf; // token start } else { diff --git a/wmake/src/wmkdepend.rl b/wmake/src/wmkdepend.rl index c57b70a8c179f6fb21b4345616391f45d234838c..3683bd0577b68a413f35c99104b064289dafe1f9 100644 --- a/wmake/src/wmkdepend.rl +++ b/wmake/src/wmkdepend.rl @@ -71,7 +71,7 @@ Note #include <unordered_set> #include <vector> -// Ragel switchs may have several implicit fallthroughs +// Ragel switches may have several implicit fallthroughs #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" // Length of the input read buffer @@ -312,8 +312,12 @@ namespace Files %%{ machine wmkdep; - action buffer { tok = p; /* Local token start */ } - action process { processFile(std::string(tok, (p - tok))); } + action buffer { tok = p; /* Local token start */ } + action process + { + processFile(tok, p); + tok = nullptr; /* Done with buffer */ + } white = [ \t\f\r]; # Horizontal whitespace nl = white* '\n'; # Newline (allow trailing whitespace) @@ -346,10 +350,26 @@ namespace Files /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +void processFile(std::string fileName); + +// +// Open a file and process. +// The file name is given by the [first,last) range +// +void processFile(const char* first, const char* last) +{ + // Extra safety + if (first && last && last > first) + { + processFile(std::string(first, last)); + } +} + + // // Open a file and process // -void processFile(const std::string& fileName) +void processFile(std::string fileName) { FILE* infile = Files::open(fileName); if (optVerbose) @@ -419,11 +439,23 @@ void processFile(const std::string& fileName) if (ts) { - // Preserve incomplete token + // Preserve incomplete token. + // We have the normal ragel range (ts, te) but potentially + // our own local buffer start as 'tok' + + if (tok && tok >= ts) + { + tok = inbuf + (tok - ts); + } + else + { + tok = nullptr; // safety + } + pending = pe - ts; memmove(inbuf, ts, pending); - te = inbuf + (te - ts); // token end (after memmove) - ts = inbuf; // token start + te = inbuf + (te - ts); // token end (after memmove) + ts = inbuf; // token start } else {