diff options
author | Martin Baulig <martin@home-of-linux.org> | 1999-10-24 20:04:37 +0000 |
---|---|---|
committer | Martin Baulig <martin@src.gnome.org> | 1999-10-24 20:04:37 +0000 |
commit | 507f171b631f7b469d6f77f3837ea3e742e74b13 (patch) | |
tree | cf6ebe1f758a622854c6187572678f9cfa470521 /lib/lib.pl | |
parent | 1dadfb6d15d2b71366f907c5449db82d0a576e81 (diff) | |
download | libgtop-507f171b631f7b469d6f77f3837ea3e742e74b13.tar.gz |
Use `retval' for the default retval.
1999-10-24 Martin Baulig <martin@home-of-linux.org>
* features.def: Use `retval' for the default retval.
* include/glibtop/command.h (glibtop_command_h): Added
`int *retval_ptr' parameter to return the retval from the
sysdeps functions.
Diffstat (limited to 'lib/lib.pl')
-rwxr-xr-x | lib/lib.pl | 37 |
1 files changed, 27 insertions, 10 deletions
@@ -68,6 +68,7 @@ $convert{'long'} = 'int64_t'; $convert{'ulong'} = 'u_int64_t'; $convert{'pid_t'} = 'pid_t'; $convert{'int'} = 'int'; +$convert{'retval'} = 'int'; $convert{'ushort'} = 'unsigned short'; $convert{'unsigned'} = 'unsigned'; @@ -91,16 +92,31 @@ sub output { $space = $feature; $space =~ s/./ /g; - print $retval; - if ($retval !~ /^void$/) { - $prefix = 'retval = '; - $prefix_space = ' '; + if ($retval eq 'retval') { + $retval_param = '&retval'; + $call_prefix = ''; + $call_prefix_space = ''; + $prefix = 'retval = '; + $prefix_space = ' '; + $retval = 'int'; + } + elsif ($retval !~ /^void$/) { + $retval_param = 'NULL'; + $prefix = 'retval = '; + $prefix_space = ' '; + $call_prefix = 'retval = '; + $call_prefix_space = ' '; } else { - $prefix = ''; - $prefix_space = ''; + $retval_param = 'NULL'; + $call_prefix = ''; + $call_prefix_space = ''; + $prefix = ''; + $prefix_space = ''; } + print $retval; + if ($param_def eq 'string') { $call_param = ', ' . $line_fields[5]; $param_decl = ",\n " . $space . ' const char *' . @@ -185,13 +201,14 @@ sub output { &toupper($feature) . ')))'; print "\t{"; - print "\t\t" . $prefix . 'glibtop_call_l (server, GLIBTOP_CMND_' . + print "\t\t" . $call_prefix . 'glibtop_call_l (server, GLIBTOP_CMND_' . &toupper($feature) . ','; - print "\t\t\t\t" . $prefix_space . 'send_size, send_ptr,'; - print "\t\t\t\t" . $prefix_space . 'sizeof (glibtop_' . $feature . + print "\t\t\t\t" . $call_prefix_space . 'send_size, send_ptr,'; + print "\t\t\t\t" . $call_prefix_space . 'sizeof (glibtop_' . $feature . - '), buf);'; + '), buf,'; + print "\t\t\t\t" . $call_prefix_space . $retval_param . ');'; print "\t} else {"; |