Index: /trunk/Ohana/src/imregister/Makefile
===================================================================
--- /trunk/Ohana/src/imregister/Makefile	(revision 3535)
+++ /trunk/Ohana/src/imregister/Makefile	(revision 3536)
@@ -73,10 +73,10 @@
 
 PHOTOBJ  = \
-$(PHOTREG)/db.$(ARCH).o     \
-$(PHOTREG)/delete.$(ARCH).o \
-$(PHOTREG)/match.$(ARCH).o  \
+$(PHOTREG)/delete.$(ARCH).o  \
+$(PHOTREG)/match.$(ARCH).o   \
 $(PHOTREG)/define.$(ARCH).o  \
-$(PHOTREG)/getImageData.$(ARCH).o  \
-$(PHOTREG)/output.$(ARCH).o 
+$(PHOTREG)/convert.$(ARCH).o \
+$(PHOTREG)/output.$(ARCH).o  \
+$(PHOTREG)/getImageData.$(ARCH).o
 
 DETOBJ  = \
Index: /trunk/Ohana/src/imregister/include/photreg.h
===================================================================
--- /trunk/Ohana/src/imregister/include/photreg.h	(revision 3535)
+++ /trunk/Ohana/src/imregister/include/photreg.h	(revision 3536)
@@ -27,27 +27,18 @@
 int args (int argc, char **argv);
 int regargs (int argc, char **argv, PhotPars *);
-PhotPars *get_images (int *N);
-int set_images (PhotPars *new, int Nnew);
-int load_db ();
-void init_db ();
-int save_db ();
-int update_db (int *match, int Nmatch);
-int append_db (PhotPars *new, int Nnew);
-int create_db ();
-int close_db ();
-void DeleteSubset (int *match, int Nmatch);
-int *match_criteria (int *Nmatch);
-int *match_images (PhotPars *subset, int Nsubset, int *Nmatch);
-void ModifySubset (int *match, int Nmatch);
-void OutputSubset (int *match, int Nmatch);
+
+void DeleteSubset (FITS_DB *db, PhotPars *photpars, int Nphotpars, int *match, int Nmatch);
+int *match_criteria (PhotPars *photpars, int Nphotpars, int *Nmatch);
+
+void OutputSubset (PhotPars *photpars, int Nphotpars, int *match, int Nmatch);
+
 void DumpFitsBintable (char *filename, PhotPars *image, int *match, int Nmatch);
 void DumpFitsTable (char *filename, PhotPars *image, int *match, int Nmatch);
 int PrintSubset (PhotPars *image, int *match, int Nmatch);
-int define_table (Header *header, Matrix *matrix, Header *theader, FTable *table);
+
 void set_timezone (double dt);
-void DumpCADCTable (char *filename, PhotPars *image, int *match, int Nmatch);
 void getImageData (char *Image, char *ImageCCD, char *ImageMode);
-void set_Binary_name (char *name);
-void set_ASCII_name (char *string);
-int load_old_db ();
 int escape (int mode, char *message);
+
+PhotPars *PhotParsOld_to_PhotPars (PhotParsOld *input, int Nphotpars);
+
Index: /trunk/Ohana/src/imregister/photreg/args.photreg.c
===================================================================
--- /trunk/Ohana/src/imregister/photreg/args.photreg.c	(revision 3535)
+++ /trunk/Ohana/src/imregister/photreg/args.photreg.c	(revision 3536)
@@ -7,5 +7,5 @@
 
   int *list, Nlist;
-  int N, required, Ntimes;
+  int N, Ntimes;
   unsigned long *tstart, *tstop;
   PhotCode *photcode, *depcode;
@@ -15,5 +15,4 @@
   photcode = NULL;
   output.modify = TRUE;
-  required = 0x0;
   bzero (newdata, sizeof(PhotPars));
 
@@ -67,5 +66,8 @@
   newdata[0].tstart = tstart[0];
   newdata[0].tstop = tstop[0];
-  required |= 0x03;
+
+  if (!get_argument (argc, argv, "-zp")) goto required;
+  if (!get_argument (argc, argv, "-dzp")) goto required;
+  if (!get_argument (argc, argv, "-photcode")) goto required;
 
   /* observed zero point */
@@ -74,6 +76,5 @@
     newdata[0].ZP = atof (argv[N]);
     remove_argument (N, &argc, argv);
-    required |= 0x04;
-  }
+  } 
 
   /* error on observed zero point */
