Re: New Shapeset -- What Will I Need To Do...?



Le Tue, Sep 03, 2002, à 01:15:23PM -0400, Tim Ellis a écrit:

Mainly, where I'm getting confused is ideology. I know we're using C which
doesn't know Object Orientation (heh), but I see a lot of OOP concepts.
lib/object.h seems to define some... uh... pointers? Or pointer
replacements...? This kind'f thing:

Well, dia is written in AHOOC  (Ad-Hoc Object Oriented C) (I made this up)

Basically, we pretend we think in a neanderthalian dialect of C++ and
translate on the fly into C.

(what, not confused enough ? ;-) )
 
typedef Object* (*CreateFunc) (Point *startpoint,
                               void *user_data,
                               Handle **handle1,
                               Handle **handle2);

And then in chrono*.c, we relate an object's events to one of these,
right...? 

static ObjectOps chronoline_ops = {
  (DestroyFunc)         chronoline_destroy,
  (DrawFunc)            chronoline_draw,
  (DistanceFunc)        chronoline_distance_from,
  (SelectFunc)          chronoline_select,
 . . . .

(This chronoline_ops thing doesn't use CreateFunc???)

CreateFunc is a member of an ObjectTypeOps structure.

Think of the contents of chronoline_ops as the virtual method table for
class "ChronoLine", and each of the chronoline_XXX() functions as virtual
methods for that type.

Over the time, the dia object API evolved, and some methods which used to be
reimplemented in each object are now replaced with common helpers (which use
newer methods). Hence, the methods beginning in object_XXXXXX() in the
individual classes ObjectOps records.

So how should I begin? Should I just take the chrono*.c files and begin
modifying them to create an ERD shapeset? I assume I *WILL* be coding C
and not making little XML files, right?

for sentence in above_paragraph:
    reply(sentence,"Indeed")

(well, there *are* things you'd certainly not want to carry over to ERD --
in particular the string parsing to list of events stuff).

Obviously since I've only spent 20 minutes familiarising myself with
StdProp so far, I don't know much. I guess I'm looking for a good starting
point. Esp code that actually uses it currently (like chrono*.c) but which
is uses every feature -- does chrono*.c do?

chrono* uses most. 

        -- Cyrille

-- 



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