|
From: <lan...@qw...> - 2006-07-05 21:18:15
|
On Jul 3, 2006, at 2:55 AM, lan...@qw... wrote:
> Hi list,
>
> Sorry to bother with such a trivial question that should properly be
> asked elsewhere, but maybe you'll humor me.
>
> I'm making some serious progress as a spare-time project in making
> Ada bindings for PLplot, and some of the examples are working well.
> Here's my dumb C question: If there is a C procedure such as
>
> void plfoo(PLFLT *bar);
>
> how does one tell if the parameter is intended to be a pointer to an
> array of PLFLT or whether it is simply a scalar (single number) PLFLT
> that is being passed by reference? Am I missing something here? Will
> I have to consult the API reference for each function to discover
> what is intended if it's not obvious otherwise?
>
> Jerry (aka C idiot)
Thanks to everyone for their suggestions. I'm finding the Modula-3
bindings very helpful, and I'll take a look at the FORTRAN bindings--
I've found a handy FORTRAN-to-Ada converter that worked pretty well
for converting some of the examples to Ada--maybe I should have
applied it to the bindings themselves. I also found a c2ada converter
that looks very polished but unfortunately needs a bit of updating in
order to work correctly. I looked at the SWIG approach but decided
that for this rather smallish job, given Ada's relatively
friendliness with C, and given that learning about SWIG was still
another layer of stuff I didn't know (added to C and Ada itself),
that a more direct approach would work OK. I've used a few regex
lines applied to plplot.h to great advantage. About the only thing
puzzling me now is what in the heck is this:
typedef struct {
char *opt;
int (*handler) (char *, char *, void *); <<<<<<< ?
void *client_data; <<<<<<< ?
void *var; <<<<<<< ?
long mode;
char *syntax;
char *desc;
} PLOptionTable;
Jerry
|