From 4a2fb0a871964b3f3bfe77c4974d25fd8313f5b3 Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Sun, 5 Dec 1999 14:07:20 +0000 Subject: [PATCH] Use `array()' as return value for functions returning an array of 1999-12-05 Martin Baulig * features.def: Use `array()' as return value for functions returning an array of structures. --- ChangeLog | 5 +++++ features.def | 6 +++--- lib/lib.pl | 4 ++++ sysdeps/guile/guile.pl | 10 +++++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45eb809e..31b978e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +1999-12-05 Martin Baulig + + * features.def: Use `array()' as return value for functions + returning an array of structures. + 1999-12-05 Martin Baulig * includes/glibtop/interfaces.h (glibtop_get_interface_names): diff --git a/features.def b/features.def index e47bb601..63ea3419 100644 --- a/features.def +++ b/features.def @@ -15,10 +15,10 @@ retval|proc_signal|ulong(signal[2],blocked[2],sigignore[2],sigcatch[2])|pid_t(pi retval|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):str(wchan)|pid_t(pid) retval|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_data,end_data,start_brk,end_brk,start_stack,start_mmap,arg_start,arg_end,env_start,env_end)|pid_t(pid) char *|proc_args|ulong(size)|pid_t(pid):unsigned(max_len) -glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid) -glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs) +array(glibtop_map_entry)|proc_map|ulong(number,size,total)|pid_t(pid) +array(glibtop_mountentry)|@mountlist|ulong(number,size,total)|int(all_fs) retval|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string(mount_dir) -glibtop_interface *|interface_names|ulong(size)|ulong(interface,number,instance,strategy) +array(glibtop_interface)|interface_names|ulong(size)|ulong(interface,number,instance,strategy) retval|netinfo|ulong(if_flags,transport,mtu,subnet,address)|string(interface):unsigned(transport) retval|netload|ulong(packets_in,packets_out,packets_total,bytes_in,bytes_out,bytes_total,errors_in,errors_out,errors_total,collisions)|string(interface):unsigned(transport,protocol) retval|ppp|ulong(state,bytes_in,bytes_out)|ushort(device) diff --git a/lib/lib.pl b/lib/lib.pl index e8e90653..a12979c2 100755 --- a/lib/lib.pl +++ b/lib/lib.pl @@ -112,6 +112,10 @@ sub output { $prefix_space = ''; } + if ($retval =~ /^array\((.*)\)$/) { + $retval = "$1 *"; + } + $check_server_code = "\n"; $check_server_code .= "\t/* If neccessary, we ask the server for the requested\n" . diff --git a/sysdeps/guile/guile.pl b/sysdeps/guile/guile.pl index ee6c4d75..e7e62961 100644 --- a/sysdeps/guile/guile.pl +++ b/sysdeps/guile/guile.pl @@ -203,8 +203,16 @@ sub make_output { $func_decl_code = sprintf (qq[static SCM\nglibtop_guile_get_%s (SCM server_smob%s)], $feature, $param_decl); + if ($retval =~ /^array\((.*)\)$/) { + $retval_type = "$1 *"; + $retval_name = $1; + } else { + $retval_type = $retval; + $retval_name = $retval; + } + if ($retval ne 'void') { - $local_var_decl_code .= sprintf (qq[\t%s retval;\n], $retval); + $local_var_decl_code .= sprintf (qq[\t%s retval;\n], $retval_type); } if ($retval ne 'void') {