octave-maintainers
[Top][All Lists]
Advanced

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

Re: general c++ question


From: John W. Eaton
Subject: Re: general c++ question
Date: Fri, 31 Aug 2007 13:04:43 -0400

On 29-Aug-2007, John W. Eaton wrote:

| On 29-Aug-2007, Shai Ayal wrote:
| 
| | This way you will loose the easiness of having them automatically
| | generated in the macro. But it is better and more consistent.
| 
| Many of them do not force any other action.  They are simply of the
| form
| 
|   PROP = val;
| 
| so they can be generated by the macro.  Of course we will need a
| separate macro that does not generate the set_PROP function.  Let me
| take a look at doing at least one or two classes this way.

After spending some time on this, I think we need something more than
the C preprocessor to do the job.  I'm working on a patch that will
move graphics.h to graphics.h.in and then use an AWK or Perl script to
generate graphics.h.  The properties declarations in the graphics.h.in
file will be something like

    BEGIN_PROPERTIES
      graphics_handle currentfigure S
      octave_value visible
    END_PROPERTIES

The properties will be specified with

  TYPE PROPNAME FLAGS

The optional FLAGS field can be some combination of characters that
tell the script whether to declare the field "mutable", emit a
definition and/or declaration for the set_PROPNAME and get_PROPNAME
functions, etc.  The script will only generate the simple ones
automatically (the ones for which the body of the function is just
"PROPNAME = val;" or "return PROPNAME;"). The others will have to be
written by hand.  With this approach, I think we can also
automatically generate the set and get functions that work with the
names of the fields.  There are a few more details to work out, but I
think I can have something checked in by next week.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]