All functions which return an array now take a `glibtop_array *array'

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

	All functions which return an array now take a `glibtop_array *array'
	parameter instead of a `glibtop_<feature> *buf' one.

	For compatibility, we typedef the corresponding `glibtop_<feature>'s
	to `glibtop_array' in <glibtop/compat_10.h>.

	This has the advantage that scripting languages like Guile with an
	array implementation which stores the length of an array in the
	array don't need the `glibtop_array' parameter at all any longer.

	We'll also add convenient functions which return GPtrArray's here.

	* include/glibtop/proclist.h (glibtop_proclist): Removed.
	(glibtop_get_proclist_*): This now takes a `glibtop_array' parameter
	instead of a `glibtop_proclist' one.

	* include/glibtop/procmap.h (glibtop_proc_map): Removed.
	(glibtop_get_proc_map_*): This now takes a `glibtop_array' parameter
	instead of a `glibtop_proc_map' one.

	* include/glibtop/mountlist.h (glibtop_mountlist): Removed.
	(glibtop_get_mountlist_*): This now takes a `glibtop_array' parameter
	instead of a `glibtop_mountlist' one.

	* include/glibtop/interfaces.h (glibtop_interface_names): Removed.
	(glibtop_get_interface_names_*): This now takes a `glibtop_array'
	parameter instead of a `glibtop_interface_name' one.

	* include/glibtop/compat_10.h: New file. Contains some typedefs and
	#defines to keep compatibility until the big restructurement is
	completely done.
This commit is contained in:
Martin Baulig
1999-12-12 14:20:17 +00:00
committed by Martin Baulig
parent a33f4df47e
commit 881c2a2086
15 changed files with 186 additions and 173 deletions

View File

@@ -211,6 +211,12 @@ sub output {
if ($line_fields[3] eq '') {
$sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server%s);\n",
$prefix, $feature, $call_param);
} elsif ($line_fields[3] eq 'array') {
$sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server, array%s);\n",
$prefix, $feature, $call_param);
} elsif ($line_fields[3] =~ /^array/) {
$sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server, array, buf%s);\n",
$prefix, $feature, $call_param);
} else {
$sysdeps_code .= sprintf ("\t%sglibtop_get_%s_s (server, buf%s);\n",
$prefix, $feature, $call_param);
@@ -243,6 +249,9 @@ sub output {
"_LIBGTOP_SEND_len", "_LIBGTOP_SEND_ptr");
if ($line_fields[3] eq '') {
$call_code .= sprintf ("\t\t\t%s0, NULL,\n", $call_prefix_space);
} elsif ($line_fields[3] eq 'array') {
$call_code .= sprintf ("\t\t\t%ssizeof (glibtop_array), array,\n",
$call_prefix_space);
} else {
$call_code .= sprintf ("\t\t\t%ssizeof (glibtop_%s), buf,\n",
$call_prefix_space, $feature);
@@ -263,7 +272,7 @@ sub output {
$check_code = "check_missing:\n";
$check_code .= "\t/* Make sure that all required fields are present. */\n";
if (!($line_fields[3] eq '')) {
if (!(($line_fields[3] eq '') or ($line_fields[3] eq 'array'))) {
$check_code .= "\tif (buf->flags & server->required." . $feature . ")\n";
$check_code .= "\t\t_glibtop_missing_feature (server, \"" . $feature .
"\", buf->flags,\n\t\t\t\t\t &server->required." . $feature . ");\n";
@@ -284,6 +293,12 @@ sub output {
if ($line_fields[3] eq '') {
$func_decl .= sprintf ("glibtop_get_%s_l (glibtop *server%s)\n",
$feature, $param_decl);
} elsif ($line_fields[3] eq 'array') {
$func_decl .= sprintf ("glibtop_get_%s_l (glibtop *server, glibtop_array *array%s)\n",
$feature, $param_decl);
} elsif ($line_fields[3] =~ /^array/) {
$func_decl .= sprintf ("glibtop_get_%s_l (glibtop *server, glibtop_array *array, %s *buf%s)\n",
$feature, 'glibtop_'.$feature, $param_decl);
} else {
$func_decl .= sprintf ("glibtop_get_%s_l (glibtop *server, %s *buf%s)\n",
$feature, 'glibtop_'.$feature, $param_decl);