Files
libgtop/lib/lib.awk
Martin Baulig f07551a43d New file.
1998-07-29  Martin Baulig  <martin@home-of-linux.org>

	* guile/ChangeLog: New file.

	* features.def: New format - now includes type of return value
	and parameters.

	* lib/lib.awk: Changed to use new `features.def'.
	* sysdeps/guile/guile.awk: Dito;
	* sysdeps/guile/names/guile-names.awk: Dito.

	* libgtopConf.sh.in: Added
	`LIBGTOP_NAMES_LIBS', `LIBGTOP_NAMES_INCS',
	`LIBGTOP_GUILE_NAMES_LIBS', `LIBGTOP_GUILE_NAMES_INCS',
	`LIBGTOP_MAJOR_VERSION', `LIBGTOP_MINOR_VERSION'
	`LIBGTOP_VERSION', `libgtop_sysdeps_dir'.

	* acinclude.m4 (AC_LC_SYSDEPS): Removed since this has been
	replaced with `GNOME_LIBGTOP_SYSDEPS' long ago.

	* LIBGTOP-VERSION: New file.

	* */Makefile.am (INCLUDES): Removed; now defined in `configure.in'.

	* sysdeps/names/mountlist.c: New file.

	* lib/{init, open}.c (GTOP_SERVER): Renamed to `LIBGTOP_SERVER'.

	* configure.in (INCLUDES): Added definition.
	(libgtop_want_names): Always true; `libgtop_names.la' is now
	always created since some other programs rely upon it - but
	have to use `LIBGTOP_NAMES_LIBS' and `LIBGTOP_NAMES_INCS' to
	use it in your application.
	(libgtop_want_guile_names): Always true; but you have to use
	`LIBGTOP_GUILE_NAMES_LIBS' and `LIBGTOP_GUILE_NAMES_INCS' to
	use it in your application.
	(LIBGTOP_LIBS): Removed `-lgtop_names' and `-lgtop_guile_names'.
	(LIBGTOP_NAMES_LIBS): New variable. Use it to link your
	application with the names interface.
	(LIBGTOP_NAMES_INCS): New variable. Also #defines `GLIBTOP_NAMES'
	which is now required if your application wants to use the names
	interface.
	(LIBGTOP_GUILE_NAMES_LIBS): New variable. Use it to link your
	application with the guile names interface.
	(LIBGTOP_GUILE_NAMES_INCS): New variable. Also #defines
	`GLIBTOP_NAMES' and `GLIBTOP_GUILE_NAMES' which are now required
	if your application wants to use the guile names interface.
1998-07-29 22:01:31 +00:00

98 lines
2.4 KiB
Awk

BEGIN {
print "/* lib.c */";
print "/* This is a generated file. Please modify `lib.awk' */";
print "";
print "#include <glibtop.h>";
print "#include <glibtop/open.h>";
print "#include <glibtop/sysdeps.h>";
print "#include <glibtop/command.h>";
print "";
}
function output(line) {
split (line, line_fields, /\|/);
retval = line_fields[1];
feature = line_fields[2];
param_typ = line_fields[4];
param = line_fields[5];
param_size = line_fields[6];
if (param_typ == "") {
param_size = "0";
param_ptr = "NULL";
} else {
if (param_size == "")
param_size = "sizeof ("param_typ")";
if (param_typ ~ /*/)
param_ptr = param;
else
param_ptr = "&"param;
}
orig = feature; sub(/^@/,"",feature);
space = feature; gsub(/./," ",space);
print retval;
if (retval !~ /^void$/) {
prefix = "return ";
prefix_space = " ";
} else {
prefix = "";
prefix_space = "";
}
if (param_typ != "") {
print "glibtop_get_"feature"_l (glibtop *server, glibtop_"feature" *buf,";
print " "space" "param_typ" "param")";
} else {
print "glibtop_get_"feature"_l (glibtop *server, glibtop_"feature" *buf)";
}
print "{";
print "\tglibtop_init_r (&server, GLIBTOP_SYSDEPS_"toupper(feature)", 0);";
print "";
print "\tif ((server->flags & _GLIBTOP_INIT_STATE_SERVER) &&";
print "\t (server->features & (1 << GLIBTOP_SYSDEPS_"toupper(feature)")))";
print "\t{";
if (param == "")
print "\t\t"prefix"glibtop_call_l (server, GLIBTOP_CMND_"toupper(feature)", 0, NULL,";
else
print "\t\t"prefix"glibtop_call_l (server, GLIBTOP_CMND_"toupper(feature)",";
if (param == "") {
print "\t\t\t\t"prefix_space"sizeof (glibtop_"feature"), buf);";
} else {
print "\t\t\t\t"prefix_space""param_size", "param_ptr",";
print "\t\t\t\t"prefix_space"sizeof (glibtop_"feature"),";
print "\t\t\t\t"prefix_space"buf);";
}
print "\t} else {";
if (orig !~ /^@/)
print "#if (!GLIBTOP_SUID_"toupper(feature)")";
if (param == "")
print "\t\t"prefix"glibtop_get_"feature"_r (server, buf);";
else
print "\t\t"prefix"glibtop_get_"feature"_r (server, buf, "param");";
if (orig !~ /^@/) {
print "#else";
print "\t\terrno = ENOSYS;";
print "\t\tglibtop_error_io_r (server, \"glibtop_get_"feature"\");";
print "#endif";
}
print "\t}";
print "}";
print "";
}
/^[^#]/ { output($0) }