@@ -82,5 +83,4 @@
     newdata[0].dZP = atof (argv[N]);
     remove_argument (N, &argc, argv);
-    required |= 0x08;
   }
 
@@ -93,10 +93,4 @@
     }
     remove_argument (N, &argc, argv);
-    required |= 0x10;
-  }
-
-  if (required ^ 0x1f) {
-    fprintf (stderr, "missing required field\n");
-    usage ();
   }
 
@@ -121,4 +115,8 @@
   if (output.offset) newdata[0].ZP += newdata[0].ZPo;
   return (TRUE);
+
+required:
+  fprintf (stderr, "missing required fields\n");
+  usage ();
 }
 
Index: /trunk/Ohana/src/imregister/photreg/args.photsearch.c
===================================================================
--- /trunk/Ohana/src/imregister/photreg/args.photsearch.c	(revision 3535)
+++ /trunk/Ohana/src/imregister/photreg/args.photsearch.c	(revision 3536)
@@ -84,5 +84,5 @@
     output.convert = TRUE;
     if (output.delete || output.modify) {
-      fprintf (stderr, "can't changed old format table\n");
+      fprintf (stderr, "can't change old format table\n");
       exit (1);
     }
Index: /trunk/Ohana/src/imregister/photreg/convert.c
===================================================================
--- /trunk/Ohana/src/imregister/photreg/convert.c	(revision 3536)
+++ /trunk/Ohana/src/imregister/photreg/convert.c	(revision 3536)
@@ -0,0 +1,27 @@
+# include "imregister.h"
+# include "photreg.h"
+
+PhotPars *PhotParsOld_to_PhotPars (PhotParsOld *input, int Nphotpars) {
+
+  int i;
+  PhotPars *output;
+
+  ALLOCATE (output, PhotPars, Nphotpars);
+
+  for (i = 0; i < Nphotpars; i++) {
+    output[i].ZP       = input[i].ZP;
+    output[i].ZPo      = input[i].ZPo;
+    output[i].dZP      = input[i].dZP;
+    output[i].K        = input[i].K;
+    output[i].X        = input[i].X;
+    output[i].tstart   = input[i].tstart;
+    output[i].tstop    = input[i].tstop;
+    output[i].c1       = input[i].c1;
+    output[i].c2       = input[i].c2;
+    output[i].photcode = input[i].photcode;
+    strcpy (output[i].label, input[i].label);
+    output[i].Nmeas = 0;
+    output[i].Ntime = 0;
+  }
+  return (output);
+}
Index: /trunk/Ohana/src/imregister/photreg/delete.c
===================================================================
--- /trunk/Ohana/src/imregister/photreg/delete.c	(revision 3535)
+++ /trunk/Ohana/src/imregister/photreg/delete.c	(revision 3536)
@@ -2,11 +2,9 @@
 # include "photreg.h"
 
-void DeleteSubset (int *match, int Nmatch) {
+void DeleteSubset (FITS_DB *db, PhotPars *photdata, int Nphotdata, int *match, int Nmatch) {
 
   int i, j;
-  int *keep, Ndel, Nphotdata, Nsubset;
-  PhotPars *photdata, *subset;
-
-  photdata = get_images (&Nphotdata);
+  int *keep, Ndel, Nsubset;
+  PhotPars *subset;
 
   ALLOCATE (keep, int, MAX (Nphotdata, 1));
@@ -25,5 +23,6 @@
   if (Ndel == 0) { 
     fprintf (stderr, "SUCCESS\n");
-    close_db ();
+    fits_db_close (db);
+    fits_db_free (db);
     exit (0);
   }
@@ -39,11 +38,10 @@
   }
 
-  free (keep);
-  free (photdata);
-  set_images (subset, Nsubset);
+  fits_table_set_PhotPars (&db[0].ftable, subset, Nsubset);
+  fits_db_save (db);
+  fits_db_close (db);
+  fits_db_free (db);
 
-  save_db ();
   fprintf (stderr, "SUCCESS\n");
   exit (0);
-
 }
Index: /trunk/Ohana/src/imregister/photreg/match.c
===================================================================
--- /trunk/Ohana/src/imregister/photreg/match.c	(revision 3535)
+++ /trunk/Ohana/src/imregister/photreg/match.c	(revision 3536)
@@ -2,11 +2,10 @@
 # include "photreg.h"
 
