1- static const char * _pln_VERSION_STR = " pln0363 " ;
1+ static const char * _pln_VERSION_STR = " pln0364 " ;
22
33#include " RS/rsEnv.h"
44#include " util/pln_log.h"
@@ -470,16 +470,20 @@ static void deal_help(const rsOpts& opts) {
470470static void deal_units (const rsOpts& opts) {
471471#ifdef PLN_UNIT_TEST_ON
472472 using namespace tes ;
473- if (opts.unit1_ ) tes::run_U1 ();
474- if (opts.unit2_ ) tes::run_U2 ();
475- if (opts.unit3_ ) tes::run_U3 ();
476- if (opts.unit4_ ) tes::run_U4 ();
477- if (opts.unit5_ ) tes::run_U5 ();
478- if (opts.unit6_ ) tes::run_U6 ();
479- if (opts.unit7_ ) tes::run_U7 ();
473+ if (opts.units_ [ 1 ] ) tes::run_U1 ();
474+ if (opts.units_ [ 2 ] ) tes::run_U2 ();
475+ if (opts.units_ [ 3 ] ) tes::run_U3 ();
476+ if (opts.units_ [ 4 ] ) tes::run_U4 ();
477+ if (opts.units_ [ 5 ] ) tes::run_U5 ();
478+ if (opts.units_ [ 6 ] ) tes::run_U6 ();
479+ if (opts.units_ [ 7 ] ) tes::run_U7 ();
480480#endif
481481}
482482
483+ static bool deal_shell (const rsOpts& opts) {
484+ return true ;
485+ }
486+
483487} // NS pln
484488
485489int main (int argc, char ** argv) {
@@ -503,13 +507,14 @@ int main(int argc, char** argv) {
503507 if (opts.trace_specified ())
504508 set_ltrace (opts.trace_ );
505509
506- if (opts.trace_ >= 8 or ltrace () >= 9 or ::getenv (" pln_trace_env" )) {
510+ uint16_t tr = ltrace ();
511+ if (opts.trace_ >= 8 or tr >= 9 or ::getenv (" pln_trace_env" )) {
507512 s_env.dump (" \n ----env----\n " );
508513 lout () << " -----------" << endl;
509514 }
510515
511516 if (opts.ver_or_help ()) {
512- if (ltrace () >= 2 ) {
517+ if (tr >= 2 ) {
513518 printf (" \t %s\n " , _pln_VERSION_STR);
514519 printf (" \t compiled: %s\n " , s_env.compTimeCS ());
515520 }
@@ -518,12 +523,12 @@ int main(int argc, char** argv) {
518523 std::quick_exit (0 );
519524 }
520525
521- if (ltrace () >= 2 ) {
526+ if (tr >= 2 ) {
522527 lprintf (" \t %s\n " , _pln_VERSION_STR);
523528 lprintf (" \t compiled: %s\n " , s_env.compTimeCS ());
524529 }
525- if (ltrace () >= 4 ) {
526- lprintf (" ltrace() = %u cmd.argc= %i\n " , ltrace () , argc);
530+ if (tr >= 4 ) {
531+ lprintf (" ltrace= %u cmd.argc= %i\n " , tr , argc);
527532 }
528533
529534 if (opts.unit_specified ()) {
@@ -552,21 +557,21 @@ int main(int argc, char** argv) {
552557 if (opts.is_fun_cmd ()) {
553558 ok = deal_cmd (opts);
554559 if (ok) {
555- if (ltrace () >= 2 ) lputs (" deal_cmd() succeeded." );
560+ if (tr >= 2 ) lputs (" deal_cmd() succeeded." );
556561 status = 0 ;
557562 } else {
558- if (ltrace () >= 2 ) lputs (" deal_cmd() failed." );
563+ if (tr >= 2 ) lputs (" deal_cmd() failed." );
559564 }
560565 goto ret;
561566 }
562567
563568 if (opts.is_fun_pinc () or opts.is_arg0_pinc () or opts.is_implicit_pinc ()) {
564569 ok = deal_pinc (opts, true );
565570 if (ok) {
566- if (ltrace () >= 2 ) lputs (" deal_pinc() succeeded." );
571+ if (tr >= 2 ) lputs (" deal_pinc() succeeded." );
567572 status = 0 ;
568573 } else {
569- if (ltrace () >= 2 ) lputs (" deal_pinc() failed." );
574+ if (tr >= 2 ) lputs (" deal_pinc() failed." );
570575 }
571576 goto ret;
572577 }
@@ -575,7 +580,7 @@ int main(int argc, char** argv) {
575580 lputs (" ======== PARTITION MODE specified ========" );
576581 ok = validate_partition_opts (opts);
577582 if (!ok) {
578- if (ltrace () >= 4 ) lputs (" validate_partition_opts() failed." );
583+ if (tr >= 4 ) lputs (" validate_partition_opts() failed." );
579584 status = 2 ;
580585 goto ret;
581586 }
@@ -584,25 +589,43 @@ int main(int argc, char** argv) {
584589 if (opts.is_fun_partition () or opts.is_fun_pack ()) {
585590 ok = deal_vpr (opts, true );
586591 if (ok) {
587- if (ltrace () >= 2 ) lputs (" deal_vpr() succeeded." );
592+ if (tr >= 2 ) lputs (" deal_vpr() succeeded." );
588593 status = 0 ;
589594 } else {
590- if (ltrace () >= 2 ) lputs (" deal_vpr() failed." );
595+ if (tr >= 2 ) lputs (" deal_vpr() failed." );
596+ }
597+ goto ret;
598+ }
599+
600+ if (opts.is_fun_shell ()) {
601+ lputs (" ======== SHELL MODE specified ========" );
602+ ok = true ; // validate_shell_opts(opts);
603+ if (!ok) {
604+ if (tr >= 4 ) lputs (" validate_shell_opts() failed." );
605+ status = 2 ;
606+ goto ret;
607+ }
608+ ok = deal_shell (opts);
609+ if (ok) {
610+ if (tr >= 2 ) lputs (" deal_shell() succeeded." );
611+ status = 0 ;
612+ } else {
613+ if (tr >= 2 ) lputs (" deal_shell() failed." );
591614 }
592615 goto ret;
593616 }
594617
595618 // default function is stars
596619 ok = deal_stars (opts, true );
597620 if (ok) {
598- if (ltrace () >= 2 ) lputs (" deal_stars() succeeded." );
621+ if (tr >= 2 ) lputs (" deal_stars() succeeded." );
599622 status = 0 ;
600623 } else {
601- if (ltrace () >= 2 ) lputs (" deal_stars() failed." );
624+ if (tr >= 2 ) lputs (" deal_stars() failed." );
602625 }
603626
604627ret:
605- if (ltrace () >= 4 )
628+ if (tr >= 4 )
606629 lprintf (" (planner main status) %i\n " , status);
607630 pln::flush_out (true );
608631 return status;
0 commit comments