Use `array(<type>)' as return value for functions returning an array of

1999-12-05  Martin Baulig  <martin@home-of-linux.org>

	* features.def: Use `array(<type>)' as return value for functions
	returning an array of structures.
This commit is contained in:
Martin Baulig
1999-12-05 14:07:20 +00:00
committed by Martin Baulig
parent 5ddf25c66a
commit 4a2fb0a871
4 changed files with 21 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
1999-12-05 Martin Baulig <martin@home-of-linux.org>
* features.def: Use `array(<type>)' as return value for functions
returning an array of structures.
1999-12-05 Martin Baulig <martin@home-of-linux.org> 1999-12-05 Martin Baulig <martin@home-of-linux.org>
* includes/glibtop/interfaces.h (glibtop_get_interface_names): * includes/glibtop/interfaces.h (glibtop_get_interface_names):

View File

@@ -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_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) 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) char *|proc_args|ulong(size)|pid_t(pid):unsigned(max_len)
glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid) array(glibtop_map_entry)|proc_map|ulong(number,size,total)|pid_t(pid)
glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs) array(glibtop_mountentry)|@mountlist|ulong(number,size,total)|int(all_fs)
retval|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string(mount_dir) 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|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|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) retval|ppp|ulong(state,bytes_in,bytes_out)|ushort(device)

View File

@@ -112,6 +112,10 @@ sub output {
$prefix_space = ''; $prefix_space = '';
} }
if ($retval =~ /^array\((.*)\)$/) {
$retval = "$1 *";
}
$check_server_code = "\n"; $check_server_code = "\n";
$check_server_code .= $check_server_code .=
"\t/* If neccessary, we ask the server for the requested\n" . "\t/* If neccessary, we ask the server for the requested\n" .

View File

@@ -203,8 +203,16 @@ sub make_output {
$func_decl_code = sprintf $func_decl_code = sprintf
(qq[static SCM\nglibtop_guile_get_%s (SCM server_smob%s)], $feature, $param_decl); (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') { 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') { if ($retval ne 'void') {