Re: I tried to send this to guppi-list...




On Tue, 20 Jul 1999, James Heald wrote:
> 
> I tried (twice) to send this to guppi-list, but I have been
> watching the web page at www.gnome.org/mailing-lists and
> it seems never to have arrived...
>

You probably need to be subscribed from the address you use to post; if
you don't want to do that, try subscribing to post-only@redhat.com and it
will then let your mail through.

I'll quote your message entirely so people know what's going on.
 
> This might be naive (I am new to C++), but anyway:
> 
> If you have an existing application written in C, how easily can you
> get Guppi to access the app's data in place ?  (ie without duplicating
> the data and doubling the memory required).
> 
> 
> As a concrete example, how easy would it be to take the existing
> interpreter level of gnuplot, and then use Guppi to display and
> interactively edit the resulting plots ?  I could then leave all
> my existing code unchanged where it talks to gnuplot, but make
> any style changes interactively in guppi, rather than having to
> edit them in by hand using xfig.
>

That sounds pretty hard. I think it would be a major pain. :-)
 
> The simplest way to make this hybrid would seem to be to let the
> existing gnuplot code in 'plot2d.c' parse its command line, load
> data, evaluate functions, calculate smoothed curves; but then to
> ambush gnuplot when it ships the results to do_plot() in the
> graphics layer 'graphics.c', and instead let guppi know where
> to access the data.
> 
> The results are passed as a linked list of the curves to be 
> plotted, using structures defined in 'plot.h': 
> 
>    struct curve_points{
>      struct curve_points *next_cp;  
>                                 /* ptr to next curve in list */
>      coordinate *points;        /* ptr to data for this curve */
>      int p_max;                 /* no of points allocated */
>      int p_count;               /* no of points actually used */
>      ...
>    }
>    
> *points points to a block of p_max units of co-ordinate data: 
> 
>    struct coordinate{
>      enum coord_type type;
>      double x,y,z;              /* the point */
>      double ylow, yhigh;        /* errorbars - y */
>      double xlow, xhigh;        /* errorbars - x */
>    }
>    
> with
> 
>    enum coord_type{
>      INRANGE                    /* inside plot boundary */
>      OUTRANGE                   /* outside plot boundary */
>      UNDEFINED                  /*  eg divided by zero */
>    }
> 
> Various other information -- eg ranges for axes, positioning
> of the key etc -- is also passed in global variables.
> 
> 
> Q.: How easy would it be to write a new do_plot() which fed these
> structures directly to guppi ?
> 
> i)   What would be the best way to wrap STL <vector> functionality
> around the curve_points block of memory ?  Could it be inherited
> or would it all need to be written explicitly ?
> 
> Would it still be possible to use the existing gnuplot cp_extend()
> routine if the block ever needs to be enlarged ?  (cp_extend does
> things like jettisoning the gnuplot help system if it starts
> running out of memory).
> 
> ii)  Would it be simple to map the datagroup object onto struct
> coordinate ? (BTW Gnuplot might be representing dates in the
> doubles, as seconds from the year 2000)
> 
> iii)  How would one then register the data with guppi, and launch
> a plot window ?
> 

I'm not familiar with the Gnuplot internals. Some ideas:

 - maybe you can use Gnuplot code to add equivalent functionality 
   to Guppi, depending on the latest Gnuplot license (must be GPL),
   then drop Gnuplot entirely

 - You could write a Gnuplot emulator for Guppi, in either C or Guile; 
   that might be a nice approach

 - You could use Guppi as a plot backend for Gnuplot, this is more or 
   less what you're describing, but you aren't going to be able to get
   Guppi to then modify the Gnuplot data structures

Any way you go, you'll have to become familiar with the Guppi code and be
prepared to extend it as needed - and once you do that, you'll be able to
answer the questions you're asking much better than I can, since I don't
know how Gnuplot works.

You might want to check out guppi-internals.texi in the Guppi 'doc'
directory to get started learning how Guppi works.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]