[Pkg-electronics-commits] [gnucap] 01/04: trace-1: io_trace uses std::cerr, not fprintf

felix salfelder felix-guest at moszumanska.debian.org
Thu Aug 11 12:33:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository gnucap.

commit 2022ad2d77363fb244528cb3d9a6506dcc163798
Author: al davis <ad211 at freeelectron.net>
Date:   Thu Aug 11 02:33:00 2016 -0400

    trace-1:  io_trace uses std::cerr, not fprintf
---
 include/io_trace.h | 135 +++++++++++++++++++++++++++++++++++++++++------------
 include/patchlev.h |   2 +-
 2 files changed, 105 insertions(+), 32 deletions(-)

diff --git a/include/io_trace.h b/include/io_trace.h
index 08ab91b..c70c19d 100644
--- a/include/io_trace.h
+++ b/include/io_trace.h
@@ -1,6 +1,7 @@
-/*$Id: io_trace.h,v 26.81 2008/05/27 05:34:00 al Exp $ -*- C++ -*-
- * Copyright (C) 2001 Albert Davis
- * Author: Albert Davis <aldavis at gnu.org>
+/*$Id: io_trace.h 2016.08.11 $ -*- C++ -*-
+ * Copyright (C) 2001 Albert Davis,
+ *               2015,16 Felix Salfelder
+ * Author: Albert Davis <aldavis at gnu.org>, Felix Salfelder
  *
  * This file is part of "Gnucap", the Gnu Circuit Analysis Package
  *
@@ -22,63 +23,135 @@
  * trace macros for model debugging
  */
 //testing=trivial 2006.07.17
+#include <iostream>
+
 /* allow multiple inclusions with different DO_TRACE */
 #undef trace_line
+#undef trace
 #undef trace0
 #undef trace1
 #undef trace2
 #undef trace3
 #undef trace4
 #undef trace5
+#undef trace6
+#undef trace7
+#undef trace8
 #undef untested
 #undef itested
 #undef unreachable
 #undef incomplete
 /*--------------------------------------------------------------------------*/
 #ifdef DO_TRACE
-#define trace_line() (printf("@@#\n@#@:%s:%u:%s\n", \
-			   __FILE__, __LINE__, __func__))
-#define trace0(s) (printf("@#@%s\n", s))
-#define trace1(s,x) (printf("@#@%s  %s=%g\n", s, #x, (double)(x)))
-#define trace2(s,x,y) (printf("@#@%s  %s=%g  %s=%g\n",\
-	s, #x, (double)(x), #y, (double)(y)))
-#define trace3(s,x,y,z) (printf("@#@%s  %s=%g  %s=%g  %s=%g\n",\
-	s, #x, (double)(x), #y, (double)(y), #z, (double)(z)))
-#define trace4(s,w,x,y,z)(printf("@#@%s  %s=%g  %s=%g  %s=%g  %s=%g\n",\
-	s, #w, (double)(w), #x, (double)(x), #y, (double)(y), #z, (double)(z)))
-#define trace5(s,v,w,x,y,z)\
-	(printf("@#@%s  %s=%g  %s=%g  %s=%g  %s=%g  %s=%g\n",\
-	s, #v, (double)(v), #w, (double)(w), #x, (double)(x),\
-	#y, (double)(y), #z, (double)(z)))
+
+#define trace_line() (std::cerr << "@@#\n@#@:" \
+              << __FILE__ << ":" << __LINE__ << ":" << __func__ << "\n" )
+#define trace0(s) ( std::cerr << "@#@" << (s) << "\n")
+#define trace1(s,x) ( \
+	   std::cerr <<  "@#@" << (s) << "  " << #x << "=" << (x)  \
+		     << endl )
+#define trace2(s,x,y) ( \
+	   std::cerr <<  "@#@" << (s) << "  " << #x << "=" << (x)  \
+		     << "  " << #y << "=" << (y)  \
+		     << endl )
+#define trace3(s,x,y,z) ( \
+	   std::cerr <<  "@#@" << (s) << "  " << #x << "=" << (x)  \
+		     << "  " << #y << "=" << (y)  \
+		     << "  " << #z << "=" << (z)  \
+		     << endl )
+#define trace4(s,w,x,y,z) ( \
+	   std::cerr <<  "@#@" << (s) << "  " << #w << "=" << (w)  \
+		     << "  " << #x << "=" << (x)  \
+		     << "  " << #y << "=" << (y)  \
+		     << "  " << #z << "=" << (z)  \
+		     << endl )
+#define trace5(s,v,w,x,y,z) ( \
+	   std::cerr <<  "@#@" << (s) << "  " << #v << "=" << (v)  \
+		     << "  " << #w << "=" << (w)  \
+		     << "  " << #x << "=" << (x)  \
+		     << "  " << #y << "=" << (y)  \
+		     << "  " << #z << "=" << (z)  \
+		     << endl )
+#define trace6(s,u,v,w,x,y,z) ( \
+	   std::cerr <<  "@#@" << (s) \
+		     << "  " << #u << "=" << (u)  \
+		     << "  " << #v << "=" << (v)  \
+		     << "  " << #w << "=" << (w)  \
+		     << "  " << #x << "=" << (x)  \
+		     << "  " << #y << "=" << (y)  \
+		     << "  " << #z << "=" << (z)  \
+		     << endl )
+#define trace7(s,t,u,v,w,x,y,z) ( \
+           std::cerr <<  "@#@" << (s)  \
+		     << "  " << #t << "=" << (t)  \
+		     << "  " << #u << "=" << (u)  \
+		     << "  " << #v << "=" << (v)  \
+		     << "  " << #w << "=" << (w)  \
+		     << "  " << #x << "=" << (x)  \
+		     << "  " << #y << "=" << (y)  \
+		     << "  " << #z << "=" << (z)  \
+		     << endl )
+#define trace8(s,r,t,u,v,w,x,y,z) ( \
+		std::cerr <<  "@#@" << (s)  \
+		     << "  " << #r << "=" << (r)  \
+		     << "  " << #t << "=" << (t)  \
+		     << "  " << #u << "=" << (u)  \
+		     << "  " << #v << "=" << (v)  \
+		     << "  " << #w << "=" << (w)  \
+		     << "  " << #x << "=" << (x)  \
+		     << "  " << #y << "=" << (y)  \
+		     << "  " << #z << "=" << (z)  \
+		     << endl )
 #else
