Pol  Revision:cb584c9
ECompileMain.cpp
Go to the documentation of this file.
1 #include "ECompileMain.h"
2 
3 #include <cstdio>
4 #include <exception>
5 #include <iosfwd>
6 #include <stdlib.h>
7 #include <string>
8 #include <time.h>
9 
10 #include "../bscript/compiler.h"
11 #include "../bscript/compilercfg.h"
12 #include "../bscript/escriptv.h"
13 #include "../bscript/executor.h"
14 #include "../bscript/executortype.h"
15 #include "../bscript/filefmt.h"
16 #include "../bscript/parser.h"
17 #include "../clib/Program/ProgramConfig.h"
18 #include "../clib/Program/ProgramMain.h"
19 #include "../clib/dirlist.h"
20 #include "../clib/esignal.h"
21 #include "../clib/fileutil.h"
22 #include "../clib/logfacility.h"
23 #include "../clib/mdump.h"
24 #include "../clib/passert.h"
25 #include "../clib/threadhelp.h"
26 #include "../clib/timer.h"
27 #include "../plib/pkg.h"
28 #include "../plib/systemstate.h"
29 #include <format/format.h>
30 
31 namespace Pol
32 {
33 namespace ECompile
34 {
35 using namespace std;
36 using namespace Pol::Core;
37 using namespace Pol::Plib;
38 using namespace Pol::Bscript;
39 
41 
42 
44 
45 ECompileMain::ECompileMain() : Pol::Clib::ProgramMain() {}
48 
50 {
51  ERROR_PRINT << "Usage:\n"
52  << " \n"
53  << " ECOMPILE [options] filespec [filespec ...]\n"
54  << " \n"
55  << " Output is : filespec.ecl\n"
56  << " Options:\n"
57  << " Options: \n"
58  << " -a compile *.asp pages also\n"
59  << " -A automatically compile scripts in main and enabled packages\n"
60  << " -Au (as '-A' but only compile updated files)\n"
61  << " -b keep building other scripts after errors\n"
62  << " -C cfgpath path to configuration (replaces ecompile.cfg)\n"
63  << " -d display confusing compiler parse information\n"
64  << " -D write dependency information\n"
65  << " -e report error on successful compilation (used for testing)\n"
66 #ifdef WIN32
67  << " -Ecfgpath set or change the ECOMPILE_CFG_PATH evironment variable\n"
68 #endif
69  << " -i include intrusive debug info in .ecl file\n"
70  << " -l generate listfile\n"
71  << " -m don't optimize object members\n"
72 #ifdef WIN32
73  << " -Pdir set or change the EM and INC files Environment Variables\n"
74 #endif
75  << " -q quiet mode (suppress normal output)\n"
76  << " -r [dir] recurse folder [from 'dir'] (defaults to current folder)\n"
77  << " -ri [dir] (as '-r' but only compile .inc files)\n"
78  << " -t[v] show timing/profiling information [override quiet mode]\n"
79  << " -u compile only updated scripts (.src newer than .ecl)\n"
80  << " -f force compile even if up-to-date\n"
81  << " -s display summary if -q is not set\n"
82  << " -T[N] use threaded compilation, force N threads to run\n"
83  << " -vN verbosity level\n"
84  << " -w display warnings\n"
85  << " -W generate wordfile\n"
86  << " -y treat warnings as errors\n"
87  << " -x write external .dbg file\n"
88  << " -xt write external .dbg.txt info file\n"
89  << "\n"
90  << " NOTE:\n"
91  << " If <filespec> are required after an empty -r[i] option, you MUST specify\n"
92  << " a literal [dir] of '.' (no quotes) or options will not parse correctly.\n";
93 }
94 
95 static int s_argc;
96 static char** s_argv;
97 
98 int debug = 0;
99 bool quiet = false;
101 bool keep_building = false;
102 bool verbose = false;
103 bool force_update = false;
104 bool show_timing_details = false;
108 std::string EmPathEnv; // "ECOMPILE_PATH_EM=xxx"
109 std::string IncPathEnv; // ECOMPILE_PATH_INC=yyy"
110 std::string CfgPathEnv; // ECOMPILE_CFG_PATH=zzz"
111 
112 struct Summary
113 {
114  unsigned UpToDateScripts = 0;
115  unsigned CompiledScripts = 0;
116  unsigned ScriptsWithCompileErrors = 0;
117  size_t ThreadCount = 0;
118 } summary;
119 
121 {
122  INFO_PRINT << "Writing word list to wordlist.txt\n";
123  std::ofstream ofs( "wordlist.txt", std::ios::out | std::ios::trunc );
124  Parser::write_words( ofs );
125 }
126 
127 void compile_inc( const char* path )
128 {
129  if ( !quiet )
130  INFO_PRINT << "Compiling: " << path << "\n";
131 
132  Compiler C;
133 
134  C.setQuiet( !debug );
136  int res = C.compileFile( path );
137 
138  if ( res )
139  throw std::runtime_error( "Error compiling file" );
140 }
141 
150 bool compile_file( const char* path )
151 {
152  std::string fname( path );
153  std::string filename_src = fname, ext( "" );
154 
155  std::string::size_type pos = fname.rfind( '.' );
156  if ( pos != std::string::npos )
157  ext = fname.substr( pos );
158 
159  if ( !ext.compare( ".inc" ) )
160  {
161  compile_inc( path );
162  return true;
163  }
164 
165  if ( ext.compare( ".src" ) != 0 && ext.compare( ".hsr" ) != 0 && ext.compare( ".asp" ) != 0 )
166  {
167  INFO_PRINT << "Didn't find '.src', '.hsr', or '.asp' extension on source filename '" << path
168  << "'!\n";
169  throw std::runtime_error( "Error in source filename" );
170  }
171  std::string filename_ecl = fname.replace( pos, 4, ".ecl" );
172  std::string filename_lst = fname.replace( pos, 4, ".lst" );
173  std::string filename_dep = fname.replace( pos, 4, ".dep" );
174  std::string filename_dbg = fname.replace( pos, 4, ".dbg" );
175 
176  if ( compilercfg.OnlyCompileUpdatedScripts && !force_update )
177  {
178  bool all_old = true;
179  unsigned int ecl_timestamp = Clib::GetFileTimestamp( filename_ecl.c_str() );
180  if ( Clib::GetFileTimestamp( filename_src.c_str() ) >= ecl_timestamp )
181  {
182  if ( verbose )
183  INFO_PRINT << filename_src << " is newer than " << filename_ecl << "\n";
184  all_old = false;
185  }
186 
187  if ( all_old )
188  {
189  std::ifstream ifs( filename_dep.c_str() );
190  // if the file doesn't exist, gotta build.
191  if ( ifs.is_open() )
192  {
193  std::string depname;
194  while ( getline( ifs, depname ) )
195  {
196  if ( Clib::GetFileTimestamp( depname.c_str() ) >= ecl_timestamp )
197  {
198  if ( verbose )
199  INFO_PRINT << depname << " is newer than " << filename_ecl << "\n";
200  all_old = false;
201  break;
202  }
203  }
204  }
205  else
206  {
207  if ( verbose )
208  INFO_PRINT << filename_dep << " does not exist."
209  << "\n";
210  all_old = false;
211  }
212  }
213  if ( all_old )
214  {
215  if ( !quiet && compilercfg.DisplayUpToDateScripts )
216  INFO_PRINT << filename_ecl << " is up-to-date."
217  << "\n";
218  return false;
219  }
220  }
221 
222  {
223  if ( !quiet )
224  INFO_PRINT << "Compiling: " << path << "\n";
225 
226  Compiler C;
227 
228  C.setQuiet( !debug );
229  int res = C.compileFile( path );
230 
231  if ( expect_compile_failure )
232  {
233  if ( res ) // good, it failed
234  {
235  if ( !quiet )
236  INFO_PRINT << "Compilation failed as expected."
237  << "\n";
238  return true;
239  }
240  else
241  {
242  throw std::runtime_error( "Compilation succeeded (-e indicates failure was expected)" );
243  }
244  }
245 
246  if ( res )
247  throw std::runtime_error( "Error compiling file" );
248 
249 
250  if ( !quiet )
251  INFO_PRINT << "Writing: " << filename_ecl << "\n";
252 
253  if ( C.write( filename_ecl.c_str() ) )
254  {
255  throw std::runtime_error( "Error writing output file" );
256  }
257 
259  {
260  if ( !quiet )
261  INFO_PRINT << "Writing: " << filename_lst << "\n";
262  std::ofstream ofs( filename_lst.c_str() );
263  C.dump( ofs );
264  }
265  else if ( Clib::FileExists( filename_lst.c_str() ) )
266  {
267  if ( !quiet )
268  INFO_PRINT << "Deleting: " << filename_lst << "\n";
269  Clib::RemoveFile( filename_lst );
270  }
271 
273  {
274  if ( !quiet )
275  {
276  INFO_PRINT << "Writing: " << filename_dbg << "\n";
278  INFO_PRINT << "Writing: " << filename_dbg << ".txt"
279  << "\n";
280  }
281  C.write_dbg( filename_dbg.c_str(), compilercfg.GenerateDebugTextInfo );
282  }
283  else if ( Clib::FileExists( filename_dbg.c_str() ) )
284  {
285  if ( !quiet )
286  INFO_PRINT << "Deleting: " << filename_dbg << "\n";
287  Clib::RemoveFile( filename_dbg );
288  }
289 
291  {
292  if ( !quiet )
293  INFO_PRINT << "Writing: " << filename_dep << "\n";
294  C.writeIncludedFilenames( filename_dep.c_str() );
295  }
296  else if ( Clib::FileExists( filename_dep.c_str() ) )
297  {
298  if ( !quiet )
299  INFO_PRINT << "Deleting: " << filename_dep << "\n";
300  Clib::RemoveFile( filename_dep );
301  }
302  }
303  return true;
304 }
305 
306 void compile_file_wrapper( const char* path )
307 {
308  try
309  {
310  if ( compile_file( path ) )
312  else
314  }
315  catch ( std::exception& )
316  {
319  if ( !keep_building )
320  throw;
321  }
322 }
323 
324 bool setting_value( const char* arg )
325 {
326  // format of arg is -C or -C-
327  if ( arg[2] == '\0' )
328  return true;
329  else if ( arg[2] == '-' )
330  return false;
331  else if ( arg[2] == '+' )
332  return true;
333  else
334  return true;
335 }
336 
337 
338 int readargs( int argc, char** argv )
339 {
340  bool unknown_opt = false;
341 
342  for ( int i = 1; i < argc; i++ )
343  {
344  const char* arg = argv[i];
345 #ifdef __linux__
346  if ( arg[0] == '-' )
347 #else
348  if ( arg[0] == '/' || arg[0] == '-' )
349 #endif
350  {
351  switch ( arg[1] )
352  {
353  case 'A': // skip it at this point.
354  break;
355 
356  case 'C': // skip it at this point.
357  ++i; // and skip its parameter.
358  break;
359 
360  case 'd':
361  debug = 1;
362  break;
363 
364  case 'D':
366  break;
367 
368  case 'e':
369  expect_compile_failure = true;
370  break;
371 
372 #ifdef WIN32
373  case 'E':
374  {
375  std::string path = &argv[i][2];
376  CfgPathEnv = "ECOMPILE_CFG_PATH=" + path;
377  _putenv( CfgPathEnv.c_str() );
378  }
379  break;
380 #endif
381 
382  case 'q':
383  quiet = true;
384  break;
385 
386  case 'w':
388  if ( argv[i][2] == 'P' )
390  break;
391  case 'y':
393  break;
394 
395  case 'l':
397  break;
398 
399  case 'i':
400  include_debug = 1;
401  break;
402 
403  case 'r': // -r[i] [dir] is okay
404  // Only suboption allowed is '-ri' (.inc recurse)
405  if ( argv[i][2] && argv[i][2] != 'i' )
406  {
407  // BZZZZT! *error*
408  unknown_opt = true;
409  break;
410  }
411 
412 // Only skip next parameter if it's not an option!!
413 #ifdef __linux__
414  if ( i + 1 < argc && argv[i + 1][0] != '-' )
415 #else
416  if ( i + 1 < argc && argv[i + 1][0] != '/' && argv[i + 1][0] != '-' )
417 #endif
418  ++i;
419  break;
420 
421  case 't':
422  show_timing_details = true;
423  if ( argv[i][2] == 'v' )
424  timing_quiet_override = true;
425  break;
426 
427  case 's':
428  // show_source = true;
430  break;
431 
432  case 'W':
433  opt_generate_wordlist = true;
434  break;
435 
436  case 'a':
438  break;
439 
440  case 'm':
442  break;
443 
444  case 'b':
445  keep_building = true;
446  break;
447 
448  case 'u':
452  break;
453 
454  case 'f':
455  force_update = true;
456  break;
457 
458  case 'v':
459  verbose = true;
460  int vlev;
461  vlev = atoi( &argv[i][2] );
462  if ( !vlev )
463  vlev = 1;
465  break;
466 
467  case 'x':
469  compilercfg.GenerateDebugTextInfo = ( argv[i][2] == 't' );
470  break;
471 
472 #ifdef WIN32
473  case 'P':
474  {
475  std::string path = &argv[i][2];
476  EmPathEnv = "ECOMPILE_PATH_EM=" + path;
477  IncPathEnv = "ECOMPILE_PATH_INC=" + path;
478  _putenv( EmPathEnv.c_str() );
479  _putenv( IncPathEnv.c_str() );
480  }
481  break;
482 #endif
483  case 'T':
484  {
486  int count = atoi( &argv[i][2] );
488  break;
489  }
490  default:
491  unknown_opt = true;
492  break;
493  }
494  }
495 
496  if ( unknown_opt )
497  {
498  ERROR_PRINT << "Unknown option: " << argv[i] << "\n";
499  return 1;
500  }
501  }
502  return 0;
503 }
504 
511 void recurse_compile( const std::string& basedir, std::vector<std::string>* files )
512 {
513  int s_compiled, s_uptodate, s_errors;
514  clock_t start, finish;
515 
516  if ( !Clib::IsDirectory( basedir.c_str() ) )
517  return;
518 
519  s_compiled = s_uptodate = s_errors = 0;
520  start = clock();
521  for ( Clib::DirList dl( basedir.c_str() ); !dl.at_end(); dl.next() )
522  {
523  if ( Clib::exit_signalled )
524  return;
525  std::string name = dl.name(), ext;
526  if ( name[0] == '.' )
527  continue;
528 
529  std::string::size_type pos = name.rfind( '.' );
530  if ( pos != std::string::npos )
531  ext = name.substr( pos );
532 
533  try
534  {
535  if ( pos != std::string::npos &&
536  ( !ext.compare( ".src" ) || !ext.compare( ".hsr" ) ||
537  ( compilercfg.CompileAspPages && !ext.compare( ".asp" ) ) ) )
538  {
539  s_compiled++;
540  if ( files == nullptr )
541  {
542  if ( compile_file( ( basedir + name ).c_str() ) )
543  {
545  }
546  else
547  {
548  ++s_uptodate;
550  }
551  }
552  else
553  files->push_back( ( basedir + name ) );
554  }
555  else
556  {
557  recurse_compile( basedir + name + "/", files );
558  }
559  }
560  catch ( std::exception& )
561  {
564  if ( !keep_building )
565  throw;
566  s_errors++;
567  }
568  }
569  if ( files == nullptr )
570  return;
571  finish = clock();
572 
573  if ( ( !quiet || timing_quiet_override ) && show_timing_details && s_compiled > 0 &&
574  files == nullptr )
575  {
576  INFO_PRINT << "Compiled " << s_compiled << " script" << ( s_compiled == 1 ? "" : "s" ) << " in "
577  << basedir << " in " << (int)( ( finish - start ) / CLOCKS_PER_SEC )
578  << " second(s)\n";
579  if ( s_uptodate > 0 )
580  INFO_PRINT << " " << s_uptodate << " script" << ( s_uptodate == 1 ? " was" : "s were" )
581  << " already up-to-date.\n";
582  if ( s_errors > 0 )
583  INFO_PRINT << " " << s_errors << " script" << ( s_errors == 1 ? "" : "s" )
584  << " had errors.\n";
585  }
586 }
587 void recurse_compile_inc( const std::string& basedir, std::vector<std::string>* files )
588 {
589  for ( Clib::DirList dl( basedir.c_str() ); !dl.at_end(); dl.next() )
590  {
591  if ( Clib::exit_signalled )
592  return;
593  std::string name = dl.name(), ext;
594  if ( name[0] == '.' )
595  continue;
596 
597  std::string::size_type pos = name.rfind( '.' );
598  if ( pos != std::string::npos )
599  ext = name.substr( pos );
600 
601  if ( pos != std::string::npos && !ext.compare( ".inc" ) )
602  {
603  if ( files == nullptr )
604  compile_file( ( basedir + name ).c_str() );
605  else
606  files->push_back( ( basedir + name ) );
607  }
608  else
609  {
610  recurse_compile( basedir + name + "/", files );
611  }
612  }
613 }
614 
615 void parallel_compile( const std::vector<std::string>& files )
616 {
617  std::atomic<unsigned> compiled_scripts( 0 );
618  std::atomic<unsigned> uptodate_scripts( 0 );
619  std::atomic<unsigned> error_scripts( 0 );
620  std::atomic<bool> par_keep_building( true );
621  {
622  unsigned int thread_count = std::max( 2u, std::thread::hardware_concurrency() * 2 );
624  thread_count = static_cast<unsigned>( compilercfg.NumberOfThreads );
625  threadhelp::TaskThreadPool pool( thread_count, "ecompile" );
626  summary.ThreadCount = pool.size();
627  for ( const auto& file : files )
628  {
629  pool.push( [&]() {
630 
631  if ( !par_keep_building || Clib::exit_signalled )
632  return;
633  try
634  {
635  if ( compile_file( file.c_str() ) )
636  ++compiled_scripts;
637  else
638  ++uptodate_scripts;
639  }
640  catch ( std::exception& e )
641  {
642  ++compiled_scripts;
643  ++error_scripts;
644  ERROR_PRINT << "failed to compile " << file.c_str() << ": " << e.what() << "\n";
645  if ( !keep_building )
646  {
647  par_keep_building = false;
648  }
649  }
650  catch ( ... )
651  {
652  par_keep_building = false;
654  }
655  } );
656  }
657  }
658  summary.CompiledScripts = compiled_scripts;
659  summary.UpToDateScripts = uptodate_scripts;
660  summary.ScriptsWithCompileErrors = error_scripts;
661 }
662 
663 
668 {
672  {
673  std::vector<std::string> files;
675  for ( const auto& pkg : Plib::systemstate.packages )
676  {
677  recurse_compile( Clib::normalized_dir_form( pkg->dir() ), &files );
678  }
679  parallel_compile( files );
680  }
681  else
682  {
684  for ( const auto& pkg : Plib::systemstate.packages )
685  {
686  recurse_compile( Clib::normalized_dir_form( pkg->dir() ), nullptr );
687  }
688  }
690 }
691 
695 bool run( int argc, char** argv )
696 {
698  // Load and analyze the package structure
699  for ( const auto& elem : compilercfg.PackageRoot )
700  {
701  Plib::load_packages( elem, true /* quiet */ );
702  }
705 
706  // Determine the run mode and do the compile itself
707  Tools::Timer<> timer;
708  bool any = false;
709 
710  for ( int i = 1; i < argc; i++ )
711  {
712 #ifdef __linux__
713  if ( argv[i][0] == '-' )
714 #else
715  if ( argv[i][0] == '/' || argv[i][0] == '-' )
716 #endif
717  {
718  // -r[i] [<dir>]
719  if ( argv[i][1] == 'A' )
720  {
721  compilercfg.UpdateOnlyOnAutoCompile = ( argv[i][2] == 'u' );
722  any = true;
723 
724  AutoCompile();
725  }
726  else if ( argv[i][1] == 'r' )
727  {
728  any = true;
729  std::string dir( "." );
730  bool compile_inc = ( argv[i][2] == 'i' ); // compile .inc files
731 
732  ++i;
733  if ( i < argc && argv[i] && argv[i][0] != '-' )
734  dir.assign( argv[i] );
735 
737  {
738  std::vector<std::string> files;
739  if ( compile_inc )
741  else
742  recurse_compile( Clib::normalized_dir_form( dir ), &files );
743  parallel_compile( files );
744  }
745  else
746  {
747  if ( compile_inc )
749  else
750  recurse_compile( Clib::normalized_dir_form( dir ), nullptr );
751  }
752  }
753  else if ( argv[i][1] == 'C' )
754  {
755  ++i; // skip the config file pathname
756  }
757  // and skip any other option.
758  }
759  else
760  {
761  any = true;
762 #ifdef _WIN32
764 #else
765  compile_file_wrapper( argv[i] );
766 #endif
767  }
768  }
769 
770  if ( !any && compilercfg.AutoCompileByDefault )
771  {
772  any = true;
773  AutoCompile();
774  }
775 
776  // Execution is completed: start final/cleanup tasks
777  timer.stop();
778 
780 
781  if ( any && compilercfg.DisplaySummary && !quiet )
782  {
783  fmt::Writer tmp;
784  tmp << "Compilation Summary:\n";
785  if ( summary.ThreadCount )
786  tmp << " Used " << summary.ThreadCount << " threads\n";
787  if ( summary.CompiledScripts )
788  tmp << " Compiled " << summary.CompiledScripts << " script"
789  << ( summary.CompiledScripts == 1 ? "" : "s" ) << " in " << timer.ellapsed() << " ms.\n";
790 
792  tmp << " " << summary.ScriptsWithCompileErrors << " of those script"
793  << ( summary.ScriptsWithCompileErrors == 1 ? "" : "s" ) << " had errors.\n";
794 
795  if ( summary.UpToDateScripts )
796  tmp << " " << summary.UpToDateScripts << " script"
797  << ( summary.UpToDateScripts == 1 ? " was" : "s were" ) << " already up-to-date.\n";
798  INFO_PRINT << tmp.str();
799  }
800 
801  return any;
802 }
803 
804 void read_config_file( int argc, char* argv[] )
805 {
806  for ( int i = 1; i < argc; i++ )
807  {
808  if ( argv[i][0] == '/' || argv[i][0] == '-' )
809  {
810  // -C cfgpath
811  if ( argv[i][1] == 'C' )
812  {
813  ++i;
814  if ( i == argc )
815  throw std::runtime_error( "-C specified without pathname" );
816 
817  compilercfg.Read( std::string( argv[i] ) );
818  return;
819  }
820  }
821  }
822 
823  // check ECOMPILE_CFG_PATH environment variable
824  const char* env_ecompile_cfg_path = getenv( "ECOMPILE_CFG_PATH" );
825  if ( env_ecompile_cfg_path != nullptr )
826  {
827  compilercfg.Read( std::string( env_ecompile_cfg_path ) );
828  return;
829  }
830 
831  // no -C arg, so use binary path (hope it's right..sigh.)
832  std::string cfgpath = PROG_CONFIG::programDir() + "ecompile.cfg";
833  if ( Clib::FileExists( "ecompile.cfg" ) )
834  {
835  compilercfg.Read( "ecompile.cfg" );
836  }
837  else if ( Clib::FileExists( cfgpath ) )
838  {
839  compilercfg.Read( cfgpath );
840  }
841  else
842  {
843  ERROR_PRINT << "Could not find " << cfgpath << "; using defaults.\n";
845  }
846 }
847 
852 {
853  const std::vector<std::string>& binArgs = programArgs();
854 
855  /**********************************************
856  * show help
857  **********************************************/
858  if ( binArgs.size() == 1 )
859  {
860  showHelp();
861  return 0; // return "okay"
862  }
863 
864 /**********************************************
865  * TODO: rework the following cruft from former uotool.cpp
866  **********************************************/
867 #ifdef _WIN32
869 #endif
870 
871  ECompile::read_config_file( s_argc, s_argv );
872 
873  int res = ECompile::readargs( s_argc, s_argv );
874  if ( res )
875  return res;
876 
877  if ( !ECompile::quiet )
878  {
879  // vX.YY
880  double vernum = (double)1 + (double)( ESCRIPT_FILE_VER_CURRENT / 100.0f );
881  ERROR_PRINT << "EScript Compiler v" << vernum << "\n" << POL_COPYRIGHT << "\n\n";
882  }
883 
885  {
887  return 0;
888  }
889 
890  bool didanything = ECompile::run( s_argc, s_argv );
891 
892  if ( !didanything )
893  {
894  showHelp();
895  return 1;
896  }
897  else
898  {
899  return 0;
900  }
901 }
902 }
903 } // namespaces
904 
908 
909 int main( int argc, char* argv[] )
910 {
911  Pol::ECompile::s_argc = argc;
912  Pol::ECompile::s_argv = argv;
913 
915  ECompileMain->start( argc, argv );
916 }
bool dont_optimize_object_members
void dump(std::ostream &os)
Definition: compiler.cpp:5445
bool timing_quiet_override
static void write_words(std::ostream &os)
Definition: parser.cpp:926
const std::vector< std::string > & programArgs() const
int include_debug
Definition: eprog2.cpp:30
std::string IncPathEnv
SystemState systemstate
Definition: systemstate.cpp:12
void recurse_compile_inc(const std::string &basedir, std::vector< std::string > *files)
#define ESCRIPT_FILE_VER_CURRENT
Definition: filefmt.h:44
int readargs(int argc, char **argv)
static int s_argc
void recurse_compile(const std::string &basedir, std::vector< std::string > *files)
void check_package_deps()
Definition: pkg.cpp:377
unsigned int GetFileTimestamp(const char *fname)
Definition: fileutil.cpp:135
static void Initialize()
Definition: mdump.cpp:60
bool opt_generate_wordlist
void setIncludeCompileMode()
Definition: compiler.h:209
STL namespace.
void start(int argc, char *argv[])
Definition: ProgramMain.cpp:42
void force_backtrace(bool complete)
Definition: passert.cpp:53
bool at_end() const
Definition: dirlist.cpp:102
CompilerConfig compilercfg
static char ** s_argv
bool compile_file(const char *path)
void read_config_file(int argc, char *argv[])
bool IsDirectory(const char *dir)
Definition: fileutil.cpp:51
void compile_file_wrapper(const char *path)
bool expect_compile_failure
std::string CfgPathEnv
void setQuiet(int x)
Definition: parser.h:146
std::string EmPathEnv
void generate_wordlist()
static void setVerbosityLevel(int vlev)
Definition: compiler.h:126
int write_dbg(const char *fname, bool generate_txtfile)
Definition: compiler.cpp:5430
void enable_exit_signaller()
Definition: esignal.cpp:65
int forspec(const char *spec, void(*func)(const char *pathname))
Definition: forspcnt.cpp:15
void compile_inc(const char *path)
void writeIncludedFilenames(const char *fname) const
Definition: compiler.cpp:5435
void replace_packages()
Definition: pkg.cpp:357
void parallel_compile(const std::vector< std::string > &files)
bool setting_value(const char *arg)
void RemoveFile(const std::string &fname)
Definition: fileutil.cpp:143
struct Pol::ECompile::Summary summary
long long ellapsed() const
Definition: timer.cpp:46
std::string name
Definition: osmod.cpp:943
#define ERROR_PRINT
Definition: logfacility.h:230
std::vector< std::string > PackageRoot
Definition: compilercfg.h:19
void push(const msg &msg)
simply fire and forget only the deconstructor ensures the msg to be finished
Definition: threadhelp.cpp:405
std::string normalized_dir_form(const std::string &istr)
Definition: fileutil.cpp:25
bool FileExists(const char *filename)
Definition: fileutil.cpp:118
bool show_timing_details
bool run(int argc, char **argv)
#define INFO_PRINT
Definition: logfacility.h:223
int write(const char *fname)
Definition: compiler.cpp:5425
Definition: berror.cpp:12
std::atomic< bool > exit_signalled
void Read(const std::string &path)
Definition: compilercfg.cpp:21
void load_packages(const std::string &basedir, bool quiet)
Definition: pkg.cpp:312
int compileFile(const char *fname)
Definition: compiler.cpp:5369