class CAxis {
 public:
    double inf, sup;
    CCoord C;
    bool   logflag; // 'log' is reserved for math.h
    bool   force;

    CAxis( bool _log ) :
        logflag(_log), force(false) { setAuto(); };

    void Ask( string quest );
    void setLog( bool _log );
    double pc(double v) const;

    void setAuto();
    void setLimits( string axnam, double _inf, double _sup );
    void setRoundedLimits( string axnam, double _inf, double _sup );
    void set_from_string( string text );

    string str() const;
    string info() const;
    bool finite() const;
    bool contains( double val ) const;
    double value2plotcoord( double v ) const;
    double plotcoord2value( double c ) const;
    double inf_pos() const;
};


#define CPLOT_PSMAX 10
#define CPLOT_LINSIZ 80

class CPlot {
 public:
    uint iPlot;
    CAxis X, Y;
    uint maxpoints;

    CPlot( uint _iPlot, bool _logx, bool _logy );

    void clearFrame();
    void plotFrame();
    void plotScan( bool as_line, int style_no,
                   const vector<double>& xp,
                   const vector<double>& yp, const vector<double>& dyp,
                   const vector<double>& z,
                   string xco, string yco, string info );
    void plotDoclines( const vector<string>& lDoc );
    void writePostscript( bool full_outfile );
    void setAux( string cmd );
    void feedGnuplot();
    string info() const;

private: // can we move this to the .cpp file ?
    int gp_fifo;
    void gp_write( string );
    int gp_fno;
    string gp_fnames;

    uint ps_fnum; // file
    uint ps_snum; // scan
    uint ps_pnum; // scan with pstyle
    uint ps_cnum; // scan with cstyle
    void ps_ticktack( uint ntack, double *tack, int ntpt, double *ticklim,
                      CAxis *A );
    vector<string> ps_Doc;
    vector<string> ps_accu; // future output is accumulated here
    char outlin[ CPLOT_LINSIZ ];
};