Pol  Revision:f37d500
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 use threaded compilation\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':
485  break;
486 
487  default:
488  unknown_opt = true;
489  break;
490  }
491  }
492 
493  if ( unknown_opt )
494  {
495  ERROR_PRINT << "Unknown option: " << argv[i] << "\n";
496  return 1;
497  }
498  }
499  return 0;
500 }
501 
508 void recurse_compile( const std::string& basedir, std::vector<std::string>* files )
509 {
510  int s_compiled, s_uptodate, s_errors;
511  clock_t start, finish;
512 
513  if ( !Clib::IsDirectory( basedir.c_str() ) )
514  return;
515 
516  s_compiled = s_uptodate = s_errors = 0;
517  start = clock();
518  for ( Clib::DirList dl( basedir.c_str() ); !dl.at_end(); dl.next() )
519  {
520  if ( Clib::exit_signalled )
521  return;
522  std::string name = dl.name(), ext;
523  if ( name[0] == '.' )
524  continue;
525 
526  std::string::size_type pos = name.rfind( '.' );
527  if ( pos != std::string::npos )
528  ext = name.substr( pos );
529 
530  try
531  {
532  if ( pos != std::string::npos &&
533  ( !ext.compare( ".src" ) || !ext.compare( ".hsr" ) ||
534  ( compilercfg.CompileAspPages && !ext.compare( ".asp" ) ) ) )
535  {
536  s_compiled++;
537  if ( files == nullptr )
538  {
539  if ( compile_file( ( basedir + name ).c_str() ) )
540  {
542  }
543  else
544  {
545  ++s_uptodate;
547  }
548  }
549  else
550  files->push_back( ( basedir + name ) );
551  }
552  else
553  {
554  recurse_compile( basedir + name + "/", files );
555  }
556  }
557  catch ( std::exception& )
558  {
561  if ( !keep_building )
562  throw;
563  s_errors++;
564  }
565  }
566  if ( files == nullptr )
567  return;
568  finish = clock();
569 
570  if ( ( !quiet || timing_quiet_override ) && show_timing_details && s_compiled > 0 &&
571  files == nullptr )
572  {
573  INFO_PRINT << "Compiled " << s_compiled << " script" << ( s_compiled == 1 ? "" : "s" ) << " in "
574  << basedir << " in " << (int)( ( finish - start ) / CLOCKS_PER_SEC )
575  << " second(s)\n";
576  if ( s_uptodate > 0 )
577  INFO_PRINT << " " << s_uptodate << " script" << ( s_uptodate == 1 ? " was" : "s were" )
578  << " already up-to-date.\n";
579  if ( s_errors > 0 )
580  INFO_PRINT << " " << s_errors << " script" << ( s_errors == 1 ? "" : "s" )
581  << " had errors.\n";
582  }
583 }
584 void recurse_compile_inc( const std::string& basedir, std::vector<std::string>* files )
585 {
586  for ( Clib::DirList dl( basedir.c_str() ); !dl.at_end(); dl.next() )
587  {
588  if ( Clib::exit_signalled )
589  return;
590  std::string name = dl.name(), ext;
591  if ( name[0] == '.' )
592  continue;
593 
594  std::string::size_type pos = name.rfind( '.' );
595  if ( pos != std::string::npos )
596  ext = name.substr( pos );
597 
598  if ( pos != std::string::npos && !ext.compare( ".inc" ) )
599  {
600  if ( files == nullptr )
601  compile_file( ( basedir + name ).c_str() );
602  else
603  files->push_back( ( basedir + name ) );
604  }
605  else
606  {
607  recurse_compile( basedir + name + "/", files );
608  }
609  }
610 }
611 
612 void parallel_compile( const std::vector<std::string>& files )
613 {
614  std::atomic<unsigned> compiled_scripts( 0 );
615  std::atomic<unsigned> uptodate_scripts( 0 );
616  std::atomic<unsigned> error_scripts( 0 );
617  std::atomic<bool> par_keep_building( true );
618  {
619  unsigned int thread_count = std::max( 2u, std::thread::hardware_concurrency() * 2 );
620  threadhelp::TaskThreadPool pool( thread_count, "ecompile" );
621  summary.ThreadCount = pool.size();
622  for ( const auto& file : files )
623  {
624  pool.push( [&]() {
625 
626  if ( !par_keep_building || Clib::exit_signalled )
627  return;
628  try
629  {
630  if ( compile_file( file.c_str() ) )
631  ++compiled_scripts;
632  else
633  ++uptodate_scripts;
634  }
635  catch ( std::exception& e )
636  {
637  ++compiled_scripts;
638  ++error_scripts;
639  ERROR_PRINT << "failed to compile " << file.c_str() << ": " << e.what() << "\n";
640  if ( !keep_building )
641  {
642  par_keep_building = false;
643  }
644  }
645  catch ( ... )
646  {
647  par_keep_building = false;
649  }
650  } );
651  }
652  }
653  summary.CompiledScripts = compiled_scripts;
654  summary.UpToDateScripts = uptodate_scripts;
655  summary.ScriptsWithCompileErrors = error_scripts;
656 }
657 
658 
663 {
667  {
668  std::vector<std::string> files;
670  for ( const auto& pkg : Plib::systemstate.packages )
671  {
672  recurse_compile( Clib::normalized_dir_form( pkg->dir() ), &files );
673  }
674  parallel_compile( files );
675  }
676  else
677  {
679  for ( const auto& pkg : Plib::systemstate.packages )
680  {
681  recurse_compile( Clib::normalized_dir_form( pkg->dir() ), nullptr );
682  }
683  }
685 }
686 
690 bool run( int argc, char** argv )
691 {
693  // Load and analyze the package structure
694  for ( const auto& elem : compilercfg.PackageRoot )
695  {
696  Plib::load_packages( elem, true /* quiet */ );
697  }
700 
701  // Determine the run mode and do the compile itself
702  Tools::Timer<> timer;
703  bool any = false;
704 
705  for ( int i = 1; i < argc; i++ )
706  {
707 #ifdef __linux__
708  if ( argv[i][0] == '-' )
709 #else
710  if ( argv[i][0] == '/' || argv[i][0] == '-' )
711 #endif
712  {
713  // -r[i] [<dir>]
714  if ( argv[i][1] == 'A' )
715  {
716  compilercfg.UpdateOnlyOnAutoCompile = ( argv[i][2] == 'u' );
717  any = true;
718 
719  AutoCompile();
720  }
721  else if ( argv[i][1] == 'r' )
722  {
723  any = true;
724  std::string dir( "." );
725  bool compile_inc = ( argv[i][2] == 'i' ); // compile .inc files
726 
727  ++i;
728  if ( i < argc && argv[i] && argv[i][0] != '-' )
729  dir.assign( argv[i] );
730 
732  {
733  std::vector<std::string> files;
734  if ( compile_inc )
736  else
737  recurse_compile( Clib::normalized_dir_form( dir ), &files );
738  parallel_compile( files );
739  }
740  else
741  {
742  if ( compile_inc )
744  else
745  recurse_compile( Clib::normalized_dir_form( dir ), nullptr );
746  }
747  }
748  else if ( argv[i][1] == 'C' )
749  {
750  ++i; // skip the config file pathname
751  }
752  // and skip any other option.
753  }
754  else
755  {
756  any = true;
757 #ifdef _WIN32
759 #else
760  compile_file_wrapper( argv[i] );
761 #endif
762  }
763  }
764 
765  if ( !any && compilercfg.AutoCompileByDefault )
766  {
767  any = true;
768  AutoCompile();
769  }
770 
771  // Execution is completed: start final/cleanup tasks
772  timer.stop();
773 
775 
776  if ( any && compilercfg.DisplaySummary && !quiet )
777  {
778  fmt::Writer tmp;
779  tmp << "Compilation Summary:\n";
780  if ( summary.ThreadCount )
781  tmp << " Used " << summary.ThreadCount << " threads\n";
782  if ( summary.CompiledScripts )
783  tmp << " Compiled " << summary.CompiledScripts << " script"
784  << ( summary.CompiledScripts == 1 ? "" : "s" ) << " in " << timer.ellapsed() << " ms.\n";
785 
787  tmp << " " << summary.ScriptsWithCompileErrors << " of those script"
788  << ( summary.ScriptsWithCompileErrors == 1 ? "" : "s" ) << " had errors.\n";
789 
790  if ( summary.UpToDateScripts )
791  tmp << " " << summary.UpToDateScripts << " script"
792  << ( summary.UpToDateScripts == 1 ? " was" : "s were" ) << " already up-to-date.\n";
793  INFO_PRINT << tmp.str();
794  }
795 
796  return any;
797 }
798 
799 void read_config_file( int argc, char* argv[] )
800 {
801  for ( int i = 1; i < argc; i++ )
802  {
803  if ( argv[i][0] == '/' || argv[i][0] == '-' )
804  {
805  // -C cfgpath
806  if ( argv[i][1] == 'C' )
807  {
808  ++i;
809  if ( i == argc )
810  throw std::runtime_error( "-C specified without pathname" );
811 
812  compilercfg.Read( std::string( argv[i] ) );
813  return;
814  }
815  }
816  }
817 
818  // check ECOMPILE_CFG_PATH environment variable
819  const char* env_ecompile_cfg_path = getenv( "ECOMPILE_CFG_PATH" );
820  if ( env_ecompile_cfg_path != nullptr )
821  {
822  compilercfg.Read( std::string( env_ecompile_cfg_path ) );
823  return;
824  }
825 
826  // no -C arg, so use binary path (hope it's right..sigh.)
827  std::string cfgpath = PROG_CONFIG::programDir() + "ecompile.cfg";
828  if ( Clib::FileExists( "ecompile.cfg" ) )
829  {
830  compilercfg.Read( "ecompile.cfg" );
831  }
832  else if ( Clib::FileExists( cfgpath ) )
833  {
834  compilercfg.Read( cfgpath );
835  }
836  else
837  {
838  ERROR_PRINT << "Could not find " << cfgpath << "; using defaults.\n";
840  }
841 }
842 
847 {
848  const std::vector<std::string>& binArgs = programArgs();
849 
850  /**********************************************
851  * show help
852  **********************************************/
853  if ( binArgs.size() == 1 )
854  {
855  showHelp();
856  return 0; // return "okay"
857  }
858 
859 /**********************************************
860  * TODO: rework the following cruft from former uotool.cpp
861  **********************************************/
862 #ifdef _WIN32
864 #endif
865 
866  ECompile::read_config_file( s_argc, s_argv );
867 
868  int res = ECompile::readargs( s_argc, s_argv );
869  if ( res )
870  return res;
871 
872  if ( !ECompile::quiet )
873  {
874  // vX.YY
875  double vernum = (double)1 + (double)( ESCRIPT_FILE_VER_CURRENT / 100.0f );
876  ERROR_PRINT << "EScript Compiler v" << vernum << "\n" << POL_COPYRIGHT << "\n\n";
877  }
878 
880  {
882  return 0;
883  }
884 
885  bool didanything = ECompile::run( s_argc, s_argv );
886 
887  if ( !didanything )
888  {
889  showHelp();
890  return 1;
891  }
892  else
893  {
894  return 0;
895  }
896 }
897 }
898 } // namespaces
899 
903 
904 int main( int argc, char* argv[] )
905 {
906  Pol::ECompile::s_argc = argc;
907  Pol::ECompile::s_argv = argv;
908 
910  ECompileMain->start( argc, argv );
911 }
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:925
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