Skip to content
Snippets Groups Projects
Commit 7c8ec459 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

improve comments

parent 9d6011d1
No related branches found
No related tags found
No related merge requests found
...@@ -27,28 +27,31 @@ CPlot::CPlot( uint _iPlot, bool _logx, bool _logy ) : ...@@ -27,28 +27,31 @@ CPlot::CPlot( uint _iPlot, bool _logx, bool _logy ) :
iPlot( _iPlot ), X( _logx ), Y( _logy ), iPlot( _iPlot ), X( _logx ), Y( _logy ),
maxpoints(20000), with_errors(true), equipoints(7), refine(true) maxpoints(20000), with_errors(true), equipoints(7), refine(true)
{ {
// Start gnuplot. Use input redirection so that gnuplot receives // == Initialization for Gnuplot ==
// commands from a gp_fifo which is created here.
// Create a named pipe (FIFO) that will transmit our commands to Gnuplot.
string fn_fifo = string("/tmp/gnuplot-") + getenv( "LOGNAME" ); string fn_fifo = string("/tmp/gnuplot-") + getenv( "LOGNAME" );
mystd::system( "rm -f "+fn_fifo ); mystd::system( "rm -f "+fn_fifo );
if (mkfifo( fn_fifo.c_str(), 0666 )) if (mkfifo( fn_fifo.c_str(), 0666 ))
throw "SYSTEM ERROR cannot make fifo " + fn_fifo + throw "SYSTEM ERROR cannot make fifo " + fn_fifo +
": will not be able to print"; ": will not be able to print";
// Start a Gnuplot that will read from our pipe.
mystd::system( "gnuplot -title " + strg(iPlot) + " -noraise" + mystd::system( "gnuplot -title " + strg(iPlot) + " -noraise" +
" < " + fn_fifo + " &" ); " < " + fn_fifo + " &" );
// we use open instead of fopen or ofstream, // Open our pipe so that we can write commands to it
// 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 ) ) ) if ( ! ( gp_fifo = open( fn_fifo.c_str(), O_WRONLY ) ) )
throw "SYSTEM ERROR cannot open fifo " + fn_fifo + throw "SYSTEM ERROR cannot open fifo " + fn_fifo +
": will not be able to print"; ": will not be able to print";
fcntl( gp_fifo, F_SETFL, O_NONBLOCK ); fcntl( gp_fifo, F_SETFL, O_NONBLOCK );
// Now the initialization _within_ Gnuplot.
gp_write( string("set terminal x11") ); gp_write( string("set terminal x11") );
// == Initialization for PostScript ==
ps_fnum=0; ps_fnum=0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment