summaryrefslogtreecommitdiff
path: root/lib/lib.pl
diff options
context:
space:
mode:
authorMartin Baulig <martin@home-of-linux.org>1999-10-24 20:04:37 +0000
committerMartin Baulig <martin@src.gnome.org>1999-10-24 20:04:37 +0000
commit507f171b631f7b469d6f77f3837ea3e742e74b13 (patch)
treecf6ebe1f758a622854c6187572678f9cfa470521 /lib/lib.pl
parent1dadfb6d15d2b71366f907c5449db82d0a576e81 (diff)
downloadlibgtop-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-xlib/lib.pl37
1 files changed, 27 insertions, 10 deletions
diff --git a/lib/lib.pl b/lib/lib.pl
index c854ab9f..18776f94 100755
--- a/lib/lib.pl
+++ b/lib/lib.pl
@@ -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 {";