Changeset 3609
- Timestamp:
- Mar 31, 2005, 4:57:00 PM (21 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 1 added
- 12 edited
-
libautocode/Makefile (modified) (3 diffs)
-
libautocode/def/common.h (modified) (2 diffs)
-
libautocode/def/photreg.d (modified) (1 diff)
-
libautocode/def/regimage.d (added)
-
libautocode/generate (modified) (5 diffs)
-
libfits/header/F_modify.c (modified) (4 diffs)
-
libohana/Makefile (modified) (8 diffs)
-
libohana/include/dvo.h (modified) (3 diffs)
-
libohana/include/elixir.h (modified) (3 diffs)
-
libohana/include/loneos.h (modified) (2 diffs)
-
libohana/include/panstarrs.h (modified) (2 diffs)
-
libohana/src/Fread.c (modified) (1 diff)
-
libohana/src/fits_db.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libautocode/Makefile
r3593 r3609 29 29 # remember to add entries here to libohana/Makefile:AOBJ as well 30 30 LIBOBJ = \ 31 $(SRC)/regimage.$(ARCH).o \ 31 32 $(SRC)/detreg.$(ARCH).o \ 32 33 $(SRC)/photreg.$(ARCH).o \ … … 37 38 38 39 LIBINC = \ 40 $(INC)/regimage.h \ 39 41 $(INC)/detreg.h \ 40 42 $(INC)/photreg.h \ … … 44 46 $(INC)/spectrum-ascii.h 45 47 46 COMINC = \47 $(DEF)/common.h48 49 48 $(LIBOBJ): $(INC)/autocode.h 50 49 51 50 $(INC)/autocode.h: $(LIBINC) 52 cat $(COMINC) $(LIBINC) > $(INC)/autocode.h 51 cat $(DEF)/common.h > $(INC)/autocode.h 52 cat $(LIBINC) >> $(INC)/autocode.h 53 @echo "# endif" >> $(INC)/autocode.h 53 54 @echo done with libautocode.a: 54 55 -
trunk/Ohana/src/libautocode/def/common.h
r3536 r3609 1 # include <stdio.h> 2 # include <stdarg.h> 3 # include <fitsio.h> 1 # include <ohana.h> 2 3 # ifndef AUTOCODE_H 4 # define AUTOCODE_H 5 /* matched endif is added by Makefile */ 4 6 5 7 # ifndef TRUE … … 32 34 33 35 # define e_time unsigned int 36 # define rawshort short 37 38 /*** rawshort is used to handle the broken pre-autocode photreg tables 39 fix the tables and remove this 40 ***/ 34 41 35 42 /*** this file uses data types which must have fixed sizes regardless -
trunk/Ohana/src/libautocode/def/photreg.d
r3536 r3609 17 17 FIELD photcode, PHOTCODE, short, photcode, photcode 18 18 FIELD label, LABEL, char[64], data label 19 FIELD refcode, REFCODE, short,photcode, photcode19 FIELD refcode, REFCODE, rawshort, photcode, photcode 20 20 FIELD Ntime, N_TIME, int, number of times 21 21 FIELD Nmeas, N_MEAS, int, number of measurements -
trunk/Ohana/src/libautocode/generate
r3536 r3609 41 41 # not a simple key/value entry 42 42 if ($key eq "FIELD") { 43 ($element, $field, $format, $comment, $unit) = split (/,\s+/, $value); 43 ($element, $field, $format, $comment, $unit) = split (/,\s+/, $value, 5); 44 # print "$element : $field : $format : $comment : $unit\n"; 44 45 push @element, $element; 45 46 push @field, $field; … … 106 107 if ($type eq "float") { $pt1 = "E"; } 107 108 if ($type eq "double") { $pt1 = "D"; } 109 110 if ($type eq "rawshort") { $pt1 = "I"; } 108 111 109 112 printf FILE " fits_define_bintable_column (header, "; … … 130 133 if ($type eq "double") { $pt1 = sprintf "F%s", $length; } 131 134 135 if ($type eq "rawshort") { $pt1 = sprintf "I%s", $length; } 136 132 137 printf FILE " fits_define_table_column (header, "; 133 138 printf FILE "\"%s\", ", $pt1; … … 179 184 next; 180 185 } 186 # this is a patch for old photreg tables: provide a fix for the tables 187 if ($type eq "rawshort") { 188 $N +=2; 189 next; 190 } 181 191 if ($type eq "short") { 182 192 $T = "BYTE"; … … 229 239 if ($type eq "float") { $Nbytes += 4; } 230 240 if ($type eq "double") { $Nbytes += 8; } 241 242 if ($type eq "rawshort") { $Nbytes += 2; } 231 243 } 232 244 return ($Nbytes); -
trunk/Ohana/src/libfits/header/F_modify.c
r3400 r3609 11 11 12 12 char comment[82], string[82], data[82]; 13 char *p, *q ;13 char *p, *qs, *qe; 14 14 va_list argp; 15 15 … … 27 27 p = fits_header_field (header, field, N); 28 28 if (p == NULL) { 29 30 29 /* new entry, find the END of the header */ 31 30 p = fits_header_field (header, "END", 1); … … 45 44 memset (p, ' ', FT_LINE_LENGTH); 46 45 } else { 47 q = fits_keyword_end (p); 48 q += 3; 49 q = MIN (p + 80, q); 50 strncpy (comment, q, p + 80 - q); 46 /* old entry, save the comment region (is this skipping a character for non-strings?) */ 47 qe = fits_keyword_end (p); 48 qe += 3; 49 qe = MIN (p + 80, qe); 50 strncpy (comment, qe, p + 80 - qe); 51 51 } 52 52 pad_ending (comment, ' ', 82); /* comment must contain spaces to the end */ … … 86 86 /* just a comment associated with a value. this is assumes a fixed format position for the comment */ 87 87 if (!strcmp (mode, "%C")) { 88 q = fits_keyword_end (p); 89 strncpy (data, p + 9, MAX (MIN ((q - p - 9), 71), 0)); 88 qe = fits_keyword_end (p); 89 qs = fits_keyword_start (p); 90 91 /* keep ' on ends, if there */ 92 if (qe[0] == 0x27) qe ++; 93 if (qs[-1] == 0x27) qs --; 94 95 strncpy (data, qs, MAX (MIN (qe - qs, 71), 0)); 90 96 strncpy (comment, va_arg (argp, char *), 80); 91 97 pad_ending (comment, ' ', 82); /* comment must contain spaces to the end */ 92 snprintf (string, 81, "%-8s=%21s / %-s", field, data, comment); 98 snprintf (string, 81, "%-8s= %s / %-s", field, data, comment); 99 /* this will keep the original line, but truncate the comment */ 93 100 } 94 101 -
trunk/Ohana/src/libohana/Makefile
r3593 r3609 13 13 DESTMAN = $(LMAN) 14 14 15 INCS = -I$(LINC) 16 CFLAGS = -Wunused -o $*.$(ARCH).o $(INCS) 17 LFLAGS = -c $(INCS) 15 CFLAGS = -I$(LINC) -D$(ARCH) 18 16 19 17 default: install … … 21 19 install: $(DESTLIB)/libohana.a 22 20 23 ohana: $(LIB)/libohana.$(ARCH).a21 libohana: $(LIB)/libohana.$(ARCH).a 24 22 25 HOBJ= \23 INC1 = \ 26 24 $(DESTINC)/Xohana.h \ 27 $(DESTINC)/ohana.h \ 25 $(DESTINC)/ohana.h 26 27 INC2 = \ 28 28 $(DESTINC)/loneos.h \ 29 29 $(DESTINC)/elixir.h \ … … 31 31 $(DESTINC)/dvo.h 32 32 33 LOBJ= \33 OBJ1 = \ 34 34 $(SRC)/version.$(ARCH).o \ 35 35 $(SRC)/string.$(ARCH).o \ … … 37 37 $(SRC)/glockfile.$(ARCH).o \ 38 38 $(SRC)/config.$(ARCH).o \ 39 $(SRC)/Fseek.$(ARCH).o 40 41 OBJ2 = \ 39 42 $(SRC)/coordops.$(ARCH).o \ 40 43 $(SRC)/Fread.$(ARCH).o \ 41 $(SRC)/Fseek.$(ARCH).o \42 44 $(SRC)/LoadPhotcodes.$(ARCH).o \ 43 45 $(SRC)/photfits.$(ARCH).o \ … … 48 50 49 51 AOBJ = \ 52 $(ASRC)/regimage.$(ARCH).o \ 50 53 $(ASRC)/detreg.$(ARCH).o \ 51 54 $(ASRC)/photreg.$(ARCH).o \ … … 55 58 $(ASRC)/spectrum-ascii.$(ARCH).o 56 59 57 autocode: 60 autocode: $(INC1) 58 61 cd $(AUTO) && make install 62 63 $(OBJ1): $(INC1) 64 $(OBJ2): $(INC2) 65 $(AOBJ): autocode 59 66 60 67 $(DESTLIB)/libohana.a: $(LIB)/libohana.$(ARCH).a … … 63 70 cp $(LIB)/libohana.$(ARCH).a $(DESTLIB)/libohana.a 64 71 65 $(LIB)/libohana.$(ARCH).a: autocode $( HOBJ) $(LOBJ)72 $(LIB)/libohana.$(ARCH).a: autocode $(OBJ1) $(AOBJ) $(OBJ2) 66 73 @if [ ! -d $(LIB) ]; then mkdir -p $(LIB); fi 67 74 rm -f $(LIB)/libohana.$(ARCH).a 68 ar rcv $(LIB)/libohana.$(ARCH).a $( LOBJ) $(AOBJ)75 ar rcv $(LIB)/libohana.$(ARCH).a $(OBJ1) $(AOBJ) $(OBJ2) 69 76 $(RANLIB) $(LIB)/libohana.$(ARCH).a 70 71 $(LOBJ): $(DESTINC)/ohana.h $(DESTINC)/loneos.h $(DESTINC)/elixir.h $(DESTINC)/panstarrs.h72 77 73 78 $(DESTINC)/%: $(INC)/% … … 88 93 89 94 .c.$(ARCH).o: 90 $(CC) $(CFLAGS) -c $< 95 $(CC) $(CFLAGS) -c $*.c -o $@ 96 @echo done with $*.o -
trunk/Ohana/src/libohana/include/dvo.h
r3536 r3609 1 # include <autocode.h> 1 2 2 3 # ifndef DVO_H 3 4 # define DVO_H 4 5 5 # define ELIXIR 1 6 # define LONEOS 0 7 # define PANSTARRS 0 6 /*** FITS DB structure ***/ 7 typedef struct { 8 FILE *f; 9 char *filename; 10 int dbstate; 11 int lockstate; 12 double timeout; 13 Header header; 14 Matrix matrix; 15 Header theader; 16 FTable ftable; 17 } FITS_DB; 18 19 /* the standard astrometric coordinates structure */ 20 typedef struct { 21 double crval1, crval2; 22 float crpix1, crpix2; 23 float cdelt1, cdelt2; 24 float pc1_1, pc1_2; 25 float pc2_1, pc2_2; 26 float polyterms[7][2]; 27 char ctype[15]; 28 char Npolyterms; 29 } Coords; /* 120 bytes / Coords */ 30 31 /* in fits_db.c */ 32 int fits_db_init PROTO((FITS_DB *db)); 33 int fits_db_create PROTO((FITS_DB *db)); 34 int fits_db_lock PROTO((FITS_DB *db, char *filename)); 35 int fits_db_load PROTO((FITS_DB *db)); 36 int fits_db_close PROTO((FITS_DB *db)); 37 int fits_db_free PROTO((FITS_DB *db)); 38 int fits_db_save PROTO((FITS_DB *db)); 39 int fits_db_update PROTO((FITS_DB *db, VTable *vtable)); 40 41 /* in coords.c */ 42 int XY_to_RD (double *ra, double *dec, double x, double y, Coords *coords); 43 int RD_to_XY (double *x, double *y, double ra, double dec, Coords *coords); 44 int fXY_to_RD (float *ra, float *dec, double x, double y, Coords *coords); 45 int fRD_to_XY (float *x, float *y, double ra, double dec, Coords *coords); 46 int GetCoords (Coords *coords, Header *header); 47 int PutCoords (Coords *coords, Header *header); 48 void RegisterMosaic (Coords *coords); 49 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch); 8 50 9 51 /* image data modes in RegImage */ … … 75 117 */ 76 118 77 /*** FITS DB structure ***/ 78 typedef struct { 79 FILE *f; 80 char *filename; 81 int dbstate; 82 int lockstate; 83 double timeout; 84 Header header; 85 Matrix matrix; 86 Header theader; 87 FTable ftable; 88 } FITS_DB; 119 /** we are going to replace these with autocode and appropriate conversions 120 for now, choose the appropriate table version **/ 89 121 90 /* the standard astrometric coordinates structure */ 91 typedef struct { 92 double crval1, crval2; 93 float crpix1, crpix2; 94 float cdelt1, cdelt2; 95 float pc1_1, pc1_2; 96 float pc2_1, pc2_2; 97 float polyterms[7][2]; 98 char ctype[15]; 99 char Npolyterms; 100 } Coords; /* 120 bytes / Coords */ 101 102 /*** FITS_DB functions ***/ 103 104 /* in fits_db.c */ 105 int fits_db_init PROTO((FITS_DB *db)); 106 int fits_db_lock PROTO((FITS_DB *db, char *filename)); 107 int fits_db_load PROTO((FITS_DB *db)); 108 int fits_db_close PROTO((FITS_DB *db)); 109 int fits_db_free PROTO((FITS_DB *db)); 110 int fits_db_save PROTO((FITS_DB *db)); 111 int fits_db_update PROTO((FITS_DB *db, VTable *vtable)); 112 113 /* in coords.c */ 114 int XY_to_RD (double *ra, double *dec, double x, double y, Coords *coords); 115 int RD_to_XY (double *x, double *y, double ra, double dec, Coords *coords); 116 int fXY_to_RD (float *ra, float *dec, double x, double y, Coords *coords); 117 int fRD_to_XY (float *x, float *y, double ra, double dec, Coords *coords); 118 int GetCoords (Coords *coords, Header *header); 119 int PutCoords (Coords *coords, Header *header); 120 void RegisterMosaic (Coords *coords); 121 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch); 122 123 # include <autocode.h> 122 # define ELIXIR 1 123 # define LONEOS 0 124 # define PANSTARRS 0 124 125 125 126 # if (LONEOS) … … 135 136 # endif 136 137 137 /* these functions refer to the DVO structures define in the includes above */ 138 /* these functions refer to the DVO structures defined in the includes above 139 * they are being replaced with autocode entries 140 */ 141 138 142 int Fread (void *ptr, int size, int nitems, FILE *f, char *type); 139 143 int Fwrite (void *ptr, int size, int nitems, FILE *f, char *type); -
trunk/Ohana/src/libohana/include/elixir.h
r3536 r3609 14 14 /************ database structures ************************************/ 15 15 16 # if (0) 16 17 /* structure for Image Registration Database */ 17 18 typedef struct { … … 43 44 e_time regtime; 44 45 } RegImage; /* 360 bytes / image */ 45 46 # endif 47 48 # if (0) 46 49 /* Detrend Database structure */ 47 50 typedef struct { … … 61 64 char filename[256]; 62 65 } DetReg; /* 416 bytes */ 66 # endif 63 67 64 68 /* average data as stored in the LONEOS database */ -
trunk/Ohana/src/libohana/include/loneos.h
r3536 r3609 34 34 } RegImage; /* 360 bytes / image */ 35 35 36 # if (0) 36 37 /* Detrend Database structure */ 37 38 typedef struct { … … 51 52 char filename[256]; 52 53 } DetReg; /* 416 bytes */ 54 # endif 53 55 54 56 /* average data as stored in the LONEOS database -- must be translated on load */ -
trunk/Ohana/src/libohana/include/panstarrs.h
r3536 r3609 34 34 } RegImage; /* 360 bytes / image */ 35 35 36 # if (0) 36 37 /* Detrend Database structure */ 37 38 typedef struct { … … 51 52 char filename[256]; 52 53 } DetReg; /* 416 bytes */ 54 # endif 53 55 54 56 /* average data as stored in the LONEOS database */ -
trunk/Ohana/src/libohana/src/Fread.c
r3466 r3609 1 # include <stdio.h>2 # include <string.h>3 1 # include <ohana.h> 4 2 # include <dvo.h> 3 5 4 int ByteSwap (char *ptr, int size, int nitems, char *type); 6 5 int ConvertStruct (char *buffer, int size, int Nbytes, char *type); -
trunk/Ohana/src/libohana/src/fits_db.c
r3538 r3609 1 # include "ohana.h"2 # include "dvo.h"1 # include <ohana.h> 2 # include <dvo.h> 3 3 4 /* init the db structure */ 4 5 int fits_db_init (FITS_DB *db) { 5 6 … … 8 9 db[0].matrix.buffer = NULL; 9 10 db[0].ftable.buffer = NULL; 11 db[0].ftable.header = &db[0].theader; 12 return (TRUE); 13 } 14 15 /* create an empty db */ 16 int fits_db_create (FITS_DB *db) { 17 fits_init_header (&db[0].header); 18 db[0].header.extend = TRUE; 19 fits_create_header (&db[0].header); 20 fits_create_matrix (&db[0].header, &db[0].matrix); 21 fits_print (&db[0].header, "NEXTEND", "%d", 1, 1); 10 22 db[0].ftable.header = &db[0].theader; 11 23 return (TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.
