From 787399b8b35732767300937bca4a260e77ae10e6 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Thu, 18 Dec 2014 13:04:17 +0100
Subject: [PATCH] SOme hand-tuning, starting to use 100 columns somewhat more.

---
 pub/lib/axis.hpp     |  5 ++--
 pub/lib/coord.cpp    |  6 ++---
 pub/lib/dualplot.cpp | 20 ++++++---------
 pub/lib/edif.cpp     |  5 ++--
 pub/lib/fit.cpp      |  5 ++--
 pub/lib/func.cpp     | 14 ++++-------
 pub/lib/node.cpp     | 58 ++++++++++++++++++++++----------------------
 pub/lib/olf.cpp      |  5 ++--
 pub/lib/opr.hpp      |  3 ++-
 pub/lib/slice.cpp    |  7 +++---
 10 files changed, 57 insertions(+), 71 deletions(-)

diff --git a/pub/lib/axis.hpp b/pub/lib/axis.hpp
index 25ec6501..df2de2fd 100644
--- a/pub/lib/axis.hpp
+++ b/pub/lib/axis.hpp
@@ -37,6 +37,5 @@ class CAxis {
     void set_xgrid( vector<double>& x, int n ) const;
     double pc( double v ) const;
     double pcerr( double v, double dv ) const;
-    void calc_ticks( vector<double>& Tacks, int *ntpt, double *ticklim )
-        const;
-};
\ No newline at end of file
+    void calc_ticks( vector<double>& Tacks, int *ntpt, double *ticklim ) const;
+};
diff --git a/pub/lib/coord.cpp b/pub/lib/coord.cpp
index a263ca3b..00d4b582 100644
--- a/pub/lib/coord.cpp
+++ b/pub/lib/coord.cpp
@@ -18,7 +18,7 @@ using namespace std;
 #include "coord.hpp"
 
 //**************************************************************************************************
-//*  class CCoord                                                            //
+//*  class CCoord
 //**************************************************************************************************
 
 //! Constructor parsing "name (unit)", where unit may be empty.
@@ -154,10 +154,10 @@ string CCoord::load_a01(string in)
 }
 
 //**************************************************************************************************
-//*  outside CCoord                                                          //
+//*  outside CCoord
 //**************************************************************************************************
 
 ostream& operator<< (ostream &s, CCoord C)
 {
     return s << C.str_std();
-}
\ No newline at end of file
+}
diff --git a/pub/lib/dualplot.cpp b/pub/lib/dualplot.cpp
index e3fe3550..897f83d6 100644
--- a/pub/lib/dualplot.cpp
+++ b/pub/lib/dualplot.cpp
@@ -38,19 +38,15 @@ CPlot::CPlot( int _iPlot, bool _logx, bool _logy ) :
     string fn_fifo = string("/tmp/gnuplot-") + getenv( "LOGNAME" );
     triv::system( "rm -f "+fn_fifo );
     if (mkfifo( fn_fifo.c_str(), 0666 ))
-        throw "SYSTEM ERROR cannot make fifo " + fn_fifo +
-            ": will not be able to print";
+        throw "SYSTEM ERROR cannot make fifo "+fn_fifo+": will not be able to print";
 
     // Start a Gnuplot that will read from our pipe.
-    triv::system( "gnuplot -title " + S(iPlot) + " -noraise" +
-                  " < " + fn_fifo + " &" );
+    triv::system( "gnuplot -title "+S(iPlot)+" -noraise < "+fn_fifo+"&" );
 
     // Open our pipe so that we can write commands to it
-    //   (we use 'open' instead of 'fopen' or 'ofstream',
-    //    because we need non-blocking mode).
+    //   (we use 'open' instead of 'fopen' or 'ofstream', because we need non-blocking mode).
     if ( ( gp_fifo = open( fn_fifo.c_str(), O_WRONLY ) )==-1 )
-        throw "SYSTEM ERROR: cannot open fifo " + fn_fifo +
-            " (" + strerror(errno) + ")";
+        throw "SYSTEM ERROR: cannot open fifo "+fn_fifo+" ("+strerror(errno)+")";
     fcntl( gp_fifo, F_SETFL, O_NONBLOCK );
 
     // Now the initialization _within_ Gnuplot.
