diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-07-12 16:32:47 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-07-14 10:20:58 +0100 |
commit | 98757e151ae8ad8d334f028690abcc85b91c73e5 (patch) | |
tree | d2b174ebd13f5664f3ea485636a908f0445a426b /java/examples/guestfs-java.pod | |
parent | 9eb606045627ff5fdc30eea011c67eb30b7655fa (diff) | |
download | libguestfs-98757e151ae8ad8d334f028690abcc85b91c73e5.tar.gz libguestfs-98757e151ae8ad8d334f028690abcc85b91c73e5.tar.xz libguestfs-98757e151ae8ad8d334f028690abcc85b91c73e5.zip |
generator: Allow non-optargs functions to gain optargs.
This commit adds a flag (once_had_no_optargs) which can be used to add
optargs to functions that currently don't have any.
The idea is that if 'func' currently has no optargs, we can safely add
optargs provided we are backwards compatible for existing callers.
In C that means we leave 'guestfs_func' alone and provide an extra
function 'guestfs_func_opts' that takes the optargs ('guestfs_func'
becomes a wrapper that calls 'guestfs_func_opts').
In the C generator this means there are two names for each function
(although the two names are normally identical). 'c_name' is the name
that we export publicly (eg. [guestfs_] 'func_opts'). 'name' is the
internal name of the function (eg. 'func') which is used for
everything apart from the public interface, and also to generate the
no-optargs compat function.
In other languages that can add optional arguments safely, we simply
add the arguments to the existing 'func', so for example in Perl:
$g->func (required_args)
$g->func (required_args, optional_args)
can be used.
Note that this commit does not cause any change to the output of the
generator. I verified this by diffing the output before and after.
Diffstat (limited to 'java/examples/guestfs-java.pod')
0 files changed, 0 insertions, 0 deletions