Index: trunk/Ohana/src/libautocode/generate
===================================================================
--- trunk/Ohana/src/libautocode/generate	(revision 7080)
+++ trunk/Ohana/src/libautocode/generate	(revision 21508)
@@ -114,4 +114,5 @@
 	
 	# rawshort is a short without byteswapping
+	# rawshort is a patch for old photreg tables
 
 	$pt1 = 0;
@@ -124,8 +125,22 @@
 	if ($type eq "int")    	      { $pt1 = "J"; }
 	if ($type eq "unsigned int")  { $pt1 = "J"; }
-	if ($type eq "e_time") 	      { $pt1 = "J"; }
+
+	if ($type eq "int8_t") 	      { $pt1 = "B"; }
+	if ($type eq "uint8_t")       { $pt1 = "B"; }
+	if ($type eq "int16_t")       { $pt1 = "I"; }
+	if ($type eq "uint16_t")      { $pt1 = "I"; }
+	if ($type eq "int32_t")       { $pt1 = "J"; }
+	if ($type eq "uint32_t")      { $pt1 = "J"; }
+
+	# FITS tables do not allow for 64bit integers.  we need to
+	# write these by splitting the value into high and low 32 bit values
+	if ($type eq "int64_t")       { $pt1 = "J"; $Np = 2*$Np; }
+	if ($type eq "uint64_t")      { $pt1 = "J"; $Np = 2*$Np; }
+
 	if ($type eq "float")  	      { $pt1 = "E"; }
 	if ($type eq "double") 	      { $pt1 = "D"; }
 
+	# special 'elixir' types:
+	if ($type eq "e_time") 	      { $pt1 = "J"; }
 	if ($type eq "e_void") 	      { $pt1 = "B"; $Np = 8*$Np; }
 	# e_void is a 64 bit pointer, cast to size_t.  its value is not loaded
@@ -146,5 +161,4 @@
 	printf FILE "%-20s 1.0, 0.0);\n", "\"$unit[$i]\", ";
     }
-
 }
 
@@ -217,8 +231,22 @@
 	if ($type eq "int")    	      { $pt1 = sprintf "I%s", $length; }
 	if ($type eq "unsigned int")  { $pt1 = sprintf "I%s", $length; }
-	if ($type eq "e_time") 	      { $pt1 = sprintf "I%s", $length; }
+
+	if ($type eq "int8_t") 	      { $pt1 = sprintf "I%s", $length; }
+	if ($type eq "uint8_t")       { $pt1 = sprintf "I%s", $length; }
+	if ($type eq "int16_t")       { $pt1 = sprintf "I%s", $length; }
+	if ($type eq "uint16_t")      { $pt1 = sprintf "I%s", $length; }
+	if ($type eq "int32_t")       { $pt1 = sprintf "I%s", $length; }
+	if ($type eq "uint32_t")      { $pt1 = sprintf "I%s", $length; }
+
+	# FITS tables do not allow for 64bit integers.  we need to
+	# write these by splitting the value into high and low 32 bit values
+	if ($type eq "int64_t")       { $pt1 = sprintf "I%s", $length; }
+	if ($type eq "uint64_t")      { $pt1 = sprintf "I%s", $length; }
+
 	if ($type eq "float")  	      { $pt1 = sprintf "F%s", $length; }
 	if ($type eq "double") 	      { $pt1 = sprintf "F%s", $length; }
 
+	# special 'elixir' types:
+	if ($type eq "e_time") 	      { $pt1 = sprintf "I%s", $length; }
 	if ($type eq "e_void") 	      { $pt1 = sprintf "I%s", $length; }
 
@@ -283,12 +311,29 @@
 	if ($type eq "unsigned char") { $N +=   $Np; next; }
 	if ($type eq "rawshort")      { $N += 2*$Np; next; }
+
 	if ($type eq "short")  	      { $T = "BYTE"; $n = 2; }
 	if ($type eq "unsigned short"){ $T = "BYTE"; $n = 2; }
 	if ($type eq "int")    	      { $T = "WORD"; $n = 4; }
 	if ($type eq "unsigned int")  { $T = "WORD"; $n = 4; }
+
+	if ($type eq "int8_t") 	      { $N +=   $Np; next; }
+	if ($type eq "uint8_t")       { $N +=   $Np; next; }
+	if ($type eq "int16_t")       { $T = "BYTE"; $n = 2; }
+	if ($type eq "uint16_t")      { $T = "BYTE"; $n = 2; }
+	if ($type eq "int32_t")       { $T = "WORD"; $n = 4; }
+	if ($type eq "uint32_t")      { $T = "WORD"; $n = 4; }
+
+	# FITS tables do not allow for 64bit integers.  we need to
+	# write these by splitting the value into high and low 32 bit values
+	if ($type eq "int64_t")       { $T = "WORD"; $n = 4; $Np = 2*$Np; }
+	if ($type eq "uint64_t")      { $T = "WORD"; $n = 4; $Np = 2*$Np; }
+
+	if ($type eq "float")  	      { $T = "WORD"; $n = 4; }
+	if ($type eq "double") 	      { $T = "DBLE"; $n = 8; }
+
+	# special 'elixir' types:
 	if ($type eq "e_time") 	      { $T = "WORD"; $n = 4; }
 	if ($type eq "e_void") 	      { $T = "DBLE"; $n = 8; }
-	if ($type eq "float")  	      { $T = "WORD"; $n = 4; }
-	if ($type eq "double") 	      { $T = "DBLE"; $n = 8; }
+
 	if (!$n) { die "unknown type $type"; }
 	for ($j = 0; $j < $Np; $j++) {
@@ -318,8 +363,23 @@
 	if ($type eq "int")    	       { $Nbytes += 4*$Np; $valid = 1; }
 	if ($type eq "unsigned int")   { $Nbytes += 4*$Np; $valid = 1; }
+
+	if ($type eq "int8_t") 	       { $Nbytes += 1*$Np; $valid = 1; }
+	if ($type eq "uint8_t")        { $Nbytes += 1*$Np; $valid = 1; }
+	if ($type eq "int16_t")        { $Nbytes += 2*$Np; $valid = 1; }
+	if ($type eq "uint16_t")       { $Nbytes += 2*$Np; $valid = 1; }
+	if ($type eq "int32_t")        { $Nbytes += 4*$Np; $valid = 1; }
+	if ($type eq "uint32_t")       { $Nbytes += 4*$Np; $valid = 1; }
+
+	# FITS tables do not allow for 64bit integers.  we need to
+	# write these by splitting the value into high and low 32 bit values
+	if ($type eq "int64_t")        { $Nbytes += 8*$Np; $valid = 1; }
+	if ($type eq "uint64_t")       { $Nbytes += 8*$Np; $valid = 1; }
+
+	if ($type eq "float")  	       { $Nbytes += 4*$Np; $valid = 1; }
+	if ($type eq "double") 	       { $Nbytes += 8*$Np; $valid = 1; }
+
+	# special 'elixir' types:
 	if ($type eq "e_time") 	       { $Nbytes += 4*$Np; $valid = 1; }
 	if ($type eq "e_void") 	       { $Nbytes += 8*$Np; $valid = 1; }
-	if ($type eq "float")  	       { $Nbytes += 4*$Np; $valid = 1; }
-	if ($type eq "double") 	       { $Nbytes += 8*$Np; $valid = 1; }
 	if (!$valid) { die "unknown type $type"; }
     }