@@ -326,8 +322,7 @@ void CPlot::writePostscript( const string& ps_outdir,
         if (ps_fnum>=999)
             throw "graph file number overflow";
         outf = triv::wordexp_unique( 
-            ps_outdir + str( format( "l%d" ) % ++ps_fnum ) + "." +
-            ( ps_dict=="" ? "psa" : "ps" ) );
+            ps_outdir + str( format( "l%d" ) % ++ps_fnum ) + "." + ( ps_dict=="" ? "psa" : "ps" ) );
         if( !triv::file_exists( outf.c_str() ) )
             break; // legal exit
     }
@@ -400,8 +395,7 @@ void CPlot::ps_ticktack( const vector<double>& Tacks, int ntpt,
             for (i=0; i<ntack; i++) {
                 snprintf( outlin, mLin,
                           "   %9.6f {(10)(%d)sp()} %%{(%g)}\n", 
-                          A->pc(Tacks[i]), (int)(log10(Tacks[i])),
-                          (float) Tacks[i]);
+                          A->pc(Tacks[i]), (int)(log10(Tacks[i])), (float) Tacks[i]);
                 ps_accu.push_back( outlin );
             }
         } else {
@@ -439,4 +433,4 @@ void NPloWin::initialize()
     Plots.push_back( new class CPlot( nPlot++, false, true ) );
     Plots.push_back( new class CPlot( nPlot++, true,  true ) );
     iPlot = 0; // current plot window
-}
\ No newline at end of file
+}
diff --git a/pub/lib/edif.cpp b/pub/lib/edif.cpp
index 28c9425c..78a695b3 100644
--- a/pub/lib/edif.cpp
+++ b/pub/lib/edif.cpp
@@ -242,8 +242,7 @@ void NEdif::editCoord( string which )
     if ( multifile && in=="f" ) {
         while ( fin = fiter() ) {
             old_co = fin->coord( &var );
-            in = sask( "Coordinate "+which+" for file "+S(fiter.k())+
-                      ": name(unit)",
+            in = sask( "Coordinate "+which+" for file "+S(fiter.k())+": name(unit)",
                        old_co.str_compact() );
             CCoord new_co(in);
             fin->lDoc.push_back( "ec"+string(which)+" "+new_co.str_compact()+
@@ -327,4 +326,4 @@ void NEdif::delNumpar()
             throw "file " + S( fiter.k() ) + " has no numpar n" + S(iN);
         f->RPar.erase( f->RPar.begin()+iN );
     }
-}
\ No newline at end of file
+}
diff --git a/pub/lib/fit.cpp b/pub/lib/fit.cpp
index ccf0ace4..94777da6 100644
--- a/pub/lib/fit.cpp
+++ b/pub/lib/fit.cpp
@@ -247,8 +247,7 @@ void NCurveFit::fit( bool _allow_slow_conv )
                 data.timeout = time(NULL) + omp_get_num_threads()*maxtime;
 
                 lm_status_struct status;
-                lmmin( npfree, &(Par[0]), nd, &data,
-                       fitEvaluate, &control, &status );
+                lmmin( npfree, &(Par[0]), nd, &data, fitEvaluate, &control, &status );
 
                 if( status.outcome==11 )
                     throw "exception in fit function";
@@ -289,4 +288,4 @@ void NCurveFit::fit( bool _allow_slow_conv )
             } // try
         } // j
     } // k
-}
\ No newline at end of file
+}
diff --git a/pub/lib/func.cpp b/pub/lib/func.cpp
index d71c0673..17b5eb9d 100644
--- a/pub/lib/func.cpp
+++ b/pub/lib/func.cpp
@@ -33,8 +33,7 @@ static triv::RandomNumberGenerator *rng = NULL;
 
 double func_not(double v) { return !v; }
 double func_neg(double v) { return -v; }
-void deri_neg(double& r, double& dr, double v, double dv)
-{ r=-v; dr=dv; }
+void deri_neg(double& r, double& dr, double v, double dv) { r=-v; dr=dv; }
 
 double func_ln(double v) { return v>0 ? log(v) : 0; }
 void deri_ln(double& r, double& dr, double v, double dv)
@@ -49,8 +48,7 @@ void deri_sqrt(double& r, double& dr, double v, double dv)
 { if(v>0) { r=sqrt(v); dr=dv/2/r; } else { r=0; dr=0; } } 
 
 double func_abs(double v) { return fabs(v); }