-int *match_criteria (int *Nmatch) {
+int *match_criteria (PhotPars *photdata, int Nphotdata, int *Nmatch) {
 
-  int i, j, Nphotdata;
+  int i, j;
   int N, NMATCH;
   int *match;
   int reject;
-  PhotPars *photdata;
 
   /* create selection index */
@@ -14,6 +13,4 @@
   NMATCH = 1000;
   ALLOCATE (match, int, NMATCH);
-
-  photdata = get_images (&Nphotdata);
 
   /* find entries that matches criteria */
Index: /trunk/Ohana/src/imregister/photreg/output.c
===================================================================
--- /trunk/Ohana/src/imregister/photreg/output.c	(revision 3535)
+++ /trunk/Ohana/src/imregister/photreg/output.c	(revision 3536)
@@ -6,15 +6,6 @@
 static char *ASCIIName = (char *) NULL;
 
-void set_ASCII_name (char *string) {
-  ASCIIName = string;
-}
-
 /* given a subset list, write out the selected images, if desired */
-void OutputSubset (int *match, int Nmatch) {
-
-  int Nphotdata;
-  PhotPars *photdata;
-
-  photdata = get_images (&Nphotdata);
+void OutputSubset (PhotPars *photdata, int Nphotdata, int *match, int Nmatch) {
 
   if (output.table != (char *) NULL) {
@@ -36,12 +27,12 @@
 
   int i, j;
-  Header header, theader;
+  FILE *f;
+  Header header;
   Matrix matrix;
-  FTable table;
+  Header theader;
+  FTable ftable;
   PhotPars *subset;
 
-  /* define table layout */
-  define_table (&header, &matrix, &theader, &table);
-
+  /* extract subset of input data */
   ALLOCATE (subset, PhotPars, MAX (1, Nmatch));
   for (i = 0; i < Nmatch; i++){
@@ -49,14 +40,36 @@
     memcpy (&subset[i], &photdata[j], sizeof (PhotPars));
   }
-  ConvertStruct ((char *) subset, sizeof (PhotPars), Nmatch, "photpars");
-  fits_add_rows (&table, (char *) subset, Nmatch, sizeof (PhotPars));
+
+  /* open file for output */
+  f = fopen (filename, "w");
+  if (f == NULL) {
+    fprintf (stderr, "ERROR: can't open output file %s\n", filename);
+    exit (1);
+  }
+
+  /* create primary header */
+  fits_init_header (&header);    
+  header.extend = TRUE;
+  fits_create_header (&header);
+  fits_create_matrix (&header, &matrix);
+  fits_print (&header, "NEXTEND", "%d", 1, 1);
+
+  ftable.header = &theader;
+  fits_table_set_PhotPars (&ftable, subset, Nmatch);
+
+  /* EXTNAME is set to ZERO_POINTS_3.0 by default */
+  if (!strcmp (output.db, "trans")) {
+    fits_modify (&theader, "EXTNAME", "%s", 1, "TRANS_POINTS_3.0");
+  }
 
   fits_write_header  (filename, &header);
   fits_write_matrix  (filename, &matrix);
   fits_write_Theader (filename, &theader);
-  fits_write_table   (filename, &table);
+  fits_write_table   (filename, &ftable);
+  fclose (f);
   exit (0);
 }
 
+/** add ASCII table to autocode? **/
 void DumpFitsTable (char *filename, PhotPars *photdata, int *index, int Nkeep) {
   
@@ -67,5 +80,5 @@
   FILE *f;
   char *startstr, *stopstr, *datestr, *line;
-  char *c1, *c2, *code, *photsys;
+  char *c1, *c2, *code, *photsys, *extname;
   int i;
   unsigned int tsecond;
@@ -79,5 +92,10 @@
   
   /* create table header */
-  fits_create_table_header (&theader, "TABLE", ASCIIName);
+  if (!strcmp (output.db, "phot")) {
+    extname = strcreate ("IMAGE_ZPTS");
+  } else {
+    extname = strcreate ("SUMMARY_ZPTS");
+  }
+  fits_create_table_header (&theader, "TABLE", extname);
     
   /* add current date/time to header */
@@ -155,5 +173,8 @@
 	      newdata[0].K, newdata[0].X, startstr, stopstr,
 	      c1, c2, newdata[0].Nmeas, newdata[0].Ntime, code, photsys, newdata[0].label);
-    if (!fits_add_rows (&table, line, 1, strlen(line))) escape (IGNORE, "error writing dataline");
+    if (!fits_add_rows (&table, line, 1, strlen(line))) {
+      fprintf (stderr, "error writing dataline");
+      exit (1);
+    }
 
     free (line);
Index: /trunk/Ohana/src/imregister/spreg/output.c
===================================================================
--- /trunk/Ohana/src/imregister/spreg/output.c	(revision 3535)
+++ /trunk/Ohana/src/imregister/spreg/output.c	(revision 3536)
@@ -68,5 +68,4 @@
   fits_fwrite_table   (f, &ftable);
   fclose (f);
-
   exit (0);
 }
Index: /trunk/Ohana/src/imregister/src/photreg.c
===================================================================
--- /trunk/Ohana/src/imregister/src/photreg.c	(revision 3535)
+++ /trunk/Ohana/src/imregister/src/photreg.c	(revision 3536)
@@ -1,24 +1,61 @@
 # include "imregister.h"
 # include "photreg.h"
-static char *version = "photreg $Revision: 1.3 $";
+static char *version = "photreg $Revision: 1.4 $";
 
 int main (int argc, char **argv) {
  
-  int status;
-  PhotPars newdata;
+  char *filename;
+  PhotPars newdata, *photdata;
+  VTable vtable;
+  FITS_DB db;
   
-  /* data values are set in args by matching flags */
   get_version (argc, argv, version);
   regargs (argc, argv, &newdata);
 
-  init_db ();
-  status = load_db ();
-  if (!status) {
-    create_db ();
+  db.lockstate = LCK_HARD;
+  db.timeout   = 300.0;
+  fits_db_init (&db);
+
+  if (!strcmp (output.db, "phot")) {
+    filename = PhotDB;
+  } else {
+    filename = TransDB;
   }
-  append_db (&newdata, 1);
+
+  if (!fits_db_lock (&db, filename)) {
+    fits_db_close (&db);
+    exit (1);
+  }
+  if (db.dbstate == LCK_EMPTY) {
+    fits_init_header (&db.header);    
+    db.header.extend = TRUE;
+    fits_create_header (&db.header);
+    fits_create_matrix (&db.header, &db.matrix);
+    fits_print (&db.header, "NEXTEND", "%d", 1, 1);
+    db.ftable.header = &db.theader;
+    fits_table_set_PhotPars (&db.ftable, NULL, 0);
+    /* EXTNAME is set to ZERO_POINTS_3.0 by default */
+    if (!strcmp (output.db, "trans")) {
+      fits_modify (&db.theader, "EXTNAME", "%s", 1, "TRANS_POINTS_3.0");
+    }
+  } else {  
+    if (!fits_db_load (&db)) {
+      fits_db_close (&db);
+      exit (1);
+    }
+  }
+
+  /** we may later want to pull this out and put it elsewhere **/
+  fits_convert_PhotPars (&newdata, sizeof (PhotPars), 1);
+  fits_table_to_vtable (&db.ftable, &vtable, 0, 1);
+  fits_db_update (&db, &vtable);
+  fits_db_close (&db);
+  fits_db_free (&db);
 
   fprintf (stderr, "SUCCESS\n");
   exit (0);
+}
 
-}
+  /* data values are set in args by matching flags */
+
+/*** stick the header, table, theader, ftable creation in a single API? ***/
Index: /trunk/Ohana/src/imregister/src/photsearch.c
===================================================================
--- /trunk/Ohana/src/imregister/src/photsearch.c	(revision 3535)
+++ /trunk/Ohana/src/imregister/src/photsearch.c	(revision 3536)
@@ -1,28 +1,71 @@
 # include "imregister.h"
 # include "photreg.h"
-static char *version = "photsearch $Revision: 1.3 $";
+static char *version = "photsearch $Revision: 1.4 $";
 
 int main (int argc, char **argv) {
 
-  int status, Nmatch;
+  char *filename;
+  int status, Nmatch, Nphotpars;
   int *match;
+  FITS_DB db;
+  PhotPars *photpars;
+  PhotParsOld *photpars_old;
 
-  /* db selection is set in args, based on -trans */
   get_version (argc, argv, version);
   args (argc, argv);
 
-  init_db ();
-  status = load_db ();
-  if (!status) {
-    close_db ();
-    exit (0);
+  db.lockstate = (output.modify || output.delete) ? LCK_HARD : LCK_SOFT;
+  db.timeout   = 300.0;
+  fits_db_init (&db);
+
+  if (!strcmp (output.db, "phot")) {
+    filename = PhotDB;
+  } else {
+    filename = TransDB;
   }
-  if (!output.modify && !output.delete) close_db ();
 
-  match = match_criteria (&Nmatch);
+  if (!fits_db_lock (&db, filename)) {
+    fits_db_close (&db);
+    exit (1);
+  }
+  
+  if (!fits_db_load (&db)) {
+    fits_db_close (&db);
+    exit (1);
+  }
 
-  if (output.delete) DeleteSubset (match, Nmatch);
+  if (!output.modify && !output.delete) fits_db_close (&db);
 
-  OutputSubset (match, Nmatch);
+  /* add test to EXTNAME? */
+  if (output.convert) {
+    photpars_old = fits_table_get_PhotParsOld (&db.ftable, &Nphotpars);
+    photpars = PhotParsOld_to_PhotPars (photpars_old, Nphotpars);
+  } else {
+    photpars = fits_table_get_PhotPars (&db.ftable, &Nphotpars);
+  }
+
+  match = match_criteria (photpars, Nphotpars, &Nmatch);
+
+  if (output.delete) DeleteSubset (&db, photpars, Nphotpars, match, Nmatch);
+
+  OutputSubset (photpars, Nphotpars, match, Nmatch);
   exit (0);
 }
+
+  /* db selection is set in args, based on -trans */
+
+/* valid EXTNAME values:
+
+   phot, !output.convert, bintable: "ZERO_POINTS_3.0"
+   phot, !output.convert, table:    "IMAGE_ZPTS"
+
+   trans, !output.convert, bintable: "TRANS_POINTS_3.0"
+   trans, !output.convert, table:    "SUMMARY_ZPTS"
+
+   phot, !output.convert, bintable: "ZERO_POINTS"
+   phot, !output.convert, table:    "IMAGE_ZPTS"
+
+   trans, !output.convert, bintable: "TRANS_POINTS"
+   trans, !output.convert, table:    "SUMMARY_ZPTS"
+
+*/
Index: /trunk/Ohana/src/imregister/src/select.c
===================================================================
--- /trunk/Ohana/src/imregister/src/select.c	(revision 3536)
+++ /trunk/Ohana/src/imregister/src/select.c	(revision 3536)
@@ -0,0 +1,31 @@
+# include "imregister.h"
+
+char *select_dbfile () {
+
+  if (!strcmp (output.db, "phot")) {
+    return (PhotDB);
+  }
+
+  if (!strcmp (output.db, "trans")) {
+    return (TransDB);
+  }
+
+  fprintf (stderr, "ERROR: invalid option for db source: %s\n", output.db);
+  exit (1);
+}
+
+/* valid EXTNAME values:
+
+   phot, !output.convert, bintable: "ZERO_POINTS_3.0"
+   phot, !output.convert, table:    "IMAGE_ZPTS"
+
+   trans, !output.convert, bintable: "TRANS_POINTS_3.0"
+   trans, !output.convert, table:    "SUMMARY_ZPTS"
+
+   phot, !output.convert, bintable: "ZERO_POINTS"
+   phot, !output.convert, table:    "IMAGE_ZPTS"
+
+   trans, !output.convert, bintable: "TRANS_POINTS"
+   trans, !output.convert, table:    "SUMMARY_ZPTS"
+
+*/
Index: /trunk/Ohana/src/imregister/src/spregister.c
===================================================================
--- /trunk/Ohana/src/imregister/src/spregister.c	(revision 3535)
+++ /trunk/Ohana/src/imregister/src/spregister.c	(revision 3536)
@@ -1,5 +1,5 @@
 # include "imregister.h"
 # include "spreg.h"
-static char *version = "spregister $Revision: 1.4 $";
+static char *version = "spregister $Revision: 1.5 $";
 
 int main (int argc, char **argv) {
@@ -28,5 +28,11 @@
   }
   if (db.dbstate == LCK_EMPTY) {
-    /* create db header & matrix */
+    fits_init_header (&db.header);    
+    db.header.extend = TRUE;
+    fits_create_header (&db.header);
+    fits_create_matrix (&db.header, &db.matrix);
+    fits_print (&db.header, "NEXTEND", "%d", 1, 1);
+    db.ftable.header = &db.theader;
+    fits_table_set_Spectrum (&db.ftable, NULL, 0);
   } else {  
     if (!fits_db_load (&db)) {
Index: /trunk/Ohana/src/imregister/src/spsearch.c
===================================================================
--- /trunk/Ohana/src/imregister/src/spsearch.c	(revision 3535)
+++ /trunk/Ohana/src/imregister/src/spsearch.c	(revision 3536)
@@ -1,5 +1,5 @@
 # include "imregister.h"
 # include "spreg.h"
-static char *version = "spsearch $Revision: 1.3 $";
+static char *version = "spsearch $Revision: 1.4 $";
 
 int main (int argc, char **argv) {
@@ -14,5 +14,4 @@
   db.lockstate = (output.modify || output.delete) ? LCK_HARD : LCK_SOFT;
   db.timeout   = 300.0;
-
   fits_db_init (&db);
 
Index: /trunk/Ohana/src/libautocode/Makefile
===================================================================
--- /trunk/Ohana/src/libautocode/Makefile	(revision 3535)
+++ /trunk/Ohana/src/libautocode/Makefile	(revision 3536)
@@ -27,5 +27,8 @@
 	@echo done autocode
 
+# remember to add entries here to libohana/Makefile:AOBJ as well
 LIBOBJ = \
+$(SRC)/photreg.$(ARCH).o \
+$(SRC)/photreg-old.$(ARCH).o \
 $(SRC)/smpdata.$(ARCH).o \
 $(SRC)/spectrum.$(ARCH).o \
@@ -33,4 +36,6 @@
 
 LIBINC = \
+$(INC)/photreg.h \
+$(INC)/photreg-old.h \
 $(INC)/smpdata.h \
 $(INC)/spectrum.h \
Index: /trunk/Ohana/src/libautocode/def/common.h
===================================================================
--- /trunk/Ohana/src/libautocode/def/common.h	(revision 3535)
+++ /trunk/Ohana/src/libautocode/def/common.h	(revision 3536)
@@ -31,2 +31,13 @@
 # endif
 
+# define e_time unsigned int
+
+/*** this file uses data types which must have fixed sizes regardless 
+     of the platform.  It originally used the basic C primitives: 
+       float, double, int, short int, unsigned long int, etc.
+     this breaks under 64 bit (and probably on other systems).
+     I should define internal data types which should be set by the 
+     use of # define statements if needed.  I will cheat for now and use
+     the time_t to replace unsigned long int in this file 
+***/
+
Index: /trunk/Ohana/src/libautocode/def/photreg-old.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/photreg-old.d	(revision 3536)
+++ /trunk/Ohana/src/libautocode/def/photreg-old.d	(revision 3536)
@@ -0,0 +1,18 @@
+STRUCT PhotParsOld
+EXTNAME ZERO_POINTS
+TYPE BINTABLE
+SIZE 100
+
+# elements of data structure / FITS table
+
+FIELD ZP,    	  ZP_OBS,     float,       measured zero point,       mag
+FIELD ZPo,   	  ZP_REF,     float, 	   nominal zero point,        mag
+FIELD dZP,   	  ZP_ERR,     float, 	   error on zero point,       mag
+FIELD K,     	  C_AIRMASS,  float, 	   airmass coeff,             mag per airmass
+FIELD X,     	  C_COLOR,    float, 	   color coeff,               mag per mag
+FIELD tstart,	  START_TIME, e_time,      start time of measurement, seconds since 1 Jan 1970 UT
+FIELD tstop, 	  STOP_TIME,  e_time,      stop time of measurement,  seconds since 1 Jan 1970 UT
+FIELD c1,    	  C1_CODE,    short, 	   code 1 for color,          photcode
+FIELD c2,    	  C2_CODE,    short, 	   code 2 for color,          photcode
+FIELD photcode,   PHOTCODE,   short, 	   photcode,                  photcode
+FIELD label,      LABEL,      char[66],    data label
Index: /trunk/Ohana/src/libautocode/def/photreg.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/photreg.d	(revision 3536)
+++ /trunk/Ohana/src/libautocode/def/photreg.d	(revision 3536)
@@ -0,0 +1,21 @@
+STRUCT PhotPars
+EXTNAME ZERO_POINTS_3.0
+TYPE BINTABLE
+SIZE 108
+
+# elements of data structure / FITS table
+
+FIELD ZP,    	  ZP_OBS,     float,       measured zero point,       mag
+FIELD ZPo,   	  ZP_REF,     float, 	   nominal zero point,        mag
+FIELD dZP,   	  ZP_ERR,     float, 	   error on zero point,       mag
+FIELD K,     	  C_AIRMASS,  float, 	   airmass coeff,             mag per airmass
+FIELD X,     	  C_COLOR,    float, 	   color coeff,               mag per mag
+FIELD tstart,	  START_TIME, e_time,      start time of measurement, seconds since 1 Jan 1970 UT
+FIELD tstop, 	  STOP_TIME,  e_time,      stop time of measurement,  seconds since 1 Jan 1970 UT
+FIELD c1,    	  C1_CODE,    short, 	   code 1 for color,          photcode
+FIELD c2,    	  C2_CODE,    short, 	   code 2 for color,          photcode
+FIELD photcode,   PHOTCODE,   short, 	   photcode,                  photcode
+FIELD label,      LABEL,      char[64],    data label
+FIELD refcode,    REFCODE,    short, 	   photcode,                  photcode
+FIELD Ntime,      N_TIME,     int, 	   number of times
+FIELD Nmeas,      N_MEAS,     int, 	   number of measurements
Index: /trunk/Ohana/src/libautocode/def/spectrum.d
===================================================================
--- /trunk/Ohana/src/libautocode/def/spectrum.d	(revision 3535)
+++ /trunk/Ohana/src/libautocode/def/spectrum.d	(revision 3536)
@@ -1,3 +1,2 @@
-# name of structure type
 STRUCT  Spectrum
 EXTNAME SPECTRUM_DATABASE
Index: /trunk/Ohana/src/libautocode/generate
===================================================================
--- /trunk/Ohana/src/libautocode/generate	(revision 3535)
+++ /trunk/Ohana/src/libautocode/generate	(revision 3536)
@@ -103,4 +103,5 @@
 	if ($type eq "short")  { $pt1 = "I"; }
 	if ($type eq "int")    { $pt1 = "J"; }
+	if ($type eq "e_time") { $pt1 = "J"; }
 	if ($type eq "float")  { $pt1 = "E"; }
 	if ($type eq "double") { $pt1 = "D"; }
@@ -125,4 +126,5 @@
 	if ($type eq "short")  { $pt1 = sprintf "I%s", $length; }
 	if ($type eq "int")    { $pt1 = sprintf "I%s", $length; }
+	if ($type eq "e_time") { $pt1 = sprintf "I%s", $length; }
 	if ($type eq "float")  { $pt1 = sprintf "F%s", $length; }
 	if ($type eq "double") { $pt1 = sprintf "F%s", $length; }
@@ -181,9 +183,13 @@
 	    $n = 2;
 	}
-	if ($type eq "float")  {
+	if ($type eq "int")    {
 	    $T = "WORD";
 	    $n = 4;
 	}
-	if ($type eq "int")    {
+	if ($type eq "e_time")    {
+	    $T = "WORD";
+	    $n = 4;
+	}
+	if ($type eq "float")  {
 	    $T = "WORD";
 	    $n = 4;
@@ -217,8 +223,10 @@
 	    }
 	}
+	if ($type eq "byte")   { $Nbytes += 1; }
+	if ($type eq "short")  { $Nbytes += 2; }
+	if ($type eq "int")    { $Nbytes += 4; }
+	if ($type eq "e_time") { $Nbytes += 4; }
+	if ($type eq "float")  { $Nbytes += 4; }
 	if ($type eq "double") { $Nbytes += 8; }
-	if ($type eq "int")    { $Nbytes += 4; }
-	if ($type eq "short")  { $Nbytes += 2; }
-	if ($type eq "float")  { $Nbytes += 4; }
     }
     return ($Nbytes);
Index: /trunk/Ohana/src/libohana/Makefile
===================================================================
--- /trunk/Ohana/src/libohana/Makefile	(revision 3535)
+++ /trunk/Ohana/src/libohana/Makefile	(revision 3536)
@@ -48,4 +48,6 @@
 
 AOBJ = \
+$(ASRC)/photreg.$(ARCH).o \
+$(ASRC)/photreg-old.$(ARCH).o \
 $(ASRC)/smpdata.$(ARCH).o \
 $(ASRC)/spectrum.$(ARCH).o \
@@ -78,5 +80,5 @@
 	rm -f */*.o
 	rm -f */*.a
-#	cd $(AUTO) && make clean
+	cd $(AUTO) && make clean
 
 dist: clean
Index: /trunk/Ohana/src/libohana/include/dvo.h
===================================================================
--- /trunk/Ohana/src/libohana/include/dvo.h	(revision 3535)
+++ /trunk/Ohana/src/libohana/include/dvo.h	(revision 3536)
@@ -6,15 +6,4 @@
 # define LONEOS    0
 # define PANSTARRS 0
-
-/*** this file uses data types which must have fixed sizes regardless 
-     of the platform.  It originally used the basic C primitives: 
-       float, double, int, short int, unsigned long int, etc.
-     this breaks under 64 bit (and probably on other systems).
-     I should define internal data types which should be set by the 
-     use of # define statements if needed.  I will cheat for now and use
-     the time_t to replace unsigned long int in this file 
-***/
-
-# define e_time unsigned int
 
 /* image data modes in RegImage */
@@ -132,4 +121,6 @@
 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);
 
+# include <autocode.h>
+
 # if (LONEOS)
 # include <loneos.h>
@@ -144,6 +135,4 @@
 # endif
 
-# include <autocode.h>
-
 /* these functions refer to the DVO structures define in the includes above */
 int   Fread (void *ptr, int size, int nitems, FILE *f, char *type);
Index: /trunk/Ohana/src/libohana/include/elixir.h
===================================================================
--- /trunk/Ohana/src/libohana/include/elixir.h	(revision 3535)
+++ /trunk/Ohana/src/libohana/include/elixir.h	(revision 3536)
@@ -61,22 +61,4 @@
   char filename[256];
 } DetReg;    /* 416 bytes */
-
-/* Instant Zeropoint structure */
-typedef struct {
-  float ZP;                   /* measured zero point */
-  float ZPo;                  /* expected zero point */
-  float dZP;                  /* error on zero point */
-  float K;                    /* airmass term used */
-  float X;                    /* color term used */
-  e_time tstart;   /* start time of observation */
-  e_time tstop;    /* end time of observation */
-  short int c1;               /* photcode for color term */
-  short int c2;               /* photcode for color term */
-  short int photcode;         /* appropriate photcode */
-  char label[64];
-  short int refcode;          /* reference photometry system */
-  int Ntime;                  /* number of measurement times */
-  int Nmeas;                  /* number of data points */
-} PhotPars;    /* 108 bytes */
 
 /* average data as stored in the LONEOS database */
Index: /trunk/Ohana/src/libohana/include/loneos.h
===================================================================
--- /trunk/Ohana/src/libohana/include/loneos.h	(revision 3535)
+++ /trunk/Ohana/src/libohana/include/loneos.h	(revision 3536)
@@ -51,22 +51,4 @@
   char filename[256];
 } DetReg;    /* 416 bytes */
-
-/* Instant Zeropoint structure */
-typedef struct {
-  float ZP;                   /* measured zero point */
-  float ZPo;                  /* expected zero point */
-  float dZP;                  /* error on zero point */
-  float K;                    /* airmass term used */
-  float X;                    /* color term used */
-  e_time tstart;   /* start time of observation */
-  e_time tstop;    /* end time of observation */
-  short int c1;               /* photcode for color term */
-  short int c2;               /* photcode for color term */
-  short int photcode;         /* appropriate photcode */
-  char label[64];
-  short int refcode;          /* reference photometry system */
-  int Ntime;                  /* number of measurement times */
-  int Nmeas;                  /* number of data points */
-} PhotPars;    /* 108 bytes */
 
 /* average data as stored in the LONEOS database -- must be translated on load */
Index: /trunk/Ohana/src/libohana/include/panstarrs.h
===================================================================
--- /trunk/Ohana/src/libohana/include/panstarrs.h	(revision 3535)
+++ /trunk/Ohana/src/libohana/include/panstarrs.h	(revision 3536)
@@ -51,22 +51,4 @@
   char filename[256];
 } DetReg;    /* 416 bytes */
-
-/* Instant Zeropoint structure */
-typedef struct {
-  float ZP;                   /* measured zero point */
-  float ZPo;                  /* expected zero point */
-  float dZP;                  /* error on zero point */
-  float K;                    /* airmass term used */
-  float X;                    /* color term used */
-  e_time tstart;   /* start time of observation */
-  e_time tstop;    /* end time of observation */
-  short int c1;               /* photcode for color term */
-  short int c2;               /* photcode for color term */
-  short int photcode;         /* appropriate photcode */
-  char label[64];
-  short int refcode;          /* reference photometry system */
-  int Ntime;                  /* number of measurement times */
-  int Nmeas;                  /* number of data points */
-} PhotPars;    /* 108 bytes */
 
 /* average data as stored in the LONEOS database */
