Index: trunk/Ohana/src/libautocode/generate
===================================================================
--- trunk/Ohana/src/libautocode/generate	(revision 3536)
+++ trunk/Ohana/src/libautocode/generate	(revision 3609)
@@ -41,5 +41,6 @@
 	# not a simple key/value entry
 	if ($key eq "FIELD") {
-	    ($element, $field, $format, $comment, $unit) = split (/,\s+/, $value);
+	    ($element, $field, $format, $comment, $unit) = split (/,\s+/, $value, 5);
+#	    print "$element : $field : $format : $comment : $unit\n";
 	    push @element, $element;
 	    push @field,   $field;
@@ -106,4 +107,6 @@
 	if ($type eq "float")  { $pt1 = "E"; }
 	if ($type eq "double") { $pt1 = "D"; }
+
+	if ($type eq "rawshort") { $pt1 = "I"; }
 
 	printf FILE "  fits_define_bintable_column (header, ";
@@ -130,4 +133,6 @@
 	if ($type eq "double") { $pt1 = sprintf "F%s", $length; }
 
+	if ($type eq "rawshort")  { $pt1 = sprintf "I%s", $length; }
+
 	printf FILE "  fits_define_table_column (header, ";
 	printf FILE "\"%s\", ",   $pt1;
@@ -179,4 +184,9 @@
 	    next;
 	}
+	# this is a patch for old photreg tables: provide a fix for the tables
+	if ($type eq "rawshort")  {
+	    $N +=2;
+	    next;
+	}
 	if ($type eq "short")  {
 	    $T = "BYTE";
@@ -229,4 +239,6 @@
 	if ($type eq "float")  { $Nbytes += 4; }
 	if ($type eq "double") { $Nbytes += 8; }
+
+	if ($type eq "rawshort")  { $Nbytes += 2; }
     }
     return ($Nbytes);