-void deri_abs(double& r, double& dr, double v, double dv)
-{ r=fabs(v); dr=dv; }
+void deri_abs(double& r, double& dr, double v, double dv) { r=fabs(v); dr=dv; }
 
 double func_sign(double v) {
     if      ( v<0 )
@@ -60,12 +58,10 @@ double func_sign(double v) {
     else
         return 0;
 }
-void deri_sign(double& r, double& dr, double v, double dv)
-{ r=func_sign(v); dr=dv; }
+void deri_sign(double& r, double& dr, double v, double dv) { r=func_sign(v); dr=dv; }
 
 double func_exp(double v) { return exp(v); }
-void deri_exp(double& r, double& dr, double v, double dv)
-{ r=exp(v); dr=dv*r; }
+void deri_exp(double& r, double& dr, double v, double dv) { r=exp(v); dr=dv*r; }
 
 double func_sin(double v) { return sin(v); }
 double func_cos(double v) { return cos(v); }
@@ -615,4 +611,4 @@ void NFunctions::initialize(void)
         ))->register_me();
     (new CFunc3( "rotdiff", func_rotdiff, 0, 0,
            "(w,tau,qb: rotational diffusion spectrum)"))->register_me();
-}
\ No newline at end of file
+}
diff --git a/pub/lib/node.cpp b/pub/lib/node.cpp
index 987bda0e..397cc69f 100644
--- a/pub/lib/node.cpp
+++ b/pub/lib/node.cpp
@@ -1,8 +1,8 @@
-//******************************************************************************
+//**************************************************************************************************
 //* FRIDA: fast reliable interactive data analysis            
 //* (C) Joachim Wuttke 1990-, v2(C++) 2001-                   
 //* http://apps.jcns.fz-juelich.de/frida                      
-//******************************************************************************
+//**************************************************************************************************
 
 //! \file  node.cpp
 //! \brief Nodes within expression trees, inheriting from virtual base CNode.
@@ -29,9 +29,9 @@ extern bool allow_slow_conv; // set in curve.cpp
 #define DEBUG 0
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeFun: function/operator node                          
-//******************************************************************************
+//**************************************************************************************************
 
 CNodeFun::CNodeFun( const class CFunc* _fun, PNode _a0 )
     : fun(_fun), narg(1)
@@ -220,9 +220,9 @@ string CNodeFun::tree_info() const
 }
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeGeni: generalized integral node                          
-//******************************************************************************
+//**************************************************************************************************
 
 
 CNodeGeni::CNodeGeni( const class CGeni *_geni, PRef _ref )
@@ -347,9 +347,9 @@ string CNodeGeni::tree_info() const
 }
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeCvin: curve functional node                          
-//******************************************************************************
+//**************************************************************************************************
 
 
 CNodeCvin::CNodeCvin(
@@ -452,9 +452,9 @@ string CNodeCvin::tree_info() const
 }
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeVal: end node containing a numeric value             
-//******************************************************************************
+//**************************************************************************************************
 
 CNodeVal::CNodeVal( double _val )
     : val( _val ) {}