+#define USE(x) (1)?(void)(0):(void)(x)
 #define trace_line()
-#define trace0(s)
-#define trace1(s,x)
-#define trace2(s,x,y)
-#define trace3(s,x,y,z)
-#define trace4(s,w,x,y,z)
-#define trace5(s,v,w,x,y,z)
+#define trace0(s) USE(s)
+#define trace1(s,x) (USE(s),USE(x))
+#define trace2(s,x,y) USE(s);USE(x);USE(y)
+#define trace3(s,x,y,z) USE(s);USE(x);USE(y);USE(z)
+#define trace4(s,w,x,y,z) USE(s);USE(w);USE(x);USE(y);USE(z)
+#define trace5(s,v,w,x,y,z) USE(s);USE(v);USE(w);USE(x);USE(y);USE(z)
+#define trace6(s,u,v,w,x,y,z) USE(s);USE(u);USE(v);USE(w);USE(x);USE(y);USE(z)
+#define trace7(s,t,u,v,w,x,y,z) USE(s);USE(t);USE(u);USE(v);USE(w);USE(x);USE(y);USE(z)
+#define trace8(r,s,t,u,v,w,x,y,z) USE(r);USE(s);USE(t);USE(u);USE(v);USE(w);USE(x);USE(y);USE(z)
 #endif
 
-#define unreachable() (fprintf(stderr,"@@#\n@@@unreachable:%s:%u:%s\n", \
-			   __FILE__, __LINE__, __func__))
+#define unreachable() ( \
+    std::cerr << "@@#\n@@@\nunreachable:" \
+              << __FILE__ << ":" << __LINE__ << ":" << __func__ << "\n" )
 
-#define incomplete() (fprintf(stderr,"@@#\n@@@incomplete:%s:%u:%s\n", \
-			   __FILE__, __LINE__, __func__))
+#define incomplete() ( \
+    std::cerr << "@@#\n@@@\nincomplete:" \
+              << __FILE__ << ":" << __LINE__ << ":" << __func__ << "\n" )
 
 #ifdef TRACE_UNTESTED
-#define untested() (fprintf(stderr,"@@#\n@@@:%s:%u:%s\n", \
-			   __FILE__, __LINE__, __func__))
+#define untested() ( std::cerr <<  "@@#\n@@@:"<< __FILE__ << ":"<< __LINE__ \
+          <<":" << __func__ << "\n" )
+#define untested1(s,x) ( std::cerr <<  "@@#\n@@@:"<< __FILE__ << ":"<< __LINE__ \
+          <<":" << __func__ << ": "  << s << "  " << #x << "=" << (x) << "\n" )
+#define untested2(s,x,y) ( std::cerr <<  "@@#\n@@@:"<< __FILE__ << ":"<< __LINE__ \
+            <<":" << __func__ << ": "  << s << "  " << #x << "=" << (x) << ", "\
+                                                    << #y << "=" << (y) << "\n" )
+#define untested3(s,x,y,z) ( std::cerr <<  "@@#\n@@@:"<< __FILE__ << ":"<< __LINE__ \
+              <<":" << __func__ << ": "  << s << "  " << #x << "=" << (x) << ", "\
+                                                      << #y << "=" << (y) << ", " \
+                                                      << #z << "=" << (z) << "\n" )
 #else
 #define untested()
+#define untested1(s,x)
+#define untested2(s,x,y)
+#define untested3(s,x,y,z)
 #endif
 
 #ifdef TRACE_ITESTED
-#define itested() (fprintf(stderr,"@@#\n@@@:%s:%u:%s\n", \
-			   __FILE__, __LINE__, __func__))
+#define itested() ( std::cerr << "@@#\n@@@:" \
+     << __FILE__ << ":" << __LINE__ << ":" << __func__ << "\n" )
 #else
 #define itested()
 #endif
+
+
+/*--------------------------------------------------------------------------*/
 /*--------------------------------------------------------------------------*/
 /*--------------------------------------------------------------------------*/
 // vim:ts=8:sw=2:noet:
diff --git a/include/patchlev.h b/include/patchlev.h
index 15ca1a1..8210f43 100644
--- a/include/patchlev.h
+++ b/include/patchlev.h
@@ -1 +1 @@
-#define PATCHLEVEL "gnucap-conf-5 2016.08.02"
+#define PATCHLEVEL "traces-1 2016.08.11"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-electronics/gnucap.git



More information about the Pkg-electronics-commits mailing list