class CRange {
 public:
    double inf, sup;

    CRange();
    CRange( double infin, double supin );

    void set_from_string( const string& text );

    bool finite() const;
    bool contained(double val) const;
    double value2plotcoord( int logflag, double v ) const;
    double plotcoord2value( int logflag, double c ) const;
    double inf_pos(void) const;

    void Round(int logflag, double relmargin, double digits);

    string str(void) const;
};


class CAxis {
 public:
    CRange R;
    CRange AlternateR; // obsoleted by multi-CPlot
    CCoord C;
    bool   log;
    bool   force;

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

    void Ask( const string& quest );
    void SetLog( const bool _log );
    string info();

    double pc(double v) const;
};


#define CPLOT_PSMAX 10
#define CPLOT_LINSIZ 80

class CPlot { // additional declarations in dualplot.cpp
 public:
    uint iPlot;
    CAxis X, Y;
    uint maxpoints;

    CPlot( uint _iPlot, bool _logx, bool _logy ) : 
        iPlot( _iPlot ), maxpoints(12000), X( _logx ), Y( _logy )
        { Open(); };

    void Multiask();

    void Open();
    void Close();
    void Clear();
    void Box();
    void Line( const bool as_line, const int style_no,
               const vector<double> x, const vector<double> y,
               const vector<double>* z,
               const string xco, const string yco,
               const string info );
    void Doc (vector<string> lDoc);
    void Save( bool full_outfile );
    void Dialog();
    string info();

 private:
    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 ];
};