@@ -464,9 +464,9 @@ void CNodeVal::set_coord( CCoord& ret, int k ) const {
 string CNodeVal::tree_info() const { return "val[" + S(val) + "]"; }
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeIva: indexed variable node                           
-//******************************************************************************
+//**************************************************************************************************
 
 void CNodeIva::npar_exec( int *np ) const
 {
@@ -735,9 +735,9 @@ string CNodeIva::tree_info() const
 }
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeRgr: register reference node                         
-//******************************************************************************
+//**************************************************************************************************
 
 CNodeRgr::CNodeRgr( PRgr& _rgr )
     : rgr( _rgr ) {}
@@ -748,16 +748,16 @@ void CNodeRgr::set_coord( CCoord& ret, int k ) const {
     ret = CCoord( "$", "" ); } // primitiver gehts nicht
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeDummy: function argument (t) node                    
-//******************************************************************************
+//**************************************************************************************************
 
 // .. nothing to do ..
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeCev: curve evaluation node                           
-//******************************************************************************
+//**************************************************************************************************
 
 CNodeCev::CNodeCev( PRef& _ref, PNode _arg )
     : ref( _ref ), arg( _arg )
@@ -804,9 +804,9 @@ void CNodeCev::set_coord( CCoord& ret, int k ) const {
     ret = CCoord( "c", "" ); } // primitiver gehts nicht
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeMixin: Base class for mixing in data from a "convolution" file
-//******************************************************************************
+//**************************************************************************************************
 
 void CNodeMixin::tree_val( CResult& ret, const CContext& ctx ) const
 {
@@ -843,9 +843,9 @@ void CNodeMixin::tree_val( CResult& ret, const CContext& ctx ) const
 }
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeConvBase: Base class for convoluting a function with a spectrum.
-//******************************************************************************
+//**************************************************************************************************
 
 void CNodeConvBase::kdep_exec( bool *kd ) const
 {
@@ -860,9 +860,9 @@ void CNodeConvBase::npar_exec( int *np ) const
 }
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeConv: convoluted function node                       
-//******************************************************************************
+//**************************************************************************************************
 
 void CNodeConv::copy_theory( CResult& ret, const CContext& ctx,
                              double theshift ) const
@@ -944,9 +944,9 @@ void CNodeConv::convolve( CResult& ret, const CContext& ctx,
 }
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodePConv: convolution with primitive                    
-//******************************************************************************
+//**************************************************************************************************
 
 void CNodePConv::copy_theory( CResult& ret, const CContext& ctx,
                               double theshift ) const
@@ -1037,9 +1037,9 @@ void CNodePConv::convolve( CResult& ret, const CContext& ctx,
 }
 
 
-//******************************************************************************
+//**************************************************************************************************
 //* CNodeDirac: node that copies the resolution function      
-//******************************************************************************
+//**************************************************************************************************
 
 void CNodeDirac::kdep_exec( bool *kd ) const
 {
@@ -1097,4 +1097,4 @@ void CNodeDirac::copy_theory( CResult& ret, const CContext& ctx,
 void CNodeDirac::set_coord( CCoord& ret, int k ) const
 {
     ret = CCoord("resol", "");
-}
\ No newline at end of file
+}
diff --git a/pub/lib/olf.cpp b/pub/lib/olf.cpp
index cd64e254..a7c9d1c3 100644
--- a/pub/lib/olf.cpp
+++ b/pub/lib/olf.cpp
@@ -527,8 +527,7 @@ void COlc::curve_val_vec( vector<double>* v, vector<double>* dv,
 
 //! Dito, scalar version, to obtain isolated points.
 
-void COlc::curve_val_sca( double *r, double *dr,
-                          double farg, int k, int j ) const
+void COlc::curve_val_sca( double *r, double *dr, double farg, int k, int j ) const
 {
     vector<double> vt(1, farg), v(1);
     if( dr ){
@@ -618,4 +617,4 @@ string COlc::weight_str() const
         return "with reciprocal variance (data only)";
     }
     throw "BUG: unexpected weight";
-}
\ No newline at end of file
+}
diff --git a/pub/lib/opr.hpp b/pub/lib/opr.hpp
index 55e06215..46c4dc2a 100644
--- a/pub/lib/opr.hpp
+++ b/pub/lib/opr.hpp
@@ -7,6 +7,7 @@
 //! \file  opr.hpp
 //! \brief NOperate: functional operations.
 
+
 //! Functional operations.
 
 namespace NOperate {
@@ -16,4 +17,4 @@ namespace NOperate {
     void Integral();
     void IntXY( string mode );
     void Functional( const string& subcmd );
-}
\ No newline at end of file
+}
diff --git a/pub/lib/slice.cpp b/pub/lib/slice.cpp
index 69edcd37..db9ee522 100644
--- a/pub/lib/slice.cpp
+++ b/pub/lib/slice.cpp
@@ -177,9 +177,8 @@ void CSpec::intpol( const vector<double>& xx,
  scales_differ:
     
     if( xx[0]<x[0] || xx[nn-1]>x[n-1] )
-        throw "interpolation to " + S(xx[0]) + " .. " + S(xx[nn-1]) +
-            " required, while available data only cover " + S(x[0]) +
-            " .. " + S(x[n-1]);
+        throw "interpolation to "+S(xx[0])+" .. "+S(xx[nn-1])+
+            " required, while available data only cover "+S(x[0])+" .. "+S(x[n-1]);
 
     int ii = 0, i = 0;
     while ( i<n-1 && xx[ii]<x[n-1] ) {
@@ -315,4 +314,4 @@ string CCurve::infoLine() const
     snprintf( wrd, LEN, "%-10.5g", 1-fitR2 );
     out += wrd;
     return out;
-}
\ No newline at end of file
+}
-- 
GitLab