Description: upstream fixes for the interpreter log machinery
 The beginning of the main function is slightly reorganized in
 such a way that whenever the interpreter 3dldf is lauched with
 the options --help and --version no log file is created.
Origin: debian
Author: Jerome Benoit <calculus@rezozer.net>
Last-Update: 2014-05-25

--- a/src/main.web
+++ b/src/main.web
@@ -965,11 +965,22 @@
   using namespace Projections;
   using namespace Scan_Parse;
 
+  stringstream cerr_strm;
 
 #if DEBUG_COMPILE
   bool DEBUG = false; /* |true| */ @;
 #endif /* |DEBUG_COMPILE|  */@; 
 
+#if DEBUG_COMPILE
+  if (DEBUG)
+    {
+      cerr_strm << "Entering `main()'.";
+      log_message(cerr_strm);
+      cerr_message(cerr_strm);
+      cerr_strm.str("");
+    }
+#endif /* |DEBUG_COMPILE|  */@;
+
   string thread_name = "";
 
 #ifdef HAVE_PTHREAD_H  
@@ -981,25 +992,10 @@
   Thread_Info_Type::thread_ctr = 1;
   Thread_Info_Type::mutex.unlock();
 
-  Thread_Info_Type* thread_info = Thread_Info_Type::get_thread_info(true);
-  thread_name = Thread_Info_Type::get_thread_name(thread_info);
-
 #endif /* |HAVE_PTHREAD_H|  */@; 
 
   bool error_stop_value = (run_state_initial.error_stop_mode == Run_State::STOPPING)
                     ? true : false;
-  
-  stringstream cerr_strm;
-  
-#if DEBUG_COMPILE
-  if (DEBUG)
-    {
-      cerr_strm << thread_name << "Entering `main()'.";
-      log_message(cerr_strm);
-      cerr_message(cerr_strm); 
-      cerr_strm.str(""); 
-    }
-#endif /* |DEBUG_COMPILE|  */@; 
 
   filename_array_ctr = 0;
 
@@ -1009,14 +1005,30 @@
 
 #endif 
 
-  /* !! START HERE.  LDF 2004.09.22.  Try to figure out how to work
-     non-interactively.  */@; 
-
   bool bison_trace = false;
 
+  /* !! START HERE.  LDF 2004.09.22.  Try to figure out how to work
+     non-interactively.  */@;
 
   @<Process command line options@>;
 
+#ifdef HAVE_PTHREAD_H
+
+  Thread_Info_Type* thread_info = Thread_Info_Type::get_thread_info(true);
+  thread_name = Thread_Info_Type::get_thread_name(thread_info);
+
+#endif /* |HAVE_PTHREAD_H|  */@;
+
+#if DEBUG_COMPILE
+  if (DEBUG)
+    {
+      cerr_strm << "Thread Name: " << thread_name;
+      log_message(cerr_strm);
+      cerr_message(cerr_strm);
+      cerr_strm.str("");
+    }
+#endif /* |DEBUG_COMPILE|  */@;
+
 #if DEBUG_COMPILE
   if (DEBUG)
     {
