Index: sources/src/sc_main.cc
===================================================================
--- sources/src/sc_main.cc	(revision 42)
+++ sources/src/sc_main.cc	(revision 52)
@@ -54,44 +54,45 @@
 #endif
 
-//
+
 using namespace std;
 using namespace sc_core;
-//
-typedef list<sc_module* >         module_list_t;
-
-//
+
+typedef list<sc_module *> module_list_t;
+
+
 namespace sc_core {
 
-bool        check_port_dependencies = false;
+bool check_port_dependencies = false;
 #ifdef CONFIG_DEFAULT_RUNTIME_COMPILATION
-bool        dynamic_link_of_scheduling_code = true;
+bool dynamic_link_of_scheduling_code = true;
 #else
-bool        dynamic_link_of_scheduling_code = false;
-#endif
-bool        dump_netlist_info       = false;
-bool        dump_funclist_info      = false;
-bool        dump_stage              = false;
-bool        dump_all_graph          = false;
-const char* dump_module_hierarchy   = NULL;
-bool        edit_schedule           = false;
-bool        keep_generated_code     = false;
-bool        nobanner                = false;
-bool        noinitialization        = false;
-bool        nosimulation            = false;
-bool        notrace                 = false;
-bool        print_schedule          = false;
-bool        print_user_resources    = false;
-char*       save_on_exit            = NULL;
-int         scheduling_method       = NO_SCHEDULING;
-bool        use_sensitivity_list    = false;
-bool        use_port_dependency     = false;
+bool dynamic_link_of_scheduling_code = false;
+#endif
+bool dump_netlist_info    = false;
+bool dump_funclist_info   = false;
+bool dump_stage           = false;
+bool dump_all_graph       = false;
+const char * dump_module_hierarchy = NULL;
+bool edit_schedule        = false;
+bool keep_generated_code  = false;
+bool nobanner             = false;
+bool noinitialization     = false;
+bool nosimulation         = false;
+bool notrace              = false;
+bool print_schedule       = false;
+bool print_user_resources = false;
+char * save_on_exit       = NULL;
+int  scheduling_method    = NO_SCHEDULING;
+bool use_sensitivity_list = false;
+bool use_port_dependency  = false;
 
 #ifdef _OPENMP
-bool        use_openmp              = true;
+bool use_openmp = true;
 #else
-bool        use_openmp              = false;
-#endif
-
-const char *HELP_STRING = \
+bool use_openmp = false;
+#endif
+
+
+const char * HELP_STRING = \
 "\n"
 "--a\n"
@@ -169,204 +170,209 @@
 
 
-static
-void 
-print_splash_screen ()
-{
-  // Display once
-  if (nobanner == false)
-    cerr << get_splash_screen ();
-  nobanner = true;
+
+static void print_splash_screen() {
+    // Display once
+    if (nobanner == false) {
+        cerr << get_splash_screen ();
+    }
+    nobanner = true;
 }
 
-static
-void
-check_parameters ()
-{
-  if (dump_all_graph) {
-    if (use_port_dependency)
-      cerr << "SystemCASS will dump signal dependency graph.\n";
-    else
-      cerr << "SystemCASS will dump module dependency graph.\n";
-  }
-  if (!use_port_dependency && check_port_dependencies)
-    cerr << "Warning : unable to check port dependencies.\n";
-  if (!use_port_dependency)
-  {
-    use_sensitivity_list = true;
-    scheduling_method = CASS_SCHEDULING;
-  }
-  switch (scheduling_method) {
-  case CASS_SCHEDULING :
-    assert(use_port_dependency == false);
-    break;
-  case BUCHMANN_SCHEDULING :
-  case MOUCHARD_SCHEDULING :
+
+static void check_parameters() {
+    if (dump_all_graph) {
+        if (use_port_dependency) {
+            cerr << "SystemCASS will dump signal dependency graph.\n";
+        }
+        else {
+            cerr << "SystemCASS will dump module dependency graph.\n";
+        }
+    }
+    if (!use_port_dependency && check_port_dependencies) {
+        cerr << "Warning : unable to check port dependencies.\n";
+    }
     if (!use_port_dependency) {
-    cerr << "Error : "
-            "The choosen scheduling needs port dependencies informations\n";
-    exit (31);
-    }
-    break;
-  default :
-    cerr << "Error : You need to choose one of the available scheduling :\n"
-         << "- Almost static scheduling like CASS (use sensitivity list)\n"
-         << "- Simple static scheduling (use port dependencies)\n"
-         << "- Entirely static scheduling (use port dependencies)\n";
-    exit (33);
-  }
-  assert(use_port_dependency || use_sensitivity_list);
+        use_sensitivity_list = true;
+        scheduling_method = CASS_SCHEDULING;
+    }
+    switch (scheduling_method) {
+        case CASS_SCHEDULING :
+            assert(use_port_dependency == false);
+            break;
+        case BUCHMANN_SCHEDULING :
+        case MOUCHARD_SCHEDULING :
+            if (!use_port_dependency) {
+                cerr << "Error : "
+                    "The choosen scheduling needs port dependencies informations\n";
+                exit (31);
+            }
+            break;
+        default :
+            cerr << "Error : You need to choose one of the available scheduling :\n"
+                << "- Almost static scheduling like CASS (use sensitivity list)\n"
+                << "- Simple static scheduling (use port dependencies)\n"
+                << "- Entirely static scheduling (use port dependencies)\n";
+            exit (33);
+    }
+    assert(use_port_dependency || use_sensitivity_list);
 }
 
-void
-apply_parameters (int &argc, char ** &argv)
-{
+
+void apply_parameters(int & argc, char ** &argv) {
 #ifdef KEEP_GENERATED_CODE // supprimer scheduling-XXXXXX.cc
-  keep_generated_code = true;
+    keep_generated_code = true;
 #endif
 #ifdef DUMP_NETLIST_INFO
-  dump_netlist_info = true;
+    dump_netlist_info = true;
 #endif
 #ifdef DUMP_FUNCLIST_INFO
-  dump_funclist_info = true;
+    dump_funclist_info = true;
 #endif
 #ifdef DUMP_STAGE
-  dump_stage = true;
+    dump_stage = true;
 #endif
 #ifdef DUMP_COMBINATIONAL_LIST2DOT
-  dump_all_graph = true;
+    dump_all_graph = true;
 #endif
 #ifdef PRINT_SCHEDULE
-  print_schedule = true;
+    print_schedule = true;
 #endif    
 #ifdef USE_PORT_DEPENDENCY
-  use_port_dependency = true;
-#endif
-  // parse the command line
-  int i;
-  for (i = 1; i < argc; ++i)
-    {
-    if (argv[i][0] == '-')
-      {
-      if (argv[i][1] == '-')
-        {
-        switch (argv[i][2])
-          {
-          case 'h' : 
-            print_splash_screen ();
-            cerr << "Usage : " 
-                 << argv[0] << " [--c] [--edit] [--d] [--f] [--h] [--i] [--k] [--modules filename] [--nobanner] [--[no]dynamiclink] [--nosim] [--notrace] [--s] [--t] [--tracestart n] [--usage] [--v] [--p|m|a] [others parameters processed by sc_main]\n"
-                 << "Thoses options are processed by SystemCASS library. All the remaining options are passed to sc_main.\n"
-                 << "sc_main function retrieves last parameters.\n"
-                 << HELP_STRING;
-            noinitialization = true;
-            nosimulation = true;
-            continue;
-          case 'v' : 
-            print_splash_screen ();
-            cerr << get_used_options  () << "\n";
-            cerr << get_used_env () << "\n";
-            cerr << sc_version () << "\n\n";
-            exit (0);
-          case 'u' : 
-            if (strcmp (argv[i]+2, "usage") == 0)
-              print_user_resources = true;
-            else
-              break;
-            continue;
-          case 'i' :
-            dump_netlist_info = true;
-            continue;
-          case 'f' :
-            dump_funclist_info = true;
-            continue;
-          case 's' :
-            if (strcmp (argv[i]+2, "save_on_exit") == 0)
-              save_on_exit = argv[++i];
-            else
-              dump_stage = true;
-            continue;
-          case 'c' :
-            print_schedule = true;
-            continue;
-          case 'd' :
-            if (strcmp (argv[i]+2, "dynamiclink") == 0)
-              dynamic_link_of_scheduling_code = true;
-            else
-              check_port_dependencies = true;
-            continue;
-          case 'e' :
-            if (strcmp (argv[i]+2, "edit") == 0)
-              edit_schedule = true;
-            else
-              break;
-            continue;
-          case 'k' :
-            keep_generated_code = true;
-            continue;
-          case 't' :
-            if (strcmp (argv[i]+2, "tracestart") == 0) {
-              ++i;
-              istringstream iss (argv[i]);
-              iss >> trace_start;
-              trace_start <<= 1;
-//              trace_start = strtoll (argv[i],0,10) << 1;
-//              trace_start = atoll (argv[i]) << 1;
-            } else {
-              dump_all_graph = true;
+    use_port_dependency = true;
+#endif
+    // parse the command line
+    int i;
+    for (i = 1; i < argc; ++i) {
+        if (argv[i][0] == '-') {
+            if (argv[i][1] == '-') {
+                switch (argv[i][2]) {
+                    case 'h' : 
+                        print_splash_screen();
+                        cerr << "Usage : " 
+                            << argv[0] << " [--c] [--edit] [--d] [--f] [--h] [--i] [--k] [--modules filename] [--nobanner] [--[no]dynamiclink] [--nosim] [--notrace] [--s] [--t] [--tracestart n] [--usage] [--v] [--p|m|a] [others parameters processed by sc_main]\n"
+                            << "Thoses options are processed by SystemCASS library. All the remaining options are passed to sc_main.\n"
+                            << "sc_main function retrieves last parameters.\n"
+                            << HELP_STRING;
+                        noinitialization = true;
+                        nosimulation = true;
+                        continue;
+                    case 'v' : 
+                        print_splash_screen ();
+                        cerr << get_used_options  () << "\n";
+                        cerr << get_used_env () << "\n";
+                        cerr << sc_version () << "\n\n";
+                        exit (0);
+                    case 'u' : 
+                        if (strcmp (argv[i] + 2, "usage") == 0) {
+                            print_user_resources = true;
+                        }
+                        else {
+                            break;
+                        }
+                        continue;
+                    case 'i' :
+                        dump_netlist_info = true;
+                        continue;
+                    case 'f' :
+                        dump_funclist_info = true;
+                        continue;
+                    case 's' :
+                        if (strcmp (argv[i] + 2, "save_on_exit") == 0) {
+                            save_on_exit = argv[++i];
+                        }
+                        else {
+                            dump_stage = true;
+                        }
+
+                        continue;
+                    case 'c' :
+                        print_schedule = true;
+                        continue;
+                    case 'd' :
+                        if (strcmp (argv[i] + 2, "dynamiclink") == 0) {
+                            dynamic_link_of_scheduling_code = true;
+                        }
+                        else {
+                            check_port_dependencies = true;
+                        }
+                        continue;
+                    case 'e' :
+                        if (strcmp (argv[i] + 2, "edit") == 0) {
+                            edit_schedule = true;
+                        }
+                        else {
+                            break;
+                        }
+                        continue;
+                    case 'k' :
+                        keep_generated_code = true;
+                        continue;
+                    case 't' :
+                        if (strcmp (argv[i] + 2, "tracestart") == 0) {
+                            ++i;
+                            istringstream iss (argv[i]);
+                            iss >> trace_start;
+                            trace_start <<= 1;
+                            // trace_start = strtoll (argv[i],0,10) << 1;
+                            // trace_start = atoll (argv[i]) << 1;
+                        }
+                        else {
+                            dump_all_graph = true;
+                        }
+                        continue;
+                    case 'm' :
+                        if (strcmp (argv[i] + 2, "modules") == 0) {
+                            ++i;
+                            dump_module_hierarchy = argv[i];
+                            continue;
+                        }
+                        else if (strcmp (argv[i] + 2, "m") == 0) {
+                            use_port_dependency = true;
+                            scheduling_method = MOUCHARD_SCHEDULING;
+                            continue;
+                        }
+                        break;
+                    case 'n' :
+                        if (strcmp (argv[i] + 2, "nobanner") == 0) {
+                            nobanner = true;
+                        }
+                        else if (strcmp (argv[i] + 2, "nodynamiclink") == 0) {
+                            dynamic_link_of_scheduling_code = false;
+                        }
+                        else if (strcmp (argv[i] + 2, "nosim") == 0) {
+                            nosimulation = true;
+                        }
+                        else if (strcmp (argv[i] + 2, "notrace") == 0) {
+                            notrace = true;
+                        }
+                        else {
+                            break;
+                        }
+                        continue;
+                    case 'a' :
+                        use_sensitivity_list = true;
+                        scheduling_method = CASS_SCHEDULING;
+                        continue;
+                    case 'p' :
+                        use_port_dependency = true;
+                        scheduling_method = BUCHMANN_SCHEDULING;
+                        continue;
+                    default :
+                        break;
+                }
+                break;
             }
-            continue;
-          case 'm' :
-            if (strcmp (argv[i]+2, "modules") == 0) {
-              ++i;
-              dump_module_hierarchy = argv[i];
-              continue;
-            } else if (strcmp (argv[i]+2, "m") == 0) {
-              use_port_dependency = true;
-              scheduling_method = MOUCHARD_SCHEDULING;
-              continue;
-            }
-            break;
-          case 'n' :
-            if (strcmp (argv[i]+2, "nobanner") == 0) {
-              nobanner = true;
-            } else if (strcmp (argv[i]+2, "nodynamiclink") == 0) {
-              dynamic_link_of_scheduling_code = false;
-            } else if (strcmp (argv[i]+2, "nosim") == 0) {
-              nosimulation = true;
-            } else if (strcmp (argv[i]+2, "notrace") == 0) {
-              notrace = true;
-            } else
-              break;
-            continue;
-          case 'a' :
-            use_sensitivity_list = true;
-            scheduling_method = CASS_SCHEDULING;
-            continue;
-          case 'p' :
-            use_port_dependency = true;
-            scheduling_method = BUCHMANN_SCHEDULING;
-            continue;
-          default :
-            break;
-          }
+        } 
         break;
+    }
+
+    // erase SystemCASS options from the command line and give it to the sc_main
+    if (i != 1) {
+        int j = 1;
+        while (i < argc) {
+            argv[j++] = argv[i++];
         }
-      } 
-      break;
-    }
-  
-  // erase SystemCASS options from the command line and give it to the sc_main
-  if (i != 1)
-    {
-    int j = 1;
-    while (i < argc)
-      {
-      argv[j++] = argv[i++];
-      }
-    argc = j;
-    }
-#if 0
-  cerr << "The user command line length is " << argc << ".\n";
-#endif
+        argc = j;
+    }
 }
 
@@ -374,30 +380,37 @@
 } // end of namespace
 
+
 using namespace sc_core;
 
-int 
-main(int   argc, 
-     char* argv[])
-{
-  apply_parameters    (argc, argv);
-  print_splash_screen ();
-  check_parameters ();
-
-  if (noinitialization)
-  {
-    return 255;
-  }
-
-  int ret = sc_main(argc, argv);
-  free (pending_write_vector);
-  close_systemcass ();
-
-  if (have_to_stop)
-  {
-    cerr << "'sc_stop' function was called. Exit code : 1\n";
-    return 1;
-  }
-
-  return ret;
+int main(int argc, char * argv[]) {
+    apply_parameters(argc, argv);
+    print_splash_screen();
+    check_parameters();
+
+    if (noinitialization) {
+        return 255;
+    }
+
+    int ret = sc_main(argc, argv);
+    free(pending_write_vector);
+    close_systemcass();
+
+    if (have_to_stop) {
+        cerr << "'sc_stop' function was called. Exit code : 1\n";
+        return 1;
+    }
+
+    return ret;
 }
 
+/*
+# Local Variables:
+# tab-width: 4;
+# c-basic-offset: 4;
+# c-file-offsets:((innamespace . 0)(inline-open . 0));
+# indent-tabs-mode: nil;
+# End:
+#
+# vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
+*/
+
