From 3f0e166e3ff9765913834f5f77f5b45621b3a474 Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Fri, 22 Jan 1999 13:50:20 +0000 Subject: [PATCH] Use a `(TYPE . DIMENSION)' pair for array types in `glibtop-types-*'. 1999-01-22 Martin Baulig * names/guile-names.awk: Use a `(TYPE . DIMENSION)' pair for array types in `glibtop-types-*'. --- sysdeps/guile/ChangeLog | 5 ++++ sysdeps/guile/names/guile-names.awk | 37 ++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/sysdeps/guile/ChangeLog b/sysdeps/guile/ChangeLog index 225ebdcc..5766f156 100644 --- a/sysdeps/guile/ChangeLog +++ b/sysdeps/guile/ChangeLog @@ -1,3 +1,8 @@ +1999-01-22 Martin Baulig + + * names/guile-names.awk: Use a `(TYPE . DIMENSION)' pair for + array types in `glibtop-types-*'. + 1998-12-09 Martin Baulig * guile.awk: For arrays, make a gh_list out of it and add this list diff --git a/sysdeps/guile/names/guile-names.awk b/sysdeps/guile/names/guile-names.awk index e8e24cea..0b9004be 100644 --- a/sysdeps/guile/names/guile-names.awk +++ b/sysdeps/guile/names/guile-names.awk @@ -32,20 +32,39 @@ function output(feature) { print "}"; print ""; - + print "static SCM"; print "glibtop_guile_types_"feature" (void)"; print "{"; print "\tint i;"; print "\tSCM list;"; print ""; - print "\tlist = gh_list (SCM_UNDEFINED);"; - print ""; - print "\tfor (i = 0; i < GLIBTOP_MAX_"toupper(feature)"; i++)"; - print "\t\tlist = scm_append"; - print "\t\t\t(gh_list (list,"; - print "\t\t\t\t gh_list (gh_ulong2scm (glibtop_types_"feature" [i])),"; - print "\t\t\t\t SCM_UNDEFINED));"; + + out = "\tlist = gh_list ("; + + nr_elements = split (element_defs[feature], elements, /:/); + for (element = 1; element <= nr_elements; element++) { + list = elements[element]; + type = elements[element]; + sub(/\(.*/, "", type); + sub(/^.*\(/, "", list); sub(/\)$/, "", list); + count = split (list, fields, /,/); + for (field = 1; field <= count; field++) { + if (fields[field] ~ /^(\w+)\[([0-9]+)\]$/) { + split(fields[field], field_parts, /\[/); + fields[field] = field_parts[1]; + sub(/\]/, "", field_parts[2]); + number = field_parts[2]; + out=out"gh_cons\n\t\t\t"; + out=out"(gh_ulong2scm (glibtop_types_"feature" ["field-1"]),\n\t\t\t"; + out=out" gh_ulong2scm ("number")),\n\t\t\t"; + } else { + out=out"gh_ulong2scm (glibtop_types_"feature" ["field-1"]),\n\t\t\t"; + } + } + } + + print out"SCM_UNDEFINED);"; print ""; print "\treturn list;"; print "}"; @@ -97,9 +116,11 @@ function output(feature) { line = $0; split (line, line_fields, /\|/); feature = line_fields[2]; + element_def = line_fields[3]; sub(/^@/,"",feature); features[feature] = feature; + element_defs[feature] = element_def; } END {