Index: trunk/Ohana/src/libautocode/generate
===================================================================
--- trunk/Ohana/src/libautocode/generate	(revision 4019)
+++ trunk/Ohana/src/libautocode/generate	(revision 4020)
@@ -1,4 +1,6 @@
 #!/usr/bin/env perl
 
+$VERBOSE = 0;
+if ($ARGV[0] eq "-v") { $VERBOSE = 1; shift @ARGV; }
 if (@ARGV != 3) { die "generate (schema) (template) (output)\n"; }
 
@@ -40,7 +42,7 @@
 
 	# not a simple key/value entry
-	if ($key eq "FIELD") {
+ 	if (($key eq "FIELD") || ($key eq "SUBSTRUCT") || ($key eq "SUBFIELD")) {
 	    ($element, $field, $format, $comment, $unit) = split (/,\s+/, $value, 5);
-#	    print "$element : $field : $format : $comment : $unit\n";
+	    if ($VERBOSE) { printf "%-20s %-20s %-15s %-35s %-10s\n", $element, $field, $format, $comment, $unit; }
 	    push @element, $element;
 	    push @field,   $field;
@@ -48,4 +50,5 @@
 	    push @comment, $comment;
 	    push @unit,    $unit;
+	    push @mode,    $key;
 	}
     }
@@ -89,4 +92,8 @@
 
     for ($i = 0; $i < @field; $i++) {
+	# skip SUBSTRUCT type of entries:
+	if ($mode[$i] eq "SUBSTRUCT") { next; }
+
+	# need to handle all structures like: float poly[5][4]
 	# add [\d\.] to match ascii-type formats
 	($type, $length) = $format[$i] =~ m|^(\w+)\[(\d+)\]|;
@@ -122,4 +129,7 @@
 
     for ($i = 0; $i < @field; $i++) {
+	# skip SUBSTRUCT type of entries:
+	if ($mode[$i] eq "SUBSTRUCT") { next; }
+
 	($type, $length) = $format[$i] =~ m|^(\w+)\[([\d\.]+)\]|;
 	if (!$type && !$length) { die "format must be specified for ASCII table"; }
@@ -147,4 +157,7 @@
     print FILE "typedef struct {\n";
     for ($i = 0; $i < @element; $i++) {
+	# skip SUBFIELD entries
+	if ($mode[$i] eq "SUBFIELD") { next; }
+
 	($type, $length) = $format[$i] =~ m|^(\w+)\[([\d\.]+)\]|;
 	if (!$type && !$length) { $type = $format[$i]; }
@@ -169,4 +182,7 @@
     $N = 0;
     for ($i = 0; $i < @field; $i++) {
+	# skip SUBSTRUCT type of entries:
+	if ($mode[$i] eq "SUBSTRUCT") { next; }
+
 	($type, $length) = $format[$i] =~ m|^(\w+)\[([\d\.]+)\]|;
 	if (!$type && !$length) { $type = $format[$i]; }
@@ -219,4 +235,6 @@
     $Nbytes = 0;
     for ($i = 0; $i < @field; $i++) {
+	# skip SUBSTRUCT type of entries:
+	if ($mode[$i] eq "SUBSTRUCT") { next; }
 
 	# add [\d\.] to match ascii-type formats
@@ -250,4 +268,7 @@
     $Nbytes = 0;
     for ($i = 0; $i < @field; $i++) {
+	# skip SUBSTRUCT type of entries:
+	if ($mode[$i] eq "SUBSTRUCT") { next; }
+
 	($length) = $format[$i] =~ m|^\w+\[([\d\.]+)\]|;
 	if ($length == 0) { die "ASCII table format requires field size"; }
