Changeset 27295 for branches/eam_branches/largefiles.20100314/Ohana
- Timestamp:
- Mar 16, 2010, 6:44:32 AM (16 years ago)
- Location:
- branches/eam_branches/largefiles.20100314/Ohana
- Files:
-
- 1 deleted
- 177 edited
-
configure.tcsh (modified) (4 diffs)
-
src/addstar/include/addstar.h (modified) (8 diffs)
-
src/addstar/src/FilterStars.c (modified) (1 diff)
-
src/addstar/src/LoadData.c (modified) (2 diffs)
-
src/addstar/src/LoadDataPMM.c (modified) (1 diff)
-
src/addstar/src/LoadDataSDSS.c (modified) (2 diffs)
-
src/addstar/src/LoadHeaders.c (modified) (2 diffs)
-
src/addstar/src/LoadStars.c (modified) (1 diff)
-
src/addstar/src/MatchHeaders.c (modified) (5 diffs)
-
src/addstar/src/ReadStarsFITS.c (modified) (8 diffs)
-
src/addstar/src/ReadStarsSDSS.c (modified) (2 diffs)
-
src/addstar/src/SkyListForStars.c (modified) (1 diff)
-
src/addstar/src/SkyTableFromTychoIndex.c (modified) (1 diff)
-
src/addstar/src/UpdateDatabase_Image.c (modified) (1 diff)
-
src/addstar/src/UpdateDatabase_Reflist.c (modified) (1 diff)
-
src/addstar/src/UpdateImageIDs.c (modified) (1 diff)
-
src/addstar/src/addstar.c (modified) (4 diffs)
-
src/addstar/src/build_links.c (modified) (13 diffs)
-
src/addstar/src/calibrate.c (modified) (3 diffs)
-
src/addstar/src/dump.c (modified) (1 diff)
-
src/addstar/src/find_matches.c (modified) (6 diffs)
-
src/addstar/src/find_matches_closest.c (modified) (6 diffs)
-
src/addstar/src/find_matches_closest_refstars.c (modified) (6 diffs)
-
src/addstar/src/find_matches_refstars.c (modified) (6 diffs)
-
src/addstar/src/find_subset.c (modified) (1 diff)
-
src/addstar/src/get2mass.c (modified) (1 diff)
-
src/addstar/src/getgsc.c (modified) (2 diffs)
-
src/addstar/src/gettycho.c (modified) (3 diffs)
-
src/addstar/src/getusno.c (modified) (2 diffs)
-
src/addstar/src/getusnob.c (modified) (2 diffs)
-
src/addstar/src/greference.c (modified) (1 diff)
-
src/addstar/src/grefstars.c (modified) (1 diff)
-
src/addstar/src/gztest.c (modified) (3 diffs)
-
src/addstar/src/resort_catalog.c (modified) (2 diffs)
-
src/addstar/src/update_coords.c (modified) (1 diff)
-
src/delstar/src/gimages.c (modified) (1 diff)
-
src/dvomerge/src/merge_catalogs.c (modified) (1 diff)
-
src/dvomerge/src/merge_catalogs_new.c (modified) (1 diff)
-
src/dvomerge/src/merge_catalogs_old.c (modified) (5 diffs)
-
src/elixir/src/DumpStatus.c (modified) (1 diff)
-
src/elixir/src/MachineOps.c (modified) (1 diff)
-
src/elixir/src/MsgOps.c (modified) (1 diff)
-
src/fixcat/src/aregion.c (modified) (1 diff)
-
src/fixcat/src/find_bright_stars.c (modified) (2 diffs)
-
src/fixcat/src/find_images.c (modified) (1 diff)
-
src/fixcat/src/find_matches.c (modified) (2 diffs)
-
src/fixcat/src/gcatalog.c (modified) (1 diff)
-
src/fixcat/src/gcatstats.c (modified) (1 diff)
-
src/fixcat/src/wcatalog.c (modified) (3 diffs)
-
src/gastro/src/getusno.c (modified) (2 diffs)
-
src/gastro/src/gfit.c (modified) (1 diff)
-
src/gastro/src/gfitpoly.c (modified) (1 diff)
-
src/gastro/src/gheader.c (modified) (5 diffs)
-
src/gastro/src/gstars.c (modified) (1 diff)
-
src/gastro2/src/getusno.c (modified) (2 diffs)
-
src/gastro2/src/getusnob.c (modified) (2 diffs)
-
src/gastro2/src/gheader2.c (modified) (5 diffs)
-
src/gastro2/src/gstars2.c (modified) (3 diffs)
-
src/getstar/src/ReadImageFiles.c (modified) (6 diffs)
-
src/gophot/src/gophot.c (modified) (1 diff)
-
src/imclean/src/wstars.c (modified) (1 diff)
-
src/imregister/base/WriteFIFO.c (modified) (1 diff)
-
src/imregister/imphot/rtext.c (modified) (3 diffs)
-
src/imregister/src/imphotmerge.c (modified) (5 diffs)
-
src/kapa2/src/Image.c (modified) (1 diff)
-
src/kapa2/src/LoadPicture.c (modified) (6 diffs)
-
src/libautocode/def/autocode.c (modified) (5 diffs)
-
src/libautocode/def/autocode.h (modified) (1 diff)
-
src/libdvo/include/dvo.h (modified) (13 diffs)
-
src/libdvo/include/dvo_util.h (modified) (3 diffs)
-
src/libdvo/src/LoadPhotcodesFITS.c (modified) (1 diff)
-
src/libdvo/src/cmf-ps1-v1-alt.c (modified) (3 diffs)
-
src/libdvo/src/coordops.c (modified) (1 diff)
-
src/libdvo/src/dvo_catalog.c (modified) (3 diffs)
-
src/libdvo/src/dvo_catalog_mef.c (modified) (16 diffs)
-
src/libdvo/src/dvo_catalog_raw.c (modified) (32 diffs)
-
src/libdvo/src/dvo_catalog_split.c (modified) (30 diffs)
-
src/libdvo/src/dvo_convert.c (modified) (12 diffs)
-
src/libdvo/src/dvo_convert_PS1_REF.c (modified) (2 diffs)
-
src/libdvo/src/dvo_image.c (modified) (4 diffs)
-
src/libdvo/src/dvo_image_raw.c (modified) (9 diffs)
-
src/libdvo/src/dvo_util.c (modified) (6 diffs)
-
src/libdvo/src/dvosorts.c (modified) (5 diffs)
-
src/libdvo/src/fits_db.c (modified) (3 diffs)
-
src/libdvo/src/skyregion_ops.c (modified) (1 diff)
-
src/libfits/header/F_H_field.c (modified) (9 diffs)
-
src/libfits/header/F_copy_H.c (modified) (2 diffs)
-
src/libfits/header/F_create_H.c (modified) (2 diffs)
-
src/libfits/header/F_delete.c (modified) (2 diffs)
-
src/libfits/header/F_modify.c (modified) (2 diffs)
-
src/libfits/header/F_print.c (modified) (2 diffs)
-
src/libfits/header/F_read_H.c (modified) (4 diffs)
-
src/libfits/header/F_read_XH.c (modified) (3 diffs)
-
src/libfits/header/F_scan.c (modified) (4 diffs)
-
src/libfits/header/F_write_H.c (modified) (3 diffs)
-
src/libfits/include/gfitsio.h (modified) (12 diffs)
-
src/libfits/matrix/F_add_M.c (modified) (2 diffs)
-
src/libfits/matrix/F_add_M_value.c (modified) (1 diff)
-
src/libfits/matrix/F_compress_M.c (modified) (5 diffs)
-
src/libfits/matrix/F_convert_format.c (modified) (6 diffs)
-
src/libfits/matrix/F_copy_M.c (modified) (1 diff)
-
src/libfits/matrix/F_create_M.c (modified) (2 diffs)
-
src/libfits/matrix/F_get_M_value.c (modified) (2 diffs)
-
src/libfits/matrix/F_insert_M.c (modified) (1 diff)
-
src/libfits/matrix/F_load_M.c (modified) (3 diffs)
-
src/libfits/matrix/F_matrix.c (modified) (2 diffs)
-
src/libfits/matrix/F_read_M.c (modified) (1 diff)
-
src/libfits/matrix/F_read_portion.c (modified) (5 diffs)
-
src/libfits/matrix/F_read_segment.c (modified) (5 diffs)
-
src/libfits/matrix/F_set_M_value.c (modified) (1 diff)
-
src/libfits/matrix/F_write_M.c (modified) (4 diffs)
-
src/libfits/table/F_create_T.c (modified) (4 diffs)
-
src/libfits/table/F_create_TH.c (modified) (2 diffs)
-
src/libfits/table/F_define_column.c (modified) (6 diffs)
-
src/libfits/table/F_get_column.c (modified) (6 diffs)
-
src/libfits/table/F_read_T.c (modified) (19 diffs)
-
src/libfits/table/F_read_TH.c (modified) (5 diffs)
-
src/libfits/table/F_set_column.c (modified) (4 diffs)
-
src/libfits/table/F_table_format.c (modified) (12 diffs)
-
src/libfits/table/F_table_row.c (modified) (7 diffs)
-
src/libfits/table/F_table_varlength.c (modified) (5 diffs)
-
src/libfits/table/F_write_T.c (modified) (7 diffs)
-
src/libfits/table/F_write_TH.c (modified) (2 diffs)
-
src/libohana/src/CommOps.c (modified) (1 diff)
-
src/libohana/src/Fread.c (modified) (5 diffs)
-
src/libohana/src/findexec.c (modified) (1 diff)
-
src/libohana/src/glockfile.c (modified) (2 diffs)
-
src/lightcurve/src/fix_header.c (modified) (6 diffs)
-
src/markrock/src/find_bright_stars.c (modified) (2 diffs)
-
src/markrock/src/gcatstats.c (modified) (2 diffs)
-
src/markrock/src/wrocks.c (modified) (1 diff)
-
src/markstar/src/find_bright_stars.c (modified) (2 diffs)
-
src/markstar/src/find_matches.c (modified) (2 diffs)
-
src/markstar/src/gcatstats.c (modified) (2 diffs)
-
src/misc/src/addastro.c (modified) (3 diffs)
-
src/misc/src/applyscat.c (modified) (3 diffs)
-
src/misc/src/fakecmp.c (modified) (5 diffs)
-
src/misc/src/fakestars.c (modified) (2 diffs)
-
src/misc/src/fiximg.c (modified) (1 diff)
-
src/misc/src/fixsimple.c (modified) (2 diffs)
-
src/misc/src/striphead.c (modified) (1 diff)
-
src/mosastro/src/getusno.c (modified) (2 diffs)
-
src/mosastro/src/getusnob.c (modified) (2 diffs)
-
src/mosastro/src/match.c (modified) (3 diffs)
-
src/mosastro/src/output.c (modified) (1 diff)
-
src/mosastro/src/rfits.c (modified) (1 diff)
-
src/mosastro/src/rtext.c (modified) (1 diff)
-
src/mosastro/src/wstars.c (modified) (2 diffs)
-
src/opihi/cmd.data/rd.c (modified) (2 diffs)
-
src/opihi/cmd.data/rdseg.c (modified) (1 diff)
-
src/opihi/cmd.data/read_vectors.c (modified) (6 diffs)
-
src/opihi/cmd.data/wd.c (modified) (4 diffs)
-
src/opihi/dvo/aregion.c (modified) (1 diff)
-
src/opihi/dvo/cmpload.c (modified) (1 diff)
-
src/opihi/dvo/cmpread.c (modified) (3 diffs)
-
src/opihi/dvo/detrend.c (modified) (1 diff)
-
src/opihi/dvo/elixir.c (modified) (1 diff)
-
src/opihi/dvo/find_regions.c (modified) (3 diffs)
-
src/opihi/dvo/gstar.c (modified) (2 diffs)
-
src/opihi/dvo/imbox.c (modified) (2 diffs)
-
src/opihi/dvo/imrough.c (modified) (1 diff)
-
src/opihi/dvo/imsearch.c (modified) (2 diffs)
-
src/opihi/dvo/lcurve.c (modified) (2 diffs)
-
src/opihi/dvo/lightcurve.c (modified) (2 diffs)
-
src/opihi/dvo/simage.c (modified) (1 diff)
-
src/opihi/dvo/subpix.c (modified) (2 diffs)
-
src/opihi/lib.shell/BufferOps.c (modified) (2 diffs)
-
src/opihi/lib.shell/stack_math.c (modified) (1 diff)
-
src/photdbc/src/join_stars.c (modified) (2 diffs)
-
src/relphot/src/GridOps.c (modified) (1 diff)
-
src/relphot/src/load_images.c (modified) (2 diffs)
-
src/skycalc/src/misc.c (deleted)
-
src/tools/src/ckfits.c (modified) (3 diffs)
-
src/tools/src/fhead.c (modified) (2 diffs)
-
src/tools/src/fields.c (modified) (2 diffs)
-
src/tools/src/fits_insert.c (modified) (7 diffs)
-
src/tools/src/ftable.c (modified) (12 diffs)
-
src/tools/src/mefhead.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/largefiles.20100314/Ohana/configure.tcsh
r21508 r27295 13 13 set use_tcmalloc = 0 14 14 set use_gnu99 = 0 15 set use_largefiles = 0 15 16 16 17 set prefix = "" … … 74 75 set use_gnu99 = 1 75 76 breaksw; 77 case --use-largefiles 78 set use_largefiles = 1 79 breaksw; 76 80 case --pedantic 77 81 set pedantic = 1 … … 180 184 # use_gnu99 181 185 if ($use_gnu99) set CFLAGS = "$CFLAGS -std=gnu99" 186 187 # use_largefiles 188 # replace with `getconf LFS_CFLAGS` 189 if ($use_largefiles) set CFLAGS = "$CFLAGS -D_FILE_OFFSET_BITS=64" 182 190 183 191 if (! $?CPPFLAGS) then … … 650 658 -h, --help display this help and exit 651 659 --enable-optimize enable compiler optimization (-O2) 660 --enable-profile enable 652 661 --enable-memcheck enable ohana memory tests 653 662 --pedantic include -Wall -Werror on compilation 663 --use-tcmalloc use the alternate tcmalloc from Google 664 --use-gnu99 use gnu99 flags to ensure C99 compatibility 665 --use-largefiles ensure large file compatibility 654 666 655 667 Installation directories: -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/include/addstar.h
r26384 r27295 44 44 45 45 typedef struct { 46 int Nstars;46 unsigned int Nstars; 47 47 Stars *stars; 48 48 int Nimages; … … 151 151 AddstarClientOptions args PROTO((int argc, char **argv, AddstarClientOptions options)); 152 152 153 void AddToCalibration PROTO((Average *average, SecFilt *secfilt, Measure *measure, Measure *new, int *next, int Nstar));153 void AddToCalibration PROTO((Average *average, SecFilt *secfilt, Measure *measure, Measure *new, off_t *next, off_t Nstar)); 154 154 void FindCalibration PROTO((Image *image)); 155 155 FILE *GetDB PROTO((int *state)); 156 156 void InitCalibration PROTO((int mode)); 157 void SaveCalibration PROTO((float Mo, float dMo, float Mr, float dMr, float Mi, int N));157 void SaveCalibration PROTO((float Mo, float dMo, float Mr, float dMr, float Mi, off_t N)); 158 158 void SetProtect PROTO((int mode)); 159 159 int SetSignals PROTO((void)); … … 165 165 SkyTable *SkyTableFromTychoIndex PROTO((char *filename, int VERBOSE)); 166 166 void check_permissions PROTO((char *basefile)); 167 int dump_rawstars PROTO((Stars *stars, int Nstars));167 int dump_rawstars PROTO((Stars *stars, unsigned int Nstars)); 168 168 int edge_check PROTO((double *x1, double *y1, double *x2, double *y2)); 169 169 Image *fakeimage PROTO((char *rootname, int *Nimage, int photcode)); 170 170 171 int find_matches PROTO((SkyRegion *region, Stars *stars,int Nstars, Catalog *catalog, AddstarClientOptions options));172 int find_matches_closest PROTO((SkyRegion *region, Stars *stars,int Nstars, Catalog *catalog, AddstarClientOptions options));173 int find_matches_refstars PROTO((SkyRegion *region, Stars **stars,int Nstars, Catalog *catalog, AddstarClientOptions options));174 int find_matches_closest_refstars PROTO((SkyRegion *region, Stars **stars,int Nstars, Catalog *catalog, AddstarClientOptions options));175 176 Stars **find_subset PROTO((SkyRegion *region, Stars *stars, int Nstars,int *NSTARS));171 int find_matches PROTO((SkyRegion *region, Stars *stars, unsigned int Nstars, Catalog *catalog, AddstarClientOptions options)); 172 int find_matches_closest PROTO((SkyRegion *region, Stars *stars, unsigned int Nstars, Catalog *catalog, AddstarClientOptions options)); 173 int find_matches_refstars PROTO((SkyRegion *region, Stars **stars, unsigned int Nstars, Catalog *catalog, AddstarClientOptions options)); 174 int find_matches_closest_refstars PROTO((SkyRegion *region, Stars **stars, unsigned int Nstars, Catalog *catalog, AddstarClientOptions options)); 175 176 Stars **find_subset PROTO((SkyRegion *region, Stars *stars, unsigned int Nstars, unsigned int *NSTARS)); 177 177 int gcatalog PROTO((Catalog *catalog)); 178 Stars *get2mass PROTO((SkyRegion *patch, int photcode, int mode, int *NSTARS));178 Stars *get2mass PROTO((SkyRegion *patch, int photcode, int mode, unsigned int *NSTARS)); 179 179 double get_subpix PROTO((double x, double y)); 180 180 181 Stars *greference PROTO((char *Refcat, SkyRegion *catstats, int photcode, int *nstars));182 Stars *getgsc PROTO((SkyRegion *patch, int *NSTARS));183 Stars *gettycho PROTO((SkyRegion *catstats, int photcode, int *Nstars));184 Stars *getusno PROTO((SkyRegion *catstats, int photcode, int *Nstars));185 Stars *getusnob PROTO((SkyRegion *catstats, int photcode, int *Nstars));181 Stars *greference PROTO((char *Refcat, SkyRegion *catstats, int photcode, unsigned int *nstars)); 182 Stars *getgsc PROTO((SkyRegion *patch, unsigned int *NSTARS)); 183 Stars *gettycho PROTO((SkyRegion *catstats, int photcode, unsigned int *Nstars)); 184 Stars *getusno PROTO((SkyRegion *catstats, int photcode, unsigned int *Nstars)); 185 Stars *getusnob PROTO((SkyRegion *catstats, int photcode, unsigned int *Nstars)); 186 186 187 187 // load text-based stars (REF only in the sense of REF photcodes) 188 Stars *grefstars PROTO((char *file, int photcode, int *Nstars));189 190 Stars *LoadStars PROTO((char *file, int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options));188 Stars *grefstars PROTO((char *file, int photcode, unsigned int *Nstars)); 189 190 Stars *LoadStars PROTO((char *file, unsigned int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options)); 191 191 Header **LoadHeaders PROTO((FILE *f, int *mode, int *Nheader)); 192 HeaderSet *MatchHeaders PROTO(( int **extsize, int *nimage, int mode, Header **headers, int Nheaders));193 int LoadData PROTO((FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int NheaderSets, AddstarClientOptions *options));192 HeaderSet *MatchHeaders PROTO((off_t **extsize, int *nimage, int mode, Header **headers, int Nheaders)); 193 int LoadData PROTO((FILE *f, char *file, Image **images, int *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, int NheaderSets, AddstarClientOptions *options)); 194 194 int GetZeroPointExposure PROTO((Header **headers, HeaderSet *headerSets, int Nimages)); 195 195 … … 199 199 void lock_image_db PROTO((FITS_DB *db, char *filename)); 200 200 int main PROTO((int argc, char **argv)); 201 void make_backup PROTO((char *filename));202 int match_refstars PROTO((Stars *stars, int Nstars));203 void mkcatalog PROTO((SkyRegion *region, Catalog *catalog));204 201 double opening_angle PROTO((double x1, double y1, double x2, double y2, double x3, double y3)); 205 202 int parse_time PROTO((Header *header)); 206 Stars *rd_gsc PROTO((char *filename, int *nstars));203 Stars *rd_gsc PROTO((char *filename, unsigned int *nstars)); 207 204 int replace_match PROTO((Average *average, Measure *measure, Stars *star)); 208 205 void resort_catalog PROTO((Catalog *catalog)); 209 Stars *rfits PROTO((FILE *f, unsigned int *nstars));210 Stars *rtext PROTO((FILE *f, unsigned int *nstars));211 206 Stars *ReadStarsFITS PROTO((FILE *f, Header *header, Header *in_theader, unsigned int *nstars)); 212 207 Stars *ReadStarsTEXT PROTO((FILE *f, unsigned int *nstars)); … … 214 209 int ReadImageHeader PROTO((Header *header, Image *image, int photcode)); 215 210 Stars *FilterStars PROTO((Stars *instars, Image *image, unsigned int imageID)); 216 Stars *MergeStars PROTO((Stars *stars, int *Nstars, Stars *instars, int Ninstars)); 217 void save_pt_catalog PROTO((Catalog *catalog)); /*** choose new name ***/ 211 Stars *MergeStars PROTO((Stars *stars, unsigned int *Nstars, Stars *instars, unsigned int Ninstars)); 218 212 double scat_subpix PROTO((double x, double y)); 219 time_t short_date_to_sec PROTO((char *date)); 220 void sort_lists PROTO((float *X, float *Y, int *S, int N)); 221 void sort_stars PROTO((Stars *stars, int N)); 222 int str_to_radec PROTO((double *ra, double *dec, char *str1, char *str2)); 223 void unlock_image_db PROTO((FITS_DB *db)); 224 void update_coords PROTO((Average *average, Measure *measure, int *next)); 225 void wcatalog PROTO((Catalog *catalog)); 226 void free_catalog PROTO((Catalog *catalog)); 227 void wimage PROTO((FITS_DB *db, Image *image)); 228 void create_image_db PROTO((FITS_DB *db)); 229 void set_db PROTO((FITS_DB *in)); 230 void uppercase PROTO((char *string)); 231 void fsort PROTO((float *X, int N)); 232 void fsort2 PROTO((float *X, float *Y, int N)); 233 int *init_measure_links PROTO((Average *average, int Naverage, Measure *measure, int Nmeasure)); 234 int *init_missing_links PROTO((Average *average, int Naverage, Missing *missing, int Nmissing)); 235 int add_meas_link PROTO((Average *average, int *next, int Nmeasure, int NMEASURE)); 236 int add_miss_link PROTO((Average *average, int *next, int Nmissing)); 237 int *build_measure_links PROTO((Average *average, int Naverage, Measure *measure, int Nmeasure)); 238 Measure *sort_measure PROTO((Average *average, int Naverage, Measure *measure, int Nmeasure, int *next)); 239 Missing *sort_missing PROTO((Average *average, int Naverage, Missing *missing, int Nmissing, int *next_miss)); 240 int ImageOptions PROTO((AddstarClientOptions *options, Image *images, int Nimages)); 213 void update_coords PROTO((Average *average, Measure *measure, off_t *next)); 214 off_t *init_measure_links PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure)); 215 off_t *init_missing_links PROTO((Average *average, off_t Naverage, Missing *missing, off_t Nmissing)); 216 off_t add_meas_link PROTO((Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE)); 217 off_t add_miss_link PROTO((Average *average, off_t *next_miss, off_t Nmissing)); 218 off_t *build_measure_links PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure)); 219 Measure *sort_measure PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next_meas)); 220 Missing *sort_missing PROTO((Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_miss)); 221 int ImageOptions PROTO((AddstarClientOptions *options, Image *images, off_t Nimages)); 241 222 int GetFileMode PROTO((Header *header)); 242 223 AddstarClientOptions args_client PROTO((int argc, char **argv, AddstarClientOptions options)); … … 251 232 int WaitServerSocket PROTO((int InitSocket, SockAddress *Address, int *validIP, int Nvalid)); 252 233 int GetClientSocket PROTO((char *hostname)); 253 int UpdateDatabase_Image PROTO((AddstarClientOptions *options, Image *images, int Nimages, Coords *mosaic, Stars *stars, int Nstars));254 int UpdateDatabase_Reflist PROTO((AddstarClientOptions *options, Stars *stars, int Nstars));234 int UpdateDatabase_Image PROTO((AddstarClientOptions *options, Image *images, int Nimages, Coords *mosaic, Stars *stars, unsigned int Nstars)); 235 int UpdateDatabase_Reflist PROTO((AddstarClientOptions *options, Stars *stars, unsigned int Nstars)); 255 236 int UpdateDatabase_Refcat PROTO((AddstarClientOptions *options, SkyRegion *UserPatch, char *refcat)); 256 SkyList *SkyListForStars PROTO((SkyTable *table, int depth, Stars *stars, int Nstars));237 SkyList *SkyListForStars PROTO((SkyTable *table, int depth, Stars *stars, unsigned int Nstars)); 257 238 SkyList *SkyListExistingSubset PROTO((SkyList *input, char *path)); 258 239 int SkyListSetPath PROTO((SkyList *list, char *path)); … … 265 246 int NewReflist_Thread PROTO((int BindSocket)); 266 247 267 Stars *Convert_SMPDATA PROTO((FTable *table, int *nstars));268 Stars *Convert_PS1_DEV_0 PROTO((FTable *table, int *nstars));269 Stars *Convert_PS1_DEV_1 PROTO((FTable *table, int *nstars));270 Stars *Convert_PS1_V1 PROTO((FTable *table, int *nstars));271 Stars *Convert_PS1_V1_Alt PROTO((FTable *table, int *nstars));272 Stars *Convert_PS1_V2 PROTO((FTable *table, int *nstars));248 Stars *Convert_SMPDATA PROTO((FTable *table, unsigned int *nstars)); 249 Stars *Convert_PS1_DEV_0 PROTO((FTable *table, unsigned int *nstars)); 250 Stars *Convert_PS1_DEV_1 PROTO((FTable *table, unsigned int *nstars)); 251 Stars *Convert_PS1_V1 PROTO((FTable *table, unsigned int *nstars)); 252 Stars *Convert_PS1_V1_Alt PROTO((FTable *table, unsigned int *nstars)); 253 Stars *Convert_PS1_V2 PROTO((FTable *table, unsigned int *nstars)); 273 254 274 255 int InitStar PROTO((Stars *star)); … … 278 259 int args_skycells (int argc, char **argv); 279 260 int ConfigInit_skycells (int *argc, char **argv); 280 int UpdateImageIDs (Stars *stars, int Nstars, Image *images, int Nimages);281 int LoadDataSDSS (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int Nimages);261 int UpdateImageIDs (Stars *stars, unsigned int Nstars, Image *images, int Nimages); 262 int LoadDataSDSS (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, int Nimages); 282 263 int altaz (double *alt, double *az, double ha, double dec, double latitude); 283 264 284 int LoadDataPMM (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars);265 int LoadDataPMM (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, unsigned int *Nstars); 285 266 PhotCode *LoadMetadataPMM (char *datafile, Image *image); 286 267 time_t pmm_date_to_sec (char *date, char *time); -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/FilterStars.c
r26384 r27295 109 109 } 110 110 111 Stars *MergeStars (Stars *stars, int *Nstars, Stars *instars,int Ninstars) {111 Stars *MergeStars (Stars *stars, unsigned int *Nstars, Stars *instars, unsigned int Ninstars) { 112 112 113 113 int i, j; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/LoadData.c
r26390 r27295 6 6 7 7 // examine the header sets and set the Image entries for the the valid images 8 int LoadData (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int Nimages, AddstarClientOptions *options) {8 int LoadData (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, int Nimages, AddstarClientOptions *options) { 9 9 10 10 char *name; 11 int i, j, Nvalid, Nhead, Ndata, Nskip; 11 off_t Nskip; 12 int i, j, Nvalid, Nhead, Ndata; 12 13 uint32_t parentID = UINT32_MAX; 13 14 Stars *inStars; … … 76 77 Nskip += extsize[j]; 77 78 } 78 fseek (f, Nskip, SEEK_SET);79 fseeko (f, Nskip, SEEK_SET); 79 80 80 81 inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &images[0][Nvalid].nstar); -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/LoadDataPMM.c
r21508 r27295 16 16 # define MAG_INDEX_ASC 22 17 17 18 int LoadDataPMM (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars) {18 int LoadDataPMM (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, unsigned int *Nstars) { 19 19 20 20 char *name, *buffer; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/LoadDataSDSS.c
r16967 r27295 4 4 // there should only be a single data set (phu + table) in this file 5 5 // each SDSS data set corresponds to 5 images (ugriz) 6 int LoadDataSDSS (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int Nimages) {6 int LoadDataSDSS (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, int Nimages) { 7 7 8 off_t Nskip; 8 9 char *name; 9 int j, Nvalid, Nhead, Ndata , Nskip;10 int j, Nvalid, Nhead, Ndata; 10 11 unsigned int Ninstars; 11 12 Stars *inStars; … … 36 37 Nskip += extsize[j]; 37 38 } 38 fseek (f, Nskip, SEEK_SET);39 fseeko (f, Nskip, SEEK_SET); 39 40 40 41 // XXX I think this is an error? should this be &images[0][Nvalid] ?? -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/LoadHeaders.c
r16810 r27295 4 4 Header **LoadHeaders (FILE *f, int *mode, int *Nheaders) { 5 5 6 int i, status, Nskip, NHEADERS; 6 off_t Nskip; 7 int i, status, NHEADERS; 7 8 Header **headers; 8 9 … … 31 32 // advance to the next header 32 33 Nskip = gfits_data_size (headers[i]); 33 fseek (f, Nskip, SEEK_CUR);34 fseeko (f, Nskip, SEEK_CUR); 34 35 if (i == NHEADERS - 1) { 35 36 NHEADERS += 10; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/LoadStars.c
r26286 r27295 1 1 # include "addstar.h" 2 2 3 Stars *LoadStars (char *filename, int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options) {3 Stars *LoadStars (char *filename, unsigned int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options) { 4 4 5 int i, Nfile, NFILE, Nheaders, NheaderSets, mode, *extsize; 5 off_t *extsize; 6 int i, Nfile, NFILE, Nheaders, NheaderSets, mode; 6 7 char **file, line[1024]; 7 8 FILE *f; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/MatchHeaders.c
r26258 r27295 3 3 // XXX largely psphot specific 4 4 5 HeaderSet *MatchHeaders ( int **extsize, int *nimage, int mode, Header **headers, int Nheaders) {5 HeaderSet *MatchHeaders (off_t **extsize, int *nimage, int mode, Header **headers, int Nheaders) { 6 6 7 7 int i, j, Nimage, NIMAGE; … … 9 9 HeaderSet *headerSets; 10 10 11 ALLOCATE (extsize[0], int, Nheaders);11 ALLOCATE (extsize[0], off_t, Nheaders); 12 12 13 13 Nimage = 0; … … 34 34 headerSets[0].extnum_head = 0; 35 35 headerSets[0].extnum_data = 1; 36 extsize[0][0] = headers[0][0]. size;36 extsize[0][0] = headers[0][0].datasize; 37 37 *nimage = 1; 38 38 return headerSets; … … 42 42 for (i = 0; i < Nheaders; i++) { 43 43 if (mode == SIMPLE_CMP) { 44 extsize[0][i] = headers[i][0]. size;44 extsize[0][i] = headers[i][0].datasize; 45 45 } else { 46 extsize[0][i] = headers[i][0]. size + gfits_data_size (headers[i]);46 extsize[0][i] = headers[i][0].datasize + gfits_data_size (headers[i]); 47 47 } 48 48 … … 92 92 // extension matched to the header in the PHU 93 93 if (Nimage == 0) { 94 extsize[0][0] = headers[0][0]. size + gfits_data_size (headers[0]);95 extsize[0][1] = headers[1][0]. size + gfits_data_size (headers[1]);94 extsize[0][0] = headers[0][0].datasize + gfits_data_size (headers[0]); 95 extsize[0][1] = headers[1][0].datasize + gfits_data_size (headers[1]); 96 96 gfits_scan (headers[1], ExtnameKeyword, "%s", 1, extname); 97 97 if (!strcmp (extname, "SMPFILE")) { -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/ReadStarsFITS.c
r24400 r27295 5 5 Stars *ReadStarsFITS (FILE *f, Header *header, Header *in_theader, unsigned int *nstars) { 6 6 7 int Nskip, Nstars; 7 off_t Nskip; 8 unsigned int Nstars; 8 9 char type[80]; 9 10 Header theader; … … 16 17 } else { 17 18 table.header = in_theader; 18 Nskip = in_theader[0]. size;19 fseek (f, Nskip, SEEK_CUR);19 Nskip = in_theader[0].datasize; 20 fseeko (f, Nskip, SEEK_CUR); 20 21 } 21 22 … … 57 58 } 58 59 59 Stars *Convert_SMPDATA (FTable *table, int *nstars) { 60 61 int i, Nstars, swapped; 60 Stars *Convert_SMPDATA (FTable *table, unsigned int *nstars) { 61 62 unsigned int i, Nstars; 63 char swapped; 62 64 double ZeroPt; 63 65 Stars *stars = NULL; … … 96 98 } 97 99 98 Stars *Convert_PS1_DEV_0 (FTable *table, int *nstars) {99 100 int i, Nstars;100 Stars *Convert_PS1_DEV_0 (FTable *table, unsigned int *nstars) { 101 102 unsigned int i, Nstars; 101 103 double ZeroPt; 102 104 Stars *stars; … … 140 142 // XXX I need to make the IPP I/O functions and these functions 141 143 // consistent wrt ZERO_POINT.... 142 Stars *Convert_PS1_DEV_1 (FTable *table, int *nstars) {143 144 int i, Nstars;144 Stars *Convert_PS1_DEV_1 (FTable *table, unsigned int *nstars) { 145 146 unsigned int i, Nstars; 145 147 double ZeroPt; 146 148 Stars *stars; … … 185 187 } 186 188 187 Stars *Convert_PS1_V1 (FTable *table, int *nstars) {188 189 int i, Nstars;189 Stars *Convert_PS1_V1 (FTable *table, unsigned int *nstars) { 190 191 unsigned int i, Nstars; 190 192 double ZeroPt; 191 193 Stars *stars; … … 261 263 } 262 264 263 Stars *Convert_PS1_V1_Alt (FTable *table, int *nstars) {264 265 int i, Nstars;265 Stars *Convert_PS1_V1_Alt (FTable *table, unsigned int *nstars) { 266 267 unsigned int i, Nstars; 266 268 double ZeroPt; 267 269 Stars *stars; … … 332 334 } 333 335 334 Stars *Convert_PS1_V2 (FTable *table, int *nstars) {335 336 int i, Nstars;336 Stars *Convert_PS1_V2 (FTable *table, unsigned int *nstars) { 337 338 unsigned int i, Nstars; 337 339 double ZeroPt; 338 340 Stars *stars; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/ReadStarsSDSS.c
r21508 r27295 33 33 Stars *ReadStarsSDSS (FILE *f, char *name, Header *header, Header *in_theader, Image *images, int *nimages, unsigned int *nstars) { 34 34 35 int i, j, N, Nskip, Nstars, camcol; 35 off_t Nskip; 36 int i, j, N, Nstars, camcol; 36 37 char type[80]; 37 38 Header theader; … … 50 51 } else { 51 52 table.header = in_theader; 52 Nskip = in_theader[0]. size;53 fseek (f, Nskip, SEEK_CUR);53 Nskip = in_theader[0].datasize; 54 fseeko (f, Nskip, SEEK_CUR); 54 55 } 55 56 -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/SkyListForStars.c
r21508 r27295 13 13 } 14 14 15 SkyList *SkyListForStars (SkyTable *table, int depth, Stars *stars, int Nstars) {15 SkyList *SkyListForStars (SkyTable *table, int depth, Stars *stars, unsigned int Nstars) { 16 16 17 17 int i, j, Nr, NR; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/SkyTableFromTychoIndex.c
r15036 r27295 147 147 skytable[0].filename[i] = NULL; 148 148 } 149 if (VERBOSE) fprintf (stderr, "loaded % d tables from tycho index\n",skytable[0].Nregions);149 if (VERBOSE) fprintf (stderr, "loaded %lld tables from tycho index\n", (long long) skytable[0].Nregions); 150 150 151 151 return (skytable); -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/UpdateDatabase_Image.c
r15743 r27295 1 1 # include "addstar.h" 2 2 3 int UpdateDatabase_Image (AddstarClientOptions *options, Image *images, int Nimages, Coords *mosaic, Stars *stars, int Nstars) {3 int UpdateDatabase_Image (AddstarClientOptions *options, Image *images, int Nimages, Coords *mosaic, Stars *stars, unsigned int Nstars) { 4 4 5 5 int i, status; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/UpdateDatabase_Reflist.c
r15743 r27295 1 1 # include "addstar.h" 2 2 3 int UpdateDatabase_Reflist (AddstarClientOptions *options, Stars *stars, int Nstars) {3 int UpdateDatabase_Reflist (AddstarClientOptions *options, Stars *stars, unsigned int Nstars) { 4 4 5 5 int i, Nsubset; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/UpdateImageIDs.c
r26390 r27295 1 1 # include "addstar.h" 2 2 3 int UpdateImageIDs (Stars *stars, int Nstars, Image *images, int Nimages) {3 int UpdateImageIDs (Stars *stars, unsigned int Nstars, Image *images, int Nimages) { 4 4 5 5 int i, status, isEmpty; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/addstar.c
r26280 r27295 1 1 # include "addstar.h" 2 2 3 // LARGEFILES: this program currently limits Nstars (input file) to < 2^31 3 4 int main (int argc, char **argv) { 4 5 6 unsigned int Nstars, Nsubset; 5 7 int Nmatch, status, loadObjects; 6 int i, N stars, Nimages, Nsubset;7 unsigned long longNaverage, Nmeasure;8 int i, Nimages; 9 off_t Naverage, Nmeasure; 8 10 Stars *stars, **subset; 9 11 Image *images; … … 46 48 newlist = SkyListByImage (sky, -1, &images[i]); 47 49 SkyListMerge (&skylist, newlist); 48 if (VERBOSE) fprintf (stderr, "added % d regions to yield %d total\n", newlist[0].Nregions,skylist[0].Nregions);50 if (VERBOSE) fprintf (stderr, "added %lld regions to yield %lld total\n", (long long) newlist[0].Nregions, (long long) skylist[0].Nregions); 49 51 SkyListFree (newlist); 50 52 } … … 78 80 skylist = tmp; 79 81 } 80 if (VERBOSE) fprintf (stderr, "writing to % d regions\n",skylist[0].Nregions);82 if (VERBOSE) fprintf (stderr, "writing to %lld regions\n", (long long) skylist[0].Nregions); 81 83 82 84 /* don't load the object tables for only_images, unless we are getting the calibration. */ … … 203 205 gettimeofday (&stop, NULL); 204 206 dtime = DTIME (stop, start); 205 fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars (%5d matches), %6lld average, %7lld measure\n", dtime, Nstars, Nmatch, Naverage,Nmeasure);207 fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars (%5d matches), %6lld average, %7lld measure\n", dtime, Nstars, Nmatch, (long long) Naverage, (long long) Nmeasure); 206 208 207 209 exit (0); -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/build_links.c
r26399 r27295 26 26 /* build the initial links assuming the table is sorted, 27 27 not partial, and has a correct set of average[].measureOffset,Nmeasure values */ 28 int *init_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure) {29 30 int i, j, N;31 int *next;28 off_t *init_measure_links (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure) { 29 30 off_t i, j, N; 31 off_t *next_meas; 32 32 33 33 N = 0; 34 34 35 ALLOCATE (next , int, Nmeasure);35 ALLOCATE (next_meas, off_t, Nmeasure); 36 36 for (i = 0; i < Naverage; i++, N++) { 37 37 for (j = 0; j < average[i].Nmeasure - 1; j++, N++) { 38 next [N] = N + 1;38 next_meas[N] = N + 1; 39 39 if (N >= Nmeasure) { 40 40 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 41 41 } 42 42 } 43 next [N] = -1;43 next_meas[N] = -1; 44 44 if (N >= Nmeasure) { 45 45 fprintf (stderr, "WARNING: N out of bounds (2)\n"); … … 51 51 } 52 52 } 53 return (next );53 return (next_meas); 54 54 } 55 55 … … 61 61 */ 62 62 63 int *build_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure) {64 65 int i, m, k, Nm, averef;66 int *next;67 68 ALLOCATE (next , int, Nmeasure);63 off_t *build_measure_links (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure) { 64 65 off_t i, m, k, Nm, averef; 66 off_t *next_meas; 67 68 ALLOCATE (next_meas, off_t, Nmeasure); 69 69 70 70 /* reset the Nm, offset values for average */ … … 77 77 averef = measure[Nm].averef; 78 78 m = average[averef].measureOffset; 79 next [Nm] = -1;79 next_meas[Nm] = -1; 80 80 81 81 if (m == -1) { /* no links yet for source */ … … 85 85 } 86 86 87 for (k = 0; next [m] != -1; k++) {88 m = next [m];87 for (k = 0; next_meas[m] != -1; k++) { 88 m = next_meas[m]; 89 89 if (m >= Nmeasure) { 90 90 fprintf (stderr, "WARNING: m out of bounds (1)\n"); … … 93 93 94 94 average[averef].Nmeasure = k + 2; 95 next [m] = Nm;95 next_meas[m] = Nm; 96 96 if (m >= Nmeasure) { 97 97 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 98 98 } 99 99 } 100 return (next );100 return (next_meas); 101 101 } 102 102 103 103 /* average[].measureOffset, average[].Nmeasure are valid within an addstar run */ 104 int add_meas_link (Average *average, int *next, int Nmeasure, int NMEASURE) {105 106 int k, m;107 108 /* if we have trouble, check validity of next [m] : m < Nmeasure */104 off_t add_meas_link (Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE) { 105 106 off_t k, m; 107 108 /* if we have trouble, check validity of next_meas[m] : m < Nmeasure */ 109 109 m = average[0].measureOffset; 110 110 111 111 for (k = 0; k < average[0].Nmeasure - 1; k++) { 112 m = next [m];112 m = next_meas[m]; 113 113 if (m >= NMEASURE) { 114 114 fprintf (stderr, "WARNING: m out of bounds (3)\n"); … … 117 117 118 118 /* set up references */ 119 next [Nmeasure] = -1;119 next_meas[Nmeasure] = -1; 120 120 if (Nmeasure >= NMEASURE) { 121 121 fprintf (stderr, "WARNING: Nmeasure out of bounds (1)\n"); … … 125 125 average[0].measureOffset = Nmeasure; 126 126 } else { 127 next [m] = Nmeasure;127 next_meas[m] = Nmeasure; 128 128 if (m >= NMEASURE) { 129 129 fprintf (stderr, "WARNING: m out of bounds (4)\n"); … … 137 137 we must always save the missing table, if it exists */ 138 138 139 Measure *sort_measure (Average *average, int Naverage, Measure *measure, int Nmeasure, int *next) {140 141 int i, k, n, N;139 Measure *sort_measure (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next_meas) { 140 141 off_t i, k, n, N; 142 142 Measure *tmpmeasure; 143 143 … … 153 153 if (measure[n].averef != i) abort(); 154 154 tmpmeasure[N].averef = i; 155 n = next [n];155 n = next_meas[n]; 156 156 } 157 157 } … … 161 161 162 162 /* build the initial links assuming the table is sorted */ 163 int *init_missing_links (Average *average, int Naverage, Missing *missing, int Nmissing) {164 165 int i, j, N;166 int *next;163 off_t *init_missing_links (Average *average, off_t Naverage, Missing *missing, off_t Nmissing) { 164 165 off_t i, j, N; 166 off_t *next_miss; 167 167 168 168 N = 0; 169 169 170 ALLOCATE (next , int, Nmissing);170 ALLOCATE (next_miss, off_t, Nmissing); 171 171 for (i = 0; i < Naverage; i++) { 172 172 for (j = 0; j < average[i].Nmissing - 1; j++, N++) { 173 next [N] = N + 1;173 next_miss[N] = N + 1; 174 174 } 175 175 if (average[i].Nmissing > 0) { 176 next [N] = -1;176 next_miss[N] = -1; 177 177 if (N >= Nmissing) { 178 178 fprintf (stderr, "overflow in init_missing_links"); … … 183 183 184 184 } 185 return (next );186 } 187 188 int add_miss_link (Average *average, int *next, int Nmissing) {189 190 int k, m;185 return (next_miss); 186 } 187 188 off_t add_miss_link (Average *average, off_t *next_miss, off_t Nmissing) { 189 190 off_t k, m; 191 191 192 192 /* there may be 0 Nmiss; this is not true for Nmeas */ 193 193 if (average[0].Nmissing < 1) { 194 194 average[0].missingOffset = Nmissing; 195 next [Nmissing] = -1;195 next_miss[Nmissing] = -1; 196 196 return (TRUE); 197 197 } 198 198 199 199 m = average[0].missingOffset; 200 for (k = 0; k < average[0].Nmissing - 1; k++) m = next [m];200 for (k = 0; k < average[0].Nmissing - 1; k++) m = next_miss[m]; 201 201 /* set up references */ 202 next [Nmissing] = -1;203 next [m] = Nmissing;202 next_miss[Nmissing] = -1; 203 next_miss[m] = Nmissing; 204 204 return (TRUE); 205 205 } 206 206 207 Missing *sort_missing (Average *average, int Naverage, Missing *missing, int Nmissing, int *next) {208 209 int i, k, n, N;207 Missing *sort_missing (Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_miss) { 208 209 off_t i, k, n, N; 210 210 Missing *tmpmissing; 211 211 … … 218 218 for (k = 0; k < average[i].Nmissing; k++, N++) { 219 219 tmpmissing[N] = missing[n]; 220 n = next [n];220 n = next_miss[n]; 221 221 } 222 222 } -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/calibrate.c
r16810 r27295 2 2 3 3 static int InternalCal; 4 static int Ncal, NCAL, *Nstar; 4 static int Ncal, NCAL; 5 static off_t *Nstar; 5 6 static float *Mobs, *dMobs, *Mref, *dMref, *Minst; 6 7 … … 13 14 NCAL = 1000; 14 15 ALLOCATE (Mobs, float, NCAL); 15 ALLOCATE (dMobs, float, NCAL);16 ALLOCATE (dMobs, float, NCAL); 16 17 ALLOCATE (Mref, float, NCAL); 17 18 ALLOCATE (dMref, float, NCAL); 18 19 ALLOCATE (Minst, float, NCAL); 19 ALLOCATE (Nstar, int,NCAL);20 ALLOCATE (Nstar, off_t, NCAL); 20 21 } 21 22 22 void SaveCalibration (float Mo, float dMo, float Mr, float dMr, float Mi, int N) {23 void SaveCalibration (float Mo, float dMo, float Mr, float dMr, float Mi, off_t N) { 23 24 24 25 Mobs[Ncal] = Mo; … … 37 38 REALLOCATE (dMref, float, NCAL); 38 39 REALLOCATE (Minst, float, NCAL); 39 REALLOCATE (Nstar, int,NCAL);40 REALLOCATE (Nstar, off_t, NCAL); 40 41 } 41 42 } 42 43 43 44 /* use the linked list to navigate the measures; safe for unsorted measures */ 44 void AddToCalibration (Average *average, SecFilt *secfilt, Measure *measure, Measure *new, int *next, int Nstar) {45 void AddToCalibration (Average *average, SecFilt *secfilt, Measure *measure, Measure *new, off_t *next, off_t Nstar) { 45 46 46 47 int i, j, m, Nsec, found0, found1, found2; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/dump.c
r21508 r27295 1 1 # include "addstar.h" 2 2 3 int dump_rawstars (Stars *stars, int Nstars) {3 int dump_rawstars (Stars *stars, unsigned int Nstars) { 4 4 5 int i;5 unsigned int i; 6 6 FILE *f; 7 7 -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/find_matches.c
r26384 r27295 1 1 # include "addstar.h" 2 2 3 int find_matches (SkyRegion *region, Stars *stars, int NstarsIn, Catalog *catalog, AddstarClientOptions options) {4 5 int i, j, n, N, J, status, Nstars;3 int find_matches (SkyRegion *region, Stars *stars, unsigned int NstarsIn, Catalog *catalog, AddstarClientOptions options) { 4 5 off_t i, j, n, N, J, status, Nstars; 6 6 double RADIUS, RADIUS2; 7 7 double *X1, *Y1, *X2, *Y2; 8 8 double dX, dY, dR; 9 int *N1, *N2, *next_meas;10 int Nave, NAVE, Nmeas, NMEAS, Nmatch;9 off_t *N1, *N2, *next_meas; 10 off_t Nave, NAVE, Nmeas, NMEAS, Nmatch; 11 11 int Nsecfilt, Nsec; 12 12 unsigned int objID, catID; … … 24 24 ALLOCATE (X1, double, NstarsIn); 25 25 ALLOCATE (Y1, double, NstarsIn); 26 ALLOCATE (N1, int,NstarsIn);26 ALLOCATE (N1, off_t, NstarsIn); 27 27 28 28 /** allocate local arrays (catalog) **/ … … 30 30 ALLOCATE (X2, double, NAVE); 31 31 ALLOCATE (Y2, double, NAVE); 32 ALLOCATE (N2, int,NAVE);33 ALLOCATE (catalog[0].found, int, NAVE);32 ALLOCATE (N2, off_t, NAVE); 33 ALLOCATE (catalog[0].found, off_t, NAVE); 34 34 /* for secfilt j and star i, secfilt[i*Nsecfilt+j] */ 35 35 … … 140 140 if (Nmeas >= NMEAS) { 141 141 NMEAS = Nmeas + 1000; 142 REALLOCATE (next_meas, int, NMEAS);142 REALLOCATE (next_meas, off_t, NMEAS); 143 143 REALLOCATE (catalog[0].measure, Measure, NMEAS); 144 144 } … … 231 231 if (Nmeas >= NMEAS) { 232 232 NMEAS = Nmeas + 1000; 233 REALLOCATE (next_meas, int, NMEAS);233 REALLOCATE (next_meas, off_t, NMEAS); 234 234 REALLOCATE (catalog[0].measure, Measure, NMEAS); 235 235 } … … 339 339 catalog[0].Nmeasure = Nmeas; 340 340 catalog[0].Nsecf_mem = Nave*Nsecfilt; 341 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: % d %d %d, (%d matches)\n", Nstars, Nave, Nmeas,Nmatch);341 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch); 342 342 343 343 free (catalog[0].found); -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/find_matches_closest.c
r26384 r27295 1 1 # include "addstar.h" 2 2 3 int find_matches_closest (SkyRegion *region, Stars *stars, int NstarsIn, Catalog *catalog, AddstarClientOptions options) {4 5 int i, j, n, N, J, Jmin, status, Nstars;3 int find_matches_closest (SkyRegion *region, Stars *stars, unsigned int NstarsIn, Catalog *catalog, AddstarClientOptions options) { 4 5 off_t i, j, n, N, J, Jmin, status, Nstars; 6 6 double RADIUS, RADIUS2, Rmin; 7 7 double *X1, *Y1, *X2, *Y2; 8 8 double dX, dY, dR; 9 int *N1, *N2,*next_meas;10 int Nave, NAVE, Nmeas, NMEAS, Nmatch;9 off_t *N1, *N2, *next_meas; 10 off_t Nave, NAVE, Nmeas, NMEAS, Nmatch; 11 11 int Nsecfilt, Nsec; 12 12 unsigned int objID, catID; … … 24 24 ALLOCATE (X1, double, NstarsIn); 25 25 ALLOCATE (Y1, double, NstarsIn); 26 ALLOCATE (N1, int,NstarsIn);26 ALLOCATE (N1, off_t, NstarsIn); 27 27 28 28 /** allocate local arrays (catalog) **/ … … 30 30 ALLOCATE (X2, double, NAVE); 31 31 ALLOCATE (Y2, double, NAVE); 32 ALLOCATE (N2, int,NAVE);33 ALLOCATE (catalog[0].found, int, NAVE);32 ALLOCATE (N2, off_t, NAVE); 33 ALLOCATE (catalog[0].found, off_t, NAVE); 34 34 /* for secfilt j and star i, secfilt[i*Nsecfilt+j] */ 35 35 … … 155 155 if (Nmeas >= NMEAS) { 156 156 NMEAS = Nmeas + 1000; 157 REALLOCATE (next_meas, int, NMEAS);157 REALLOCATE (next_meas, off_t, NMEAS); 158 158 REALLOCATE (catalog[0].measure, Measure, NMEAS); 159 159 } … … 226 226 if (Nmeas >= NMEAS) { 227 227 NMEAS = Nmeas + 1000; 228 REALLOCATE (next_meas, int, NMEAS);228 REALLOCATE (next_meas, off_t, NMEAS); 229 229 REALLOCATE (catalog[0].measure, Measure, NMEAS); 230 230 } … … 335 335 catalog[0].Nmeasure = Nmeas; 336 336 catalog[0].Nsecf_mem = Nave*Nsecfilt; 337 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: % d %d %d, (%d matches)\n", Nstars, Nave, Nmeas,Nmatch);337 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch); 338 338 339 339 free (catalog[0].found); -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/find_matches_closest_refstars.c
r26384 r27295 1 1 # include "addstar.h" 2 2 3 int find_matches_closest_refstars (SkyRegion *region, Stars **stars, int NstarsIn, Catalog *catalog, AddstarClientOptions options) {4 5 int i, j, n, N, J, Jmin, status;3 int find_matches_closest_refstars (SkyRegion *region, Stars **stars, unsigned int NstarsIn, Catalog *catalog, AddstarClientOptions options) { 4 5 off_t i, j, n, N, J, Jmin, status; 6 6 double RADIUS, RADIUS2, Rmin; 7 7 double *X1, *Y1, *X2, *Y2; 8 8 double dX, dY, dR; 9 int *N1, *N2, *next_meas;10 int Nave, NAVE, Nmeas, NMEAS, Nstars, Nmatch;9 off_t *N1, *N2, *next_meas; 10 off_t Nave, NAVE, Nmeas, NMEAS, Nstars, Nmatch; 11 11 unsigned int objID, catID; 12 12 Coords tcoords; … … 24 24 ALLOCATE (X1, double, NstarsIn); 25 25 ALLOCATE (Y1, double, NstarsIn); 26 ALLOCATE (N1, int,NstarsIn);26 ALLOCATE (N1, off_t, NstarsIn); 27 27 28 28 /** allocate local arrays (catalog) **/ … … 30 30 ALLOCATE (X2, double, NAVE); 31 31 ALLOCATE (Y2, double, NAVE); 32 ALLOCATE (N2, int,NAVE);33 ALLOCATE (catalog[0].found, int, NAVE);32 ALLOCATE (N2, off_t, NAVE); 33 ALLOCATE (catalog[0].found, off_t, NAVE); 34 34 /* for secfilt j and star i, secfilt[i*Nsecfilt+j] */ 35 35 … … 164 164 if (Nmeas >= NMEAS) { 165 165 NMEAS = Nmeas + 1000; 166 REALLOCATE (next_meas, int, NMEAS);166 REALLOCATE (next_meas, off_t, NMEAS); 167 167 REALLOCATE (catalog[0].measure, Measure, NMEAS); 168 168 } … … 239 239 if (Nmeas >= NMEAS - NREFSTAR_GROUP) { 240 240 NMEAS = Nmeas + 1000; 241 REALLOCATE (next_meas, int, NMEAS);241 REALLOCATE (next_meas, off_t, NMEAS); 242 242 REALLOCATE (catalog[0].measure, Measure, NMEAS); 243 243 } … … 351 351 catalog[0].Nmeasure = Nmeas; 352 352 catalog[0].Nsecf_mem = Nave*Nsecfilt; 353 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: % d %d %d, (%d matches)\n", Nstars, Nave, Nmeas,Nmatch);353 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch); 354 354 355 355 free (catalog[0].found); -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/find_matches_refstars.c
r26400 r27295 1 1 # include "addstar.h" 2 2 3 int find_matches_refstars (SkyRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options) {4 5 int i, j, n, N, J;3 int find_matches_refstars (SkyRegion *region, Stars **stars, unsigned int Nstars, Catalog *catalog, AddstarClientOptions options) { 4 5 off_t i, j, n, N, J; 6 6 double RADIUS, RADIUS2; 7 7 double *X1, *Y1, *X2, *Y2; 8 8 double dX, dY, dR; 9 int *N1, *N2, *next_meas;10 int Nave, NAVE, Nmeas, NMEAS, Nmatch;9 off_t *N1, *N2, *next_meas; 10 off_t Nave, NAVE, Nmeas, NMEAS, Nmatch; 11 11 unsigned int objID, catID; 12 12 Coords tcoords; … … 24 24 ALLOCATE (X1, double, Nstars); 25 25 ALLOCATE (Y1, double, Nstars); 26 ALLOCATE (N1, int,Nstars);26 ALLOCATE (N1, off_t, Nstars); 27 27 28 28 /** allocate local arrays (catalog) **/ … … 31 31 ALLOCATE (X2, double, NAVE); 32 32 ALLOCATE (Y2, double, NAVE); 33 ALLOCATE (N2, int,NAVE);34 ALLOCATE (catalog[0].found, int, NAVE);33 ALLOCATE (N2, off_t, NAVE); 34 ALLOCATE (catalog[0].found, off_t, NAVE); 35 35 REALLOCATE (catalog[0].average, Average, NAVE); 36 36 REALLOCATE (catalog[0].secfilt, SecFilt, NAVE*catalog[0].Nsecfilt); … … 124 124 if (Nmeas == NMEAS) { 125 125 NMEAS = Nmeas + 1000; 126 REALLOCATE (next_meas, int, NMEAS);126 REALLOCATE (next_meas, off_t, NMEAS); 127 127 REALLOCATE (catalog[0].measure, Measure, NMEAS); 128 128 } … … 209 209 if (Nmeas >= NMEAS - NREFSTAR_GROUP) { 210 210 NMEAS = Nmeas + 1000; 211 REALLOCATE (next_meas, int, NMEAS);211 REALLOCATE (next_meas, off_t, NMEAS); 212 212 REALLOCATE (catalog[0].measure, Measure, NMEAS); 213 213 } … … 325 325 catalog[0].Nmeasure = Nmeas; 326 326 catalog[0].Nsecf_mem = Nave*Nsecfilt; 327 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: % d %d %d, (%d matches)\n", Nstars, Nave, Nmeas,Nmatch);327 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch); 328 328 329 329 free (catalog[0].found); -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/find_subset.c
r21508 r27295 2 2 3 3 /* find stars within this region */ 4 Stars **find_subset (SkyRegion *region, Stars *stars, int Nstars,int *Nsubset) {4 Stars **find_subset (SkyRegion *region, Stars *stars, unsigned int Nstars, unsigned int *Nsubset) { 5 5 6 6 int i, N, NSUBSET; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/get2mass.c
r17439 r27295 2 2 # include "2mass.h" 3 3 4 Stars *get2mass (SkyRegion *patch, int photcode, int mode, int *NSTARS) {4 Stars *get2mass (SkyRegion *patch, int photcode, int mode, unsigned int *NSTARS) { 5 5 6 6 char *path; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/getgsc.c
r21508 r27295 7 7 static SkyTable *sky = NULL; 8 8 9 Stars *getgsc (SkyRegion *patch, int *NSTARS) {9 Stars *getgsc (SkyRegion *patch, unsigned int *NSTARS) { 10 10 11 11 int i, Ngsc, Nstars; … … 45 45 } 46 46 47 Stars *rd_gsc (char *filename, int *nstars) {47 Stars *rd_gsc (char *filename, unsigned int *nstars) { 48 48 49 49 int i, NSTARS, Nstars, Nbytes, nbytes, Nline, Nbyte; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/gettycho.c
r21508 r27295 6 6 static SkyTable *tychoTable = NULL; 7 7 8 Stars *gettycho (SkyRegion *catstats, int photcode, int *nstars) {8 Stars *gettycho (SkyRegion *catstats, int photcode, unsigned int *nstars) { 9 9 10 10 int i, j, nitems; … … 13 13 FILE *f; 14 14 int NTYCHO, Ntycho; 15 int firstRow, firstByte;15 off_t firstRow, firstByte; 16 16 short int TYCHO_B, TYCHO_V; 17 17 e_time TychoEpoch; … … 60 60 region[0].Rmin, region[0].Rmax, region[0].Dmin, region[0].Dmax); 61 61 62 firstRow = atoi (region[0].name);62 firstRow = strtol (region[0].name, NULL, 0); 63 63 firstByte = firstRow * NBYTE; 64 fseek (f, firstByte, SEEK_SET);64 fseeko (f, firstByte, SEEK_SET); 65 65 66 66 while (1) { -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/getusno.c
r21508 r27295 4 4 # define NELEM 3 5 5 6 Stars *getusno (SkyRegion *catstats, int photcode, int *nstars) {6 Stars *getusno (SkyRegion *catstats, int photcode, unsigned int *nstars) { 7 7 8 long int offset;8 off_t offset; 9 9 int i, bin, first, last, nitems, Nitems, Nbins, Nstars; 10 10 float hours[100]; … … 84 84 /* advance file pointer to first slice */ 85 85 offset = NELEM*NBYTE*(start[first] - 1); 86 fseek (f, offset, SEEK_SET);86 fseeko (f, offset, SEEK_SET); 87 87 88 88 /* sum the number of stars in data segment of interest */ -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/getusnob.c
r26280 r27295 3 3 # define NELEM 20 4 4 5 Stars *getusnob (SkyRegion *catstats, int photcode, int *nstars) {5 Stars *getusnob (SkyRegion *catstats, int photcode, unsigned int *nstars) { 6 6 7 long int offset;7 off_t offset; 8 8 int i, bin, first, last, nitems, Nitems, Nbins, Nitemsum; 9 9 float hours[100]; … … 93 93 /* advance file pointer to first slice */ 94 94 offset = NELEM*NBYTE*(start[first] - 1); 95 fseek (f, offset, SEEK_SET);95 fseeko (f, offset, SEEK_SET); 96 96 97 97 /* sum the number of stars in data segment of interest */ -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/greference.c
r21508 r27295 3 3 # define LOAD_DR2 1 4 4 5 Stars *greference (char *Refcat, SkyRegion *region, int photcode, int *nstars) {5 Stars *greference (char *Refcat, SkyRegion *region, int photcode, unsigned int *nstars) { 6 6 7 7 int Nstars; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/grefstars.c
r21508 r27295 2 2 3 3 /* read ASCII file with ref star data */ 4 Stars *grefstars (char *file, int photcode, int *Nstars) {4 Stars *grefstars (char *file, int photcode, unsigned int *Nstars) { 5 5 6 6 FILE *f; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/gztest.c
r3376 r27295 5 5 main (int argc, char **argv) { 6 6 7 int N, Nread, Nseek, Nback; 7 off_t Nseek, Nback; 8 int N, Nread; 8 9 char *filename, *buffer; 9 10 gzFile gf; … … 66 67 67 68 gettimeofday (&start, NULL); 68 N = fseek (f, Nseek, SEEK_SET);69 N = fseeko (f, Nseek, SEEK_SET); 69 70 gettimeofday (&stop, NULL); 70 71 if (N) { … … 84 85 85 86 gettimeofday (&start, NULL); 86 N = fseek (f, Nback, SEEK_CUR);87 N = fseeko (f, Nback, SEEK_CUR); 87 88 gettimeofday (&stop, NULL); 88 89 if (N) { -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/resort_catalog.c
r7039 r27295 3 3 void resort_catalog (Catalog *catalog) { 4 4 5 int *next_meas;6 int Naves, Nmeas;5 off_t *next_meas; 6 off_t Naves, Nmeas; 7 7 double dtime; 8 8 struct timeval start, stop; … … 24 24 gettimeofday (&stop, NULL); 25 25 dtime = DTIME (stop, start); 26 fprintf (stderr, " match time %9.4f sec for %7 d measures, %6d average\n", dtime, Nmeas,Naves);26 fprintf (stderr, " match time %9.4f sec for %7lld measures, %6lld average\n", dtime, (long long) Nmeas, (long long) Naves); 27 27 28 28 return; -
branches/eam_branches/largefiles.20100314/Ohana/src/addstar/src/update_coords.c
r16810 r27295 2 2 3 3 /* find the average and scatter for R and D - no outlier rejection */ 4 void update_coords (Average *average, Measure *measure, int *next) {4 void update_coords (Average *average, Measure *measure, off_t *next) { 5 5 6 int i, m, Npt;6 off_t i, m, Npt; 7 7 double R, D, r, d; 8 8 double r2, d2, dR2, dD2; -
branches/eam_branches/largefiles.20100314/Ohana/src/delstar/src/gimages.c
r20184 r27295 25 25 Shutdown ("ERROR: can't find data file %s", filename); 26 26 } 27 fseek (f, header.size, SEEK_SET);27 fseeko (f, header.datasize, SEEK_SET); 28 28 29 29 /* add file name to image structure */ -
branches/eam_branches/largefiles.20100314/Ohana/src/dvomerge/src/merge_catalogs.c
r24745 r27295 5 5 int merge_catalogs_new (Catalog *output, Catalog *input) { 6 6 7 int i, j, offset;8 int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nsecfilt, Nm;7 off_t i, j, offset; 8 off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nsecfilt, Nm; 9 9 10 10 Naverage = output[0].Naverage; -
branches/eam_branches/largefiles.20100314/Ohana/src/dvomerge/src/merge_catalogs_new.c
r24745 r27295 9 9 int merge_catalogs_new (SkyRegion *region, Catalog *output, Catalog *input) { 10 10 11 int i, j, offset;12 int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nsecfilt, Nm;11 off_t i, j, offset; 12 off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nsecfilt, Nm; 13 13 14 14 Naverage = output[0].Naverage; -
branches/eam_branches/largefiles.20100314/Ohana/src/dvomerge/src/merge_catalogs_old.c
r24750 r27295 9 9 int merge_catalogs_old (SkyRegion *region, Catalog *output, Catalog *input, double RADIUS) { 10 10 11 int i, j, n, N, Nin, offset, J, Jmin, status, Nstars;11 off_t i, j, n, N, Nin, offset, J, Jmin, status, Nstars; 12 12 double RADIUS2, Rmin, Rin, Din; 13 13 double *X1, *Y1, *X2, *Y2; 14 14 double dX, dY, dR; 15 int *N1, *N2, *next_meas;16 int Nave, NAVE, Nmeas, NMEAS, Nmatch;15 off_t *N1, *N2, *next_meas; 16 off_t Nave, NAVE, Nmeas, NMEAS, Nmatch; 17 17 int Nsecfilt; 18 18 unsigned int objID, catID; … … 24 24 ALLOCATE (X1, double, input[0].Naverage); 25 25 ALLOCATE (Y1, double, input[0].Naverage); 26 ALLOCATE (N1, int,input[0].Naverage);27 ALLOCATE (input[0].found, int, input[0].Naverage);26 ALLOCATE (N1, off_t, input[0].Naverage); 27 ALLOCATE (input[0].found, off_t, input[0].Naverage); 28 28 29 29 /** allocate local arrays (catalog) **/ … … 31 31 ALLOCATE (X2, double, NAVE); 32 32 ALLOCATE (Y2, double, NAVE); 33 ALLOCATE (N2, int, NAVE);34 ALLOCATE (output[0].found, int, NAVE);33 ALLOCATE (N2, off_t, NAVE); 34 ALLOCATE (output[0].found, off_t, NAVE); 35 35 /* for secfilt j and star i, secfilt[i*Nsecfilt+j] */ 36 36 … … 157 157 if (Nmeas + input[0].average[N].Nmeasure >= NMEAS) { 158 158 NMEAS = Nmeas + input[0].average[N].Nmeasure + 1000; 159 REALLOCATE (next_meas, int, NMEAS);159 REALLOCATE (next_meas, off_t, NMEAS); 160 160 REALLOCATE (output[0].measure, Measure, NMEAS); 161 161 } … … 220 220 if (Nmeas + input[0].average[N].Nmeasure >= NMEAS) { 221 221 NMEAS = Nmeas + input[0].average[N].Nmeasure + 1000; 222 REALLOCATE (next_meas, int, NMEAS);222 REALLOCATE (next_meas, off_t, NMEAS); 223 223 REALLOCATE (output[0].measure, Measure, NMEAS); 224 224 } -
branches/eam_branches/largefiles.20100314/Ohana/src/elixir/src/DumpStatus.c
r10336 r27295 18 18 f = fsetlockfile (filename, 0.1, LCK_XCLD, &state); 19 19 if (f == NULL) return (2); 20 fseek (f, 0, SEEK_END);20 fseeko (f, 0, SEEK_END); 21 21 } 22 22 -
branches/eam_branches/largefiles.20100314/Ohana/src/elixir/src/MachineOps.c
r10336 r27295 454 454 f = fsetlockfile (filename, 0.1, LCK_XCLD, &state); 455 455 if (f == NULL) return (2); 456 fseek (f, 0, SEEK_END);456 fseeko (f, 0, SEEK_END); 457 457 } 458 458 -
branches/eam_branches/largefiles.20100314/Ohana/src/elixir/src/MsgOps.c
r10336 r27295 99 99 100 100 /* write message to end of file */ 101 fseek (f, 0, SEEK_END);101 fseeko (f, 0, SEEK_END); 102 102 fprintf (f, "%s\n", message); 103 103 -
branches/eam_branches/largefiles.20100314/Ohana/src/fixcat/src/aregion.c
r19823 r27295 79 79 NLINES += NDecLines[i]; 80 80 } 81 fseek (f, 5*2880 + 48*NLINES, SEEK_SET);81 fseeko (f, 5*2880 + 48*NLINES, SEEK_SET); 82 82 83 83 done = FALSE; -
branches/eam_branches/largefiles.20100314/Ohana/src/fixcat/src/find_bright_stars.c
r16040 r27295 6 6 { 7 7 8 int i, j, n, m, first_j, Nave, Ngsc;8 int j, n, m, first_j, Ngsc; 9 9 Catalog GSCdata; 10 10 double MinRA, MinDEC, MaxRA, MaxDEC, RaCenter, DecCenter; 11 11 Coords *tcoords; 12 12 double *X1, *Y1, *X2, *Y2; 13 int *N1, *N2; 13 off_t i, Nave; 14 off_t *N1, *N2; 14 15 char *mark; 15 16 double dX, dY, dR, MaxDist, MaxDist1, MaxRadius, radius, radius2; … … 27 28 ALLOCATE (X1, double, Ngsc); 28 29 ALLOCATE (Y1, double, Ngsc); 29 ALLOCATE (N1, int, Ngsc);30 ALLOCATE (N1, off_t, Ngsc); 30 31 ALLOCATE (mark, char, Nave); 31 32 bzero (mark, Nave); -
branches/eam_branches/largefiles.20100314/Ohana/src/fixcat/src/find_images.c
r7080 r27295 73 73 exit (0); 74 74 } 75 fseek (f, header.size, SEEK_SET);75 fseeko (f, header.datasize, SEEK_SET); 76 76 77 77 /* set up buffers for images, temporary storage */ -
branches/eam_branches/largefiles.20100314/Ohana/src/fixcat/src/find_matches.c
r16040 r27295 11 11 double *X1, *Y1, *X2, *Y2; 12 12 double dX, dY, dR; 13 int *N1, *N2;13 off_t *N1, *N2; 14 14 int Nstar, Nghost, Ng; 15 15 unsigned int flags; … … 29 29 ALLOCATE (X1, double, Nghost); 30 30 ALLOCATE (Y1, double, Nghost); 31 ALLOCATE (N1, int, Nghost);31 ALLOCATE (N1, off_t, Nghost); 32 32 33 33 /* project ghosts to the frame of the catalog */ -
branches/eam_branches/largefiles.20100314/Ohana/src/fixcat/src/gcatalog.c
r7080 r27295 28 28 exit (0); 29 29 } 30 fseek (f, catalog[0].header.size, SEEK_SET);30 fseeko (f, catalog[0].header.datasize, SEEK_SET); 31 31 32 32 /** find number of stars, measurements **/ -
branches/eam_branches/largefiles.20100314/Ohana/src/fixcat/src/gcatstats.c
r16040 r27295 6 6 { 7 7 8 int i;8 off_t i; 9 9 double RaCenter, DecCenter; 10 10 double MinRA, MaxRA, MinDEC, MaxDEC; 11 11 double *X1, *Y1; 12 int *N1;13 12 Coords tcoords; 14 13 -
branches/eam_branches/largefiles.20100314/Ohana/src/fixcat/src/wcatalog.c
r7080 r27295 1 1 # include "markstar.h" 2 2 3 wcatalog (catname, catalog) 4 char *catname; 5 Catalog catalog[]; 6 { 3 int wcatalog (char *catname, catalog *catalog) { 7 4 8 int i, Nitems, nitems, status, mode; 5 int status, mode; 6 off_t i, Nitems, nitems; 9 7 char filename[128], line[256]; 10 8 FILE *f; … … 36 34 chmod (filename, mode); 37 35 38 gfits_modify (&catalog[0].header, "NSTARS", "% d", 1, catalog[0].Naverage);39 gfits_modify (&catalog[0].header, "NMEAS", "%d", 1, catalog[0].Nmeasure);40 gfits_modify (&catalog[0].header, "NMISS", "%d", 1, catalog[0].Nmissing);36 gfits_modify (&catalog[0].header, "NSTARS", "%lld", 1, catalog[0].Naverage); 37 gfits_modify (&catalog[0].header, "NMEAS", "%lld", 1, catalog[0].Nmeasure); 38 gfits_modify (&catalog[0].header, "NMISS", "%lld", 1, catalog[0].Nmissing); 41 39 42 40 gfits_modify (&catalog[0].header, "MARKSTAR", "%t", 1, TRUE); 43 41 44 nitems = Fwrite (catalog[0].header.buffer, 1, catalog[0].header. size, f, "char");42 nitems = Fwrite (catalog[0].header.buffer, 1, catalog[0].header.datasize, f, "char"); 45 43 if (nitems != catalog[0].header.size) { 46 44 fprintf (stderr, "ERROR: failed to write header\n"); … … 71 69 fclose (f); 72 70 71 return TRUE; 73 72 } 74 -
branches/eam_branches/largefiles.20100314/Ohana/src/gastro/src/getusno.c
r2435 r27295 11 11 USNOdata *getusno (USNOstats *usnostats, CatStats *catstats, int *Nusno) { 12 12 13 long int offset;13 off_t offset; 14 14 int i, bin, first, last, nitems, Nitems, Nbins; 15 15 float hours[100]; … … 91 91 /* advance file pointer to first slice */ 92 92 offset = 3*sizeof(int)*(start[first] - 1); 93 fseek (f, offset, SEEK_SET);93 fseeko (f, offset, SEEK_SET); 94 94 /* on each loop, load data from an RA slice of the catalog */ 95 95 for (bin = first; bin < last; bin++) { -
branches/eam_branches/largefiles.20100314/Ohana/src/gastro/src/gfit.c
r19823 r27295 8 8 9 9 int i, j, iteration, Niter, last, halt, first_j, *Nextra, extras; 10 int *tmpN1, *tmpN2;10 off_t *tmpN1, *tmpN2; 11 11 double X_O, X_X, X_Y, dX; 12 12 double Y_O, Y_X, Y_Y, dY; -
branches/eam_branches/largefiles.20100314/Ohana/src/gastro/src/gfitpoly.c
r19823 r27295 5 5 int i, j, m, n, M, N; 6 6 int first_j, last; 7 int *tmpN1, *tmpN2;7 off_t *tmpN1, *tmpN2; 8 8 int NORDER, NTERM, NPARS, NPOWR; 9 9 double **sum, **xsum, **ysum; -
branches/eam_branches/largefiles.20100314/Ohana/src/gastro/src/gheader.c
r12332 r27295 5 5 Header header; 6 6 FILE *f, *g; 7 int i, oldsize, nbytes, status;7 off_t i, oldsize, nbytes, status; 8 8 char line[1024]; 9 9 … … 12 12 exit(0); 13 13 } 14 oldsize = header. size;14 oldsize = header.datasize; 15 15 16 16 /* validating the photcode name should be the job of DVO/addstar */ … … 80 80 81 81 skipstuff: 82 if (header. size > oldsize) {82 if (header.datasize > oldsize) { 83 83 if (VERBOSE) fprintf (stderr, "header expanded, creating new copy\n"); 84 84 sprintf (line, "mv %s %s~", file, file); … … 99 99 exit(0); 100 100 } 101 nbytes = fwrite (header.buffer, 1, header. size, g);102 fseek (f, oldsize, SEEK_SET);103 for (i = 0; (nbytes = fread (header.buffer, 1, header. size, f)) > 0; i++) {101 nbytes = fwrite (header.buffer, 1, header.datasize, g); 102 fseeko (f, oldsize, SEEK_SET); 103 for (i = 0; (nbytes = fread (header.buffer, 1, header.datasize, f)) > 0; i++) { 104 104 if (nbytes != fwrite (header.buffer, 1, nbytes, g)) { 105 105 fprintf (stderr, "ERROR: failure writing output data file\n"); … … 116 116 } 117 117 118 fseek (f, 0, SEEK_SET);119 nbytes = fwrite (header.buffer, 1, header. size, f);118 fseeko (f, 0, SEEK_SET); 119 nbytes = fwrite (header.buffer, 1, header.datasize, f); 120 120 121 121 fclose (f); -
branches/eam_branches/largefiles.20100314/Ohana/src/gastro/src/gstars.c
r19823 r27295 162 162 exit(0); 163 163 } 164 fseek (f, header.size, SEEK_SET);164 fseeko (f, header.datasize, SEEK_SET); 165 165 166 166 N = nstar = 0; -
branches/eam_branches/largefiles.20100314/Ohana/src/gastro2/src/getusno.c
r8496 r27295 11 11 int getusno (CatStats *catstats, RefCatalog *Ref) { 12 12 13 long int offset;13 off_t offset; 14 14 int i, bin, first, last, nitems, Nitems, Nbins; 15 15 float hours[100]; … … 86 86 /* advance file pointer to first slice */ 87 87 offset = 3*sizeof(int)*(start[first] - 1); 88 fseek (f, offset, SEEK_SET);88 fseeko (f, offset, SEEK_SET); 89 89 /* on each loop, load data from an RA slice of the catalog */ 90 90 for (bin = first; bin < last; bin++) { -
branches/eam_branches/largefiles.20100314/Ohana/src/gastro2/src/getusnob.c
r8513 r27295 5 5 int getusnob (CatStats *catstats, RefCatalog *Ref, double epoch) { 6 6 7 long int offset;7 off_t offset; 8 8 int i, bin, first, last, nitems, Nitems, Nbins; 9 9 float hours[100]; … … 76 76 /* advance file pointer to first slice */ 77 77 offset = NELEM*NBYTE*(start[first] - 1); 78 fseek (f, offset, SEEK_SET);78 fseeko (f, offset, SEEK_SET); 79 79 80 80 /* sum the number of stars in data segment of interest */ -
branches/eam_branches/largefiles.20100314/Ohana/src/gastro2/src/gheader2.c
r8300 r27295 6 6 Header header; 7 7 FILE *f, *g; 8 int i, oldsize, nbytes, status;8 off_t i, oldsize, nbytes, status; 9 9 char line[1024]; 10 10 … … 13 13 exit(0); 14 14 } 15 oldsize = header. size;15 oldsize = header.datasize; 16 16 17 17 /* check for insufficient number of stars */ … … 59 59 60 60 skipstuff: 61 if (header. size > oldsize) {61 if (header.datasize > oldsize) { 62 62 if (VERBOSE) fprintf (stderr, "header expanded, creating new copy\n"); 63 63 sprintf (line, "mv %s %s~", file, file); … … 78 78 exit(0); 79 79 } 80 nbytes = fwrite (header.buffer, 1, header. size, g);81 fseek (f, oldsize, SEEK_SET);82 for (i = 0; (nbytes = fread (header.buffer, 1, header. size, f)) > 0; i++) {80 nbytes = fwrite (header.buffer, 1, header.datasize, g); 81 fseeko (f, oldsize, SEEK_SET); 82 for (i = 0; (nbytes = fread (header.buffer, 1, header.datasize, f)) > 0; i++) { 83 83 if (nbytes != fwrite (header.buffer, 1, nbytes, g)) { 84 84 fprintf (stderr, "ERROR: failure writing output data file\n"); … … 95 95 } 96 96 97 fseek (f, 0, SEEK_SET);98 nbytes = fwrite (header.buffer, 1, header. size, f);97 fseeko (f, 0, SEEK_SET); 98 nbytes = fwrite (header.buffer, 1, header.datasize, f); 99 99 100 100 fclose (f); -
branches/eam_branches/largefiles.20100314/Ohana/src/gastro2/src/gstars2.c
r19823 r27295 6 6 char line[80]; 7 7 double det; 8 int NX, NY, Nskip, FoundAstrom, extend, naxis; 8 off_t Nskip; 9 int NX, NY, FoundAstrom, extend, naxis; 9 10 StarData *stars; 10 11 FILE *f; … … 21 22 } 22 23 /* this line should not be needed */ 23 fseek (f, Target[0].header.size, SEEK_SET);24 fseeko (f, Target[0].header.datasize, SEEK_SET); 24 25 25 26 NX = Target[0].header.Naxis[0]; … … 128 129 if ((naxis == 0) && !TEXTMODE) { 129 130 Nskip = gfits_data_size (&Target[0].header); 130 fseek (f, Nskip, SEEK_CUR);131 fseeko (f, Nskip, SEEK_CUR); 131 132 stars = rfits (f, &Nstars); 132 133 } else { -
branches/eam_branches/largefiles.20100314/Ohana/src/getstar/src/ReadImageFiles.c
r24418 r27295 4 4 Image *ReadImageFiles (char *filename, int *Nimages) { 5 5 6 int i, j, N, Nfile, Nheader, NHEADER, Nimage, NIMAGE; 6 off_t Nskip, *extsize; 7 int i, j, N, Nfile, Nheader, Nimage, NHEADER, NIMAGE; 7 8 int Nskip, Nhead, Ndata, done, status, mode; 8 9 char **file, *name; … … 10 11 glob_t globList; 11 12 char **exthead, **extdata, **exttype, tmpword[80]; 12 int *extnum_head, *extnum_data , *extsize;13 int *extnum_head, *extnum_data; 13 14 Header *header, **headers; 14 15 Image *image; … … 89 90 headers[0] = header; 90 91 Nskip = gfits_data_size (header); 91 fseek (f, Nskip, SEEK_CUR);92 fseeko (f, Nskip, SEEK_CUR); 92 93 93 94 // load all headers into memory … … 118 119 ALLOCATE (extnum_head, int, NIMAGE); 119 120 ALLOCATE (extnum_data, int, NIMAGE); 120 ALLOCATE (extsize, int, Nheader);121 ALLOCATE (extsize, off_t, Nheader); 121 122 122 123 if (mode == MOSAIC_MEF) { … … 130 131 // now examine the headers, count the table entries, find corresponding headers 131 132 for (i = 0; i < Nheader; i++) { 132 extsize[i] = headers[i][0]. size + gfits_data_size (headers[i]);133 extsize[i] = headers[i][0].datasize + gfits_data_size (headers[i]); 133 134 gfits_scan (headers[i], "EXTTYPE", "%s", 1, tmpword); 134 135 … … 166 167 // extension matched to the header in the PHU 167 168 if (Nimage == 0) { 168 extsize[0] = headers[0][0]. size + gfits_data_size (headers[0]);169 extsize[1] = headers[1][0]. size + gfits_data_size (headers[1]);169 extsize[0] = headers[0][0].datasize + gfits_data_size (headers[0]); 170 extsize[1] = headers[1][0].datasize + gfits_data_size (headers[1]); 170 171 gfits_scan (headers[1], "EXTNAME", "%s", 1, tmpword); 171 172 if (!strcmp (tmpword, "SMPFILE")) { -
branches/eam_branches/largefiles.20100314/Ohana/src/gophot/src/gophot.c
r20652 r27295 26 26 /* convert to float, set up noise array and axes */ 27 27 gfits_convert_format (&header, &matrix, -32, 1.0, 0.0, 0xffff, 0); 28 ALLOCATE (noise, float, matrix. size);28 ALLOCATE (noise, float, matrix.datasize); 29 29 big = (float *) matrix.buffer; 30 30 nfast = matrix.Naxis[0]; -
branches/eam_branches/largefiles.20100314/Ohana/src/imclean/src/wstars.c
r3519 r27295 14 14 } 15 15 16 fwrite (header[0].buffer, 1, header[0]. size, g);16 fwrite (header[0].buffer, 1, header[0].datasize, g); 17 17 18 18 for (i = 0; i < Nstars; i++) { -
branches/eam_branches/largefiles.20100314/Ohana/src/imregister/base/WriteFIFO.c
r3648 r27295 12 12 } 13 13 14 fseek (f, 0, SEEK_END);14 fseeko (f, 0LL, SEEK_END); 15 15 fprintf (f, "%s\n", line); 16 16 -
branches/eam_branches/largefiles.20100314/Ohana/src/imregister/imphot/rtext.c
r15487 r27295 4 4 int rtext (FITS_DB *db) { 5 5 6 int Nimage, size, nimage;6 off_t Nimage, size, nimage; 7 7 struct stat filestatus; 8 8 Image *image; … … 10 10 /* check that file size makes sense */ 11 11 Nimage = 0; 12 gfits_scan (&db[0].header, "NIMAGES", "% d", 1, &Nimage);12 gfits_scan (&db[0].header, "NIMAGES", "%lld", 1, &Nimage); 13 13 if (stat (db[0].filename, &filestatus) == -1) { 14 14 if (VERBOSE) fprintf (stderr, "ERROR: failed to get status of image catalog\n"); 15 15 exit (1); 16 16 } 17 size = Nimage*sizeof(Image) + db[0].header. size;17 size = Nimage*sizeof(Image) + db[0].header.datasize; 18 18 if (size != filestatus.st_size) { 19 19 int Ndata; 20 20 21 Ndata = (filestatus.st_size - db[0].header. size) / sizeof (Image);21 Ndata = (filestatus.st_size - db[0].header.datasize) / sizeof (Image); 22 22 if (VERBOSE) fprintf (stderr, "ERROR: image catalog has inconsistent size\n"); 23 23 if (VERBOSE) fprintf (stderr, "header: %d, data: %d\n", Nimage, Ndata); … … 41 41 } 42 42 db[0].ftable.buffer = (char *) image; 43 gfits_modify (&db[0].theader, "NAXIS2", "% d", 1, Nimage);43 gfits_modify (&db[0].theader, "NAXIS2", "%lld", 1, Nimage); 44 44 db[0].theader.Naxis[1] = Nimage; 45 db[0].ftable. size = gfits_data_size (&db[0].theader);45 db[0].ftable.datasize = gfits_data_size (&db[0].theader); 46 46 47 47 return (TRUE); -
branches/eam_branches/largefiles.20100314/Ohana/src/imregister/src/imphotmerge.c
r12332 r27295 8 8 int main (int argc, char **argv) { 9 9 10 off_t status, Nimage; 10 11 Header header, theader; 11 12 Image *image, *input; 12 13 FILE *f, *g; 13 int i, j, status,N;14 int i, j, N; 14 15 char *dBFile; 15 int Ni mage, Ninput, *index, Ntimes;16 int Ninput, *index, Ntimes; 16 17 time_t *tstart, *tstop; 17 18 int VERBOSE, PHOTCODE, dbstate; … … 115 116 116 117 /* position to begining of file to write header */ 117 fseek (f, 0, SEEK_SET);118 status = Fwrite (header.buffer, 1, header. size, f, "char");119 if (status != header. size) {118 fseeko (f, 0, SEEK_SET); 119 status = Fwrite (header.buffer, 1, header.datasize, f, "char"); 120 if (status != header.datasize) { 120 121 fprintf (stderr, "ERROR: failed writing data to image header\n"); 121 122 exit (0); … … 123 124 124 125 /* position to end of file for new image data */ 125 fseek (f, header.size, SEEK_SET);126 fseeko (f, header.datasize, SEEK_SET); 126 127 status = Fwrite (image, sizeof(Image), Nimage, f, "image"); 127 128 if (status != Nimage) { … … 137 138 } 138 139 139 Image *LoadImageTable (FILE *f, Header *header, int *nimage) {140 Image *LoadImageTable (FILE *f, Header *header, off_t *nimage) { 140 141 141 int Nimage, Ndata, Nread, size;142 off_t Nimage, Ndata, Nread, size; 142 143 struct stat filestatus; 143 144 Image *image; … … 151 152 /* check that file size makes sense */ 152 153 Nimage = 0; 153 gfits_scan (header, "NIMAGES", "% d", 1, &Nimage);154 gfits_scan (header, "NIMAGES", "%lld", 1, &Nimage); 154 155 if (fstat (fileno(f), &filestatus) == -1) { 155 156 fprintf (stderr, "ERROR: failed to get status of image catalog\n"); 156 157 exit (1); 157 158 } 158 size = Nimage*sizeof(Image) + header[0]. size;159 size = Nimage*sizeof(Image) + header[0].datasize; 159 160 if (size != filestatus.st_size) { 160 161 Ndata = (filestatus.st_size - header[0].size) / sizeof (Image); -
branches/eam_branches/largefiles.20100314/Ohana/src/kapa2/src/Image.c
r25757 r27295 11 11 12 12 channel->coords.Npolyterms = 0; 13 channel->matrix. size = 0; /* a flag to show there is no data in the matrix */13 channel->matrix.datasize = 0; /* a flag to show there is no data in the matrix */ 14 14 ALLOCATE (channel->matrix.buffer, char, 1); /* allocate so later free will not crash! */ 15 15 -
branches/eam_branches/largefiles.20100314/Ohana/src/kapa2/src/LoadPicture.c
r26891 r27295 5 5 Header header; 6 6 char *buff; 7 int status, bytes_left;7 off_t status, bytes_left; 8 8 Section *section; 9 9 KapaImageWidget *image; … … 24 24 Xoffset = 0.0; 25 25 Yoffset = 0.0; 26 if (image[0].image[0].matrix. size) {26 if (image[0].image[0].matrix.datasize) { 27 27 // XXX enforce int center here? 28 28 Xoffset = image[0].picture.Xc - 0.5*image[0].image[0].matrix.Naxis[0]; … … 41 41 42 42 KiiScanMessage (sock, "%lf %lf %s %s", &image[0].image[0].zero, &image[0].image[0].range, image[0].image[0].name, image[0].image[0].file); 43 KiiScanMessage (sock, "%lf %lf % d", &image[0].image[0].min, &image[0].image[0].max, &header.size);43 KiiScanMessage (sock, "%lf %lf %lld", &image[0].image[0].min, &image[0].image[0].max, &header.datasize); 44 44 KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].image[0].coords.crval1, &image[0].image[0].coords.crpix1, &image[0].image[0].coords.cdelt1, &image[0].image[0].coords.pc1_1, &image[0].image[0].coords.pc1_2); 45 45 KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].image[0].coords.crval2, &image[0].image[0].coords.crpix2, &image[0].image[0].coords.cdelt2, &image[0].image[0].coords.pc2_1, &image[0].image[0].coords.pc2_2); … … 67 67 status = 1; 68 68 buff = image[0].image[0].matrix.buffer; 69 bytes_left = header. size;70 image[0].image[0].matrix. size = 0;69 bytes_left = header.datasize; 70 image[0].image[0].matrix.datasize = 0; 71 71 while (bytes_left > 0) { 72 72 status = read (sock, buff, bytes_left); … … 77 77 } 78 78 if (status != -1) { /* pipe has data */ 79 image[0].image[0].matrix. size += status;79 image[0].image[0].matrix.datasize += status; 80 80 bytes_left -= status; 81 81 buff = (char *)(buff + status); … … 85 85 fcntl (sock, F_SETFL, !O_NONBLOCK); 86 86 87 if (DEBUG) fprintf (stderr, "read %d bytes\n", image[0].image[0].matrix. size);87 if (DEBUG) fprintf (stderr, "read %d bytes\n", image[0].image[0].matrix.datasize); 88 88 /* it it not obvious this condition should kill kii, but ... */ 89 if (image[0].image[0].matrix. size != header.size) {90 fprintf (stderr, "error: expected % d bytes, but got only %d\n", header.size, image[0].image[0].matrix.size);89 if (image[0].image[0].matrix.datasize != header.datasize) { 90 fprintf (stderr, "error: expected %lld bytes, but got only %lld\n", header.datasize, image[0].image[0].matrix.datasize); 91 91 return (FALSE); 92 92 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libautocode/def/autocode.c
r24399 r27295 1 1 # include "autocode.h" 2 2 3 int gfits_convert_$STRUCT ($STRUCT *data, int size, int nitems) {3 int gfits_convert_$STRUCT ($STRUCT *data, off_t size, off_t nitems) { 4 4 5 int i;5 off_t i; 6 6 unsigned char *byte, tmp; 7 7 8 8 if (size != $SIZE) { 9 fprintf (stderr, "WARNING: mismatch in data types $STRUCT: % d vs %d\n", size,$SIZE);9 fprintf (stderr, "WARNING: mismatch in data types $STRUCT: %lld vs %lld\n", (long long) size, (long long) $SIZE); 10 10 return (FALSE); 11 11 } … … 25 25 } 26 26 27 $STRUCT *gfits_downsize_and_convert_$STRUCT ($STRUCT *data, int size, int nitems) {27 $STRUCT *gfits_downsize_and_convert_$STRUCT ($STRUCT *data, off_t size, off_t nitems) { 28 28 29 int i;29 off_t i; 30 30 unsigned char *byte, tmp; 31 31 $STRUCT *output; 32 32 33 33 if ($SIZE > size) { 34 fprintf (stderr, "ERROR: uncorrectable mismatch in data types $STRUCT: % d vs %d\n", size,$SIZE);34 fprintf (stderr, "ERROR: uncorrectable mismatch in data types $STRUCT: %lld vs %lld\n", (long long) size, (long long) $SIZE); 35 35 exit (1); 36 36 } … … 58 58 /*** add test of EXTNAME and header-defined columns? ***/ 59 59 /* return internal structure representation */ 60 $STRUCT *gfits_table_get_$STRUCT (FTable *ftable, int *Ndata, int*swapped) {60 $STRUCT *gfits_table_get_$STRUCT (FTable *ftable, off_t *Ndata, char *swapped) { 61 61 62 62 $STRUCT *data, *output; … … 68 68 output = gfits_downsize_and_convert_$STRUCT (data, sizeof ($STRUCT), *Ndata); 69 69 free (ftable[0].buffer); 70 ftable[0].buffer = output;70 ftable[0].buffer = (char *) output; 71 71 // XXX do I need to change NX? 72 72 } … … 77 77 } 78 78 79 int gfits_table_set_$STRUCT (FTable *ftable, $STRUCT *data, int Ndata) {79 int gfits_table_set_$STRUCT (FTable *ftable, $STRUCT *data, off_t Ndata) { 80 80 81 81 Header *header; -
branches/eam_branches/largefiles.20100314/Ohana/src/libautocode/def/autocode.h
r7080 r27295 2 2 /** STRUCT DEFINITION **/ 3 3 4 $STRUCT *gfits_table_get_$STRUCT (FTable *table, int *Ndata, int*swapped);5 int gfits_table_set_$STRUCT (FTable *ftable, $STRUCT *data, int Ndata);4 $STRUCT *gfits_table_get_$STRUCT (FTable *table, off_t *Ndata, char *swapped); 5 int gfits_table_set_$STRUCT (FTable *ftable, $STRUCT *data, off_t Ndata); 6 6 int gfits_table_mkheader_$STRUCT (Header *header); 7 int gfits_convert_$STRUCT ($STRUCT *data, int size, int nitems);8 int Send_$STRUCT (int device, $STRUCT *data, int Ndata, int copy);9 int Recv_$STRUCT (int device, $STRUCT **data, int *Ndata);7 int gfits_convert_$STRUCT ($STRUCT *data, off_t size, off_t nitems); 8 int Send_$STRUCT (int device, $STRUCT *data, int Ndata, int copy); 9 int Recv_$STRUCT (int device, $STRUCT **data, int *Ndata); -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/include/dvo.h
r25757 r27295 10 10 11 11 /* DVO table formats */ 12 typedef enum {DVO_FORMAT_UNDEF, 13 DVO_FORMAT_INTERNAL, 14 DVO_FORMAT_ELIXIR, 15 DVO_FORMAT_LONEOS, 16 DVO_FORMAT_PANSTARRS_DEV_0, 17 DVO_FORMAT_PANSTARRS_DEV_1, 18 DVO_FORMAT_PS1_DEV_1, 19 DVO_FORMAT_PS1_DEV_2, 20 DVO_FORMAT_PS1_DEV_3, 21 DVO_FORMAT_PS1_V1, 22 DVO_FORMAT_PS1_REF 12 typedef enum { 13 DVO_FORMAT_UNDEF, 14 DVO_FORMAT_INTERNAL, 15 DVO_FORMAT_ELIXIR, 16 DVO_FORMAT_LONEOS, 17 DVO_FORMAT_PANSTARRS_DEV_0, 18 DVO_FORMAT_PANSTARRS_DEV_1, 19 DVO_FORMAT_PS1_DEV_1, 20 DVO_FORMAT_PS1_DEV_2, 21 DVO_FORMAT_PS1_DEV_3, 22 DVO_FORMAT_PS1_V1, 23 DVO_FORMAT_PS1_REF 23 24 } DVOTableFormat; 24 25 … … 155 156 FILE *f; 156 157 char *filename; 157 int dbstate;158 int lockstate;159 158 double timeout; 160 159 Header header; … … 163 162 FTable ftable; 164 163 VTable vtable; 165 int mode; /* what data storage mode is used for disk file? */ 166 int format; /* what data format is used for disk file? */ 167 int virtual; /* is table in ftable or vtable? */ 168 int swapped; /* is table in internal byte-order? */ 164 int dbstate; 165 char lockstate; 166 char mode; /* what data storage mode is used for disk file? */ 167 char format; /* what data format is used for disk file? */ 168 char virtual; /* is table in ftable or vtable? */ 169 char swapped; /* is table in internal byte-order? */ 169 170 } FITS_DB; 170 171 … … 174 175 /* SkyRegion : better implementation than GSCRegion */ 175 176 typedef struct { 176 int Nregions;177 off_t Nregions; 177 178 char **filename; 178 179 SkyRegion *regions; … … 180 181 181 182 typedef struct { 182 int Nregions;183 off_t Nregions; 183 184 int ownElements; /* does this list own filename, regions? */ 184 185 char **filename; … … 187 188 188 189 // special-case function: 189 CMF_PS1_V2 *gfits_table_get_CMF_PS1_V1_Alt (FTable *ftable, int *Ndata, int *swapped); 190 191 # if (0) 192 /* structure for data on a catalog region */ 193 typedef struct { 194 char filename[256]; 195 double DEC[2], RA[2]; 196 } GSCRegion; 197 # endif 190 CMF_PS1_V2 *gfits_table_get_CMF_PS1_V1_Alt (FTable *ftable, off_t *Ndata, char *swapped); 198 191 199 192 typedef struct { … … 219 212 220 213 int Nsecfilt; /* number of secfilt entries for each average entry */ 221 int Naverage, Nmeasure, Nmissing, Nsecf_mem; /* current number of each component in memory */ 222 int Naves_disk, Nmeas_disk, Nmiss_disk, Nsecf_disk; /* current number of each component on disk */ 223 int Naves_off, Nmeas_off, Nmiss_off, Nsecf_off; /* index of first loaded data value */ 214 off_t Naverage, Nmeasure, Nmissing, Nsecf_mem; /* current number of each component in memory */ 215 off_t Naves_disk, Nmeas_disk, Nmiss_disk, Nsecf_disk; /* current number of each component on disk */ 216 off_t Naves_off, Nmeas_off, Nmiss_off, Nsecf_off; /* index of first loaded data value */ 217 218 /* the Nsecf_* values above are number of table rows (eg, Naverage*Nsecfilt) */ 224 219 225 220 /* note the different counting for Nsecfilt: … … 239 234 240 235 /* extra catalog information */ 241 intlockmode;242 intcatmode; /* storage mode (raw, mef, split, mysql) */243 intcatformat; /* storage format (elixir, panstarrs, etc) */244 intcatflags; /* choices to be loaded */245 intsorted; /* is measure table average-sorted? */236 char lockmode; 237 char catmode; /* storage mode (raw, mef, split, mysql) */ 238 char catformat; /* storage format (elixir, panstarrs, etc) */ 239 char catflags; /* choices to be loaded */ 240 char sorted; /* is measure table average-sorted? */ 246 241 247 242 /* pointers for data manipulation */ 248 int *found;249 int *image;250 int *mosaic;243 off_t *found; 244 off_t *image; 245 off_t *mosaic; 251 246 float *X; 252 247 float *Y; … … 261 256 int gfits_db_lock PROTO((FITS_DB *db, char *filename)); 262 257 int gfits_db_load PROTO((FITS_DB *db)); 263 int gfits_db_load_segment PROTO((FITS_DB *db, int start, int Nrows));258 int gfits_db_load_segment PROTO((FITS_DB *db, off_t start, off_t Nrows)); 264 259 int gfits_db_save PROTO((FITS_DB *db)); 265 260 int gfits_db_update PROTO((FITS_DB *db)); … … 348 343 char *get_mode_name (int mode); 349 344 350 /* these functions refer to the DVO structures defined in the includes above 351 * they are being replaced with autocode entries (drop when totally autocoded) 352 */ 353 345 // read/write with byteswap for generic types 354 346 int Fread (void *ptr, int size, int nitems, FILE *f, char *type); 355 347 int Fwrite (void *ptr, int size, int nitems, FILE *f, char *type); 356 int ByteSwap (char *ptr, int size, int nitems, char *type);357 int ConvertStruct (char *buffer, int size, int Nbytes, char *type);358 348 359 349 /** dvo_catalog APIs */ … … 384 374 int dvo_catalog_save_split_complete (Catalog *catalog, char VERBOSE); 385 375 386 int dvo_catalog_load_segment (Catalog *catalog, int VERBOSE, int start, int Nrows);387 int dvo_catalog_load_segment_split (Catalog *catalog, int VERBOSE, int start, int Nrows);376 int dvo_catalog_load_segment (Catalog *catalog, int VERBOSE, off_t start, off_t Nrows); 377 int dvo_catalog_load_segment_split (Catalog *catalog, int VERBOSE, off_t start, off_t Nrows); 388 378 389 379 /*** conversion functions / I/O conversions ***/ 390 Average *ReadRawAverage (FILE *f, int Naverage, intformat, SecFilt **primary);391 Measure *ReadRawMeasure (FILE *f, int Nmeasure, intformat);392 SecFilt *ReadRawSecFilt (FILE *f, int Nsecfilt, intformat);393 int WriteRawAverage (FILE *f, Average *average, int Naverage, intformat, SecFilt *primary);394 int WriteRawMeasure (FILE *f, Measure *measure, int Nmeasure, intformat);395 int WriteRawSecFilt (FILE *f, SecFilt *secfilt, int Nsecfilt, intformat);396 397 Average *FtableToAverage (FTable *ftable, int *Naverage, int*format, SecFilt **primary);398 Measure *FtableToMeasure (FTable *ftable, int *Nmeasure, int*format);399 SecFilt *FtableToSecFilt (FTable *ftable, int *Nsecfilt, int*format);400 int FtableToImage (FTable *ftable, Header *theader, int*format);401 402 int AverageToFtable (FTable *ftable, Average *average, int Naverage, intformat, SecFilt *primary);403 int MeasureToFtable (FTable *ftable, Measure *measure, int Nmeasure, intformat);404 int SecFiltToFtable (FTable *ftable, SecFilt *secfilt, int Nsecfilt, intformat);405 int ImageToFtable (FTable *ftable, Header *theader, intformat);406 int ImageToVtable (VTable *vtable, Header *theader, intformat);380 Average *ReadRawAverage (FILE *f, off_t Naverage, char format, SecFilt **primary); 381 Measure *ReadRawMeasure (FILE *f, off_t Nmeasure, char format); 382 SecFilt *ReadRawSecFilt (FILE *f, off_t Nsecfilt, char format); 383 int WriteRawAverage (FILE *f, Average *average, off_t Naverage, char format, SecFilt *primary); 384 int WriteRawMeasure (FILE *f, Measure *measure, off_t Nmeasure, char format); 385 int WriteRawSecFilt (FILE *f, SecFilt *secfilt, off_t Nsecfilt, char format); 386 387 Average *FtableToAverage (FTable *ftable, off_t *Naverage, char *format, SecFilt **primary); 388 Measure *FtableToMeasure (FTable *ftable, off_t *Nmeasure, char *format); 389 SecFilt *FtableToSecFilt (FTable *ftable, off_t *Nsecfilt, char *format); 390 int FtableToImage (FTable *ftable, Header *theader, char *format); 391 392 int AverageToFtable (FTable *ftable, Average *average, off_t Naverage, char format, SecFilt *primary); 393 int MeasureToFtable (FTable *ftable, Measure *measure, off_t Nmeasure, char format); 394 int SecFiltToFtable (FTable *ftable, SecFilt *secfilt, off_t Nsecfilt, char format); 395 int ImageToFtable (FTable *ftable, Header *theader, char format); 396 int ImageToVtable (VTable *vtable, Header *theader, char format); 407 397 408 398 # include "loneos_defs.h" … … 425 415 int dvo_image_update_raw (FITS_DB *db, int VERBOSE); 426 416 int dvo_image_save_raw (FITS_DB *db, int VERBOSE); 427 int dvo_image_addrows (FITS_DB *db, Image *new, int Nnew);417 int dvo_image_addrows (FITS_DB *db, Image *new, off_t Nnew); 428 418 void dvo_image_create (FITS_DB *db, double ZeroPoint); 429 419 … … 454 444 455 445 /* dvo-specific sorting functions */ 456 void sortave (Average *ave, int N);457 void sort_image_subset (Image *image, int *subset, int N);458 void sort_coords_index (double *X, double *Y, int *S, int N);459 void sort_regions (SkyRegion *region, int N);446 void sortave (Average *ave, off_t N); 447 void sort_image_subset (Image *image, off_t *subset, off_t N); 448 void sort_coords_index (double *X, double *Y, off_t *S, off_t N); 449 void sort_regions (SkyRegion *region, off_t N); 460 450 461 451 # endif -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/include/dvo_util.h
r26410 r27295 9 9 10 10 typedef struct { 11 char gscfile[256];12 char catdir[256];13 char catmode[256];14 char catformat[256];15 char photcodeFile[256];16 char skyTableFile[256];17 int skyDepth;18 FITS_DB imageDB;19 Image *images;20 intnImages;21 SkyTable *skyTable;11 char gscfile[256]; 12 char catdir[256]; 13 char catmode[256]; 14 char catformat[256]; 15 char photcodeFile[256]; 16 char skyTableFile[256]; 17 int skyDepth; 18 FITS_DB imageDB; 19 Image *images; 20 off_t nImages; 21 SkyTable *skyTable; 22 22 #if (DVO_UTIL_READ_CAMERA_CONFIG) 23 char cameraConfig[256];24 int *ccdNum;25 int nCCD;23 char cameraConfig[256]; 24 int *ccdNum; 25 int nCCD; 26 26 #endif 27 27 } dvoConfig; … … 29 29 // This structure needs to be fleshed out 30 30 typedef struct { 31 int valid;32 Average ave;33 Measure meas;31 int valid; 32 Average ave; 33 Measure meas; 34 34 #ifdef notdef 35 int objID;36 int catID;37 int detID;38 uint64_t pspsObjID;39 uint64_t pspsDetID;35 int objID; 36 int catID; 37 int detID; 38 uint64_t pspsObjID; 39 uint64_t pspsDetID; 40 40 #endif 41 41 } dvoDetection; … … 72 72 // return a list of detectsions from a particular image id 73 73 // Use dvoFree() to free the memory pointed to by results 74 int dvoGetDetections(SkyList *skylist, int imageID, dvoDetection **results, int *pMaxDetID);74 off_t dvoGetDetections(SkyList *skylist, int imageID, dvoDetection **results, int *pMaxDetID); 75 75 76 76 // free memory returned by various dvo util functions -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/LoadPhotcodesFITS.c
r24748 r27295 11 11 char extname[80]; 12 12 13 int i, code, Ncode, Nsec, Nsecfilt; 13 int i, code, Nsec, Nsecfilt; 14 off_t Ncode; 14 15 15 16 /* XXX choose more sensible lock timeouts! */ -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/cmf-ps1-v1-alt.c
r24400 r27295 1 1 # include "dvo.h" 2 2 3 CMF_PS1_V2 *gfits_table_get_CMF_PS1_V1_Alt (FTable *ftable, int *Ndata, int*swapped) {3 CMF_PS1_V2 *gfits_table_get_CMF_PS1_V1_Alt (FTable *ftable, off_t *Ndata, char *swapped) { 4 4 5 int i, nitems;5 off_t i, nitems; 6 6 unsigned char *byte, *inbyte, *otbyte, tmp; 7 7 CMF_PS1_V2 *output; … … 13 13 // this function is a special case : it must have Nx = 136 14 14 if (ftable[0].header[0].Naxis[0] != 136) { 15 fprintf (stderr, "ERROR: wrong format for CMF_PS1_V1_Alt: % d vs %d\n",ftable[0].header[0].Naxis[0], 136);15 fprintf (stderr, "ERROR: wrong format for CMF_PS1_V1_Alt: %lld vs %d\n", (long long) ftable[0].header[0].Naxis[0], 136); 16 16 exit (2); 17 17 } … … 83 83 84 84 free (ftable[0].buffer); 85 ftable[0].buffer = output;85 ftable[0].buffer = (char *) output; 86 86 87 87 // XXX other mods to make ftable consistent with CMF_PS1_V2? (Nx, EXTNAME?) -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/coordops.c
r27025 r27295 307 307 int i; 308 308 double Ro, Xo, Yo; 309 double dX, dY, X, Y,Lo, Mo, dL, dM;309 double dX, dY, Lo, Mo, dL, dM; 310 310 double dLdX, dLdY, dMdX, dMdY, Do; 311 311 -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/dvo_catalog.c
r26398 r27295 141 141 if (catalog[0].f == NULL) return (DVO_CAT_OPEN_FAIL); 142 142 143 fseek (catalog[0].f, 0, SEEK_SET);143 fseeko (catalog[0].f, 0, SEEK_SET); 144 144 return (DVO_CAT_OPEN_OK); 145 145 } … … 376 376 int dvo_catalog_check (Catalog *catalog, int Nsecfilt, int extend) { 377 377 378 int i, j, Nextra, in, out; 378 off_t in, out, i; 379 int j, Nextra; 379 380 SecFilt *insec, *outsec; 380 381 … … 444 445 */ 445 446 446 int dvo_catalog_load_segment (Catalog *catalog, int VERBOSE, int start, int Nrows) {447 int dvo_catalog_load_segment (Catalog *catalog, int VERBOSE, off_t start, off_t Nrows) { 447 448 448 449 switch (catalog[0].catmode) { -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/dvo_catalog_mef.c
r24755 r27295 3 3 int dvo_catalog_load_mef (Catalog *catalog, int VERBOSE) { 4 4 5 int Nitems, Nbytes, Nexpect, Naverage, Nmeasure, Nmissing, Nsecfilt;5 off_t Nitems, Nbytes, Nexpect, Naverage, Nmeasure, Nmissing, Nsecfilt; 6 6 FILE *f; 7 7 … … 15 15 16 16 /* move pointer past header -- must be already read (load_catalog) */ 17 fseek (f, catalog[0].header.size, SEEK_SET);17 fseeko (f, catalog[0].header.datasize, SEEK_SET); 18 18 19 19 /* matrix should be empty */ … … 23 23 } 24 24 /* get the components from the header */ 25 if (!gfits_scan (&catalog[0].header, "NSTARS", "% d", 1, &Naverage)) return (FALSE);26 if (!gfits_scan (&catalog[0].header, "NMEAS", "% d", 1, &Nmeasure)) return (FALSE);27 if (!gfits_scan (&catalog[0].header, "NMISS", "% d", 1, &Nmissing)) return (FALSE);28 if (!gfits_scan (&catalog[0].header, "NSECFILT", "% d", 1, &Nsecfilt)) Nsecfilt = 0;25 if (!gfits_scan (&catalog[0].header, "NSTARS", "%lld", 1, &Naverage)) return (FALSE); 26 if (!gfits_scan (&catalog[0].header, "NMEAS", "%lld", 1, &Nmeasure)) return (FALSE); 27 if (!gfits_scan (&catalog[0].header, "NMISS", "%lld", 1, &Nmissing)) return (FALSE); 28 if (!gfits_scan (&catalog[0].header, "NSECFILT", "%lld", 1, &Nsecfilt)) Nsecfilt = 0; 29 29 30 30 /* the OBJID is a counter that uniquely defines an average entry and never changes. if … … 72 72 catalog[0].average = FtableToAverage (&ftable, &Naverage, &catalog[0].catformat, &primary); 73 73 if (Naverage != catalog[0].Naves_disk) { 74 fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (% d vs %d)\n", Naverage,catalog[0].Naves_disk);74 fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%lld vs %lld)\n", (long long) Naverage, (long long) catalog[0].Naves_disk); 75 75 } 76 76 catalog[0].Naverage = catalog[0].Naves_disk; … … 78 78 } else { 79 79 Nbytes = gfits_data_size (&header); 80 fseek (f, Nbytes, SEEK_CUR);80 fseeko (f, Nbytes, SEEK_CUR); 81 81 ALLOCATE (catalog[0].average, Average, 1); 82 82 catalog[0].Naverage = 0; … … 99 99 catalog[0].measure = FtableToMeasure (&ftable, &catalog[0].Nmeasure, &catalog[0].catformat); 100 100 if (Nmeasure != catalog[0].Nmeas_disk) { 101 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (% d vs %d)\n", Nmeasure,catalog[0].Nmeas_disk);101 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%lld vs %lld)\n", (long long) Nmeasure, (long long) catalog[0].Nmeas_disk); 102 102 } 103 103 catalog[0].Nmeasure = catalog[0].Nmeas_disk; … … 105 105 } else { 106 106 Nbytes = gfits_data_size (&header); 107 fseek (f, Nbytes, SEEK_CUR);107 fseeko (f, Nbytes, SEEK_CUR); 108 108 ALLOCATE (catalog[0].measure, Measure, 1); 109 109 catalog[0].Nmeasure = 0; … … 125 125 catalog[0].missing = gfits_table_get_Missing (&ftable, &catalog[0].Nmissing, NULL); 126 126 if (Nmissing != catalog[0].Nmiss_disk) { 127 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (% d vs %d)\n", Nmissing,catalog[0].Nmiss_disk);127 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%lld vs %lld)\n", (long long) Nmissing, (long long) catalog[0].Nmiss_disk); 128 128 } 129 129 catalog[0].Nmissing = catalog[0].Nmiss_disk; … … 131 131 } else { 132 132 Nbytes = gfits_data_size (&header); 133 fseek (f, Nbytes, SEEK_CUR);133 fseeko (f, Nbytes, SEEK_CUR); 134 134 ALLOCATE (catalog[0].missing, Missing, 1); 135 135 catalog[0].Nmissing = 0; … … 153 153 catalog[0].secfilt = FtableToSecFilt (&ftable, &Nitems, &catalog[0].catformat); 154 154 if (Nexpect != Nitems) { 155 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (% d vs %d)\n", Nexpect,Nitems);155 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%lld vs %lld)\n", (long long) Nexpect, (long long) Nitems); 156 156 } 157 157 … … 159 159 we need to interleave these magnitudes with the secfilt entries just loaded */ 160 160 if (primary != NULL) { 161 int Ntmpfilt, Ntotal, i, j;161 off_t Ntmpfilt, Ntotal, i, j; 162 162 SecFilt *tmpfilt; 163 163 tmpfilt = catalog[0].secfilt; … … 182 182 /* no real need to skip the data array here... */ 183 183 Nbytes = gfits_data_size (&header); 184 fseek (f, Nbytes, SEEK_CUR);184 fseeko (f, Nbytes, SEEK_CUR); 185 185 if (primary != NULL) { 186 186 free (primary); … … 200 200 int dvo_catalog_save_mef (Catalog *catalog, char VERBOSE) { 201 201 202 int Nitems;202 off_t Nitems; 203 203 FILE *f; 204 204 Matrix matrix; … … 207 207 SecFilt *primary; 208 208 SecFilt *secfilt; 209 int i, j, Nsecfilt, Nallfilt, Ntotal;209 off_t i, j, Nsecfilt, Nallfilt, Ntotal; 210 210 211 211 if (catalog[0].Naverage == 0) { … … 236 236 237 237 /* make sure header is consistent with data */ 238 gfits_modify (&catalog[0].header, "NSTARS", "% d", 1, catalog[0].Naverage);239 gfits_modify (&catalog[0].header, "NMEAS", "% d", 1, catalog[0].Nmeasure);240 gfits_modify (&catalog[0].header, "NMISS", "% d", 1, catalog[0].Nmissing);241 gfits_modify (&catalog[0].header, "NSECFILT", "% d", 1, Nsecfilt);238 gfits_modify (&catalog[0].header, "NSTARS", "%lld", 1, catalog[0].Naverage); 239 gfits_modify (&catalog[0].header, "NMEAS", "%lld", 1, catalog[0].Nmeasure); 240 gfits_modify (&catalog[0].header, "NMISS", "%lld", 1, catalog[0].Nmissing); 241 gfits_modify (&catalog[0].header, "NSECFILT", "%lld", 1, Nsecfilt); 242 242 gfits_modify (&catalog[0].header, "EXTEND", "%t", 1, TRUE); 243 243 gfits_modify (&catalog[0].header, "OBJID", "%d", 1, catalog[0].objID); … … 245 245 f = catalog[0].f; 246 246 /* rewind file pointers and truncate */ 247 fseek (f, 0, SEEK_SET);247 fseeko (f, 0LL, SEEK_SET); 248 248 ftruncate (fileno (catalog[0].f), 0); 249 249 ftable.header = &header; -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/dvo_catalog_raw.c
r24748 r27295 5 5 int dvo_catalog_load_raw (Catalog *catalog, int VERBOSE) { 6 6 7 int Nitems, nitems;8 int i, Nmeas, Nmiss, size;9 int NewMeasure, Nskip;10 int AverageSize, MeasureSize, MissingSize, SecFiltSize;7 off_t Nitems, nitems; 8 off_t i, Nmeas, Nmiss, size; 9 off_t NewMeasure, Nskip; 10 off_t AverageSize, MeasureSize, MissingSize, SecFiltSize; 11 11 FILE *f; 12 12 struct stat filestatus; … … 17 17 18 18 /* move pointer past header -- must be already read (load_catalog) */ 19 fseek (f, catalog[0].header.size, SEEK_SET);19 fseeko (f, catalog[0].header.datasize, SEEK_SET); 20 20 21 21 /* get the components from the header */ 22 22 catalog[0].Naverage = catalog[0].Nmeasure = catalog[0].Nmissing = catalog[0].Nsecfilt = 0; 23 if (!gfits_scan (&catalog[0].header, "NSTARS", "% d", 1, &catalog[0].Naverage)) return (FALSE);24 if (!gfits_scan (&catalog[0].header, "NMEAS", "% d", 1, &catalog[0].Nmeasure)) return (FALSE);25 if (!gfits_scan (&catalog[0].header, "NMISS", "% d", 1, &catalog[0].Nmissing)) return (FALSE);26 if (!gfits_scan (&catalog[0].header, "NSECFILT", "% d", 1, &catalog[0].Nsecfilt)) catalog[0].Nsecfilt = 0;23 if (!gfits_scan (&catalog[0].header, "NSTARS", "%lld", 1, &catalog[0].Naverage)) return (FALSE); 24 if (!gfits_scan (&catalog[0].header, "NMEAS", "%lld", 1, &catalog[0].Nmeasure)) return (FALSE); 25 if (!gfits_scan (&catalog[0].header, "NMISS", "%lld", 1, &catalog[0].Nmissing)) return (FALSE); 26 if (!gfits_scan (&catalog[0].header, "NSECFILT", "%lld", 1, &catalog[0].Nsecfilt)) catalog[0].Nsecfilt = 0; 27 27 28 28 /* the OBJID is a counter that uniquely defines an average entry and never changes. if … … 98 98 99 99 /* predicted file size - for double checking data validity */ 100 size = catalog[0].header. size;100 size = catalog[0].header.datasize; 101 101 size += AverageSize * catalog[0].Naverage; 102 102 size += MeasureSize * catalog[0].Nmeasure; … … 112 112 if (VERBOSE) { 113 113 fprintf (stderr, "star catalog has inconsistent size\n"); 114 fprintf (stderr, "average: % d = %d bytes\n", catalog[0].Naverage,catalog[0].Naverage*AverageSize);115 fprintf (stderr, "measure: % d = %d bytes\n", catalog[0].Nmeasure,catalog[0].Nmeasure*MeasureSize);116 fprintf (stderr, "missing: % d = %d bytes\n", catalog[0].Nmissing,catalog[0].Nmissing*MissingSize);117 fprintf (stderr, "secfilt: % d = %d bytes\n", catalog[0].Nsecfilt,catalog[0].Nsecfilt*SecFiltSize*catalog[0].Naverage);118 fprintf (stderr, "expect: % d, found: %d\n", size, (int)filestatus.st_size);114 fprintf (stderr, "average: %lld = %lld bytes\n", (long long) catalog[0].Naverage, (long long) catalog[0].Naverage*AverageSize); 115 fprintf (stderr, "measure: %lld = %lld bytes\n", (long long) catalog[0].Nmeasure, (long long) catalog[0].Nmeasure*MeasureSize); 116 fprintf (stderr, "missing: %lld = %lld bytes\n", (long long) catalog[0].Nmissing, (long long) catalog[0].Nmissing*MissingSize); 117 fprintf (stderr, "secfilt: %lld = %lld bytes\n", (long long) catalog[0].Nsecfilt, (long long) catalog[0].Nsecfilt*SecFiltSize*catalog[0].Naverage); 118 fprintf (stderr, "expect: %lld, found: %lld\n", (long long) size, (long long) filestatus.st_size); 119 119 } 120 120 return (FALSE); … … 136 136 /* skip over averages */ 137 137 Nskip = catalog[0].Naverage * AverageSize; 138 fseek (f, Nskip, SEEK_CUR);138 fseeko (f, Nskip, SEEK_CUR); 139 139 } 140 140 … … 145 145 /* skip over measures */ 146 146 Nskip = catalog[0].Nmeasure * MeasureSize; 147 fseek (f, Nskip, SEEK_CUR);147 fseeko (f, Nskip, SEEK_CUR); 148 148 } 149 149 … … 154 154 nitems = fread (catalog[0].missing, MissingSize, Nitems, f); 155 155 if (nitems != Nitems) { 156 if (VERBOSE) fprintf (stderr, "failed to read missing from catalog file %s (% d vs %d)\n", catalog[0].filename, nitems,Nitems);156 if (VERBOSE) fprintf (stderr, "failed to read missing from catalog file %s (%lld vs %lld)\n", catalog[0].filename, (long long) nitems, (long long) Nitems); 157 157 return (FALSE); 158 158 } … … 161 161 /* skip over missings */ 162 162 Nskip = catalog[0].Nmissing * MissingSize; 163 fseek (f, Nskip, SEEK_CUR);163 fseeko (f, Nskip, SEEK_CUR); 164 164 } 165 165 … … 172 172 we need to interleave these magnitudes with the secfilt entries just loaded */ 173 173 if (primary != NULL) { 174 int Ntmpfilt, Nsecfilt, Ntotal, i, j;174 off_t Ntmpfilt, Nsecfilt, Ntotal, i, j; 175 175 SecFilt *tmpfilt; 176 176 tmpfilt = catalog[0].secfilt; … … 193 193 /* skip over secfilts */ 194 194 Nskip = catalog[0].Nsecfilt * catalog[0].Naverage * SecFiltSize; 195 fseek (f, Nskip, SEEK_CUR);195 fseeko (f, Nskip, SEEK_CUR); 196 196 if (primary != NULL) free (primary); 197 197 } 198 198 199 if (VERBOSE) fprintf (stderr, "read %d stars from catalog file %s (%d measurements, %d missing, %d secondary filters)\n", 200 catalog[0].Naverage, catalog[0].filename, catalog[0].Nmeasure, catalog[0].Nmissing, catalog[0].Nsecfilt); 199 if (VERBOSE) fprintf (stderr, "read %lld stars from catalog file %s (%lld measurements, %lld missing, %lld secondary filters)\n", 200 (long long) catalog[0].Naverage, 201 catalog[0].filename, 202 (long long) catalog[0].Nmeasure, 203 (long long) catalog[0].Nmissing, 204 (long long) catalog[0].Nsecfilt); 201 205 202 206 /* check data integrity */ … … 209 213 if (VERBOSE) { 210 214 fprintf (stderr, "****** data in catalog %s is corrupt, sums don't check\n", catalog[0].filename); 211 fprintf (stderr, "****** Nmeas: % d, %d\n", Nmeas,catalog[0].Nmeasure);212 fprintf (stderr, "****** Nmiss: % d, %d\n", Nmiss,catalog[0].Nmissing);215 fprintf (stderr, "****** Nmeas: %lld, %lld\n", (long long) Nmeas, (long long) catalog[0].Nmeasure); 216 fprintf (stderr, "****** Nmiss: %lld, %lld\n", (long long) Nmiss, (long long) catalog[0].Nmissing); 213 217 } 214 218 return (FALSE); … … 226 230 int dvo_catalog_save_raw (Catalog *catalog, char VERBOSE) { 227 231 228 int Nitems, nitems;232 off_t Nitems, nitems; 229 233 FILE *f; 230 234 SecFilt *primary; 231 235 SecFilt *secfilt; 232 int i, j, Nsecfilt, Nallfilt, Ntotal;236 off_t i, j, Nsecfilt, Nallfilt, Ntotal; 233 237 234 238 if (catalog[0].Naverage == 0) { … … 259 263 260 264 /* make sure header is consistent with data */ 261 gfits_modify (&catalog[0].header, "NSTARS", "% d", 1,catalog[0].Naverage);262 gfits_modify (&catalog[0].header, "NMEAS", "% d", 1,catalog[0].Nmeasure);263 gfits_modify (&catalog[0].header, "NMISS", "% d", 1,catalog[0].Nmissing);264 gfits_modify (&catalog[0].header, "NSECFILT", "% d", 1,catalog[0].Nsecfilt);265 gfits_modify (&catalog[0].header, "NSTARS", "%lld", 1, (long long) catalog[0].Naverage); 266 gfits_modify (&catalog[0].header, "NMEAS", "%lld", 1, (long long) catalog[0].Nmeasure); 267 gfits_modify (&catalog[0].header, "NMISS", "%lld", 1, (long long) catalog[0].Nmissing); 268 gfits_modify (&catalog[0].header, "NSECFILT", "%lld", 1, (long long) catalog[0].Nsecfilt); 265 269 gfits_modify (&catalog[0].header, "OBJID", "%d", 1, catalog[0].objID); 266 270 … … 278 282 /* rewind file pointers and truncate file */ 279 283 f = catalog[0].f; 280 fseek (f, 0, SEEK_SET);284 fseeko (f, 0, SEEK_SET); 281 285 ftruncate (fileno (catalog[0].f), 0); 282 286 283 287 /* write header data (use gfits_write_header?) */ 284 nitems = fwrite (catalog[0].header.buffer, 1, catalog[0].header. size, f);285 if (nitems != catalog[0].header. size) {288 nitems = fwrite (catalog[0].header.buffer, 1, catalog[0].header.datasize, f); 289 if (nitems != catalog[0].header.datasize) { 286 290 if (VERBOSE) fprintf (stderr, "failed to write header\n"); 287 291 goto failure; … … 330 334 in these cases, save these values in primary; otherwise set primary to NULL */ 331 335 332 Average *ReadRawAverage (FILE *f, int Naverage, intformat, SecFilt **primary) {336 Average *ReadRawAverage (FILE *f, off_t Naverage, char format, SecFilt **primary) { 333 337 334 338 Average *average; … … 339 343 # define FORMAT_CASE(NAME,TYPE) \ 340 344 case DVO_FORMAT_##NAME: { \ 341 int nitems; \345 off_t nitems; \ 342 346 Average_##TYPE *tmpAverage; \ 343 347 ALLOCATE (tmpAverage, Average_##TYPE, MAX (Naverage, 1)); \ 344 348 nitems = fread (tmpAverage, sizeof(Average_##TYPE), Naverage, f); \ 345 349 if (nitems != Naverage) { \ 346 fprintf (stderr, "failed to read averages (% d vs %d)\n", nitems,Naverage); \350 fprintf (stderr, "failed to read averages (%lld vs %lld)\n", (long long) nitems, (long long) Naverage); \ 347 351 return (NULL); \ 348 352 } \ … … 354 358 switch (format) { 355 359 case DVO_FORMAT_INTERNAL: { 356 int nitems;360 off_t nitems; 357 361 ALLOCATE (average, Average, MAX (Naverage, 1)); 358 362 nitems = fread (average, sizeof(Average), Naverage, f); 359 363 if (nitems != Naverage) { 360 fprintf (stderr, "failed to read averages (% d vs %d)\n", nitems,Naverage);364 fprintf (stderr, "failed to read averages (%lld vs %lld)\n", (long long) nitems, (long long) Naverage); 361 365 return (NULL); 362 366 } … … 384 388 /* accepts and converts internal average formats and outputs 385 389 raw data in the specified format */ 386 int WriteRawAverage (FILE *f, Average *average, int Naverage, intformat, SecFilt *primary) {390 int WriteRawAverage (FILE *f, Average *average, off_t Naverage, char format, SecFilt *primary) { 387 391 388 392 // this macro generates the case statements for each type 389 393 # define FORMAT_CASE(NAME,TYPE) \ 390 394 case DVO_FORMAT_##NAME: { \ 391 int nitems; \395 off_t nitems; \ 392 396 Average_##TYPE *tmpAverage; \ 393 397 tmpAverage = AverageInternalTo_##TYPE (average, Naverage, primary); \ … … 396 400 free (tmpAverage); \ 397 401 if (nitems != Naverage) { \ 398 fprintf (stderr, "failed to write averages (% d vs %d)\n", nitems,Naverage); \402 fprintf (stderr, "failed to write averages (%lld vs %lld)\n", (long long) nitems, (long long) Naverage); \ 399 403 return (FALSE); \ 400 404 } \ … … 403 407 switch (format) { 404 408 case DVO_FORMAT_INTERNAL: { 405 int nitems;409 off_t nitems; 406 410 gfits_convert_Average (average, sizeof(Average), Naverage); 407 411 nitems = fwrite (average, sizeof(Average), Naverage, f); 408 412 if (nitems != Naverage) { 409 fprintf (stderr, "failed to write averages (% d vs %d)\n", nitems,Naverage);413 fprintf (stderr, "failed to write averages (%lld vs %lld)\n", (long long) nitems, (long long) Naverage); 410 414 return (FALSE); 411 415 } … … 432 436 /** Average / Raw Table conversions **/ 433 437 434 Measure *ReadRawMeasure (FILE *f, int Nmeasure, intformat) {438 Measure *ReadRawMeasure (FILE *f, off_t Nmeasure, char format) { 435 439 436 440 Measure *measure; … … 439 443 # define FORMAT_CASE(NAME,TYPE) \ 440 444 case DVO_FORMAT_##NAME: { \ 441 int nitems; \445 off_t nitems; \ 442 446 Measure_##TYPE *tmpMeasure; \ 443 447 ALLOCATE (tmpMeasure, Measure_##TYPE, MAX (Nmeasure, 1)); \ 444 448 nitems = fread (tmpMeasure, sizeof(Measure_##TYPE), Nmeasure, f); \ 445 449 if (nitems != Nmeasure) { \ 446 fprintf (stderr, "failed to read measures (% d vs %d)\n", nitems,Nmeasure); \450 fprintf (stderr, "failed to read measures (%lld vs %lld)\n", (long long) nitems, (long long) Nmeasure); \ 447 451 return (NULL); \ 448 452 } \ … … 454 458 switch (format) { 455 459 case DVO_FORMAT_INTERNAL: { 456 int nitems;460 off_t nitems; 457 461 ALLOCATE (measure, Measure, MAX (Nmeasure, 1)); 458 462 nitems = fread (measure, sizeof(Measure), Nmeasure, f); 459 463 if (nitems != Nmeasure) { 460 fprintf (stderr, "failed to read measures (% d vs %d)\n", nitems,Nmeasure);464 fprintf (stderr, "failed to read measures (%lld vs %lld)\n", (long long) nitems, (long long) Nmeasure); 461 465 return (NULL); 462 466 } … … 484 488 /* accepts and converts internal measure formats and outputs 485 489 raw data in the specified format */ 486 int WriteRawMeasure (FILE *f, Measure *measure, int Nmeasure, intformat) {490 int WriteRawMeasure (FILE *f, Measure *measure, off_t Nmeasure, char format) { 487 491 488 492 // this macro generates the case statements for each type 489 493 # define FORMAT_CASE(NAME,TYPE) \ 490 494 case DVO_FORMAT_##NAME: { \ 491 int nitems; \495 off_t nitems; \ 492 496 Measure_##TYPE *tmpMeasure; \ 493 497 tmpMeasure = MeasureInternalTo_##TYPE (measure, Nmeasure); \ … … 496 500 free (tmpMeasure); \ 497 501 if (nitems != Nmeasure) { \ 498 fprintf (stderr, "failed to write measures (% d vs %d)\n", nitems,Nmeasure); \502 fprintf (stderr, "failed to write measures (%lld vs %lld)\n", (long long) nitems, (long long) Nmeasure); \ 499 503 return (FALSE); \ 500 504 } \ … … 503 507 switch (format) { 504 508 case DVO_FORMAT_INTERNAL: { 505 int nitems;509 off_t nitems; 506 510 gfits_convert_Measure (measure, sizeof(Measure), Nmeasure); 507 511 nitems = fwrite (measure, sizeof(Measure), Nmeasure, f); 508 512 if (nitems != Nmeasure) { 509 fprintf (stderr, "failed to write measures (% d vs %d)\n", nitems,Nmeasure);513 fprintf (stderr, "failed to write measures (%lld vs %lld)\n", (long long) nitems, (long long) Nmeasure); 510 514 return (FALSE); 511 515 } … … 532 536 /** SecFilt / Raw Table conversions **/ 533 537 534 SecFilt *ReadRawSecFilt (FILE *f, int Nsecfilt, intformat) {538 SecFilt *ReadRawSecFilt (FILE *f, off_t Nsecfilt, char format) { 535 539 536 540 SecFilt *secfilt; … … 539 543 # define FORMAT_CASE(NAME,TYPE) \ 540 544 case DVO_FORMAT_##NAME: { \ 541 int nitems; \545 off_t nitems; \ 542 546 SecFilt_##TYPE *tmpSecFilt; \ 543 547 ALLOCATE (tmpSecFilt, SecFilt_##TYPE, MAX (Nsecfilt, 1)); \ 544 548 nitems = fread (tmpSecFilt, sizeof(SecFilt_##TYPE), Nsecfilt, f); \ 545 549 if (nitems != Nsecfilt) { \ 546 fprintf (stderr, "failed to read secfilts (% d vs %d)\n", nitems,Nsecfilt); \550 fprintf (stderr, "failed to read secfilts (%lld vs %lld)\n", (long long) nitems, (long long) Nsecfilt); \ 547 551 return (NULL); \ 548 552 } \ … … 554 558 switch (format) { 555 559 case DVO_FORMAT_INTERNAL: { 556 int nitems;560 off_t nitems; 557 561 ALLOCATE (secfilt, SecFilt, MAX (Nsecfilt, 1)); 558 562 nitems = fread (secfilt, sizeof(SecFilt), Nsecfilt, f); 559 563 if (nitems != Nsecfilt) { 560 fprintf (stderr, "failed to read secfilts (% d vs %d)\n", nitems,Nsecfilt);564 fprintf (stderr, "failed to read secfilts (%lld vs %lld)\n", (long long) nitems, (long long) Nsecfilt); 561 565 return (NULL); 562 566 } … … 584 588 /* accepts and converts internal secfilt formats and outputs 585 589 raw data in the specified format */ 586 int WriteRawSecFilt (FILE *f, SecFilt *secfilt, int Nsecfilt, intformat) {590 int WriteRawSecFilt (FILE *f, SecFilt *secfilt, off_t Nsecfilt, char format) { 587 591 588 592 // this macro generates the case statements for each type 589 593 # define FORMAT_CASE(NAME,TYPE) \ 590 594 case DVO_FORMAT_##NAME: { \ 591 int nitems; \595 off_t nitems; \ 592 596 SecFilt_##TYPE *tmpSecFilt; \ 593 597 tmpSecFilt = SecFiltInternalTo_##TYPE (secfilt, Nsecfilt); \ … … 596 600 free (tmpSecFilt); \ 597 601 if (nitems != Nsecfilt) { \ 598 fprintf (stderr, "failed to write secfilts (% d vs %d)\n", nitems,Nsecfilt); \602 fprintf (stderr, "failed to write secfilts (%lld vs %lld)\n", (long long) nitems, (long long) Nsecfilt); \ 599 603 return (FALSE); \ 600 604 } \ … … 603 607 switch (format) { 604 608 case DVO_FORMAT_INTERNAL: { 605 int nitems;609 off_t nitems; 606 610 gfits_convert_SecFilt (secfilt, sizeof(SecFilt), Nsecfilt); 607 611 nitems = fwrite (secfilt, sizeof(SecFilt), Nsecfilt, f); 608 612 if (nitems != Nsecfilt) { 609 fprintf (stderr, "failed to write secfilts (% d vs %d)\n", nitems,Nsecfilt);613 fprintf (stderr, "failed to write secfilts (%lld vs %lld)\n", (long long) nitems, (long long) Nsecfilt); 610 614 return (FALSE); 611 615 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/dvo_catalog_split.c
r20982 r27295 6 6 // * ok 7 7 8 int dvo_catalog_secfilt_to_primary (Catalog *catalog, SecFilt **myPrimary, SecFilt **mySecfilt, int *myNsecfilt) {9 10 int i, j, Nallfilt, Nsecfilt, Ntotal;8 int dvo_catalog_secfilt_to_primary (Catalog *catalog, SecFilt **myPrimary, SecFilt **mySecfilt, off_t *myNsecfilt) { 9 10 off_t i, j, Nallfilt, Nsecfilt, Ntotal; 11 11 12 12 SecFilt *primary; … … 43 43 } 44 44 45 int dvo_catalog_primary_to_secfilt (Catalog *catalog, SecFilt *primary, int Naves) {46 47 int Ntmpfilt, Nsecfilt, Ntotal, i, j;45 int dvo_catalog_primary_to_secfilt (Catalog *catalog, SecFilt *primary, off_t Naves) { 46 47 off_t Ntmpfilt, Nsecfilt, Ntotal, i, j; 48 48 SecFilt *tmpfilt; 49 49 … … 71 71 } 72 72 73 int dvo_catalog_save_subcat (Catalog *catalog, FTable *ftable, int start, int Nrows, int Ndisk, int Ntotal) {73 int dvo_catalog_save_subcat (Catalog *catalog, FTable *ftable, off_t start, off_t Nrows, off_t Ndisk, off_t Ntotal) { 74 74 75 75 Matrix matrix; 76 76 77 77 /* rewind file pointers and truncate (file is still open) */ 78 fseek (catalog->f, 0, SEEK_SET);78 fseeko (catalog->f, 0LL, SEEK_SET); 79 79 80 80 // write PHU header … … 103 103 int dvo_catalog_open_subcat (Catalog *catalog, Catalog **Subcat, Header *header, char *name, int VERBOSE) { 104 104 105 int Nskip, status; 105 off_t Nskip; 106 int status; 106 107 char *path, string[80]; 107 108 Catalog *subcat; … … 145 146 } 146 147 Nskip = gfits_data_size (&subcat[0].header); 147 fseek (subcat[0].f, Nskip, SEEK_CUR);148 fseeko (subcat[0].f, Nskip, SEEK_CUR); 148 149 149 150 /* read Measure table header */ … … 158 159 int dvo_catalog_load_split (Catalog *catalog, int VERBOSE) { 159 160 160 int Nbytes, Nitems, Naverage, Nmeasure, Nmissing, Nsecfilt, status; 161 off_t Nbytes; 162 off_t Naverage, Nmeasure, Nmissing; 163 off_t Nitems, Nsecfilt; 164 int status; 161 165 Header header; 162 166 FTable ftable; … … 170 174 171 175 /* get the components from the header - these duplicate information in the split files (NAXIS2) */ 172 if (!gfits_scan (&catalog[0].header, "NSTARS", "% d", 1, &Naverage)) return (FALSE);173 if (!gfits_scan (&catalog[0].header, "NMEAS", "% d", 1, &Nmeasure)) return (FALSE);174 if (!gfits_scan (&catalog[0].header, "NMISS", "% d", 1, &Nmissing)) return (FALSE);175 if (!gfits_scan (&catalog[0].header, "NSECFILT", "% d", 1, &Nsecfilt)) Nsecfilt = 0;176 if (!gfits_scan (&catalog[0].header, "NSTARS", "%lld", 1, &Naverage)) return (FALSE); 177 if (!gfits_scan (&catalog[0].header, "NMEAS", "%lld", 1, &Nmeasure)) return (FALSE); 178 if (!gfits_scan (&catalog[0].header, "NMISS", "%lld", 1, &Nmissing)) return (FALSE); 179 if (!gfits_scan (&catalog[0].header, "NSECFILT", "%lld", 1, &Nsecfilt)) Nsecfilt = 0; 176 180 177 181 /* the OBJID is a counter that uniquely defines an average entry and never changes. if 178 182 it is not defined for a legacy database, we can generate them using the existing index values. 179 183 If it is missing, give a warning and recommend the user upgrade the DB */ 180 if (!gfits_scan (&catalog[0].header, "OBJID", "% d", 1, &catalog[0].objID)) {184 if (!gfits_scan (&catalog[0].header, "OBJID", "%u", 1, &catalog[0].objID)) { 181 185 if (VERBOSE) fprintf (stderr, "WARNING: OBJID is not set for this database: upgrade for full feature set\n"); 182 186 catalog[0].objID = 0; 183 187 } 184 if (!gfits_scan (&catalog[0].header, "CATID", "% d", 1, &catalog[0].catID)) {188 if (!gfits_scan (&catalog[0].header, "CATID", "%u", 1, &catalog[0].catID)) { 185 189 if (VERBOSE) fprintf (stderr, "WARNING: CATID is not set for this database: upgrade for full feature set\n"); 186 190 catalog[0].catID = 0; … … 206 210 if (catalog[0].catflags & LOAD_AVES) { 207 211 /* move pointer past header -- must be already read (load_catalog) */ 208 Nbytes = catalog[0].header. size + gfits_data_size (&catalog[0].header);209 fseek (catalog[0].f, Nbytes, SEEK_SET);212 Nbytes = catalog[0].header.datasize + gfits_data_size (&catalog[0].header); 213 fseeko (catalog[0].f, Nbytes, SEEK_SET); 210 214 /* read Average table header */ 211 215 if (!gfits_fread_header (catalog[0].f, &header)) { … … 223 227 catalog[0].average = FtableToAverage (&ftable, &Naverage, &catalog[0].catformat, &primary); 224 228 if (Naverage != catalog[0].Naves_disk) { 225 fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (% d vs %d)\n", Naverage,catalog[0].Naves_disk);229 fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%lld vs %lld)\n", (long long) Naverage, (long long) catalog[0].Naves_disk); 226 230 } 227 231 gfits_free_header (&header); … … 252 256 catalog[0].measure = FtableToMeasure (&ftable, &Nmeasure, &catalog[0].catformat); 253 257 if (Nmeasure != catalog[0].Nmeas_disk) { 254 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (% d vs %d)\n", Nmeasure,catalog[0].Nmeas_disk);258 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%lld vs %lld)\n", (long long) Nmeasure, (long long) catalog[0].Nmeas_disk); 255 259 } 256 260 catalog[0].Nmeasure = catalog[0].Nmeas_disk; … … 282 286 catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL); 283 287 if (Nmissing != catalog[0].Nmiss_disk) { 284 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (% d vs %d)\n", Nmissing,catalog[0].Nmiss_disk);288 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%lld vs %lld)\n", (long long) Nmissing, (long long) catalog[0].Nmiss_disk); 285 289 } 286 290 catalog[0].Nmissing = catalog[0].Nmiss_disk; … … 311 315 catalog[0].secfilt = FtableToSecFilt (&ftable, &Nitems, &catalog[0].catformat); 312 316 if (Nitems != catalog[0].Nsecf_disk) { 313 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (% d vs %d)\n", Nitems,catalog[0].Nsecf_disk);317 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%lld vs %lld)\n", (long long) Nitems, (long long) catalog[0].Nsecf_disk); 314 318 } 315 319 catalog[0].Nsecf_mem = catalog[0].Nsecf_disk; … … 339 343 // I need to always read both average and secfilt at the same time to correctly manage the 340 344 // primary secfilt values... 341 int dvo_catalog_load_segment_split (Catalog *catalog, int VERBOSE, int start, int Nrows) { 342 343 int Nbytes, Naverage, Nexpect, Nitems, Nmeasure, Nmissing; 345 int dvo_catalog_load_segment_split (Catalog *catalog, int VERBOSE, off_t start, off_t Nrows) { 346 347 off_t Nbytes; 348 off_t Naverage, Nexpect, Nitems, Nmeasure, Nmissing; 344 349 Header header; 345 350 FTable ftable; … … 357 362 /*** load the Average data ***/ 358 363 /* move pointer past header and matrix -- must be already read (load_catalog) */ 359 Nbytes = catalog[0].header. size + gfits_data_size (&catalog[0].header);360 fseek (catalog[0].f, Nbytes, SEEK_SET);364 Nbytes = catalog[0].header.datasize + gfits_data_size (&catalog[0].header); 365 fseeko (catalog[0].f, Nbytes, SEEK_SET); 361 366 /* read Average table header */ 362 367 if (!gfits_fread_header (catalog[0].f, &header)) { … … 386 391 387 392 /* move pointer past header -- must be already read (load_catalog) */ 388 Nbytes = subcat[0].header. size + gfits_data_size (&subcat[0].header);389 fseek (subcat[0].f, Nbytes, SEEK_SET);393 Nbytes = subcat[0].header.datasize + gfits_data_size (&subcat[0].header); 394 fseeko (subcat[0].f, Nbytes, SEEK_SET); 390 395 391 396 /* read Secfilt table header */ … … 403 408 catalog[0].secfilt = FtableToSecFilt (&ftable, &Nitems, &catalog[0].catformat); 404 409 if (Nitems != Nexpect) { 405 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (% d vs %d)\n", Nitems,Nexpect);410 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%lld vs %lld)\n", (long long) Nitems, (long long) Nexpect); 406 411 } 407 412 catalog[0].Nsecf_mem = catalog[0].Naverage * catalog[0].Nsecfilt; … … 422 427 423 428 /* move pointer past header -- must be already read (load_catalog) */ 424 Nbytes = subcat[0].header. size + gfits_data_size (&subcat[0].header);425 fseek (subcat[0].f, Nbytes, SEEK_SET);429 Nbytes = subcat[0].header.datasize + gfits_data_size (&subcat[0].header); 430 fseeko (subcat[0].f, Nbytes, SEEK_SET); 426 431 427 432 /* read Measure table header */ … … 439 444 catalog[0].measure = FtableToMeasure (&ftable, &Nmeasure, &catalog[0].catformat); 440 445 if (Nmeasure != Nrows) { 441 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (% d vs %d)\n", Nmeasure,Nrows);446 fprintf (stderr, "Warning: mismatch between Nmeasure in PHU and Table headers (%lld vs %lld)\n", (long long) Nmeasure, (long long) Nrows); 442 447 } 443 448 gfits_free_header (&header); … … 452 457 453 458 /* move pointer past header -- must be already read (load_catalog) */ 454 Nbytes = subcat[0].header. size + gfits_data_size (&subcat[0].header);455 fseek (subcat[0].f, Nbytes, SEEK_SET);459 Nbytes = subcat[0].header.datasize + gfits_data_size (&subcat[0].header); 460 fseeko (subcat[0].f, Nbytes, SEEK_SET); 456 461 457 462 /* read Missing table header */ … … 469 474 catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL); 470 475 if (Nmissing != Nrows) { 471 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (% d vs %d)\n", Nmissing,Nrows);476 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers (%lld vs %lld)\n", (long long) Nmissing, (long long) Nrows); 472 477 } 473 478 gfits_free_header (&header); … … 481 486 int dvo_catalog_save_split (Catalog *catalog, char VERBOSE) { 482 487 483 int Nitems;488 off_t Nitems; 484 489 Header header; 485 490 FTable ftable; 486 491 SecFilt *primary, *secfilt; 487 int Nsecfilt;488 int Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new;489 int first, start, Nrows;492 off_t Nsecfilt; 493 off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new; 494 off_t first, start, Nrows; 490 495 491 496 ftable.header = &header; … … 519 524 520 525 /* make sure header is consistent with data */ 521 gfits_modify (&catalog[0].header, "NSTARS", "% d", 1, Naves_disk_new);522 gfits_modify (&catalog[0].header, "NMEAS", "% d", 1, Nmeas_disk_new);523 gfits_modify (&catalog[0].header, "NMISS", "% d", 1, Nmiss_disk_new);524 gfits_modify (&catalog[0].header, "NSECFILT", "% d", 1, Nsecfilt);526 gfits_modify (&catalog[0].header, "NSTARS", "%lld", 1, Naves_disk_new); 527 gfits_modify (&catalog[0].header, "NMEAS", "%lld", 1, Nmeas_disk_new); 528 gfits_modify (&catalog[0].header, "NMISS", "%lld", 1, Nmiss_disk_new); 529 gfits_modify (&catalog[0].header, "NSECFILT", "%lld", 1, Nsecfilt); 525 530 gfits_modify (&catalog[0].header, "EXTEND", "%t", 1, TRUE); 526 531 gfits_modify (&catalog[0].header, "OBJID", "%d", 1, catalog[0].objID); … … 555 560 // even if we do not save the average table, we need to keep the header in sync 556 561 /* rewind file pointers and truncate (file is still open) */ 557 fseek (catalog[0].f, 0, SEEK_SET);562 fseeko (catalog[0].f, 0, SEEK_SET); 558 563 559 564 /* write table PHU header - always write this out */ … … 662 667 int dvo_catalog_save_split_complete (Catalog *catalog, char VERBOSE) { 663 668 664 int Nitems;669 off_t Nitems; 665 670 Header header; 666 671 FTable ftable; 667 672 SecFilt *primary, *secfilt; 668 int Nsecfilt;669 int Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new;670 int first, start, Nrows;673 off_t Nsecfilt; 674 off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new; 675 off_t first, start, Nrows; 671 676 672 677 ftable.header = &header; … … 693 698 } 694 699 695 if ((catalog[0].Naverage > 0) && (Naves_disk_new == 0)) {696 Naves_disk_new = catalog[0].Naverage;700 Naves_disk_new = catalog[0].Naverage; 701 if (Naves_disk_new == 0) { 697 702 if (VERBOSE) fprintf (stderr, "resulting catalog is empty; delete it\n"); 698 703 // unlink (); 699 704 return (TRUE); 700 705 } 701 702 Naves_disk_new = catalog[0].Naverage;703 706 704 707 // for the appropriate types, pull out the first secfilt and pass to AverageToFtable as primary … … 720 723 721 724 /* make sure header is consistent with data */ 722 gfits_modify (&catalog[0].header, "NSTARS", "% d", 1, Naves_disk_new);723 gfits_modify (&catalog[0].header, "NMEAS", "% d", 1, Nmeas_disk_new);724 gfits_modify (&catalog[0].header, "NMISS", "% d", 1, Nmiss_disk_new);725 gfits_modify (&catalog[0].header, "NSECFILT", "% d", 1, Nsecfilt);725 gfits_modify (&catalog[0].header, "NSTARS", "%lld", 1, Naves_disk_new); 726 gfits_modify (&catalog[0].header, "NMEAS", "%lld", 1, Nmeas_disk_new); 727 gfits_modify (&catalog[0].header, "NMISS", "%lld", 1, Nmiss_disk_new); 728 gfits_modify (&catalog[0].header, "NSECFILT", "%lld", 1, Nsecfilt); 726 729 gfits_modify (&catalog[0].header, "EXTEND", "%t", 1, TRUE); 727 730 gfits_modify (&catalog[0].header, "OBJID", "%d", 1, catalog[0].objID); … … 756 759 // even if we do not save the average table, we need to keep the header in sync 757 760 /* rewind file pointers and truncate (file is still open) */ 758 fseek (catalog[0].f, 0, SEEK_SET);761 fseeko (catalog[0].f, 0, SEEK_SET); 759 762 760 763 /* write table PHU header - always write this out */ … … 866 869 FTable ftable; 867 870 SecFilt *primary, *secfilt; 868 int Nsecfilt;869 int Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new;870 int first, start, Nrows;871 off_t Nsecfilt; 872 off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new; 873 off_t first, start, Nrows; 871 874 872 875 ftable.header = &header; … … 899 902 900 903 /* make sure header is consistent with data */ 901 gfits_modify (&catalog[0].header, "NSTARS", "% d", 1, Naves_disk_new);902 gfits_modify (&catalog[0].header, "NMEAS", "% d", 1, Nmeas_disk_new);903 gfits_modify (&catalog[0].header, "NMISS", "% d", 1, Nmiss_disk_new);904 gfits_modify (&catalog[0].header, "NSECFILT", "% d", 1, Nsecfilt);904 gfits_modify (&catalog[0].header, "NSTARS", "%lld", 1, Naves_disk_new); 905 gfits_modify (&catalog[0].header, "NMEAS", "%lld", 1, Nmeas_disk_new); 906 gfits_modify (&catalog[0].header, "NMISS", "%lld", 1, Nmiss_disk_new); 907 gfits_modify (&catalog[0].header, "NSECFILT", "%lld", 1, Nsecfilt); 905 908 gfits_modify (&catalog[0].header, "EXTEND", "%t", 1, TRUE); 906 909 gfits_modify (&catalog[0].header, "OBJID", "%d", 1, catalog[0].objID); … … 935 938 // even if we do not save the average table, we need to keep the header in sync 936 939 /* rewind file pointers and truncate (file is still open) */ 937 fseek (catalog[0].f, 0, SEEK_SET);940 fseeko (catalog[0].f, 0, SEEK_SET); 938 941 939 942 /* write table PHU header - always write this out */ -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/dvo_convert.c
r24748 r27295 13 13 /*** Average / FTable conversion functions ***/ 14 14 15 Average *FtableToAverage (FTable *ftable, int *Naverage, int*format, SecFilt **primary) {15 Average *FtableToAverage (FTable *ftable, off_t *Naverage, char *format, SecFilt **primary) { 16 16 17 17 Average *average; … … 59 59 } 60 60 61 int AverageToFtable (FTable *ftable, Average *average, int Naverage, intformat, SecFilt *primary) {61 int AverageToFtable (FTable *ftable, Average *average, off_t Naverage, char format, SecFilt *primary) { 62 62 63 63 # define FORMAT_CASE(FORMAT, TYPE) \ … … 94 94 /*** Measure / FTable conversion functions ***/ 95 95 96 Measure *FtableToMeasure (FTable *ftable, int *Nmeasure, int*format) {96 Measure *FtableToMeasure (FTable *ftable, off_t *Nmeasure, char *format) { 97 97 98 98 Measure *measure; … … 136 136 } 137 137 138 int MeasureToFtable (FTable *ftable, Measure *measure, int Nmeasure, intformat) {138 int MeasureToFtable (FTable *ftable, Measure *measure, off_t Nmeasure, char format) { 139 139 140 140 # define FORMAT_CASE(FORMAT, TYPE) \ … … 171 171 /*** SecFilt / FTable conversion functions ***/ 172 172 173 SecFilt *FtableToSecFilt (FTable *ftable, int *Nsecfilt, int*format) {173 SecFilt *FtableToSecFilt (FTable *ftable, off_t *Nsecfilt, char *format) { 174 174 175 175 SecFilt *secfilt; … … 213 213 } 214 214 215 int SecFiltToFtable (FTable *ftable, SecFilt *secfilt, int Nsecfilt, intformat) {215 int SecFiltToFtable (FTable *ftable, SecFilt *secfilt, off_t Nsecfilt, char format) { 216 216 217 217 # define FORMAT_CASE(FORMAT, TYPE) \ … … 248 248 /*** Image Conversions ***/ 249 249 250 int FtableToImage (FTable *ftable, Header *theader, int*format) {251 252 int Nimage;250 int FtableToImage (FTable *ftable, Header *theader, char *format) { 251 252 off_t Nimage; 253 253 char extname[80]; 254 254 … … 261 261 gfits_free_header (theader); 262 262 gfits_table_mkheader_Image (theader); 263 gfits_modify (theader, "NAXIS2", "% d", 1, Nimage);263 gfits_modify (theader, "NAXIS2", "%lld", 1, Nimage); 264 264 theader[0].Naxis[1] = Nimage; 265 ftable[0]. size = gfits_data_size (theader);265 ftable[0].datasize = gfits_data_size (theader); 266 266 return (TRUE); 267 267 } … … 282 282 gfits_free_header (theader); \ 283 283 gfits_table_mkheader_Image (theader); \ 284 gfits_modify (theader, "NAXIS2", "% d", 1, Nimage); \284 gfits_modify (theader, "NAXIS2", "%lld", 1, Nimage); \ 285 285 theader[0].Naxis[1] = Nimage; \ 286 ftable[0]. size = gfits_data_size (theader); \286 ftable[0].datasize = gfits_data_size (theader); \ 287 287 return (TRUE); } 288 288 … … 312 312 } 313 313 314 int ImageToFtable (FTable *ftable, Header *theader, intformat) {315 316 int Nimage;314 int ImageToFtable (FTable *ftable, Header *theader, char format) { 315 316 off_t Nimage; 317 317 318 318 Nimage = theader[0].Naxis[1]; … … 353 353 } 354 354 355 int ImageToVtable (VTable *vtable, Header *theader, intformat) {356 357 int i, Nrow, Nimage;355 int ImageToVtable (VTable *vtable, Header *theader, char format) { 356 357 off_t i, Nrow, Nimage; 358 358 359 359 Nrow = vtable[0].Nrow; … … 370 370 } \ 371 371 /* convert header from old format to new format */ \ 372 gfits_scan (theader, "NAXIS2", "% d", 1, &Nimage); \372 gfits_scan (theader, "NAXIS2", "%lld", 1, &Nimage); \ 373 373 gfits_free_header (theader); \ 374 374 gfits_table_mkheader_Image_##TYPE (theader); \ 375 gfits_modify (theader, "NAXIS2", "% d", 1, Nimage); \375 gfits_modify (theader, "NAXIS2", "%lld", 1, Nimage); \ 376 376 theader[0].Naxis[1] = Nimage; \ 377 vtable[0]. size = gfits_data_size (theader); \377 vtable[0].datasize = gfits_data_size (theader); \ 378 378 return (TRUE); } 379 379 -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c
r26482 r27295 97 97 out[i].P = NAN; 98 98 out[i].dP = NAN; 99 out[i].Xp = NAN ;99 out[i].Xp = NAN_S_SHORT; 100 100 out[i].ChiSq = NAN; 101 101 out[i].Npos = 0; … … 148 148 out[i].M = in[i].M; 149 149 out[i].dM = in[i].dM; 150 out[i].Xm = NAN ;150 out[i].Xm = NAN_S_SHORT; 151 151 out[i].Ncode = 0; 152 152 out[i].Nused = 0; -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/dvo_image.c
r25757 r27295 52 52 /* test for NAXIS == 2 in line 3 */ 53 53 bzero (buffer, 241); 54 fseek (db[0].f, 0, SEEK_SET);54 fseeko (db[0].f, 0, SEEK_SET); 55 55 Nread = fread (buffer, 1, 240, db[0].f); 56 56 if (Nread != 240) { … … 63 63 return (FALSE); 64 64 } 65 fseek (db[0].f, 0, SEEK_SET);65 fseeko (db[0].f, 0, SEEK_SET); 66 66 67 67 /* default values */ … … 114 114 } 115 115 116 int dvo_image_addrows (FITS_DB *db, Image *new, int Nnew) {117 118 int Nimages;116 int dvo_image_addrows (FITS_DB *db, Image *new, off_t Nnew) { 117 118 off_t Nimages; 119 119 120 120 /* adjust header */ 121 121 Nimages = 0; 122 gfits_scan (&db[0].header, "NIMAGES", "% d", 1, &Nimages);122 gfits_scan (&db[0].header, "NIMAGES", "%lld", 1, &Nimages); 123 123 Nimages += Nnew; 124 gfits_modify (&db[0].header, "NIMAGES", "% d", 1, Nimages);124 gfits_modify (&db[0].header, "NIMAGES", "%lld", 1, Nimages); 125 125 126 126 gfits_table_to_vtable (&db[0].ftable, &db[0].vtable, 0, 0); … … 195 195 gfits_table_set_Image (&db[0].ftable, NULL, 0); 196 196 197 gfits_modify (&db[0].header, "NIMAGES", "% d", 1, 0);197 gfits_modify (&db[0].header, "NIMAGES", "%lld", 1, 0); 198 198 gfits_modify (&db[0].header, "ZERO_PT", "%lf", 1, ZeroPoint); 199 199 -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/dvo_image_raw.c
r24748 r27295 7 7 int dvo_image_load_raw (FITS_DB *db, int VERBOSE, int FORCE_READ) { 8 8 9 int Nimage, Ndata, size, ImageSize, nbytes, Nbytes;9 off_t Nimage, Ndata, size, ImageSize, nbytes, Nbytes; 10 10 struct stat filestatus; 11 11 char format[80], telescope[80]; … … 39 39 /* find number of images */ 40 40 Nimage = 0; 41 gfits_scan (&db[0].header, "NIMAGES", "% d", 1, &Nimage);41 gfits_scan (&db[0].header, "NIMAGES", "%lld", 1, &Nimage); 42 42 if (stat (db[0].filename, &filestatus) == -1) { 43 43 if (VERBOSE) fprintf (stderr, "ERROR: failed to get status of image catalog\n"); … … 59 59 60 60 /* check that filesize makes sense */ 61 size = Nimage*ImageSize + db[0].header. size;61 size = Nimage*ImageSize + db[0].header.datasize; 62 62 if (size != filestatus.st_size) { 63 Ndata = (filestatus.st_size - db[0].header. size) / ImageSize;63 Ndata = (filestatus.st_size - db[0].header.datasize) / ImageSize; 64 64 if (VERBOSE) fprintf (stderr, "ERROR: image catalog has inconsistent size\n"); 65 if (VERBOSE) fprintf (stderr, "header: % d, data: %d\n", Nimage,Ndata);65 if (VERBOSE) fprintf (stderr, "header: %lld, data: %lld\n", (long long) Nimage, (long long) Ndata); 66 66 if (!FORCE_READ) exit (1); 67 67 Nimage = Ndata; … … 94 94 } 95 95 96 gfits_modify (&db[0].theader, "NAXIS2", "% d", 1, Nimage);96 gfits_modify (&db[0].theader, "NAXIS2", "%lld", 1, Nimage); 97 97 db[0].theader.Naxis[1] = Nimage; 98 db[0].ftable. size = gfits_data_size (&db[0].theader);98 db[0].ftable.datasize = gfits_data_size (&db[0].theader); 99 99 db[0].swapped = FALSE; /* table does not have internal byte-order */ 100 100 return (TRUE); … … 104 104 int dvo_image_update_raw (FITS_DB *db, int VERBOSE) { 105 105 106 int i, Nx, Ny, Nrow, Nbytes;107 int status, start, offset;108 int *row;106 off_t i, Nx, Ny, Nrow, Nbytes, start, offset; 107 off_t status; 108 off_t *row; 109 109 110 if (VERBOSE) fprintf (stderr, "writing out % d images\n",db[0].vtable.Nrow);110 if (VERBOSE) fprintf (stderr, "writing out %lld images\n", (long long) db[0].vtable.Nrow); 111 111 112 112 /* position to start of file */ 113 Fseek(db[0].f, 0, SEEK_SET);113 fseeko (db[0].f, 0, SEEK_SET); 114 114 115 115 /* write out complete header (no check on disk size?) */ 116 status = fwrite (db[0].header.buffer, 1, db[0].header. size, db[0].f);117 if (status != db[0].header. size) {116 status = fwrite (db[0].header.buffer, 1, db[0].header.datasize, db[0].f); 117 if (status != db[0].header.datasize) { 118 118 fprintf (stderr, "ERROR: failed writing data to image header\n"); 119 119 exit (1); … … 123 123 Nrow = db[0].vtable.Nrow; 124 124 row = db[0].vtable.row; 125 gfits_scan (db[0].vtable.header, "NAXIS1", "% d", 1, &Nx);126 gfits_scan (db[0].vtable.header, "NAXIS2", "% d", 1, &Ny);125 gfits_scan (db[0].vtable.header, "NAXIS1", "%lld", 1, &Nx); 126 gfits_scan (db[0].vtable.header, "NAXIS2", "%lld", 1, &Ny); 127 127 128 128 /* file pointer is at beginning of desired table data */ … … 131 131 for (i = 0; i < Nrow; i++) { 132 132 offset = start + Nx*row[i]; 133 fseek (db[0].f, offset, SEEK_SET);133 fseeko (db[0].f, offset, SEEK_SET); 134 134 Nbytes = fwrite (db[0].vtable.buffer[i], sizeof (char), Nx, db[0].f); 135 135 if (Nbytes != Nx) { return (FALSE); } … … 141 141 int dvo_image_save_raw (FITS_DB *db, int VERBOSE) { 142 142 143 int status, Nx, Ny, size, Nbytes; 143 off_t Nx, Ny, size, Nbytes; 144 int status; 144 145 145 if (VERBOSE) fprintf (stderr, "writing out % d images\n",db[0].theader.Naxis[1]);146 if (VERBOSE) fprintf (stderr, "writing out %lld images\n", (long long) db[0].theader.Naxis[1]); 146 147 147 148 /* position to start of file */ … … 149 150 150 151 /* write out complete header (no check on disk size?) */ 151 status = fwrite (db[0].header.buffer, 1, db[0].header. size, db[0].f);152 if (status != db[0].header. size) {152 status = fwrite (db[0].header.buffer, 1, db[0].header.datasize, db[0].f); 153 if (status != db[0].header.datasize) { 153 154 fprintf (stderr, "ERROR: failed writing data to image header\n"); 154 155 exit (1); 155 156 } 156 157 157 gfits_scan (db[0].ftable.header, "NAXIS1", "% d", 1, &Nx);158 gfits_scan (db[0].ftable.header, "NAXIS2", "% d", 1, &Ny);158 gfits_scan (db[0].ftable.header, "NAXIS1", "%lld", 1, &Nx); 159 gfits_scan (db[0].ftable.header, "NAXIS2", "%lld", 1, &Ny); 159 160 size = Nx * Ny; 160 161 Nbytes = fwrite (db[0].ftable.buffer, sizeof(char), size, db[0].f); -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/dvo_util.c
r26410 r27295 18 18 19 19 memset(config, 0, sizeof(dvoConfig)); 20 return config; 20 21 } 21 22 … … 98 99 } 99 100 100 char *catdir,filename[256];101 char filename[256]; 101 102 102 103 sprintf (filename, "%s/Images.dat", dvoConfig->catdir); … … 136 137 Image *dvoImageByExternID(dvoConfig *dvoConfig, int sourceID, int externID) 137 138 { 138 Image *images;139 int Nimage;140 139 int i; 141 140 … … 199 198 } 200 199 201 int dvoGetDetections(SkyList *skylist, int imageID, dvoDetection **results, int *pMaxDetID) 202 { 203 int QUIET = 0; 204 int FULL_OUTPUT = 0; 200 off_t dvoGetDetections(SkyList *skylist, int imageID, dvoDetection **results, int *pMaxDetID) 201 { 205 202 int GetMeasures = 1; 206 int SaveVectors = 0;207 203 int reg; 208 int Ndetect = 0;204 off_t Ndetect = 0; 209 205 210 206 int detectionsArrayLength = 1000; … … 226 222 dvo_catalog_unlock (&catalog); 227 223 228 int Nstars = catalog.Naverage; 229 int Nmeasure = catalog.Nmeasure; 230 231 int i; 224 off_t Nmeasure = catalog.Nmeasure; 225 226 off_t i; 232 227 for (i=0; i< Nmeasure; i++) { 233 228 Measure *m = catalog.measure + i; … … 265 260 266 261 memset(sorted, 0, sizeof(dvoDetection) * *pMaxDetID); 267 int i;262 off_t i; 268 263 for (i = 0; i < Ndetect; i++) { 269 264 sorted[detections[i].meas.detID] = detections[i]; -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/dvosorts.c
r21508 r27295 4 4 5 5 /* values are ave[i].R, ave[i].D, ave[i].M */ 6 void sortave (Average *ave, int N) {6 void sortave (Average *ave, off_t N) { 7 7 8 8 # define SWAPFUNC(A,B){ Average tmp; tmp = ave[A]; ave[A] = ave[B]; ave[B] = tmp; } … … 17 17 18 18 /* sort subset by image[subset[i]].tzero */ 19 void sort_image_subset (Image *image, int *subset, int N) {19 void sort_image_subset (Image *image, off_t *subset, off_t N) { 20 20 21 21 # define SWAPFUNC(A,B){ int tmp; tmp = subset[A]; subset[A] = subset[B]; subset[B] = tmp; } … … 30 30 31 31 /* sort a coordinate pair (X,Y) and the associated index (S) */ 32 void sort_coords_index (double *X, double *Y, int *S, int N) {32 void sort_coords_index (double *X, double *Y, off_t *S, off_t N) { 33 33 34 # define SWAPFUNC(A,B){ double dtmp; int itmp; \34 # define SWAPFUNC(A,B){ double dtmp; off_t itmp; \ 35 35 dtmp = X[A]; X[A] = X[B]; X[B] = dtmp; \ 36 36 dtmp = Y[A]; Y[A] = Y[B]; Y[B] = dtmp; \ … … 46 46 } 47 47 48 void sort_regions (SkyRegion *region, int N) {48 void sort_regions (SkyRegion *region, off_t N) { 49 49 50 50 # define SWAPFUNC(A,B){ SkyRegion tmp; tmp = region[A]; region[A] = region[B]; region[B] = tmp; } … … 57 57 58 58 } 59 60 # if (0)61 // deprecated along with Stars as an autocode type62 void sort_stars_ra (Stars *stars, int N) {63 64 # define SWAPFUNC(A,B){ Stars tmp; tmp = stars[A]; stars[A] = stars[B]; stars[B] = tmp; }65 # define COMPARE(A,B)(stars[A].R < stars[B].R)66 67 OHANA_SORT (N, COMPARE, SWAPFUNC);68 69 # undef SWAPFUNC70 # undef COMPARE71 72 }73 # endif -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/fits_db.c
r15750 r27295 92 92 } 93 93 94 /* load the data from Nrowsfrom table starting at start; load header, etc if needed */95 int gfits_db_load_segment (FITS_DB *db, int start, int Nrows) {96 97 int Nskip;94 /* load the Nrows data from table starting at start; load header, etc if needed */ 95 int gfits_db_load_segment (FITS_DB *db, off_t start, off_t Nrows) { 96 97 off_t Nskip; 98 98 99 99 /* database name must be set first */ … … 119 119 } 120 120 } else { 121 Nskip = db[0].header. size;121 Nskip = db[0].header.datasize; 122 122 Fseek (db[0].f, Nskip, SEEK_CUR); 123 123 } … … 141 141 } 142 142 } else { 143 Nskip = db[0].header. size;143 Nskip = db[0].header.datasize; 144 144 Fseek (db[0].f, Nskip, SEEK_CUR); 145 145 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libdvo/src/skyregion_ops.c
r24976 r27295 386 386 SkyList *SkyListChildrenByBounds_List (SkyList *table, int depth, double Rmin, double Rmax, double Dmin, double Dmax) { 387 387 388 int i, j, Ns, Ne, Nnew, NNEW; 389 int append; 390 SkyList *children; 388 int i, Nnew, NNEW; 391 389 SkyList *list; 392 390 SkyRegion **region; -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/header/F_H_field.c
r21059 r27295 6 6 7 7 char *buf; 8 int i, Nwant, Nfound; 8 off_t i; 9 int Nwant, Nfound; 9 10 char keyword[10]; 10 11 … … 19 20 /* find the Nth entry */ 20 21 Nfound = 0; 21 for (i = 0; i < header[0]. size; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) {22 for (i = 0; i < header[0].datasize; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) { 22 23 if (!strncmp (keyword, buf, 8)) { 23 24 Nfound ++; … … 30 31 /* count the entries */ 31 32 Nfound = 0; 32 for (i = 0; i < header[0]. size; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) {33 for (i = 0; i < header[0].datasize; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) { 33 34 if (!strncmp (keyword, buf, 8)) { 34 35 Nfound ++; … … 41 42 /* find the Nwant entry */ 42 43 Nfound = 0; 43 for (i = 0; i < header[0]. size; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) {44 for (i = 0; i < header[0].datasize; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) { 44 45 if (!strncmp (keyword, buf, 8)) { 45 46 Nfound ++; … … 66 67 67 68 char *buf, *ptr; 68 int i, Nwant, Nfound, Nfield; 69 off_t i; 70 int Nwant, Nfound, Nfield; 69 71 70 72 Nfield = strlen (field); … … 76 78 if (N > 0) { 77 79 Nfound = 0; 78 for (i = 0; i < header[0]. size; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) {80 for (i = 0; i < header[0].datasize; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) { 79 81 // have we found a HIERARCH entry? 80 82 if (strncmp ("HIERARCH", buf, 8)) continue; … … 90 92 /* count the entries */ 91 93 Nfound = 0; 92 for (i = 0; i < header[0]. size; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) {94 for (i = 0; i < header[0].datasize; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) { 93 95 if (strncmp ("HIERARCH", buf, 8)) continue; 94 96 ptr = buf + 9; // start of following keyword … … 102 104 /* find the Nwant entry */ 103 105 Nfound = 0; 104 for (i = 0; i < header[0]. size; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) {106 for (i = 0; i < header[0].datasize; i+= FT_LINE_LENGTH, buf += FT_LINE_LENGTH) { 105 107 if (strncmp ("HIERARCH", buf, 8)) continue; 106 108 ptr = buf + 9; // start of following keyword … … 122 124 123 125 /*********************** fits header field ****************************/ 124 char *gfits_header_lineno (Header *header, int N) {126 char *gfits_header_lineno (Header *header, off_t N) { 125 127 126 128 char *buf; 127 129 128 if (N*80 >= header[0]. size) return NULL;130 if (N*80 >= header[0].datasize) return NULL; 129 131 130 132 buf = &header[0].buffer[N*80]; -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/header/F_copy_H.c
r17903 r27295 16 16 out[0].Naxis[i] = in[0].Naxis[i]; 17 17 18 out[0]. size = in[0].size;18 out[0].datasize = in[0].datasize; 19 19 20 20 out[0].pcount = in[0].pcount; … … 24 24 25 25 if (out[0].buffer != NULL) free (out[0].buffer); 26 ALLOCATE (out[0].buffer, char, out[0]. size);26 ALLOCATE (out[0].buffer, char, out[0].datasize); 27 27 28 strncpy (out[0].buffer, in[0].buffer, out[0].size);28 memcpy (out[0].buffer, in[0].buffer, out[0].datasize); 29 29 30 30 return (TRUE); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/header/F_create_H.c
r15487 r27295 9 9 char axis[10]; 10 10 11 header[0]. size = NBYTES;11 header[0].datasize = NBYTES; 12 12 13 13 ALLOCATE (header[0].buffer, char, NBYTES); … … 23 23 for (i = 0; i < header[0].Naxes; i++) { 24 24 snprintf (axis, 10, "NAXIS%d", i + 1); 25 gfits_modify (header, axis, "% d", 1, header[0].Naxis[i]);25 gfits_modify (header, axis, "%lld", 1, header[0].Naxis[i]); 26 26 } 27 27 -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/header/F_delete.c
r7054 r27295 5 5 int gfits_delete (Header *header, char *field, int N) { 6 6 7 int i, Nbytes; 7 int i; 8 off_t Nbytes; 8 9 char *p1, *p2; 9 10 … … 22 23 23 24 p2 = gfits_header_field (header, "END", 1); 24 if (header[0]. size - (p2 - header[0].buffer + FT_LINE_LENGTH) > FT_RECORD_SIZE) {25 header[0]. size -= FT_RECORD_SIZE;26 REALLOCATE (header[0].buffer, char, header[0]. size);25 if (header[0].datasize - (p2 - header[0].buffer + FT_LINE_LENGTH) > FT_RECORD_SIZE) { 26 header[0].datasize -= FT_RECORD_SIZE; 27 REALLOCATE (header[0].buffer, char, header[0].datasize); 27 28 } 28 29 return (TRUE); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/header/F_modify.c
r21059 r27295 29 29 30 30 /* is there enough space for 1 more line? */ 31 if (header[0]. size - (p - (header[0].buffer)) < 2*FT_LINE_LENGTH) {32 header[0]. size += FT_RECORD_SIZE;33 REALLOCATE (header[0].buffer, char, header[0]. size);31 if (header[0].datasize - (p - (header[0].buffer)) < 2*FT_LINE_LENGTH) { 32 header[0].datasize += FT_RECORD_SIZE; 33 REALLOCATE (header[0].buffer, char, header[0].datasize); 34 34 p = gfits_header_field (header, "END", 1); 35 35 if (p == NULL) return (FALSE); … … 50 50 51 51 /* write the numeric modes */ 52 if (!strcmp (mode, "%d")) snprintf (string, 81, "%-8s= %20d / %-s ", field, va_arg (argp, int), comment); 53 if (!strcmp (mode, "%u")) snprintf (string, 81, "%-8s= %20d / %-s ", field, va_arg (argp, unsigned), comment); 54 if (!strcmp (mode, "%ld")) snprintf (string, 81, "%-8s= %20ld / %-s ", field, va_arg (argp, long), comment); 55 if (!strcmp (mode, "%hd")) snprintf (string, 81, "%-8s= %20d / %-s ", field, va_arg (argp, int), comment); 56 if (!strcmp (mode, "%f")) snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double), comment); 57 if (!strcmp (mode, "%lf")) snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double), comment); 58 if (!strcmp (mode, "%e")) snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double), comment); 59 if (!strcmp (mode, "%le")) snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double), comment); 60 if (!strcmp (mode, "%g")) snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double), comment); 61 if (!strcmp (mode, "%lg")) snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double), comment); 52 if (!strcmp (mode, "%d")) snprintf (string, 81, "%-8s= %20d / %-s ", field, va_arg (argp, int), comment); 53 if (!strcmp (mode, "%ld")) snprintf (string, 81, "%-8s= %20ld / %-s ", field, va_arg (argp, long), comment); 54 if (!strcmp (mode, "%lld")) snprintf (string, 81, "%-8s= %20lld / %-s ", field, va_arg (argp, long long), comment); 55 if (!strcmp (mode, "%Ld")) snprintf (string, 81, "%-8s= %20lld / %-s ", field, va_arg (argp, long long), comment); 56 if (!strcmp (mode, "%u")) snprintf (string, 81, "%-8s= %20u / %-s ", field, va_arg (argp, unsigned), comment); 57 if (!strcmp (mode, "%lu")) snprintf (string, 81, "%-8s= %20lu / %-s ", field, va_arg (argp, unsigned long), comment); 58 if (!strcmp (mode, "%llu")) snprintf (string, 81, "%-8s= %20llu / %-s ", field, va_arg (argp, unsigned long long), comment); 59 if (!strcmp (mode, "%Lu")) snprintf (string, 81, "%-8s= %20llu / %-s ", field, va_arg (argp, unsigned long long), comment); 60 if (!strcmp (mode, "%hd")) snprintf (string, 81, "%-8s= %20d / %-s ", field, va_arg (argp, int), comment); 61 if (!strcmp (mode, "%f")) snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double), comment); 62 if (!strcmp (mode, "%lf")) snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double), comment); 63 if (!strcmp (mode, "%e")) snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double), comment); 64 if (!strcmp (mode, "%le")) snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double), comment); 65 if (!strcmp (mode, "%g")) snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double), comment); 66 if (!strcmp (mode, "%lg")) snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double), comment); 62 67 63 68 /* write the boolean mode */ -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/header/F_print.c
r7054 r27295 27 27 28 28 /* is there enough space for 1 more line? */ 29 if (header[0]. size - (p - (header[0].buffer)) < 2*FT_LINE_LENGTH) {30 header[0]. size += FT_RECORD_SIZE;31 REALLOCATE (header[0].buffer, char, header[0]. size);29 if (header[0].datasize - (p - (header[0].buffer)) < 2*FT_LINE_LENGTH) { 30 header[0].datasize += FT_RECORD_SIZE; 31 REALLOCATE (header[0].buffer, char, header[0].datasize); 32 32 /* re-find the "END" marker, in case new memory block is used */ 33 33 p = gfits_header_field (header, "END", 1); … … 45 45 46 46 /* write the numeric modes */ 47 if (!strcmp (mode, "%d")) { snprintf (string, 81, "%-8s= %20d / %46s ", field, va_arg (argp, int), blank); } 48 if (!strcmp (mode, "%u")) { snprintf (string, 81, "%-8s= %20d / %46s ", field, va_arg (argp, unsigned), blank); } 49 if (!strcmp (mode, "%ld")) { snprintf (string, 81, "%-8s= %20ld / %46s ", field, va_arg (argp, long), blank); } 50 if (!strcmp (mode, "%hd")) { snprintf (string, 81, "%-8s= %20d / %46s ", field, va_arg (argp, int), blank); } 51 if (!strcmp (mode, "%f")) { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double), blank); } 52 if (!strcmp (mode, "%lf")) { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double), blank); } 53 if (!strcmp (mode, "%e")) { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double), blank); } 54 if (!strcmp (mode, "%le")) { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double), blank); } 55 if (!strcmp (mode, "%g")) { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double), blank); } 56 if (!strcmp (mode, "%lg")) { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double), blank); } 47 if (!strcmp (mode, "%d")) { snprintf (string, 81, "%-8s= %20d / %46s ", field, va_arg (argp, int), blank); } 48 if (!strcmp (mode, "%ld")) { snprintf (string, 81, "%-8s= %20ld / %46s ", field, va_arg (argp, long), blank); } 49 if (!strcmp (mode, "%lld")){ snprintf (string, 81, "%-8s= %20lld / %46s ", field, va_arg (argp, long long), blank); } 50 if (!strcmp (mode, "%Ld")) { snprintf (string, 81, "%-8s= %20lld / %46s ", field, va_arg (argp, long long), blank); } 51 if (!strcmp (mode, "%u")) { snprintf (string, 81, "%-8s= %20u / %46s ", field, va_arg (argp, unsigned), blank); } 52 if (!strcmp (mode, "%lu")) { snprintf (string, 81, "%-8s= %20lu / %46s ", field, va_arg (argp, unsigned long), blank); } 53 if (!strcmp (mode, "%llu")){ snprintf (string, 81, "%-8s= %20llu / %46s ", field, va_arg (argp, unsigned long long), blank); } 54 if (!strcmp (mode, "%Lu")) { snprintf (string, 81, "%-8s= %20llu / %46s ", field, va_arg (argp, unsigned long long), blank); } 55 if (!strcmp (mode, "%hd")) { snprintf (string, 81, "%-8s= %20d / %46s ", field, va_arg (argp, int), blank); } 56 if (!strcmp (mode, "%f")) { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double), blank); } 57 if (!strcmp (mode, "%lf")) { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double), blank); } 58 if (!strcmp (mode, "%e")) { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double), blank); } 59 if (!strcmp (mode, "%le")) { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double), blank); } 60 if (!strcmp (mode, "%g")) { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double), blank); } 61 if (!strcmp (mode, "%lg")) { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double), blank); } 57 62 58 63 /* write the boolean mode */ -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/header/F_read_H.c
r15904 r27295 23 23 int gfits_load_header (FILE *f, Header *header) { 24 24 25 int i, done, Nbytes, t1, t2; 25 off_t i, Nbytes; 26 int done, t1, t2; 26 27 char *p; 27 28 28 header[0]. size = 0;29 header[0].datasize = 0; 29 30 done = FALSE; 30 31 ALLOCATE (header[0].buffer, char, 1); … … 32 33 for (i = 0; !done; i++) { 33 34 REALLOCATE (header[0].buffer, char, (i + 1)*FT_RECORD_SIZE); 34 Nbytes = fread (&header[0].buffer[i*FT_RECORD_SIZE], 35 sizeof(char), FT_RECORD_SIZE, f); 35 Nbytes = fread (&header[0].buffer[i*FT_RECORD_SIZE], sizeof(char), FT_RECORD_SIZE, f); 36 36 if (Nbytes != FT_RECORD_SIZE) { 37 37 if (feof(f)) return (FALSE); … … 40 40 } 41 41 42 header[0]. size += Nbytes;42 header[0].datasize += Nbytes; 43 43 44 44 if (i == 0) { … … 69 69 gfits_scan (header, "BZERO", "%lf", 1, &header[0].bzero); 70 70 71 gfits_scan (header, "NAXIS1", "% d", 1, &header[0].Naxis[0]);72 gfits_scan (header, "NAXIS2", "% d", 1, &header[0].Naxis[1]);73 gfits_scan (header, "NAXIS3", "% d", 1, &header[0].Naxis[2]);74 gfits_scan (header, "NAXIS4", "% d", 1, &header[0].Naxis[3]);75 gfits_scan (header, "NAXIS5", "% d", 1, &header[0].Naxis[4]);76 gfits_scan (header, "NAXIS6", "% d", 1, &header[0].Naxis[5]);77 gfits_scan (header, "NAXIS7", "% d", 1, &header[0].Naxis[6]);78 gfits_scan (header, "NAXIS8", "% d", 1, &header[0].Naxis[7]);79 gfits_scan (header, "NAXIS9", "% d", 1, &header[0].Naxis[8]);80 gfits_scan (header, "NAXIS10", "% d", 1, &header[0].Naxis[9]);71 gfits_scan (header, "NAXIS1", "%lld", 1, &header[0].Naxis[0]); 72 gfits_scan (header, "NAXIS2", "%lld", 1, &header[0].Naxis[1]); 73 gfits_scan (header, "NAXIS3", "%lld", 1, &header[0].Naxis[2]); 74 gfits_scan (header, "NAXIS4", "%lld", 1, &header[0].Naxis[3]); 75 gfits_scan (header, "NAXIS5", "%lld", 1, &header[0].Naxis[4]); 76 gfits_scan (header, "NAXIS6", "%lld", 1, &header[0].Naxis[5]); 77 gfits_scan (header, "NAXIS7", "%lld", 1, &header[0].Naxis[6]); 78 gfits_scan (header, "NAXIS8", "%lld", 1, &header[0].Naxis[7]); 79 gfits_scan (header, "NAXIS9", "%lld", 1, &header[0].Naxis[8]); 80 gfits_scan (header, "NAXIS10", "%lld", 1, &header[0].Naxis[9]); 81 81 82 82 if (!gfits_scan (header, "PCOUNT", "%d", 1, &header[0].pcount)) { -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/header/F_read_XH.c
r19250 r27295 31 31 /* read header for extension number N */ 32 32 33 int j, Nmatrix, Nskip; 33 int j; 34 off_t Nmatrix, Nskip; 34 35 Header theader; 35 36 36 37 /* set f to beginning of file */ 37 fseek (f, 0, SEEK_SET);38 fseeko (f, 0, SEEK_SET); 38 39 39 40 Nskip = 0; … … 47 48 48 49 /* skip to next header */ 49 fseek (f, Nmatrix, SEEK_CUR);50 Nskip += (Nmatrix + theader. size);50 fseeko (f, Nmatrix, SEEK_CUR); 51 Nskip += (Nmatrix + theader.datasize); 51 52 gfits_free_header (&theader); 52 53 } … … 55 56 return (FALSE); 56 57 } 57 Nskip += header[0]. size;58 Nskip += header[0].datasize; 58 59 return (Nskip); 59 60 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/header/F_scan.c
r21059 r27295 17 17 char *p, *q, *s, tmp[81]; 18 18 int Nchar, status; 19 double value; 19 long long value; 20 double fvalue; 20 21 21 22 /* find the correct line with field */ … … 77 78 s = gfits_keyword_start (p); /* points at first char (not ') */ 78 79 q = gfits_keyword_end (p); /* points at following space or ' */ 79 value = strtod (s, &q); 80 if ((*q == 'd') || (*q == 'D')) 81 value *= pow (10.0, atof (q + 1)); 82 83 if (!strcmp (mode, "%d")) { *va_arg (argp, int *) = value; return (TRUE); } 84 if (!strcmp (mode, "%u")) { *va_arg (argp, unsigned *) = value; return (TRUE); } 85 if (!strcmp (mode, "%ld")) { *va_arg (argp, long *) = value; return (TRUE); } 86 if (!strcmp (mode, "%hd")) { *va_arg (argp, short *) = value; return (TRUE); } 87 if (!strcmp (mode, "%f")) { *va_arg (argp, float *) = value; return (TRUE); } 88 if (!strcmp (mode, "%lf")) { *va_arg (argp, double *) = value; return (TRUE); } 80 81 if (!strcmp (mode, "%f") || !strcmp (mode, "%lf")) { 82 fvalue = strtod (s, &q); 83 if ((*q == 'd') || (*q == 'D')) 84 fvalue *= pow (10.0, atof (q + 1)); 85 86 if (!strcmp (mode, "%f")) { *va_arg (argp, float *) = fvalue; return (TRUE); } 87 if (!strcmp (mode, "%lf")) { *va_arg (argp, double *) = fvalue; return (TRUE); } 88 } 89 90 value = strtoll (s, &q, 0); 91 if ((*q == 'd') || (*q == 'D')) value *= pow (10.0, atof (q + 1)); 92 93 if (!strcmp (mode, "%d")) { *va_arg (argp, int *) = value; return (TRUE); } 94 if (!strcmp (mode, "%ld")) { *va_arg (argp, long *) = value; return (TRUE); } 95 if (!strcmp (mode, "%lld")) { *va_arg (argp, long long *) = value; return (TRUE); } 96 if (!strcmp (mode, "%Ld")) { *va_arg (argp, long long *) = value; return (TRUE); } 97 if (!strcmp (mode, "%u")) { *va_arg (argp, unsigned *) = value; return (TRUE); } 98 if (!strcmp (mode, "%lu")) { *va_arg (argp, unsigned long *) = value; return (TRUE); } 99 if (!strcmp (mode, "%llu")) { *va_arg (argp, unsigned long long *) = value; return (TRUE); } 100 if (!strcmp (mode, "%Lu")) { *va_arg (argp, unsigned long long *) = value; return (TRUE); } 101 if (!strcmp (mode, "%hd")) { *va_arg (argp, short *) = value; return (TRUE); } 89 102 90 103 /* no valid mode found */ … … 97 110 char *p, *q, *s, tmp[81]; 98 111 int Nchar, Nfield; 99 double value; 112 long long value; 113 double fvalue; 100 114 101 115 /* find the correct line with field */ … … 156 170 s = gfits_hierarch_keyword_start (p, field); /* points at first char (not ') */ 157 171 q = gfits_hierarch_keyword_end (p, field); /* points at following space or ' */ 158 value = strtod (s, &q); 159 if ((*q == 'd') || (*q == 'D')) 160 value *= pow (10.0, atof (q + 1)); 161 162 if (!strcmp (mode, "%d")) { *va_arg (argp, int *) = value; return (TRUE); } 163 if (!strcmp (mode, "%u")) { *va_arg (argp, unsigned *) = value; return (TRUE); } 164 if (!strcmp (mode, "%ld")) { *va_arg (argp, long *) = value; return (TRUE); } 165 if (!strcmp (mode, "%hd")) { *va_arg (argp, short *) = value; return (TRUE); } 166 if (!strcmp (mode, "%f")) { *va_arg (argp, float *) = value; return (TRUE); } 167 if (!strcmp (mode, "%lf")) { *va_arg (argp, double *) = value; return (TRUE); } 172 173 if (!strcmp (mode, "%f") || !strcmp (mode, "%lf")) { 174 fvalue = strtod (s, &q); 175 if ((*q == 'd') || (*q == 'D')) 176 fvalue *= pow (10.0, atof (q + 1)); 177 178 if (!strcmp (mode, "%f")) { *va_arg (argp, float *) = fvalue; return (TRUE); } 179 if (!strcmp (mode, "%lf")) { *va_arg (argp, double *) = fvalue; return (TRUE); } 180 } 181 182 value = strtoll (s, &q, 0); 183 if ((*q == 'd') || (*q == 'D')) value *= pow (10.0, atof (q + 1)); 184 185 if (!strcmp (mode, "%d")) { *va_arg (argp, int *) = value; return (TRUE); } 186 if (!strcmp (mode, "%ld")) { *va_arg (argp, long *) = value; return (TRUE); } 187 if (!strcmp (mode, "%lld")) { *va_arg (argp, long long *) = value; return (TRUE); } 188 if (!strcmp (mode, "%Ld")) { *va_arg (argp, long long *) = value; return (TRUE); } 189 if (!strcmp (mode, "%u")) { *va_arg (argp, unsigned *) = value; return (TRUE); } 190 if (!strcmp (mode, "%lu")) { *va_arg (argp, unsigned long *) = value; return (TRUE); } 191 if (!strcmp (mode, "%llu")) { *va_arg (argp, unsigned long long *) = value; return (TRUE); } 192 if (!strcmp (mode, "%Lu")) { *va_arg (argp, unsigned long long *) = value; return (TRUE); } 193 if (!strcmp (mode, "%hd")) { *va_arg (argp, short *) = value; return (TRUE); } 168 194 169 195 /* no valid mode found */ -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/header/F_write_H.c
r7054 r27295 6 6 7 7 FILE *f; 8 int Nbytes, status; 8 off_t Nbytes; 9 int status; 9 10 10 11 status = TRUE; … … 13 14 if (f == (FILE *) NULL) return (FALSE); 14 15 15 Nbytes = fwrite (header[0].buffer, sizeof(char), header[0]. size, f);16 Nbytes = fwrite (header[0].buffer, sizeof(char), header[0].datasize, f); 16 17 17 if (Nbytes != header[0]. size) {18 if (Nbytes != header[0].datasize) { 18 19 status = FALSE; 19 20 } … … 27 28 int gfits_save_header (FILE *f, Header *header) { 28 29 29 int Nbytes, status; 30 off_t Nbytes; 31 int status; 30 32 31 33 status = TRUE; 32 34 33 Nbytes = fwrite (header[0].buffer, sizeof(char), header[0]. size, f);35 Nbytes = fwrite (header[0].buffer, sizeof(char), header[0].datasize, f); 34 36 35 if (Nbytes != header[0]. size) {37 if (Nbytes != header[0].datasize) { 36 38 status = FALSE; 37 39 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/include/gfitsio.h
r21059 r27295 44 44 45 45 typedef struct { 46 int simple; 47 int unsign; 48 int extend; 49 int bitpix; 50 int Naxes; 51 intNaxis[FT_MAX_NAXES];52 intsize;46 int simple; // T or F 47 int unsign; // T or F 48 int extend; // T or F 49 int bitpix; // 8, 16, 32, 64, or -32, -64 50 int Naxes; // < FT_MAX_NAXES (10) 51 off_t Naxis[FT_MAX_NAXES]; 52 off_t datasize; 53 53 int pcount; 54 54 int gcount; … … 65 65 int bitpix; 66 66 int Naxes; 67 intNaxis[FT_MAX_NAXES];68 intsize;67 off_t Naxis[FT_MAX_NAXES]; 68 off_t datasize; 69 69 double bzero; 70 70 double bscale; … … 76 76 Header *header; 77 77 char *buffer; 78 intsize;78 off_t datasize; 79 79 } FTable; 80 80 … … 83 83 Header *header; 84 84 char **buffer; 85 intNrow;86 int*row;87 intsize; /* total buffer size */88 intpad; /* bytes of padding at the end */85 off_t Nrow; 86 off_t *row; 87 off_t datasize; /* total buffer size */ 88 off_t pad; /* bytes of padding at the end */ 89 89 } VTable; 90 90 91 91 typedef struct { 92 int maxlen; // max size of all table rows 93 int nbytes; // number of bytes per column element 94 int Nstart; // byte offset of this column 95 int heap_start; // byte offset to start of HEAP 96 char format; // data format character (one of: XLABIJEDCM) 92 int maxlen; // max size of all table rows 93 int nbytes; // number of bytes per column element 94 int Nstart; // byte offset of this column relative to first column 95 off_t heap_start; // byte offset to start of HEAP 96 char format; // data format character (one of: XLABIJEDCM) 97 char mode; // access data pointer type (one of P or Q) 97 98 } VarLengthColumn; 98 99 … … 106 107 107 108 char *gfits_header_field PROTO((Header *header, char *field, int N)); 108 char *gfits_header_lineno PROTO((Header *header, int N));109 char *gfits_header_lineno PROTO((Header *header, off_t N)); 109 110 char *gfits_keyword_end PROTO((char *line)); 110 111 int gfits_copy_header PROTO((Header *in, Header *out)); … … 128 129 int gfits_vscan PROTO((Header *header, char *field, char *mode, int N, va_list argp)); 129 130 int gfits_write_header PROTO((char *filename, Header *header)); 130 intgfits_data_size PROTO((Header *header));131 intgfits_data_min_size PROTO((Header *header));131 off_t gfits_data_size PROTO((Header *header)); 132 off_t gfits_data_min_size PROTO((Header *header)); 132 133 int gfits_extended_to_primary PROTO((Header *header, int simple, char *comment)); 133 134 int gfits_primary_to_extended PROTO((Header *header, char *exttype, char *comment)); … … 143 144 /******************************* Matrix functions *************/ 144 145 145 void gfits_add_matrix_value PROTO((Matrix *matrix, int x, int y, double value));146 void gfits_add_matrix_value PROTO((Matrix *matrix, off_t x, off_t y, double value)); 146 147 int gfits_convert_format PROTO((Header *header, Matrix *matrix, int outBitpix, double outScale, double outZero, int inBlank, int outUnsign)); 147 148 int gfits_copy_matrix PROTO((Matrix *in, Matrix *out)); … … 152 153 void gfits_free_matrix PROTO((Matrix *matrix)); 153 154 int gfits_fwrite_matrix PROTO((FILE *f, Matrix *matrix)); 154 double gfits_get_matrix_value PROTO((Matrix *matrix, int x, int y));155 void gfits_insert_ array PROTO((Matrix *matrix, Matrix *array, int x, int y));155 double gfits_get_matrix_value PROTO((Matrix *matrix, off_t x, off_t y)); 156 void gfits_insert_matrix PROTO((Matrix *matrix, Matrix *array, off_t x, off_t y)); 156 157 int gfits_load_matrix PROTO((FILE *f, Matrix *matrix, Header *header)); 157 158 int gfits_multiply_matrix PROTO((Matrix *M1, Matrix *M2, Matrix *M3)); 158 159 int gfits_read_matrix PROTO((char *filename, Matrix *matrix)); 159 160 int gfits_read_matrix_segment PROTO((char *filename, Matrix *matrix, char *region)); 160 int gfits_read_portion PROTO((char *filename, Matrix *matrix, int Nskip, int Npix));161 void gfits_set_matrix_value PROTO((Matrix *matrix, int x, int y, double value));161 int gfits_read_portion PROTO((char *filename, Matrix *matrix, off_t Nskip, off_t Npix)); 162 void gfits_set_matrix_value PROTO((Matrix *matrix, off_t x, off_t y, double value)); 162 163 int gfits_write_matrix PROTO((char *filename, Matrix *matrix)); 163 164 int gfits_uncompress_image PROTO((Header *header, Matrix *matrix, FTable *ftable)); … … 166 167 int gfits_byteswap_zdata PROTO((char *zdata, int Nzdata, int bitpix)); 167 168 int gfits_extension_is_compressed PROTO((Header *header)); 168 intgfits_tile_size PROTO((Matrix *matrix, int *otile, int *ztile));169 off_t gfits_tile_size PROTO((Matrix *matrix, int *otile, int *ztile)); 169 170 int gfits_uncompressed_data_pixsize PROTO((char *cmptype, int out_bitpix, char **optname, char **optvalue, int Noptions)); 170 171 int gfits_vartable_heap_pixsize PROTO((char format)); … … 173 174 174 175 char *gfits_table_print PROTO((FTable *ftable,...)); 175 int gfits_add_rows PROTO((FTable *ftable, char *data, int Nrow, int Nbytes));176 int gfits_add_rows PROTO((FTable *ftable, char *data, off_t Nrow, off_t Nbytes)); 176 177 int gfits_bintable_format PROTO((char *format, char *type, int *Nval, int *Nbytes)); 177 178 int gfits_create_table PROTO((Header *header, FTable *ftable)); … … 181 182 int gfits_fread_ftable PROTO((FILE *f, FTable *ftable, char *extname)); 182 183 int gfits_fread_ftable_data PROTO((FILE *f, FTable *ftable)); 183 int gfits_fread_ftable_range PROTO((FILE *f, FTable *ftable, int start, int Nrows));184 int gfits_fread_vtable PROTO((FILE *f, VTable *vtable, char *extname, int Nrow, int *row));185 int gfits_fread_vtable_range PROTO((FILE *f, VTable *vtable, int start, int Nrows));184 int gfits_fread_ftable_range PROTO((FILE *f, FTable *ftable, off_t start, off_t Nrows)); 185 int gfits_fread_vtable PROTO((FILE *f, VTable *vtable, char *extname, off_t Nrow, off_t *row)); 186 int gfits_fread_vtable_range PROTO((FILE *f, VTable *vtable, off_t start, off_t Nrows)); 186 187 int gfits_free_table PROTO((FTable *ftable)); 187 188 int gfits_free_vtable PROTO((VTable *vtable)); 188 189 int gfits_fwrite_table PROTO((FILE *f, FTable *table)); 189 190 int gfits_fwrite_vtable PROTO((FILE *f, VTable *table)); 190 int gfits_fwrite_ftable_range PROTO((FILE *f, FTable *table, int start, int Nrows, int Ndisk, int Ntotal));191 int gfits_fwrite_ftable_range PROTO((FILE *f, FTable *table, off_t start, off_t Nrows, off_t Ndisk, off_t Ntotal)); 191 192 int gfits_get_bintable_column PROTO((Header *header, FTable *table, char *label, void **data)); 192 193 int gfits_get_bintable_column_type PROTO((Header *header, char *label, char *type, int *Nval)); 193 void *gfits_get_bintable_column_data PROTO((Header *header, FTable *table, char *label, char *type, int *Nrow, int *Ncol));194 void *gfits_get_bintable_column_data PROTO((Header *header, FTable *table, char *label, char *type, off_t *Nrow, int *Ncol)); 194 195 int gfits_get_table_column PROTO((Header *header, FTable *table, char *label, void **data)); 195 196 int gfits_get_table_column_type PROTO((Header *header, char *label, char *type)); 196 197 int gfits_read_ftable PROTO((char *filename, FTable *table, char *extname)); 197 198 int gfits_read_table PROTO((char *filename, FTable *ftable)); 198 int gfits_set_bintable_column PROTO((Header *header, FTable *table, char *label, void *data, int Nrow));199 int gfits_set_table_column PROTO((Header *header, FTable *table, char *label, void *data, int Nrow));199 int gfits_set_bintable_column PROTO((Header *header, FTable *table, char *label, void *data, off_t Nrow)); 200 int gfits_set_table_column PROTO((Header *header, FTable *table, char *label, void *data, off_t Nrow)); 200 201 int gfits_table_column PROTO((FTable *ftable, char *field, char *mode,...)); 201 202 int gfits_table_format PROTO((char *format, char *type, int *Nval, int *Nbytes)); 202 203 int gfits_table_scale_data PROTO((FTable *ftable)); 203 204 int gfits_table_scale_storage PROTO((FTable *ftable)); 204 int gfits_table_to_vtable PROTO((FTable *ftable, VTable *vtable, int start, int Nkeep));205 int gfits_vadd_rows PROTO((VTable *vtable, char *data, int Nrow, int Nbytes));206 int gfits_vtable_from_ftable PROTO((FTable *ftable, VTable *vtable, int *row, int Nrow));205 int gfits_table_to_vtable PROTO((FTable *ftable, VTable *vtable, off_t start, off_t Nkeep)); 206 int gfits_vadd_rows PROTO((VTable *vtable, char *data, off_t Nrow, off_t Nbytes)); 207 int gfits_vtable_from_ftable PROTO((FTable *ftable, VTable *vtable, off_t *row, off_t Nrow)); 207 208 int gfits_write_table PROTO((char *filename, FTable *ftable)); 208 209 … … 215 216 216 217 int gfits_varlength_column_define PROTO((FTable *ftable, VarLengthColumn *def, int column)); 217 void *gfits_varlength_column_pointer PROTO((FTable *ftable, VarLengthColumn *column, int row, int *length));218 void *gfits_varlength_column_pointer PROTO((FTable *ftable, VarLengthColumn *column, off_t row, off_t *length)); 218 219 219 220 #endif /* FITSIO */ -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_add_M.c
r7054 r27295 3 3 4 4 /*********************** fits insert array ***********************************/ 5 void gfits_add_matrix (matrix, array, x, y) 6 Matrix *matrix, *array; 7 int x, y; 5 void gfits_add_matrix (Matrix *matrix, Matrix *array, off_t x, off_t y) 8 6 { 9 7 … … 15 13 if ((x + array[0].Naxis[0] > matrix[0].Naxis[0]) || 16 14 (y + array[0].Naxis[1] > matrix[0].Naxis[1])) { 17 fprintf (stderr, "can't add array here: (%d,%d) - (%d,%d) vs (%d,%d)\n", 18 x, y, x + array[0].Naxis[0], y + array[0].Naxis[1], 19 matrix[0].Naxis[0], matrix[0].Naxis[1]); 15 fprintf (stderr, "can't add array here: (%lld,%lld) - (%lld,%lld) vs (%lld,%lld)\n", 16 (long long) x, 17 (long long) y, 18 (long long) x + array[0].Naxis[0], 19 (long long) y + array[0].Naxis[1], 20 (long long) matrix[0].Naxis[0], 21 (long long) matrix[0].Naxis[1]); 20 22 return; 21 23 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_add_M_value.c
r7054 r27295 3 3 4 4 /***************** fits add matrix value ***********************************/ 5 void gfits_add_matrix_value (matrix, x, y, Value) 6 Matrix *matrix; 7 int x, y; 8 double Value; 5 void gfits_add_matrix_value (Matrix *matrix, off_t x, off_t y, double Value) 9 6 { 10 7 -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_compress_M.c
r23724 r27295 31 31 int gfits_uncompress_image (Header *header, Matrix *matrix, FTable *ftable) { 32 32 33 int i, j, status, zimage, zcol, Nzrows, Nout, Nzdata, max_tile_size; 33 off_t Nzdata, Nzrows, zcol; 34 int i, j, status, zimage, Nout, max_tile_size; 34 35 char cmptype[80]; 35 36 char zaxis[10], naxis[10], key[10], word[81], exttype[81], checksum[81], datasum[81]; … … 196 197 if (!gfits_varlength_column_define (ftable, &zdef, zcol)) ESCAPE; 197 198 gfits_delete (header, "TFIELDS", 1); 198 snprintf (key, 10, "TTYPE% d",zcol);199 snprintf (key, 10, "TTYPE%lld", (long long) zcol); 199 200 gfits_delete (header, key, 1); 200 snprintf (key, 10, "TFORM% d",zcol);201 snprintf (key, 10, "TFORM%lld", (long long) zcol); 201 202 gfits_delete (header, key, 1); 202 203 … … 236 237 ALLOCATE (out, char, odata_pixsize*max_tile_size); 237 238 239 off_t row; 240 238 241 // uncompress the data 239 242 Nzrows = ftable->header->Naxis[1]; 240 for ( i = 0; i < Nzrows; i++) {243 for (row = 0; row < Nzrows; row++) { 241 244 242 245 // expected output size for this tile 243 246 Nout = gfits_tile_size (matrix, otile, ztile); 244 247 245 zdata = gfits_varlength_column_pointer (ftable, &zdef, i, &Nzdata);248 zdata = gfits_varlength_column_pointer (ftable, &zdef, row, &Nzdata); 246 249 if (!zdata) return (FALSE); 247 250 … … 254 257 255 258 // gfits_uncompress_data uncompresses from zdata to the temporary output buffer which must be allocated 259 // XXX the tile must not be > 2GB 256 260 if (!gfits_uncompress_data ((char *)zdata, Nzdata, cmptype, optname, optvalue, Noptions, out, &Nout, odata_pixsize)) return (FALSE); 257 261 … … 284 288 285 289 // true sizes of this tile (in pixels) 286 int gfits_tile_size (Matrix *matrix, int *otile, int *ztile) {287 288 int i, Npixels, Ndimen;290 off_t gfits_tile_size (Matrix *matrix, int *otile, int *ztile) { 291 292 off_t i, Npixels, Ndimen; 289 293 290 294 Npixels = 1; -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_convert_format.c
r20652 r27295 24 24 *out = *in*A + B; \ 25 25 } \ 26 REALLOCATE (matrix[0].buffer, char, matrix[0]. size);26 REALLOCATE (matrix[0].buffer, char, matrix[0].datasize); 27 27 28 28 # define CONVERTSAME(MY_NAN) \ … … 41 41 inMode *in; \ 42 42 outMode *out; \ 43 REALLOCATE (matrix[0].buffer, char, matrix[0]. size); \43 REALLOCATE (matrix[0].buffer, char, matrix[0].datasize); \ 44 44 out = (outMode *)matrix[0].buffer + Npixels - 1; \ 45 45 in = (inMode *)matrix[0].buffer + Npixels - 1; \ … … 62 62 *out = *in*A + B; \ 63 63 } \ 64 REALLOCATE (matrix[0].buffer, char, matrix[0]. size);64 REALLOCATE (matrix[0].buffer, char, matrix[0].datasize); 65 65 66 66 # define CONVERTSAME_FF(MY_NAN) \ … … 79 79 inMode *in; \ 80 80 outMode *out; \ 81 REALLOCATE (matrix[0].buffer, char, matrix[0]. size); \81 REALLOCATE (matrix[0].buffer, char, matrix[0].datasize); \ 82 82 out = (outMode *)matrix[0].buffer + Npixels - 1; \ 83 83 in = (inMode *)matrix[0].buffer + Npixels - 1; \ … … 106 106 return (TRUE); 107 107 108 matrix[0].bitpix = header[0].bitpix = outBitpix;109 matrix[0].bscale = header[0].bscale = outScale;110 matrix[0].bzero = header[0].bzero = outZero;111 matrix[0].unsign = header[0].unsign = outUnsign;112 matrix[0]. size= gfits_data_size (header);108 matrix[0].bitpix = header[0].bitpix = outBitpix; 109 matrix[0].bscale = header[0].bscale = outScale; 110 matrix[0].bzero = header[0].bzero = outZero; 111 matrix[0].unsign = header[0].unsign = outUnsign; 112 matrix[0].datasize = gfits_data_size (header); 113 113 gfits_modify (header, "BITPIX", "%d", 1, outBitpix); 114 114 gfits_modify (header, "BSCALE", "%lf", 1, outScale); … … 426 426 { 427 427 char *out; 428 int Nextra;428 off_t Nextra; 429 429 430 430 out = (char *)matrix[0].buffer; 431 Nextra = matrix[0]. size - nbytes;431 Nextra = matrix[0].datasize - nbytes; 432 432 bzero (&out[nbytes], Nextra); 433 433 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_copy_M.c
r17903 r27295 7 7 int i; 8 8 9 matrix2[0].unsign = matrix1[0].unsign;10 matrix2[0].bitpix = matrix1[0].bitpix;11 matrix2[0]. size = matrix1[0].size;12 matrix2[0].bzero = matrix1[0].bzero;13 matrix2[0].bscale = matrix1[0].bscale;14 matrix2[0].Naxes = matrix1[0].Naxes;9 matrix2[0].unsign = matrix1[0].unsign; 10 matrix2[0].bitpix = matrix1[0].bitpix; 11 matrix2[0].datasize = matrix1[0].datasize; 12 matrix2[0].bzero = matrix1[0].bzero; 13 matrix2[0].bscale = matrix1[0].bscale; 14 matrix2[0].Naxes = matrix1[0].Naxes; 15 15 for (i = 0; i < FT_MAX_NAXES; i++) 16 16 matrix2[0].Naxis[i] = matrix1[0].Naxis[i]; 17 17 18 18 if (matrix2[0].buffer != NULL) free (matrix2[0].buffer); 19 ALLOCATE (matrix2[0].buffer, char, matrix2[0]. size);19 ALLOCATE (matrix2[0].buffer, char, matrix2[0].datasize); 20 20 21 memcpy (matrix2[0].buffer, matrix1[0].buffer, matrix2[0]. size);21 memcpy (matrix2[0].buffer, matrix1[0].buffer, matrix2[0].datasize); 22 22 23 23 return (TRUE); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_create_M.c
r17903 r27295 3 3 4 4 /*********************** fits create matrix *******************************/ 5 int gfits_create_matrix (header, matrix) 6 Header *header; 7 Matrix *matrix; 8 { 5 int gfits_create_matrix (Header *header, Matrix *matrix) { 9 6 10 int i, Nbytes; 7 int i; 8 off_t Nbytes; 11 9 12 10 matrix[0].bitpix = header[0].bitpix; … … 20 18 Nbytes = gfits_data_size (header); 21 19 ALLOCATE (matrix[0].buffer, char, MAX (Nbytes, 1)); 22 bzero (matrix[0].buffer, Nbytes);20 memset (matrix[0].buffer, 0, Nbytes); 23 21 24 matrix[0]. size = Nbytes;22 matrix[0].datasize = Nbytes; 25 23 return (TRUE); 26 24 -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_get_M_value.c
r15487 r27295 3 3 4 4 /***************** fits get matrix value ***********************************/ 5 double gfits_get_matrix_value (Matrix *matrix, int x, int y) {5 double gfits_get_matrix_value (Matrix *matrix, off_t x, off_t y) { 6 6 7 7 double value; … … 11 11 return (0.0); 12 12 pixel = matrix[0].Naxis[0]*y + x; 13 value = HUGE_VAL;13 value = NAN; 14 14 15 15 if (matrix[0].unsign) { -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_insert_M.c
r15487 r27295 3 3 4 4 /*********************** fits insert array ***********************************/ 5 void gfits_insert_matrix (Matrix *matrix, Matrix *array, int x, int y) {5 void gfits_insert_matrix (Matrix *matrix, Matrix *array, off_t x, off_t y) { 6 6 7 7 /* there is no check here to match BITPIX, BZERO, or BSCALE */ 8 8 9 int i, start_m, Nbytes_m, Nbytes; 9 int i; 10 off_t start_m, Nbytes_m, Nbytes; 10 11 11 12 if ((x + array[0].Naxis[0] > matrix[0].Naxis[0]) || 12 13 (y + array[0].Naxis[1] > matrix[0].Naxis[1])) { 13 fprintf (stderr, "can't insert array here: (%d,%d) - (%d,%d) vs (%d,%d)\n", 14 x, y, x + array[0].Naxis[0], y + array[0].Naxis[1], 15 matrix[0].Naxis[0], matrix[0].Naxis[1]); 14 fprintf (stderr, "can't insert array here: (%lld,%lld) - (%lld,%lld) vs (%lld,%lld)\n", 15 (long long) x, 16 (long long) y, 17 (long long) x + array[0].Naxis[0], 18 (long long) y + array[0].Naxis[1], 19 (long long) matrix[0].Naxis[0], 20 (long long) matrix[0].Naxis[1]); 16 21 return; 17 22 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_load_M.c
r16139 r27295 13 13 int gfits_load_matrix (FILE *f, Matrix *matrix, Header *header) { 14 14 15 int i, nbytes, Nbytes; 15 16 off_t i, nbytes, Nbytes; 16 17 17 18 matrix[0].bitpix = header[0].bitpix; … … 25 26 Nbytes = gfits_data_size (header); 26 27 ALLOCATE (matrix[0].buffer, char, Nbytes); 27 matrix[0]. size = Nbytes;28 matrix[0].datasize = Nbytes; 28 29 29 30 nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f); … … 94 95 } 95 96 if (nbytes != Nbytes) { /* this is a FITS error, but often the image is OK */ 96 fprintf (stderr, "incomplete block in FITS file: (% d, %d)\n", nbytes,Nbytes);97 fprintf (stderr, "incomplete block in FITS file: (%lld, %lld)\n", (long long) nbytes, (long long) Nbytes); 97 98 return (TRUE); 98 99 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_matrix.c
r15751 r27295 2 2 # include <gfitsio.h> 3 3 4 int gfits_data_size (Header *header) {4 off_t gfits_data_size (Header *header) { 5 5 6 int i, Nrec, size; 6 int i; 7 off_t Nrec, size; 7 8 8 9 if (header[0].Naxes == 0) return (0); … … 25 26 } 26 27 27 int gfits_data_min_size (Header *header) {28 off_t gfits_data_min_size (Header *header) { 28 29 29 int i, size; 30 int i; 31 off_t size; 30 32 31 33 if (header[0].Naxes == 0) return (0); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_read_M.c
r7054 r27295 18 18 if (f == NULL) return (FALSE); 19 19 20 fseek (f, header.size, 0);20 fseeko (f, header.datasize, 0); 21 21 22 22 status = gfits_load_matrix (f, matrix, &header); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_read_portion.c
r16139 r27295 9 9 /*********************** fits read matrix ***********************************/ 10 10 /** the result of this function is a matrix with dimension Npix * 1 **/ 11 int gfits_read_portion (char *filename, Matrix *matrix, int Nskip, int Npix) {11 int gfits_read_portion (char *filename, Matrix *matrix, off_t Nskip, off_t Npix) { 12 12 13 13 FILE *f; 14 14 Header header; 15 int status, nbytes, Nbytes, Nrec; 15 int status; 16 off_t nbytes, Nbytes, Nrec; 16 17 17 18 status = gfits_read_header (filename, &header); … … 37 38 Nbytes = FT_RECORD_SIZE * Nrec; 38 39 } 39 matrix[0]. size = Nbytes;40 matrix[0].datasize = Nbytes; 40 41 ALLOCATE (matrix[0].buffer, char, Nbytes); 41 42 … … 43 44 f = fopen (filename, "r"); 44 45 if (f == NULL) return (FALSE); 45 fseek (f, header.size + Nskip, SEEK_SET);46 fseeko (f, header.datasize + Nskip, SEEK_SET); 46 47 nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f); 47 48 if (nbytes != Nbytes) { … … 52 53 53 54 # ifdef BYTE_SWAP 54 { 55 int i, perpix; 56 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp; 55 { 56 off_t i; 57 int perpix; 58 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp; 57 59 58 perpix = abs(header.bitpix) / 8; 59 if (perpix > 1) { 60 byte0 = (unsigned char *) matrix[0].buffer; 61 byte1 = (unsigned char *) matrix[0].buffer + 1; 62 byte2 = (unsigned char *) matrix[0].buffer + 2; 63 byte3 = (unsigned char *) matrix[0].buffer + 3; 64 byte4 = (unsigned char *) matrix[0].buffer + 4; 65 byte5 = (unsigned char *) matrix[0].buffer + 5; 66 byte6 = (unsigned char *) matrix[0].buffer + 6; 67 byte7 = (unsigned char *) matrix[0].buffer + 7; 68 if (perpix == 2) { 69 for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) { 70 ctmp = *byte0; 71 *byte0 = *byte1; 72 *byte1 = ctmp; 60 perpix = abs(header.bitpix) / 8; 61 if (perpix > 1) { 62 byte0 = (unsigned char *) matrix[0].buffer; 63 byte1 = (unsigned char *) matrix[0].buffer + 1; 64 byte2 = (unsigned char *) matrix[0].buffer + 2; 65 byte3 = (unsigned char *) matrix[0].buffer + 3; 66 byte4 = (unsigned char *) matrix[0].buffer + 4; 67 byte5 = (unsigned char *) matrix[0].buffer + 5; 68 byte6 = (unsigned char *) matrix[0].buffer + 6; 69 byte7 = (unsigned char *) matrix[0].buffer + 7; 70 if (perpix == 2) { 71 for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) { 72 ctmp = *byte0; 73 *byte0 = *byte1; 74 *byte1 = ctmp; 75 } 73 76 } 74 }75 if (perpix == 4) {76 for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) { 77 ctmp = *byte0;78 *byte0 = *byte3;79 *byte3 = ctmp;80 ctmp = *byte1;81 *byte1 = *byte2;82 *byte2 = ctmp;77 if (perpix == 4) { 78 for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) { 79 ctmp = *byte0; 80 *byte0 = *byte3; 81 *byte3 = ctmp; 82 ctmp = *byte1; 83 *byte1 = *byte2; 84 *byte2 = ctmp; 85 } 83 86 } 84 }85 if (perpix == 8) {86 for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) { 87 ctmp = *byte0;88 *byte0 = *byte7;89 *byte7 = ctmp;90 ctmp = *byte1;91 *byte1 = *byte6;92 *byte6 = ctmp;93 ctmp = *byte1;94 *byte2 = *byte5;95 *byte5 = ctmp;96 ctmp = *byte1;97 *byte3 = *byte4;98 *byte4 = ctmp;87 if (perpix == 8) { 88 for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) { 89 ctmp = *byte0; 90 *byte0 = *byte7; 91 *byte7 = ctmp; 92 ctmp = *byte1; 93 *byte1 = *byte6; 94 *byte6 = ctmp; 95 ctmp = *byte1; 96 *byte2 = *byte5; 97 *byte5 = ctmp; 98 ctmp = *byte1; 99 *byte3 = *byte4; 100 *byte4 = ctmp; 101 } 99 102 } 100 103 } 101 104 } 102 }103 105 # endif 104 106 … … 106 108 107 109 if (nbytes < Nbytes - 2880) { /* this is a bad FITS error: image is not OK */ 108 fprintf (stderr, "error reading in matrix data from FITS file %s (% d < %d - 2880)\n", filename, nbytes,Nbytes);110 fprintf (stderr, "error reading in matrix data from FITS file %s (%lld < %lld - 2880)\n", filename, (long long) nbytes, (long long) Nbytes); 109 111 return (FALSE); 110 112 } 111 113 if (nbytes != Nbytes) { /* this is a FITS error, but often the image is OK */ 112 fprintf (stderr, "incomplete block in %s: (% d, %d)\n", filename, nbytes,Nbytes);114 fprintf (stderr, "incomplete block in %s: (%lld, %lld)\n", filename, (long long) nbytes, (long long) Nbytes); 113 115 return (TRUE); 114 116 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_read_segment.c
r16139 r27295 36 36 int gfits_fread_matrix_segment (FILE *f, Matrix *matrix, Header *header, char *region) { 37 37 38 int status, i, nbytes, Nbytes, Nskip, NbytesData; 38 int status; 39 off_t i, nbytes, Nbytes, Nskip, NbytesData; 39 40 int wantaxis[FT_MAX_NAXES][2]; 40 41 double tmp; … … 65 66 matrix[0].Naxis[i] = wantaxis[i][1] - wantaxis[i][0]; 66 67 67 matrix[0]. size = abs (matrix[0].bitpix) / 8;68 matrix[0].datasize = abs (matrix[0].bitpix) / 8; 68 69 for (i = 0; i < matrix[0].Naxes; i++) 69 matrix[0]. size *= matrix[0].Naxis[i];70 matrix[0].datasize *= matrix[0].Naxis[i]; 70 71 71 72 Nskip = wantaxis[2][0]*matrix[0].Naxis[0]*matrix[0].Naxis[1]*abs(matrix[0].bitpix)/8; 72 NbytesData = Nskip + matrix[0]. size;73 NbytesData = Nskip + matrix[0].datasize; 73 74 74 75 if (NbytesData % FT_RECORD_SIZE) 75 Nbytes = FT_RECORD_SIZE * (( int) (NbytesData / FT_RECORD_SIZE) + 1) - Nskip;76 Nbytes = FT_RECORD_SIZE * ((off_t) (NbytesData / FT_RECORD_SIZE) + 1) - Nskip; 76 77 else 77 Nbytes = FT_RECORD_SIZE * (( int) (NbytesData / FT_RECORD_SIZE)) - Nskip;78 Nbytes = FT_RECORD_SIZE * ((off_t) (NbytesData / FT_RECORD_SIZE)) - Nskip; 78 79 79 80 ALLOCATE (matrix[0].buffer, char, MAX (Nbytes, 1)); … … 86 87 87 88 /* currently only good for reading in full planes in 3-D */ 88 fseek (f, Nskip, SEEK_CUR);89 fseeko (f, Nskip, SEEK_CUR); 89 90 nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f); 90 91 if (nbytes != Nbytes) { … … 92 93 } 93 94 94 matrix[0]. size = Nbytes;95 matrix[0].datasize = Nbytes; 95 96 96 97 # ifdef BYTE_SWAP … … 147 148 148 149 if (nbytes < Nbytes - 2880) { /* this is a bad FITS error: image is not OK */ 149 fprintf (stderr, "error reading in matrix data from FITS file (% d < %d - 2880)\n", nbytes,Nbytes);150 fprintf (stderr, "error reading in matrix data from FITS file (%lld < %lld - 2880)\n", (long long) nbytes, (long long) Nbytes); 150 151 return (FALSE); 151 152 } 152 153 if (nbytes != Nbytes) { /* this is a FITS error, but often the image is OK */ 153 fprintf (stderr, "incomplete block in FITS file: (% d, %d)\n", nbytes,Nbytes);154 fprintf (stderr, "incomplete block in FITS file: (%lld, %lld)\n", (long long) nbytes, (long long) Nbytes); 154 155 return (TRUE); 155 156 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_set_M_value.c
r15487 r27295 3 3 4 4 /****************** fits set matrix value ***********************************/ 5 void gfits_set_matrix_value (Matrix *matrix, int x, int y, double Value) {5 void gfits_set_matrix_value (Matrix *matrix, off_t x, off_t y, double Value) { 6 6 7 int pixel;7 off_t pixel; 8 8 double value; 9 9 -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/matrix/F_write_M.c
r16139 r27295 11 11 if (f == NULL) return (FALSE); 12 12 13 fseek (f, 0, SEEK_END); /* write matrix to end of file! */13 fseeko (f, 0LL, SEEK_END); /* write matrix to end of file! */ 14 14 15 15 status = gfits_fwrite_matrix (f, matrix); … … 21 21 int gfits_fwrite_matrix (FILE *f, Matrix *matrix) { 22 22 23 int status, nbytes, Nbytes; 23 int status; 24 off_t nbytes, Nbytes; 24 25 25 26 status = TRUE; … … 27 28 /* this is a bit dangerous: we are not realloc'ing the matrix. 28 29 if the size is wrong, it probably should simply pad the fwrite statement. 29 better policy should be defined (ie, matrix. size always correct blocking?)30 better policy should be defined (ie, matrix.datasize always correct blocking?) 30 31 */ 31 32 32 if (matrix[0]. size % FT_RECORD_SIZE)33 nbytes = FT_RECORD_SIZE * (( int) (matrix[0].size / FT_RECORD_SIZE) + 1);33 if (matrix[0].datasize % FT_RECORD_SIZE) 34 nbytes = FT_RECORD_SIZE * ((off_t) (matrix[0].datasize / FT_RECORD_SIZE) + 1); 34 35 else 35 nbytes = FT_RECORD_SIZE * (( int) (matrix[0].size / FT_RECORD_SIZE));36 nbytes = FT_RECORD_SIZE * ((off_t) (matrix[0].datasize / FT_RECORD_SIZE)); 36 37 37 38 /* this is a bit cumbersome: swap all words, write out file, then swap back... */ 38 39 # ifdef BYTE_SWAP 39 40 { 40 int i;41 off_t i; 41 42 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp; 42 43 int perpix; … … 96 97 # ifdef BYTE_SWAP 97 98 { 98 int i;99 off_t i; 99 100 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp; 100 101 int perpix; -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_create_T.c
r15487 r27295 5 5 int gfits_create_table (Header *header, FTable *table) { 6 6 7 int Nbytes;7 off_t Nbytes; 8 8 char type[80]; 9 9 … … 19 19 memset (table[0].buffer, 0, Nbytes); 20 20 } 21 table[0]. size = Nbytes;21 table[0].datasize = Nbytes; 22 22 return (TRUE); 23 23 … … 29 29 int gfits_create_vtable (Header *header, VTable *table, int Nrow) { 30 30 31 int i, Nx, Ny;31 off_t i, Nx, Ny; 32 32 char type[80]; 33 33 … … 37 37 Nx = table[0].header[0].Naxis[0]; 38 38 Ny = table[0].header[0].Naxis[0]; 39 table[0]. size = gfits_data_size (header);40 table[0].pad = table[0]. size - Nx*Ny;39 table[0].datasize = gfits_data_size (header); 40 table[0].pad = table[0].datasize - Nx*Ny; 41 41 42 42 table[0].Nrow = Nrow; 43 43 ALLOCATE (table[0].buffer, char *, MAX (Nrow, 1)); 44 ALLOCATE (table[0].row, int, MAX (Nrow, 1));44 ALLOCATE (table[0].row, off_t, MAX (Nrow, 1)); 45 45 for (i = 0; i < Nrow; i++) { 46 46 ALLOCATE (table[0].buffer[i], char, Nx); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_create_TH.c
r15487 r27295 13 13 char axis[10]; 14 14 15 header[0]. size = NBYTES;15 header[0].datasize = NBYTES; 16 16 17 17 ALLOCATE (header[0].buffer, char, NBYTES); … … 27 27 for (i = 0; i < header[0].Naxes; i++) { 28 28 sprintf (axis, "NAXIS%d", i + 1); 29 gfits_modify (header, axis, "% d", 1, header[0].Naxis[i], 1);29 gfits_modify (header, axis, "%lld", 1, header[0].Naxis[i]); 30 30 } 31 31 -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_define_column.c
r26384 r27295 5 5 int gfits_define_bintable_column (Header *header, char *format, char *label, char *comment, char *unit, double bscale, double bzero) { 6 6 7 int Nfields, Nbytes, Nval, Naxis1; 7 off_t Naxis1; 8 int Nfields, Nbytes, Nval; 8 9 char type[16], field[16]; 9 10 … … 12 13 Nfields = 0; 13 14 gfits_scan (header, "TFIELDS", "%d", 1, &Nfields); 14 gfits_scan (header, "NAXIS1", "% d", 1, &Naxis1);15 gfits_scan (header, "NAXIS1", "%lld", 1, &Naxis1); 15 16 Nfields ++; 16 17 Naxis1 += Nbytes*Nval; … … 34 35 /* update TFIELDS & NAXIS1 */ 35 36 gfits_modify (header, "TFIELDS", "%d", 1, Nfields); 36 gfits_modify (header, "NAXIS1", "% d", 1, Naxis1);37 gfits_modify (header, "NAXIS1", "%lld", 1, Naxis1); 37 38 header[0].Naxis[0] = Naxis1; 38 39 … … 43 44 int gfits_define_table_column (Header *header, char *format, char *label, char *comment, char *unit) { 44 45 45 int Nstart, Nfields, Nbytes, Nval, Naxis1; 46 off_t Naxis1; 47 int Nstart, Nfields, Nbytes, Nval; 46 48 char type[16], field[16], cformat[16]; 47 49 … … 51 53 Nfields = 0; 52 54 gfits_scan (header, "TFIELDS", "%d", 1, &Nfields); 53 gfits_scan (header, "NAXIS1", "% d", 1, &Naxis1);55 gfits_scan (header, "NAXIS1", "%lld", 1, &Naxis1); 54 56 Nstart = Naxis1 + 1; 55 57 Nfields ++; … … 68 70 69 71 gfits_modify (header, "TFIELDS", "%d", 1, Nfields); 70 gfits_modify (header, "NAXIS1", "% d", 1, Naxis1);72 gfits_modify (header, "NAXIS1", "%lld", 1, Naxis1); 71 73 header[0].Naxis[0] = Naxis1; 72 74 -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_get_column.c
r26384 r27295 16 16 tmp = Pin[3]; Pin[3] = Pin[4]; Pin[4] = tmp; } 17 17 18 void *gfits_get_bintable_column_data (Header *header, FTable *table, char *label, char *type, int *Nrow, int *Ncol) { 19 20 int i, N, Nfields, Nval, Nbytes, Nx, Ny, Nstart, Nv, Nb; 18 void *gfits_get_bintable_column_data (Header *header, FTable *table, char *label, char *type, off_t *Nrow, int *Ncol) { 19 20 off_t Nx, Ny; 21 int i, N, Nfields, Nval, Nbytes, Nstart, Nv, Nb; 21 22 char tlabel[80], field[80], format[80], tmpline[16]; 22 23 char *Pin, *Pout, *array; … … 50 51 51 52 /* check existing table dimensions */ 52 gfits_scan (header, "NAXIS1", "% d", 1, &Nx);53 gfits_scan (header, "NAXIS2", "% d", 1, &Ny);53 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 54 gfits_scan (header, "NAXIS2", "%lld", 1, &Ny); 54 55 55 56 /* scan columns to find insert point */ … … 153 154 int gfits_get_bintable_column (Header *header, FTable *table, char *label, void **data) { 154 155 155 int i, N, Nfields, Nval, Nbytes, Nx, Ny, Nstart, Nv, Nb; 156 off_t Nx, Ny; 157 int i, N, Nfields, Nval, Nbytes, Nstart, Nv, Nb; 156 158 char tlabel[80], field[80], format[80], type[16], tmpline[16]; 157 159 char *Pin, *Pout, *array; … … 185 187 186 188 /* check existing table dimensions */ 187 gfits_scan (header, "NAXIS1", "% d", 1, &Nx);188 gfits_scan (header, "NAXIS2", "% d", 1, &Ny);189 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 190 gfits_scan (header, "NAXIS2", "%lld", 1, &Ny); 189 191 190 192 /* scan columns to find insert point */ … … 307 309 int gfits_get_table_column (Header *header, FTable *table, char *label, void **data) { 308 310 309 int i, N, Nfields, Nval, Nbytes, Nx, Ny, Nstart, Nv, Nb; 311 off_t Nx, Ny; 312 int i, N, Nfields, Nval, Nbytes, Nstart, Nv, Nb; 310 313 char tlabel[80], field[80], format[80], cformat[80], type[16], tmp[16]; 311 314 char *array, *Pin, *Pout, *line; … … 333 336 334 337 /* check existing table dimensions */ 335 gfits_scan (header, "NAXIS1", "% d", 1, &Nx);336 gfits_scan (header, "NAXIS2", "% d", 1, &Ny);338 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 339 gfits_scan (header, "NAXIS2", "%lld", 1, &Ny); 337 340 338 341 /* scan columns to find insert point */ -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_read_T.c
r15751 r27295 19 19 int gfits_fread_ftable (FILE *f, FTable *table, char *extname) { 20 20 21 int j, found, Nbytes; 21 int j, found; 22 off_t Nbytes; 22 23 Header *header; 23 24 char tname[80]; 24 25 25 26 header = table[0].header; 26 fseek (f, 0, SEEK_SET);27 fseeko (f, 0, SEEK_SET); 27 28 28 29 found = FALSE; … … 42 43 /* skip to next header */ 43 44 Nbytes = gfits_data_size (header); 44 fseek (f, Nbytes, SEEK_CUR);45 fseeko (f, Nbytes, SEEK_CUR); 45 46 gfits_free_header (header); 46 47 } … … 51 52 int gfits_fread_ftable_data (FILE *f, FTable *table) { 52 53 53 int Nbytes, Nread;54 off_t Nbytes, Nread; 54 55 char string[128]; 55 56 … … 63 64 perror (string); 64 65 if (Nread < gfits_data_min_size (table[0].header)) { 65 fprintf (stderr, "error: fits read error in %s, read % d, need %d\n", __func__, Nread,gfits_data_min_size (table[0].header));66 fprintf (stderr, "error: fits read error in %s, read %lld, need %lld\n", __func__, (long long) Nread, (long long) gfits_data_min_size (table[0].header)); 66 67 gfits_free_table (table); 67 68 return (FALSE); … … 69 70 fprintf (stderr, "warning: file missing pad\n"); 70 71 } 71 table[0]. size = Nbytes;72 table[0].datasize = Nbytes; 72 73 return (TRUE); 73 74 } 74 75 75 76 /*********************** fits read ftable data ***********************************/ 76 int gfits_fread_ftable_range (FILE *f, FTable *table, int start, int Nrows) {77 78 int Nbytes, Nread, Nskip, Nx, Ny;77 int gfits_fread_ftable_range (FILE *f, FTable *table, off_t start, off_t Nrows) { 78 79 off_t Nbytes, Nread, Nskip, Nx, Ny; 79 80 80 81 /* find disk table size */ … … 93 94 ALLOCATE (table[0].buffer, char, MAX (Nbytes, 1)); 94 95 95 fseek (f, Nskip, SEEK_CUR);96 fseeko (f, Nskip, SEEK_CUR); 96 97 97 98 Nread = fread (table[0].buffer, sizeof (char), Nbytes, f); … … 108 109 /* modify structure and header to match actual read rows Ny */ 109 110 table[0].header[0].Naxis[1] = Nrows; 110 gfits_modify (table[0].header, "NAXIS2", "% d", 1, Nrows);111 table[0]. size = gfits_data_size (table[0].header);111 gfits_modify (table[0].header, "NAXIS2", "%lld", 1, Nrows); 112 table[0].datasize = gfits_data_size (table[0].header); 112 113 113 114 return (TRUE); … … 115 116 116 117 /*********************** fits read ftable data ***********************************/ 117 int gfits_fread_vtable_range (FILE *f, VTable *table, int start, int Nrows) {118 119 int i, Nbytes, Nread, Nskip, Nx, Ny;118 int gfits_fread_vtable_range (FILE *f, VTable *table, off_t start, off_t Nrows) { 119 120 off_t i, Nbytes, Nread, Nskip, Nx, Ny; 120 121 char *buffer; 121 122 … … 123 124 Nx = table[0].header[0].Naxis[0]; 124 125 Ny = table[0].header[0].Naxis[1]; 125 table[0]. size = gfits_data_size (table[0].header);126 table[0].pad = table[0]. size - Nx*Ny;126 table[0].datasize = gfits_data_size (table[0].header); 127 table[0].pad = table[0].datasize - Nx*Ny; 127 128 128 129 if (start < 0) return (FALSE); … … 133 134 ALLOCATE (buffer, char, MAX (Nbytes, 1)); 134 135 135 fseek (f, Nskip, SEEK_CUR);136 fseeko (f, Nskip, SEEK_CUR); 136 137 Nread = fread (buffer, sizeof (char), Nbytes, f); 137 138 if (Nread != Nbytes) { … … 141 142 } 142 143 143 ALLOCATE (table[0].row, int, MAX (Nrows, 1));144 ALLOCATE (table[0].row, off_t, MAX (Nrows, 1)); 144 145 ALLOCATE (table[0].buffer, char *, MAX (Nrows, 1)); 145 146 for (i = 0; i < Nrows; i++) { … … 154 155 155 156 /*********************** fits read virtual table ***********************************/ 156 int gfits_fread_vtable (FILE *f, VTable *table, char *extname, int Nrow, int *row) { 157 158 int i, j, Nbytes, Nread; 159 int start, Nx, Ny, offset; 157 int gfits_fread_vtable (FILE *f, VTable *table, char *extname, off_t Nrow, off_t *row) { 158 159 off_t i, j; 160 off_t Nbytes, Nread; 161 off_t start, Nx, Ny, offset; 160 162 Header *header; 161 163 char tname[80]; 162 164 163 165 header = table[0].header; 164 fseek (f, 0, SEEK_SET);166 fseeko (f, 0, SEEK_SET); 165 167 166 168 for (j = -1; TRUE; j++) { … … 176 178 if (strcmp (tname, extname)) { 177 179 /* skip to next header */ 178 fseek (f, Nbytes, SEEK_CUR);180 fseeko (f, Nbytes, SEEK_CUR); 179 181 gfits_free_header (header); 180 182 continue; … … 182 184 183 185 /* file pointer is at beginning of desired table data */ 184 start = ftell (f);185 gfits_scan (header, "NAXIS1", "% d", 1, &Nx);186 gfits_scan (header, "NAXIS2", "% d", 1, &Ny);186 start = ftello (f); 187 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 188 gfits_scan (header, "NAXIS2", "%lld", 1, &Ny); 187 189 for (i = 0; i < Nrow; i++) { 188 190 if (row[i] > Ny) { return (FALSE); } … … 193 195 ALLOCATE (table[0].buffer[i], char, MAX (1, Nx)); 194 196 offset = start + Nx*row[i]; 195 fseek (f, offset, SEEK_SET);197 fseeko (f, offset, SEEK_SET); 196 198 Nread = fread (table[0].buffer[i], sizeof (char), Nx, f); 197 199 if (Nread != Nx) { … … 202 204 203 205 table[0].Nrow = Nrow; 204 ALLOCATE (table[0].row, int, MAX (1, Nrow));206 ALLOCATE (table[0].row, off_t, MAX (1, Nrow)); 205 207 for (i = 0; i < Nrow; i++) table[0].row[i] = row[i]; 206 table[0]. size= gfits_data_size (table[0].header);207 table[0].pad = table[0].size - Nx*Ny;208 table[0].datasize = gfits_data_size (table[0].header); 209 table[0].pad = table[0].datasize - Nx*Ny; 208 210 return (TRUE); 209 211 } … … 212 214 int gfits_fread_header_extname (FILE *f, Header *header, char *extname) { 213 215 214 int Nbytes;216 off_t Nbytes; 215 217 char current[80]; 216 218 217 fseek (f, 0, SEEK_SET);219 fseeko (f, 0, SEEK_SET); 218 220 gfits_fread_header (f, header); 219 221 … … 221 223 222 224 Nbytes = gfits_data_size (header); 223 fseek (f, Nbytes, SEEK_CUR);225 fseeko (f, Nbytes, SEEK_CUR); 224 226 225 227 while (gfits_fread_header (f, header)) { … … 227 229 if (!strcmp (current, extname)) return (TRUE); 228 230 Nbytes = gfits_data_size (header); 229 fseek (f, Nbytes, SEEK_CUR);231 fseeko (f, Nbytes, SEEK_CUR); 230 232 } 231 233 return (FALSE); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_read_TH.c
r15743 r27295 7 7 FILE *f; 8 8 Header header; 9 int status, Nbytes; 9 int status; 10 off_t Nbytes; 10 11 11 12 status = gfits_read_header (filename, &header); … … 23 24 24 25 Nbytes = gfits_data_size (&header); 25 fseek (f, Nbytes, SEEK_SET);26 fseeko (f, Nbytes, SEEK_SET); 26 27 gfits_free_header (&header); 27 28 … … 36 37 37 38 char *p; 38 int i, done, status, Nbytes; 39 int i, done, status; 40 off_t Nbytes; 39 41 40 Theader[0]. size = 0;42 Theader[0].datasize = 0; 41 43 done = FALSE; 42 44 ALLOCATE (Theader[0].buffer, char, 1); … … 44 46 for (i = 0; !done; i++) { 45 47 REALLOCATE (Theader[0].buffer, char, (i + 1)*FT_RECORD_SIZE); 46 Nbytes = fread (&Theader[0].buffer[i*FT_RECORD_SIZE], 47 sizeof(char), FT_RECORD_SIZE, f); 48 Nbytes = fread (&Theader[0].buffer[i*FT_RECORD_SIZE], sizeof(char), FT_RECORD_SIZE, f); 48 49 if (Nbytes != FT_RECORD_SIZE) { 49 50 perror ("fits matrix read error"); 50 51 } 51 52 52 Theader[0]. size += Nbytes;53 if (Nbytes != FT_RECORD_SIZE) 53 Theader[0].datasize += Nbytes; 54 if (Nbytes != FT_RECORD_SIZE) { 54 55 done = TRUE; 56 } 55 57 p = gfits_header_field (Theader, "END", 1); 56 58 if (p != NULL) … … 68 70 if (!status) return (FALSE); 69 71 70 gfits_scan (Theader, "NAXIS1", "% d", 1, &Theader[0].Naxis[0]);71 gfits_scan (Theader, "NAXIS2", "% d", 1, &Theader[0].Naxis[1]);72 gfits_scan (Theader, "NAXIS3", "% d", 1, &Theader[0].Naxis[2]);73 gfits_scan (Theader, "NAXIS4", "% d", 1, &Theader[0].Naxis[3]);74 gfits_scan (Theader, "NAXIS5", "% d", 1, &Theader[0].Naxis[4]);75 gfits_scan (Theader, "NAXIS6", "% d", 1, &Theader[0].Naxis[5]);76 gfits_scan (Theader, "NAXIS7", "% d", 1, &Theader[0].Naxis[6]);77 gfits_scan (Theader, "NAXIS8", "% d", 1, &Theader[0].Naxis[7]);78 gfits_scan (Theader, "NAXIS9", "% d", 1, &Theader[0].Naxis[8]);79 gfits_scan (Theader, "NAXIS10", "% d", 1, &Theader[0].Naxis[9]);72 gfits_scan (Theader, "NAXIS1", "%lld", 1, &Theader[0].Naxis[0]); 73 gfits_scan (Theader, "NAXIS2", "%lld", 1, &Theader[0].Naxis[1]); 74 gfits_scan (Theader, "NAXIS3", "%lld", 1, &Theader[0].Naxis[2]); 75 gfits_scan (Theader, "NAXIS4", "%lld", 1, &Theader[0].Naxis[3]); 76 gfits_scan (Theader, "NAXIS5", "%lld", 1, &Theader[0].Naxis[4]); 77 gfits_scan (Theader, "NAXIS6", "%lld", 1, &Theader[0].Naxis[5]); 78 gfits_scan (Theader, "NAXIS7", "%lld", 1, &Theader[0].Naxis[6]); 79 gfits_scan (Theader, "NAXIS8", "%lld", 1, &Theader[0].Naxis[7]); 80 gfits_scan (Theader, "NAXIS9", "%lld", 1, &Theader[0].Naxis[8]); 81 gfits_scan (Theader, "NAXIS10", "%lld", 1, &Theader[0].Naxis[9]); 80 82 81 83 return (TRUE); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_set_column.c
r16139 r27295 16 16 17 17 /***********************/ 18 int gfits_set_bintable_column (Header *header, FTable *table, char *label, void *data, int Nrow) { 19 20 int i, N, Nfields, Nval, Nbytes, Nx, Ny, nbytes, Nstart, Nv, Nb; 18 int gfits_set_bintable_column (Header *header, FTable *table, char *label, void *data, off_t Nrow) { 19 20 off_t Nx, Ny, nbytes; 21 int i, N, Nfields; 22 int Nval, Nbytes, Nstart, Nv, Nb; 21 23 char tlabel[80], field[80], format[80], type[16], tmpline[16]; 22 24 char *Pin, *Pout, *array; … … 47 49 48 50 /* check existing table dimensions */ 49 gfits_scan (header, "NAXIS1", "%d", 1, &Nx);50 gfits_scan (header, "NAXIS2", "%d", 1, &Ny);51 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 52 gfits_scan (header, "NAXIS2", "%lld", 1, &Ny); 51 53 if (Ny == 0) { 52 54 Ny = Nrow; 53 55 header[0].Naxis[1] = Ny; 54 gfits_modify (header, "NAXIS2", "%d", 1, Ny);56 gfits_modify (header, "NAXIS2", "%lld", 1, Ny); 55 57 56 58 nbytes = gfits_data_size (header); 57 59 REALLOCATE (table[0].buffer, char, MAX (nbytes, 1)); 58 60 bzero (table[0].buffer, nbytes); 59 table[0]. size = nbytes;61 table[0].datasize = nbytes; 60 62 } 61 63 if (Ny != Nrow) return (FALSE); … … 151 153 152 154 /***********************/ 153 int gfits_set_table_column (Header *header, FTable *table, char *label, void *data, int Nrow) { 154 155 int i, N, Nfields, Nval, Nbytes, Nx, Ny, nbytes, Nstart, Nv, Nb; 155 int gfits_set_table_column (Header *header, FTable *table, char *label, void *data, off_t Nrow) { 156 157 off_t Nx, Ny, nbytes; 158 int i, N, Nfields, Nval, Nbytes, Nstart, Nv, Nb; 156 159 char tlabel[80], field[80], format[80], cformat[80], type[16], tmp[16]; 157 160 char *array, *Pin, *Pout, *line; … … 178 181 179 182 /* check existing table dimensions */ 180 gfits_scan (header, "NAXIS1", "%d", 1, &Nx);181 gfits_scan (header, "NAXIS2", "%d", 1, &Ny);183 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 184 gfits_scan (header, "NAXIS2", "%lld", 1, &Ny); 182 185 if (Ny == 0) { 183 186 Ny = Nrow; 184 187 header[0].Naxis[1] = Ny; 185 gfits_modify (header, "NAXIS2", "%d", 1, Ny);188 gfits_modify (header, "NAXIS2", "%lld", 1, Ny); 186 189 187 190 nbytes = gfits_data_size (header); 188 191 REALLOCATE (table[0].buffer, char, MAX (nbytes, 1)); 189 192 bzero (table[0].buffer, nbytes); 190 table[0]. size = nbytes;193 table[0].datasize = nbytes; 191 194 } 192 195 if (Ny != Nrow) return (FALSE); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_table_format.c
r26384 r27295 3 3 4 4 /***********************/ 5 // get the format of a table column 6 // Nval : number of joined columns 7 // Nbytes : width of column 5 8 int gfits_bintable_format (char *format, char *type, int *Nval, int *Nbytes) { 6 9 … … 119 122 120 123 /** extract a table subset to a vtable ***/ 121 int gfits_table_to_vtable (FTable *ftable, VTable *vtable, int start, int Nkeep) {124 int gfits_table_to_vtable (FTable *ftable, VTable *vtable, off_t start, off_t Nkeep) { 122 125 123 126 /* gfits_table_to_vtable (f, v, 0, Ny - 1) - keep all of table … … 125 128 */ 126 129 127 int i, Nx, Ny;128 129 gfits_scan (ftable[0].header, "NAXIS1", "% d", 1, &Nx);130 gfits_scan (ftable[0].header, "NAXIS2", "% d", 1, &Ny);130 off_t i, Nx, Ny; 131 132 gfits_scan (ftable[0].header, "NAXIS1", "%lld", 1, &Nx); 133 gfits_scan (ftable[0].header, "NAXIS2", "%lld", 1, &Ny); 131 134 132 135 if (start + Nkeep > Ny) return (FALSE); … … 134 137 if (Nkeep < 0) return (FALSE); 135 138 136 ALLOCATE (vtable[0].row, int, MAX (1, Nkeep));139 ALLOCATE (vtable[0].row, off_t, MAX (1, Nkeep)); 137 140 ALLOCATE (vtable[0].buffer, char *, MAX (1, Nkeep)); 138 141 for (i = 0; i < Nkeep; i++) { … … 143 146 144 147 vtable[0].header = ftable[0].header; 145 vtable[0]. size = ftable[0].size;148 vtable[0].datasize = ftable[0].datasize; 146 149 vtable[0].Nrow = Nkeep; 147 vtable[0].pad = vtable[0]. size - Nx*Ny;150 vtable[0].pad = vtable[0].datasize - Nx*Ny; 148 151 149 152 return (TRUE); … … 151 154 152 155 /** convert specified rows to vtable */ 153 int gfits_vtable_from_ftable (FTable *ftable, VTable *vtable, int *row, int Nrow) {154 155 int i, N, Nx, Ny;156 157 gfits_scan (ftable[0].header, "NAXIS1", "% d", 1, &Nx);158 gfits_scan (ftable[0].header, "NAXIS2", "% d", 1, &Ny);156 int gfits_vtable_from_ftable (FTable *ftable, VTable *vtable, off_t *row, off_t Nrow) { 157 158 off_t i, N, Nx, Ny; 159 160 gfits_scan (ftable[0].header, "NAXIS1", "%lld", 1, &Nx); 161 gfits_scan (ftable[0].header, "NAXIS2", "%lld", 1, &Ny); 159 162 160 163 /* make empty vtable from table */ 161 vtable[0].header = ftable[0].header; /* make this a copy? */162 vtable[0]. size = ftable[0].size;163 vtable[0].pad = vtable[0].size - Nx*Ny;164 vtable[0].Nrow = Ny;164 vtable[0].header = ftable[0].header; /* make this a copy? */ 165 vtable[0].datasize = ftable[0].datasize; 166 vtable[0].pad = vtable[0].datasize - Nx*Ny; 167 vtable[0].Nrow = Ny; 165 168 166 169 /* insert selected rows in vtable (mask rows marked with -1) */ 167 ALLOCATE (vtable[0].row, int, Nrow);170 ALLOCATE (vtable[0].row, off_t, Nrow); 168 171 ALLOCATE (vtable[0].buffer, char *, Nrow); 169 172 for (N = i = 0; i < Nrow; i++) { … … 181 184 char *gfits_table_print (FTable *table,...) { 182 185 183 int i, Nx, Nfields;184 int off, Nchar, Nval, Nbytes;186 off_t Nx, off; 187 int i, Nchar, Nval, Nbytes, Nfields; 185 188 char *line, format[64], field[16], type[16]; 186 189 va_list argp; … … 188 191 va_start (argp, table); 189 192 190 gfits_scan (table[0].header, "NAXIS1", "% d", 1, &Nx);193 gfits_scan (table[0].header, "NAXIS1", "%lld", 1, &Nx); 191 194 gfits_scan (table[0].header, "TFIELDS", "%d", 1, &Nfields); 192 195 … … 220 223 // apply table tzero, tscal in situ (from storage to data) 221 224 int gfits_table_scale_data (FTable *ftable) { 222 223 int i, j, n, Nx, Ny, Nfields; 224 int off, Nchar, Nval, Nbytes, status; 225 226 off_t Nx, Ny, off; 227 int i, j, n, Nfields; 228 int Nchar, Nval, Nbytes, status; 225 229 char format[64], field[16], type[16]; 226 230 double tzero, tscale; … … 232 236 off = 0; 233 237 234 gfits_scan (ftable[0].header, "NAXIS1", "% d", 1, &Nx);235 gfits_scan (ftable[0].header, "NAXIS2", "% d", 1, &Ny);238 gfits_scan (ftable[0].header, "NAXIS1", "%lld", 1, &Nx); 239 gfits_scan (ftable[0].header, "NAXIS2", "%lld", 1, &Ny); 236 240 gfits_scan (ftable[0].header, "TFIELDS", "%d", 1, &Nfields); 237 241 … … 304 308 int gfits_table_scale_storage (FTable *ftable) { 305 309 306 int i, j, n, Nx, Ny, Nfields; 307 int off, Nchar, Nval, Nbytes, status; 310 off_t Nx, Ny, off; 311 int i, j, n, Nfields; 312 int Nchar, Nval, Nbytes, status; 308 313 char format[64], field[16], type[16]; 309 314 double tzero, tscale; … … 315 320 off = 0; 316 321 317 gfits_scan (ftable[0].header, "NAXIS1", "% d", 1, &Nx);318 gfits_scan (ftable[0].header, "NAXIS2", "% d", 1, &Ny);322 gfits_scan (ftable[0].header, "NAXIS1", "%lld", 1, &Nx); 323 gfits_scan (ftable[0].header, "NAXIS2", "%lld", 1, &Ny); 319 324 gfits_scan (ftable[0].header, "TFIELDS", "%d", 1, &Nfields); 320 325 -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_table_row.c
r15487 r27295 3 3 4 4 /*********************** fits table column ****************************/ 5 int gfits_add_rows (FTable *table, char *data, int Nrow, int Nbytes) {5 int gfits_add_rows (FTable *table, char *data, off_t Nrow, off_t Nbytes) { 6 6 7 int Nx, Ny;8 int nbytes, Nstart;7 off_t Nx, Ny; 8 off_t nbytes, Nstart; 9 9 Header *header; 10 10 11 11 header = table[0].header; 12 12 13 gfits_scan (header, "NAXIS1", "% d", 1, &Nx);14 gfits_scan (header, "NAXIS2", "% d", 1, &Ny);13 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 14 gfits_scan (header, "NAXIS2", "%lld", 1, &Ny); 15 15 16 16 if (header[0].Naxis[1] != Ny) return (FALSE); … … 23 23 Ny += Nrow; 24 24 header[0].Naxis[1] = Ny; 25 gfits_modify (header, "NAXIS2", "% d", 1, Ny);25 gfits_modify (header, "NAXIS2", "%lld", 1, Ny); 26 26 27 27 nbytes = gfits_data_size (header); 28 28 REALLOCATE (table[0].buffer, char, MAX (nbytes, 1)); 29 table[0]. size = nbytes;29 table[0].datasize = nbytes; 30 30 31 31 memcpy (&table[0].buffer[Nstart], data, Nbytes*Nrow); … … 35 35 36 36 /*********************** fits add (real) rows to virtual table ****************************/ 37 int gfits_vadd_rows (VTable *table, char *data, int Nrow, int Nbytes) {37 int gfits_vadd_rows (VTable *table, char *data, off_t Nrow, off_t Nbytes) { 38 38 39 int i, Nx, Ny;40 int Nstart;39 off_t i, Nx, Ny; 40 off_t Nstart; 41 41 Header *header; 42 42 43 43 header = table[0].header; 44 44 45 gfits_scan (header, "NAXIS1", "% d", 1, &Nx);46 gfits_scan (header, "NAXIS2", "% d", 1, &Ny);45 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 46 gfits_scan (header, "NAXIS2", "%lld", 1, &Ny); 47 47 48 48 if (header[0].Naxis[1] != Ny) return (FALSE); … … 54 54 table[0].Nrow += Nrow; 55 55 REALLOCATE (table[0].buffer, char *, table[0].Nrow); 56 REALLOCATE (table[0].row, int, table[0].Nrow);56 REALLOCATE (table[0].row, off_t, table[0].Nrow); 57 57 for (i = 0; i < Nrow; i++) { 58 58 ALLOCATE (table[0].buffer[Nstart+i], char, MAX (1, Nx)); … … 64 64 Ny += Nrow; 65 65 header[0].Naxis[1] = Ny; 66 gfits_modify (header, "NAXIS2", "%d", 1, Ny);66 gfits_modify (header, "NAXIS2", "%lld", 1, Ny); 67 67 68 table[0]. size= gfits_data_size (table[0].header);69 table[0].pad = table[0].size - Nx*Ny;68 table[0].datasize = gfits_data_size (table[0].header); 69 table[0].pad = table[0].datasize - Nx*Ny; 70 70 71 71 return (TRUE); … … 73 73 74 74 /*********************** fits table column ****************************/ 75 int gfits_delete_rows (FTable *table, int Nstart, int Nrow) {75 int gfits_delete_rows (FTable *table, off_t Nstart, off_t Nrow) { 76 76 77 int Nx, Ny, N0, N1, N2;78 int nbytes;77 off_t Nx, Ny, N0, N1, N2; 78 off_t nbytes; 79 79 Header *header; 80 80 81 81 header = table[0].header; 82 82 83 gfits_scan (header, "NAXIS1", "% d", 1, &Nx);84 gfits_scan (header, "NAXIS2", "% d", 1, &Ny);83 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 84 gfits_scan (header, "NAXIS2", "%lld", 1, &Ny); 85 85 86 86 if (header[0].Naxis[1] != Ny) return (FALSE); … … 97 97 Ny -= Nrow; 98 98 header[0].Naxis[1] = Ny; 99 gfits_modify (header, "NAXIS2", "%d", 1, Ny);99 gfits_modify (header, "NAXIS2", "%lld", 1, Ny); 100 100 101 101 nbytes = gfits_data_size (header); 102 102 REALLOCATE (table[0].buffer, char, MAX (nbytes, 1)); 103 table[0]. size = nbytes;103 table[0].datasize = nbytes; 104 104 return (TRUE); 105 105 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_table_varlength.c
r18264 r27295 4 4 int gfits_varlength_column_define (FTable *ftable, VarLengthColumn *def, int column) { 5 5 6 int i, Nv, Nb; 6 int i; 7 int Nv, Nb; 7 8 char *p1, *p2, *p3; 8 9 char field[81]; … … 32 33 // now p1 must be 'P'; 33 34 if (*p1 == 0) return (FALSE); 34 if (*p1 != 'P') return (FALSE); 35 if ((*p1 != 'P') && (*p1 != 'Q')) return (FALSE); 36 def->mode = *p1; 35 37 36 38 // next value is the actual varlength column format … … 61 63 } 62 64 63 if (!gfits_scan (ftable->header, "THEAP", "%d", 1, &def->heap_start)) { 65 // heap_start must be long long so file may be very large 66 if (!gfits_scan (ftable->header, "THEAP", "%lld", 1, &def->heap_start)) { 64 67 def->heap_start = ftable->header->Naxis[0]*ftable->header->Naxis[1]; 65 68 } … … 68 71 } 69 72 70 void *gfits_varlength_column_pointer (FTable *ftable, VarLengthColumn *column, int row, int *length) { 73 // return the data and length for row 'row' of a variable length column 74 // is this capable of handling large files (value holding length and offset is an int)? 75 void *gfits_varlength_column_pointer (FTable *ftable, VarLengthColumn *column, off_t row, off_t *length) { 71 76 72 77 void *result; 73 int offset, Nx, *ptr; 78 off_t offset, Nx; 79 80 if ((column->mode != 'P') && (column->mode != 'Q')) abort(); 74 81 75 82 // find the values for the specified row … … 89 96 # endif 90 97 91 ptr = (int *) &ftable->buffer[row*Nx + column->Nstart]; 92 *length = ptr[0]; 93 offset = ptr[1]; 98 if (column->mode == 'P') { 99 int *ptr; 100 ptr = (int *) &ftable->buffer[row*Nx + column->Nstart]; 101 *length = ptr[0]; 102 offset = ptr[1]; 103 } 104 if (column->mode == 'Q') { 105 off_t *ptr; 106 ptr = (off_t *) &ftable->buffer[row*Nx + column->Nstart]; 107 *length = ptr[0]; 108 offset = ptr[1]; 109 } 94 110 95 111 result = (void *) (ftable->buffer + column->heap_start + offset); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_write_T.c
r15743 r27295 13 13 if (f == (FILE *) NULL) return (FALSE); 14 14 15 status = fseek (f, 0, SEEK_END); /* write table to end of file! */15 status = fseeko (f, 0LL, SEEK_END); /* write table to end of file! */ 16 16 status = gfits_fwrite_table (f, table); 17 17 … … 23 23 int gfits_fwrite_table (FILE *f, FTable *table) { 24 24 25 int Nbytes;25 off_t Nbytes; 26 26 27 Nbytes = fwrite (table[0].buffer, sizeof(char), table[0]. size, f);27 Nbytes = fwrite (table[0].buffer, sizeof(char), table[0].datasize, f); 28 28 29 if (Nbytes != table[0]. size) return (FALSE);29 if (Nbytes != table[0].datasize) return (FALSE); 30 30 return (TRUE); 31 31 } … … 34 34 int gfits_fwrite_vtable (FILE *f, VTable *table) { 35 35 36 int i, Nx, Ny, Npad, offset, start;37 int Nbytes, *row, Nrow;36 off_t i, Nx, Ny, Npad, offset, start; 37 off_t Nbytes, *row, Nrow; 38 38 char *pad; 39 39 40 40 Nrow = table[0].Nrow; 41 41 row = table[0].row; 42 gfits_scan (table[0].header, "NAXIS1", "% d", 1, &Nx);43 gfits_scan (table[0].header, "NAXIS2", "% d", 1, &Ny);42 gfits_scan (table[0].header, "NAXIS1", "%lld", 1, &Nx); 43 gfits_scan (table[0].header, "NAXIS2", "%lld", 1, &Ny); 44 44 45 45 /* file pointer is at beginning of desired table data */ 46 start = ftell (f);46 start = ftello (f); 47 47 48 48 for (i = 0; i < Nrow; i++) { 49 49 offset = start + Nx*row[i]; 50 fseek (f, offset, SEEK_SET);50 fseeko (f, offset, SEEK_SET); 51 51 Nbytes = fwrite (table[0].buffer[i], sizeof (char), Nx, f); 52 52 if (Nbytes != Nx) { return (FALSE); } 53 53 } 54 54 55 Npad = table[0]. size - Nx*Ny;55 Npad = table[0].datasize - Nx*Ny; 56 56 ALLOCATE (pad, char, Npad); 57 57 bzero (pad, Npad); 58 58 59 59 offset = start + Nx*Ny; 60 fseek (f, offset, SEEK_SET);60 fseeko (f, offset, SEEK_SET); 61 61 Nbytes = fwrite (pad, sizeof (char), Npad, f); 62 62 if (Nbytes != Npad) { return (FALSE); } … … 71 71 72 72 /*********************** fits read ftable data ***********************************/ 73 int gfits_fwrite_ftable_range (FILE *f, FTable *ftable, int start, int Nrows, int Ndisk, int Ntotal) {73 int gfits_fwrite_ftable_range (FILE *f, FTable *ftable, off_t start, off_t Nrows, off_t Ndisk, off_t Ntotal) { 74 74 75 int Nbytes, Nwrite, Nskip, Nx, Npad;75 off_t Nbytes, Nwrite, Nskip, Nx, Npad; 76 76 char *pad; 77 77 … … 79 79 80 80 /* modify vtable to represent full disk table */ 81 gfits_modify (ftable[0].header, "NAXIS2", "% d", 1, Ntotal);81 gfits_modify (ftable[0].header, "NAXIS2", "%lld", 1, Ntotal); 82 82 ftable[0].header[0].Naxis[1] = Ntotal; 83 83 84 84 Nx = ftable[0].header[0].Naxis[0]; // final output table size on disk 85 ftable[0]. size = gfits_data_size (ftable[0].header);85 ftable[0].datasize = gfits_data_size (ftable[0].header); 86 86 87 87 Nskip = start * Nx; … … 95 95 96 96 // cursor must be at start of the table (after table header) 97 fseek (f, Nskip, SEEK_CUR);97 fseeko (f, Nskip, SEEK_CUR); 98 98 Nwrite = fwrite (ftable[0].buffer, sizeof (char), Nbytes, f); 99 99 if (Nwrite != Nbytes) { … … 102 102 103 103 if (Ntotal >= Ndisk) { 104 Npad = ftable[0]. size - Nx*Ntotal;104 Npad = ftable[0].datasize - Nx*Ntotal; 105 105 ALLOCATE (pad, char, Npad); 106 106 bzero (pad, Npad); -
branches/eam_branches/largefiles.20100314/Ohana/src/libfits/table/F_write_TH.c
r7054 r27295 13 13 if (f == (FILE *) NULL) return (FALSE); 14 14 15 status = fseek (f, 0, SEEK_END); /* write header to end of file! */15 status = fseeko (f, 0LL, SEEK_END); /* write header to end of file! */ 16 16 status = gfits_fwrite_Theader (f, header); 17 17 … … 23 23 int gfits_fwrite_Theader (FILE *f, Header *header) { 24 24 25 int Nbytes;25 off_t Nbytes; 26 26 27 Nbytes = fwrite (header[0].buffer, sizeof(char), header[0]. size, f);27 Nbytes = fwrite (header[0].buffer, sizeof(char), header[0].datasize, f); 28 28 29 if (Nbytes != header[0]. size) return (FALSE);29 if (Nbytes != header[0].datasize) return (FALSE); 30 30 return (TRUE); 31 31 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libohana/src/CommOps.c
r26996 r27295 103 103 int SendMessageFixed (int device, int length, char *message) { 104 104 105 int status;106 105 int Nbytes, Nsent; 107 106 struct timespec request, remain; -
branches/eam_branches/largefiles.20100314/Ohana/src/libohana/src/Fread.c
r5851 r27295 1 1 # include <ohana.h> 2 2 3 int ByteSwap (char *ptr, int size, int nitems, char *type);3 static int ByteSwap (char *ptr, off_t size, off_t nitems, char *type); 4 4 5 5 # define BYTE_EXCHANGE(X,Y) tmp = byte[X]; byte[X] = byte[Y]; byte[Y] = tmp; … … 30 30 /* add other architectures here, ie dec, alpha, etc */ 31 31 32 int Fread (void *ptr, int size, int nitems, FILE *f, char *type) {32 off_t Fread (void *ptr, off_t size, off_t nitems, FILE *f, char *type) { 33 33 34 int valid, status; 34 int valid; 35 off_t status; 35 36 36 37 status = fread (ptr, size, nitems, f); … … 42 43 } 43 44 44 int Fwrite (void *ptr, int size, int nitems, FILE *f, char *type) {45 off_t Fwrite (void *ptr, off_t size, off_t nitems, FILE *f, char *type) { 45 46 46 int valid, status; 47 int valid; 48 off_t status; 47 49 48 50 valid = ByteSwap (ptr, size, nitems, type); … … 54 56 } 55 57 56 int ByteSwap (char *ptr, int size, int nitems, char *type) {58 static int ByteSwap (char *ptr, off_t size, off_t nitems, char *type) { 57 59 58 60 # ifdef BYTE_SWAP 59 61 60 int i;62 off_t i; 61 63 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp; 62 64 … … 116 118 } 117 119 118 # if (0) /** now in autocode **/119 if (!strcmp (type, "regimage")) {120 if (size != REGIMAGE_SIZE) {121 fprintf (stderr, "mismatch in type sizes (RegImage) %d vs %d\n", size, REGIMAGE_SIZE);122 return (FALSE);123 }124 byte = (unsigned char *)ptr;125 for (i = 0; i < nitems; i++, byte += REGIMAGE_SIZE) {126 SWAP_WORD (284); /* exptime */127 SWAP_WORD (288); /* airmass */128 SWAP_WORD (292); /* sky */129 SWAP_WORD (296); /* bias */130 SWAP_WORD (300); /* fwhm */131 SWAP_WORD (304); /* telfocus */132 SWAP_WORD (308); /* xprobe */133 SWAP_WORD (312); /* yprobe */134 SWAP_WORD (316); /* zprobe */135 SWAP_WORD (320); /* dettemp */136 SWAP_WORD (324); /* teltemp[0] */137 SWAP_WORD (328); /* teltemp[1] */138 SWAP_WORD (332); /* teltemp[2] */139 SWAP_WORD (336); /* teltemp[3] */140 SWAP_WORD (340); /* rotangle */141 SWAP_WORD (344); /* ra */142 SWAP_WORD (348); /* dec */143 SWAP_WORD (352); /* obstime */144 SWAP_WORD (356); /* regtime */145 }146 return (TRUE);147 }148 149 if (!strcmp (type, "detreg")) {150 if (size != DETREG_SIZE) {151 fprintf (stderr, "mismatch in type sizes (DetReg) %d vs %d\n", size, DETREG_SIZE);152 return (FALSE);153 }154 byte = (unsigned char *)ptr;155 for (i = 0; i < nitems; i++, byte += DETREG_SIZE) {156 SWAP_WORD (0); /* tstart */157 SWAP_WORD (4); /* tstop */158 SWAP_WORD (8); /* treg */159 SWAP_WORD (12); /* exptime */160 SWAP_WORD (16); /* type */161 SWAP_WORD (20); /* filter */162 SWAP_WORD (24); /* ccd */163 SWAP_WORD (28); /* Nentry */164 SWAP_WORD (32); /* Norder */165 }166 return (TRUE);167 }168 169 if (!strcmp (type, "photpars")) {170 if (size != PHOTPARS_SIZE) {171 fprintf (stderr, "mismatch in type sizes (PhotPars) %d vs %d\n", size, PHOTPARS_SIZE);172 return (FALSE);173 }174 byte = (unsigned char *)ptr;175 for (i = 0; i < nitems; i++, byte += PHOTPARS_SIZE) {176 SWAP_WORD (0); /* ZP */177 SWAP_WORD (4); /* ZPo */178 SWAP_WORD (8); /* dZP */179 SWAP_WORD (12); /* K */180 SWAP_WORD (16); /* A */181 SWAP_WORD (20); /* tstart */182 SWAP_WORD (24); /* tstop */183 SWAP_BYTE (28); /* c1 */184 SWAP_BYTE (30); /* c2 */185 SWAP_BYTE (32); /* photcode */186 SWAP_WORD (100); /* Ntime */187 SWAP_WORD (104); /* Nmeas */188 }189 return (TRUE);190 }191 192 if (!strcmp (type, "missing")) {193 if (size != MISSING_SIZE) {194 fprintf (stderr, "mismatch in type sizes (Missing) %d vs %d\n", size, MISSING_SIZE);195 return (FALSE);196 }197 byte0 = (unsigned char *)ptr;198 byte1 = (unsigned char *)ptr + 1;199 byte2 = (unsigned char *)ptr + 2;200 byte3 = (unsigned char *)ptr + 3;201 for (i = 0; i < nitems; i++, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {202 tmp = *byte0;203 *byte0 = *byte3;204 *byte3 = tmp;205 tmp = *byte1;206 *byte1 = *byte2;207 *byte2 = tmp;208 }209 return (TRUE);210 }211 212 if (!strcmp (type, "secfilt")) {213 if (size != SECFILT_SIZE) {214 fprintf (stderr, "mismatch in type sizes (SecFilt) %d vs %d\n", size, SECFILT_SIZE);215 return (FALSE);216 }217 byte = (unsigned char *) ptr;218 for (i = 0; i < nitems; i++, byte += SECFILT_SIZE) {219 SWAP_BYTE (0); /* M */220 SWAP_BYTE (2); /* Xm */221 SWAP_BYTE (4); /* dM */222 }223 return (TRUE);224 }225 226 if (!strcmp (type, "spectrum")) {227 if (size != SPECTRUM_SIZE) {228 fprintf (stderr, "mismatch in type sizes (Spectrum) %d vs %d\n", size, SPECTRUM_SIZE);229 return (FALSE);230 }231 byte = (unsigned char *)ptr;232 for (i = 0; i < nitems; i++, byte += SPECTRUM_SIZE) {233 SWAP_WORD (0); /* ra */234 SWAP_WORD (4); /* dec */235 SWAP_WORD (8); /* exptime */236 SWAP_WORD (12); /* airmass */237 SWAP_WORD (16); /* Ws */238 SWAP_WORD (20); /* We */239 SWAP_WORD (24); /* dW */240 SWAP_WORD (28); /* Nspec */241 SWAP_WORD (32); /* obstime */242 SWAP_WORD (36); /* regtime */243 }244 return (TRUE);245 }246 247 if (!strcmp (type, "image")) {248 if (size != IMAGE_SIZE) {249 fprintf (stderr, "mismatch in type sizes (Image) %d vs %d\n", size, IMAGE_SIZE);250 return (FALSE);251 }252 byte = (unsigned char *)ptr;253 for (i = 0; i < nitems; i++, byte += IMAGE_SIZE) {254 SWAP_DBLE (0); /* coords.crval1 */255 SWAP_DBLE (8); /* coords.crval2 */256 for (j = 16; j < 104; j+=4) { /* coords.crpix, delt, pc_ij, polyterms[7][2] */257 SWAP_WORD (j);258 }259 SWAP_WORD (120); /* tzero */260 SWAP_WORD (124); /* nstar */261 for (j = 128; j < 146; j+=2) { /* sec z, NX, NY, apmifit, dapmifit, source, Mcal, dMcal, Xm */262 SWAP_BYTE (j);263 }264 SWAP_WORD (184); /* exptime */265 SWAP_WORD (210); /* order */266 /**** this (210) is an error! (don't fix, replaced with autocode) ****/267 for (j = 212; j < 240; j+=2) {268 SWAP_BYTE (j); /* Mx - Myyy */269 }270 }271 return (TRUE);272 }273 274 # if (PANSTARRS)275 if (!strcmp (type, "average")) {276 if (size != AVERAGE_SIZE) {277 fprintf (stderr, "mismatch in type sizes (Average) %d vs %d\n", size, AVERAGE_SIZE);278 return (FALSE);279 }280 byte = (unsigned char *)ptr;281 for (i = 0; i < nitems; i++, byte += AVERAGE_SIZE) {282 SWAP_DBLE (0); /* R */283 SWAP_DBLE (8); /* D */284 SWAP_BYTE (16); /* M */285 SWAP_BYTE (18); /* Nm */286 SWAP_BYTE (20); /* Nn */287 SWAP_BYTE (22); /* Xp */288 SWAP_BYTE (24); /* Xm */289 SWAP_BYTE (26); /* code */290 SWAP_WORD (28); /* offset */291 SWAP_WORD (32); /* missing */292 SWAP_BYTE (36); /* dM */293 SWAP_BYTE (38); /* Xg */294 }295 return (TRUE);296 }297 if (!strcmp (type, "measure")) {298 if (size != MEASURE_SIZE) {299 fprintf (stderr, "mismatch in type sizes (Measure) %d vs %d\n", size, MEASURE_SIZE);300 return (FALSE);301 }302 byte = (unsigned char *)ptr;303 for (i = 0; i < nitems; i++, byte += MEASURE_SIZE) {304 SWAP_BYTE (0); /* dR */305 SWAP_BYTE (2); /* dD */306 SWAP_BYTE (4); /* M */307 SWAP_BYTE (6); /* Mcal */308 SWAP_BYTE (8); /* Mgal */309 SWAP_BYTE (10); /* Map */310 SWAP_BYTE (12); /* FWx */311 /* 14, 15, 16, 17 - char */312 SWAP_BYTE (18); /* source */313 SWAP_WORD (20); /* t */314 SWAP_WORD (24); /* averef */315 SWAP_BYTE (28); /* dt */316 SWAP_BYTE (30); /* flags */317 }318 return (TRUE);319 }320 321 # endif /** PANSTARRS **/322 323 324 # if (ELIXIR)325 if (!strcmp (type, "average")) {326 if (size != AVERAGE_SIZE) {327 fprintf (stderr, "mismatch in type sizes (Average) %d vs %d\n", size, AVERAGE_SIZE);328 return (FALSE);329 }330 byte = (unsigned char *)ptr;331 for (i = 0; i < nitems; i++, byte += AVERAGE_SIZE) {332 SWAP_WORD (0); /* R */333 SWAP_WORD (4); /* D */334 SWAP_BYTE (8); /* M */335 SWAP_BYTE (10); /* Nm */336 SWAP_BYTE (12); /* Nn */337 SWAP_BYTE (14); /* Xp */338 SWAP_BYTE (16); /* Xm */339 SWAP_BYTE (18); /* code */340 SWAP_WORD (20); /* offset */341 SWAP_WORD (24); /* missing */342 SWAP_BYTE (28); /* dM */343 SWAP_BYTE (30); /* Xg */344 }345 return (TRUE);346 }347 if (!strcmp (type, "measure")) {348 if (size != MEASURE_SIZE) {349 fprintf (stderr, "mismatch in type sizes (Measure) %d vs %d\n", size, MEASURE_SIZE);350 return (FALSE);351 }352 byte = (unsigned char *)ptr;353 for (i = 0; i < nitems; i++, byte += MEASURE_SIZE) {354 SWAP_BYTE (0); /* dR */355 SWAP_BYTE (2); /* dD */356 SWAP_BYTE (4); /* M */357 SWAP_BYTE (6); /* Mcal */358 SWAP_BYTE (8); /* Mgal */359 SWAP_BYTE (10); /* Map */360 SWAP_BYTE (12); /* FWx */361 /* 14, 15, 16, 17 - char */362 SWAP_BYTE (18); /* source */363 SWAP_WORD (20); /* t */364 SWAP_WORD (24); /* averef */365 SWAP_BYTE (28); /* dt */366 SWAP_BYTE (30); /* flags */367 }368 return (TRUE);369 }370 371 # endif /** ELIXIR **/372 373 374 # if (LONEOS)375 if (!strcmp (type, "average")) {376 if (size != OLDAVERAGE_SIZE) {377 fprintf (stderr, "mismatch in type sizes (OldAverage) %d vs %d\n", size, OLDAVERAGE_SIZE);378 return (FALSE);379 }380 byte = (unsigned char *)ptr;381 for (i = 0; i < nitems; i++, byte += OLDAVERAGE_SIZE) {382 SWAP_WORD (0); /* R */383 SWAP_WORD (4); /* D */384 SWAP_BYTE (8); /* M */385 SWAP_BYTE (10); /* Nm */386 SWAP_BYTE (12); /* Nn */387 SWAP_BYTE (14); /* Xp */388 SWAP_BYTE (16); /* Xm */389 SWAP_BYTE (18); /* code */390 SWAP_WORD (20); /* offset */391 SWAP_WORD (24); /* missing */392 }393 return (TRUE);394 }395 if (!strcmp (type, "measure")) {396 if (size != OLDMEASURE_SIZE) {397 fprintf (stderr, "mismatch in type sizes (OldMeasure) %d vs %d\n", size, OLDMEASURE_SIZE);398 return (FALSE);399 }400 byte = (unsigned char *)ptr;401 for (i = 0; i < nitems; i++, byte += OLDMEASURE_SIZE) {402 SWAP_BYTE (0); /* dR */403 SWAP_BYTE (2); /* dD */404 SWAP_BYTE (4); /* M */405 SWAP_BYTE (6); /* Mcal */406 SWAP_BYTE (10); /* source */407 SWAP_WORD (12); /* t */408 SWAP_WORD (16); /* average */409 }410 return (TRUE);411 }412 # endif /** LONEOS **/413 414 # if (0) /*** others ***/415 if (!strcmp (type, "oldsecfilt")) {416 if (size != OLDSECFILT_SIZE) {417 fprintf (stderr, "mismatch in type sizes (OldSecFilt) %d vs %d\n", size, OLDSECFILT_SIZE);418 return (FALSE);419 }420 byte = (unsigned char *) ptr;421 for (i = 0; i < nitems; i++, byte += OLDSECFILT_SIZE) {422 SWAP_BYTE (0); /* M */423 SWAP_BYTE (2); /* Xm */424 }425 return (TRUE);426 }427 if (!strcmp (type, "rufimage")) {428 if (size != RUFIMAGE_SIZE) {429 fprintf (stderr, "mismatch in type sizes (RufImage) %d vs %d\n", size, RUFIMAGE_SIZE);430 return (FALSE);431 }432 byte = (unsigned char *)ptr;433 for (i = 0; i < nitems; i++, byte += RUFIMAGE_SIZE) {434 SWAP_WORD (0); /* sky */435 SWAP_WORD (4); /* bias */436 SWAP_WORD (8); /* fwhm */437 SWAP_WORD (12); /* exptime */438 SWAP_WORD (16); /* airmass */439 SWAP_WORD (20); /* obstime */440 SWAP_BYTE (24); /* ccdnum */441 }442 return (TRUE);443 }444 if (!strcmp (type, "olddetreg")) {445 if (size != OLDDETREG_SIZE) {446 fprintf (stderr, "mismatch in type sizes (DetReg) %d vs %d\n", size, OLDDETREG_SIZE);447 return (FALSE);448 }449 byte = (unsigned char *)ptr;450 for (i = 0; i < nitems; i++, byte += OLDDETREG_SIZE) {451 SWAP_WORD (0); /* tstart */452 SWAP_WORD (4); /* tstop */453 SWAP_WORD (8); /* treg */454 SWAP_WORD (12); /* sigma */455 SWAP_WORD (16); /* clipsigma */456 SWAP_WORD (20); /* type */457 SWAP_WORD (24); /* filter */458 SWAP_WORD (28); /* ccd */459 }460 return (TRUE);461 }462 # endif /** others **/463 # endif /** now in autocode **/464 465 120 fprintf (stderr, "unknown type %s\n", type); 466 121 return (FALSE); -
branches/eam_branches/largefiles.20100314/Ohana/src/libohana/src/findexec.c
r25757 r27295 391 391 392 392 /* fseek with timeout - 0.5 sec */ 393 int Fseek (FILE *f, longoffset, int whence) {393 int Fseek (FILE *f, off_t offset, int whence) { 394 394 395 395 int status, k; 396 396 397 status = fseek (f, offset, whence);397 status = fseeko (f, offset, whence); 398 398 if (status == -1) { 399 for (k = 0; (k < 10) && ((status = fseek (f, 0, SEEK_SET)) == -1); k++) usleep (50000);399 for (k = 0; (k < 10) && ((status = fseeko (f, 0, SEEK_SET)) == -1); k++) usleep (50000); 400 400 if (status == -1) { 401 return (0);402 } 403 } 404 return (1);405 } 401 return FALSE; 402 } 403 } 404 return TRUE; 405 } -
branches/eam_branches/largefiles.20100314/Ohana/src/libohana/src/glockfile.c
r4717 r27295 117 117 if (type == LCK_HARD) { 118 118 /* we've really got the lock, write BUSY to protect it */ 119 fseek (flock, 0, SEEK_SET);119 fseeko (flock, 0LL, SEEK_SET); 120 120 nbytes = fprintf (flock, "BUSY\n"); 121 121 … … 212 212 213 213 /* set value to IDLE */ 214 fseek (flock, 0, SEEK_SET);214 fseeko (flock, 0LL, SEEK_SET); 215 215 nbytes = fprintf (flock, "IDLE\n"); 216 216 if (nbytes != 5) { -
branches/eam_branches/largefiles.20100314/Ohana/src/lightcurve/src/fix_header.c
r7080 r27295 7 7 */ 8 8 9 void 10 fix_header 11 (Header *header) 9 void fix_header (Header *header) 12 10 { 13 11 … … 15 13 char *p1, *p2; 16 14 17 Nbytes = 2880 * (int) (header[0]. size / 2880 + 1);15 Nbytes = 2880 * (int) (header[0].datasize / 2880 + 1); 18 16 reallocate (header[0].buffer, char, Nbytes); 19 bzero (&header[0].buffer[header[0]. size], Nbytes - header[0].size - 1);17 bzero (&header[0].buffer[header[0].datasize], Nbytes - header[0].datasize - 1); 20 18 21 19 p1 = header[0].buffer - 1; … … 24 22 while (p2 != NULL) { 25 23 if ((N = p2 - p1) != 80) { 26 bcopy (p2, p1 + 80, header[0]. size - (p2 - header[0].buffer));24 bcopy (p2, p1 + 80, header[0].datasize - (p2 - header[0].buffer)); 27 25 for (i = 0; i < 80 - N; i++) { 28 26 *(p2 + i) = ' '; 29 27 } 30 header[0]. size += 80 - N;28 header[0].datasize += 80 - N; 31 29 } 32 30 p1 = strchr (p1 + 1, RETURN); … … 34 32 } 35 33 36 header[0]. size = Nbytes;34 header[0].datasize = Nbytes; 37 35 p1 = gfits_header_field (header, "END", 1); 38 36 for (i = 3; i < 79; i++) … … 40 38 *(p1 + 79) = RETURN; 41 39 42 Nbytes = header[0]. size - (p1 - header[0].buffer) - 80;40 Nbytes = header[0].datasize - (p1 - header[0].buffer) - 80; 43 41 44 42 for (i = 0; i < Nbytes; i++) { … … 48 46 } 49 47 50 Nbytes = header[0]. size - (p1 - header[0].buffer) - 80;48 Nbytes = header[0].datasize - (p1 - header[0].buffer) - 80; 51 49 while (Nbytes >= 2880) { 52 header[0]. size -= 2880;53 Nbytes = header[0]. size - (p1 - header[0].buffer) - 80;50 header[0].datasize -= 2880; 51 Nbytes = header[0].datasize - (p1 - header[0].buffer) - 80; 54 52 } 55 53 56 reallocate (header[0].buffer, char, header[0]. size);54 reallocate (header[0].buffer, char, header[0].datasize); 57 55 } 58 56 -
branches/eam_branches/largefiles.20100314/Ohana/src/markrock/src/find_bright_stars.c
r16040 r27295 3 3 void find_bright_stars (Catalog *catalog, CatStats *catstats) { 4 4 5 int i, j, n, m, first_j, Nave, Ngsc, Nmark;5 off_t i, j, n, m, first_j, Nave, Ngsc, Nmark; 6 6 Catalog GSCdata; 7 7 double MinRA, MinDEC, MaxRA, MaxDEC, RaCenter, DecCenter; 8 8 Coords *tcoords; 9 9 double *X1, *Y1, *X2, *Y2; 10 int *N1, *N2;10 off_t *N1, *N2; 11 11 char *mark; 12 12 double dX, dY, dR, MaxDist, MaxDist1, MaxRadius, radius, radius2; … … 24 24 ALLOCATE (X1, double, Ngsc); 25 25 ALLOCATE (Y1, double, Ngsc); 26 ALLOCATE (N1, int, Ngsc);26 ALLOCATE (N1, off_t, Ngsc); 27 27 ALLOCATE (mark, char, Nave); 28 28 bzero (mark, Nave); -
branches/eam_branches/largefiles.20100314/Ohana/src/markrock/src/gcatstats.c
r16040 r27295 6 6 { 7 7 8 int i;8 off_t i; 9 9 double RaCenter, DecCenter; 10 10 double MinRA, MaxRA, MinDEC, MaxDEC; 11 11 double *X1, *Y1; 12 int *N1;13 12 Coords tcoords; 14 13 … … 31 30 ALLOCATE (catstats[0].X, double, catalog[0].Naverage); 32 31 ALLOCATE (catstats[0].Y, double, catalog[0].Naverage); 33 ALLOCATE (catstats[0].N, int, catalog[0].Naverage);32 ALLOCATE (catstats[0].N, off_t, catalog[0].Naverage); 34 33 35 34 /* project onto rectilinear grid with 1 arcsec pixels, sort by X */ -
branches/eam_branches/largefiles.20100314/Ohana/src/markrock/src/wrocks.c
r2490 r27295 16 16 } 17 17 /* position to begining of file to write header */ 18 fseek (f, 0, SEEK_END);18 fseeko (f, 0, SEEK_END); 19 19 20 20 /* get statistics on rocks */ -
branches/eam_branches/largefiles.20100314/Ohana/src/markstar/src/find_bright_stars.c
r16040 r27295 3 3 void find_bright_stars (Catalog *catalog, CatStats *catstats) { 4 4 5 int i, j, n, m, first_j, Nave, Ngsc;5 off_t i, j, n, m, first_j, Nave, Ngsc; 6 6 Catalog GSCdata; 7 7 double MinRA, MinDEC, MaxRA, MaxDEC, RaCenter, DecCenter; 8 8 Coords *tcoords; 9 9 double *X1, *Y1, *X2, *Y2; 10 int *N1, *N2;10 off_t *N1, *N2; 11 11 char *mark; 12 12 double dX, dY, dR, MaxDist, MaxDist1, MaxRadius, radius, radius2; … … 25 25 ALLOCATE (X1, double, Ngsc); 26 26 ALLOCATE (Y1, double, Ngsc); 27 ALLOCATE (N1, int, Ngsc);27 ALLOCATE (N1, off_t, Ngsc); 28 28 ALLOCATE (mark, char, Nave); 29 29 bzero (mark, Nave); -
branches/eam_branches/largefiles.20100314/Ohana/src/markstar/src/find_matches.c
r16040 r27295 7 7 double *X1, *Y1, *X2, *Y2; 8 8 double dX, dY, dR; 9 int *N1, *N2;9 off_t *N1, *N2; 10 10 int Nstar, Nghost, Ng; 11 11 unsigned int flags; … … 25 25 ALLOCATE (X1, double, Nghost); 26 26 ALLOCATE (Y1, double, Nghost); 27 ALLOCATE (N1, int, Nghost);27 ALLOCATE (N1, off_t, Nghost); 28 28 29 29 /* project ghosts to the frame of the catalog */ -
branches/eam_branches/largefiles.20100314/Ohana/src/markstar/src/gcatstats.c
r16040 r27295 3 3 void gcatstats (Catalog *catalog, CatStats *catstats) { 4 4 5 int i;5 off_t i; 6 6 double RaCenter, DecCenter; 7 7 double MinRA, MaxRA, MinDEC, MaxDEC; 8 8 double *X1, *Y1; 9 int *N1;10 9 Coords tcoords; 11 10 … … 41 40 ALLOCATE (catstats[0].X, double, catalog[0].Naverage); 42 41 ALLOCATE (catstats[0].Y, double, catalog[0].Naverage); 43 ALLOCATE (catstats[0].N, int,catalog[0].Naverage);42 ALLOCATE (catstats[0].N, off_t, catalog[0].Naverage); 44 43 45 44 /* project onto rectilinear grid with 1 arcsec pixels, sort by X */ -
branches/eam_branches/largefiles.20100314/Ohana/src/misc/src/addastro.c
r7080 r27295 6 6 /* USAGE: addastro (cmp) (ref) */ 7 7 8 int i, j, nbytes, itmp, oldsize; 8 off_t nbytes, oldsize; 9 int i, j, itmp; 9 10 double tmp; 10 11 Header header, refhead; … … 22 23 exit (1); 23 24 } 24 oldsize = header. size;25 oldsize = header.datasize; 25 26 26 27 if (!gfits_read_header (argv[2], &refhead)) { … … 72 73 exit (1); 73 74 } 74 nbytes = fwrite (header.buffer, 1, header. size, g);75 fseek (g, header.size, SEEK_SET);75 nbytes = fwrite (header.buffer, 1, header.datasize, g); 76 fseeko (g, header.datasize, SEEK_SET); 76 77 77 78 /* read date from file */ -
branches/eam_branches/largefiles.20100314/Ohana/src/misc/src/applyscat.c
r21537 r27295 14 14 Matrix matrix; 15 15 Stars *stars; 16 int Nstar, Nbytes, nbytes; 16 int Nstar; 17 off_t Nbytes, nbytes; 17 18 FILE *f; 18 19 char *buffer, line[10]; … … 37 38 exit (1); 38 39 } 39 fseek (f, header.size, SEEK_SET);40 fseeko (f, header.datasize, SEEK_SET); 40 41 41 42 /* find expected number of stars */ … … 110 111 exit (1); 111 112 } 112 fseek (f, header.size, SEEK_SET);113 fseeko (f, header.datasize, SEEK_SET); 113 114 114 115 /* load in data */ -
branches/eam_branches/largefiles.20100314/Ohana/src/misc/src/fakecmp.c
r7080 r27295 4 4 void main (int argc, char **argv) { 5 5 6 int i, j, N, status; 7 int Nreserved, start_size; 6 off_t start_size, status; 7 int i, j, N; 8 int Nreserved; 8 9 char *p, keyword[16], line[256]; 9 10 FILE *f; … … 69 70 exit (1); 70 71 } 71 start_size = header. size;72 start_size = header.datasize; 72 73 73 74 /* run through the lines in the header data file */ … … 94 95 p = (char *) NULL; 95 96 Nreserved = strlen (reserved); 96 for (i = 0; (i < header. size) && (p == (char *) NULL) ; i+= FT_LINE_LENGTH) {97 for (i = 0; (i < header.datasize) && (p == (char *) NULL) ; i+= FT_LINE_LENGTH) { 97 98 if (!strncmp (&header.buffer[i], reserved, Nreserved)) { 98 99 p = &header.buffer[i]; … … 114 115 */ 115 116 116 if (header. size != start_size) {117 if (header.datasize != start_size) { 117 118 fprintf (stderr, "header changed size: should not happen!\n"); 118 119 exit (1); … … 125 126 } 126 127 127 fseek (f, 0, SEEK_SET);128 status = fwrite (header.buffer, 1, header. size, f);129 if (status != header. size) {128 fseeko (f, 0, SEEK_SET); 129 status = fwrite (header.buffer, 1, header.datasize, f); 130 if (status != header.datasize) { 130 131 fprintf (stderr, "failed to write data to image header\n"); 131 132 exit (1); -
branches/eam_branches/largefiles.20100314/Ohana/src/misc/src/fakestars.c
r7080 r27295 57 57 exit (1); 58 58 } 59 fseek (f, header.size, SEEK_SET);59 fseeko (f, header.datasize, SEEK_SET); 60 60 61 61 /* find expected number of stars */ … … 108 108 exit (1); 109 109 } 110 fseek (f, header.size, SEEK_SET);110 fseeko (f, header.datasize, SEEK_SET); 111 111 112 112 for (i = 0; i < Nstar; i++) { -
branches/eam_branches/largefiles.20100314/Ohana/src/misc/src/fiximg.c
r7080 r27295 31 31 fprintf (stderr, "deleted %d comments\n", N); 32 32 p = gfits_header_field (&header, "END", 1); 33 for (i = 3; i < header. size - (int) (p - header.buffer); i++) {33 for (i = 3; i < header.datasize - (int) (p - header.buffer); i++) { 34 34 p[i] = ' '; 35 35 } -
branches/eam_branches/largefiles.20100314/Ohana/src/misc/src/fixsimple.c
r7080 r27295 26 26 fprintf (stderr, "deleted %d comments\n", N); 27 27 p = gfits_header_field (&header, "END", 1); 28 for (i = 3; i < header. size - (int) (p - header.buffer); i++) {28 for (i = 3; i < header.datasize - (int) (p - header.buffer); i++) { 29 29 p[i] = ' '; 30 30 } … … 47 47 } 48 48 49 fseek (f, skip, SEEK_SET);50 status = fwrite (header.buffer, 1, header. size, f);51 if (status != header. size) {49 fseeko (f, skip, SEEK_SET); 50 status = fwrite (header.buffer, 1, header.datasize, f); 51 if (status != header.datasize) { 52 52 fprintf (stderr, "failed to write data to image header\n"); 53 53 exit (1); -
branches/eam_branches/largefiles.20100314/Ohana/src/misc/src/striphead.c
r7080 r27295 51 51 } 52 52 53 for (j = 79; j < header. size; j+= 80) {53 for (j = 79; j < header.datasize; j+= 80) { 54 54 header.buffer[j] = 10; 55 55 } -
branches/eam_branches/largefiles.20100314/Ohana/src/mosastro/src/getusno.c
r8499 r27295 11 11 StarData *getusno (CatStats *catstats, int *Nstars) { 12 12 13 long int offset;14 int i, bin, first, last, nitems, Nitems,Nbins;13 off_t offset, nitems, Nitems; 14 int i, bin, first, last, Nbins; 15 15 float hours[100]; 16 16 int start[100], number[100], *buffer, *buf; … … 91 91 /* advance file pointer to first slice */ 92 92 offset = 3*sizeof(int)*(start[first] - 1); 93 fseek (f, offset, SEEK_SET);93 fseeko (f, offset, SEEK_SET); 94 94 /* on each loop, load data from an RA slice of the catalog */ 95 95 for (bin = first; bin < last; bin++) { -
branches/eam_branches/largefiles.20100314/Ohana/src/mosastro/src/getusnob.c
r8499 r27295 5 5 StarData *getusnob (CatStats *catstats, int *Nstars) { 6 6 7 long int offset;8 int i, bin, first, last, nitems, Nitems,Nbins;7 off_t offset, nitems, Nitems; 8 int i, bin, first, last, Nbins; 9 9 float hours[100]; 10 10 int start[100], number[100], *buffer, *buf; … … 76 76 /* advance file pointer to first slice */ 77 77 offset = NELEM*NBYTE*(start[first] - 1); 78 fseek (f, offset, SEEK_SET);78 fseeko (f, offset, SEEK_SET); 79 79 80 80 /* sum the number of stars in data segment of interest */ -
branches/eam_branches/largefiles.20100314/Ohana/src/mosastro/src/match.c
r16040 r27295 8 8 double dp, dq, radius, Radius; 9 9 double *p, *q, *P, *Q; 10 int *U, *u;10 off_t *U, *u; 11 11 12 12 /* requested radius is in arcsec ; internally radius is in pixels */ … … 17 17 ALLOCATE (P, double, Nrefcat); 18 18 ALLOCATE (Q, double, Nrefcat); 19 ALLOCATE (U, int, Nrefcat);19 ALLOCATE (U, off_t, Nrefcat); 20 20 for (i = 0; i < Nrefcat; i++) { 21 21 U[i] = i; … … 35 35 ALLOCATE (p, double, chip[i].Nstars); 36 36 ALLOCATE (q, double, chip[i].Nstars); 37 ALLOCATE (u, int,chip[i].Nstars);37 ALLOCATE (u, off_t, chip[i].Nstars); 38 38 for (j = 0; j < chip[i].Nstars; j++) { 39 39 u[j] = j; -
branches/eam_branches/largefiles.20100314/Ohana/src/mosastro/src/output.c
r3466 r27295 41 41 } 42 42 43 fwrite (header[0].buffer, 1, header[0]. size, f);43 fwrite (header[0].buffer, 1, header[0].datasize, f); 44 44 fclose (f); 45 45 } -
branches/eam_branches/largefiles.20100314/Ohana/src/mosastro/src/rfits.c
r7080 r27295 14 14 exit (1); 15 15 } 16 fseek (f, mychip[0].header.size, SEEK_SET);16 fseeko (f, mychip[0].header.datasize, SEEK_SET); 17 17 18 18 /* init & load in table data */ -
branches/eam_branches/largefiles.20100314/Ohana/src/mosastro/src/rtext.c
r7080 r27295 12 12 return (FALSE); 13 13 } 14 fseek (f, mychip[0].header.size, SEEK_SET);14 fseeko (f, mychip[0].header.datasize, SEEK_SET); 15 15 16 16 /* find expected number of stars */ -
branches/eam_branches/largefiles.20100314/Ohana/src/mosastro/src/wstars.c
r3520 r27295 16 16 } 17 17 18 fwrite (data[0].header.buffer, 1, data[0].header. size, g);18 fwrite (data[0].header.buffer, 1, data[0].header.datasize, g); 19 19 fwrite (data[0].buffer, 1, data[0].Nbuffer, g); 20 20 fclose (g); … … 34 34 } 35 35 36 fwrite (header[0].buffer, 1, header[0]. size, g);36 fwrite (header[0].buffer, 1, header[0].datasize, g); 37 37 38 38 for (i = 0; i < Nstars; i++) { -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/cmd.data/rd.c
r20652 r27295 153 153 buf[0].header.Naxes = 0; 154 154 ALLOCATE (buf[0].matrix.buffer, char, 1); 155 buf[0].matrix. size = 0;155 buf[0].matrix.datasize = 0; 156 156 buf[0].bitpix = 16; 157 157 buf[0].bzero = 0; … … 222 222 buf[0].unsign = buf[0].header.unsign; 223 223 224 gprint (GP_LOG, "read % d bytes from %s into buffer %s\n",225 buf[0].header. size + buf[0].matrix.size, argv[2], argv[1]);224 gprint (GP_LOG, "read %lld bytes from %s into buffer %s\n", 225 buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]); 226 226 227 227 blank = 0xffff; -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/cmd.data/rdseg.c
r20652 r27295 62 62 buf[0].bzero = buf[0].header.bzero; /* store the original values */ 63 63 buf[0].unsign = buf[0].header.unsign; 64 gprint (GP_LOG, "read %d bytes from %s into buffer %s\n", 65 buf[0].header.size + buf[0].matrix.size, argv[2], argv[1]); 64 gprint (GP_LOG, "read %d bytes from %s into buffer %s\n", buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]); 66 65 67 66 gfits_scan (&buf[0].header, "BLANK", "%d", 1, &blank); -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/cmd.data/read_vectors.c
r20936 r27295 57 57 return (FALSE); 58 58 } 59 fseek (f, 0, SEEK_SET);59 fseeko (f, 0LL, SEEK_SET); 60 60 61 61 Nvec = (argc - 1) / 2; … … 159 159 int read_table_vectors (int argc, char **argv, char *extname) { 160 160 161 int i, j, k, N, Nbytes, Nextend, Ny, Binary, vecType; 161 off_t Nbytes; 162 int i, j, k, N, Nextend, Ny, Binary, vecType; 162 163 char type[16], ID[80], *CCDKeyword; 163 164 FTable table; … … 184 185 185 186 if (f == NULL) ESCAPE ("file not found"); 186 fseek (f, 0, SEEK_SET);187 fseeko (f, 0LL, SEEK_SET); 187 188 table.header = &header; 188 189 … … 193 194 if (!gfits_load_header (f, &header)) ESCAPE ("error reading primary header for file"); 194 195 Nbytes = gfits_data_size (&header); 195 fseek (f, Nbytes, SEEK_CUR);196 fseeko (f, Nbytes, SEEK_CUR); 196 197 gfits_free_header (&header); 197 198 … … 200 201 Nbytes = gfits_data_size (&header); 201 202 /* skip the prior data buffers */ 202 fseek (f, Nbytes, SEEK_CUR);203 fseeko (f, Nbytes, SEEK_CUR); 203 204 gfits_free_header (&header); 204 205 } … … 215 216 216 217 while (1) { 217 if (!gfits_load_header (f, &header)) ESCAPE ("extensio not found in file");218 if (!gfits_load_header (f, &header)) ESCAPE ("extension not found in file"); 218 219 Nbytes = gfits_data_size (&header); 219 220 220 221 if (!gfits_scan (&header, CCDKeyword, "%s", 1, ID)) { 221 fseek (f, Nbytes, SEEK_CUR);222 fseeko (f, Nbytes, SEEK_CUR); 222 223 gfits_free_header (&header); 223 224 continue; 224 225 } 225 226 if (strcmp (ID, extname)) { 226 fseek (f, Nbytes, SEEK_CUR);227 fseeko (f, Nbytes, SEEK_CUR); 227 228 gfits_free_header (&header); 228 229 continue; -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/cmd.data/wd.c
r20652 r27295 75 75 /* save the (float) version, write out a temporary buffer */ 76 76 temp_matrix = buf[0].matrix; 77 ALLOCATE (temp_matrix.buffer, char, MAX(1, temp_matrix. size));78 memcpy (temp_matrix.buffer, buf[0].matrix.buffer, temp_matrix. size);77 ALLOCATE (temp_matrix.buffer, char, MAX(1, temp_matrix.datasize)); 78 memcpy (temp_matrix.buffer, buf[0].matrix.buffer, temp_matrix.datasize); 79 79 temp_header = buf[0].header; 80 ALLOCATE (temp_header.buffer, char, MAX(1, temp_header. size));81 memcpy (temp_header.buffer, buf[0].header.buffer, temp_header. size);80 ALLOCATE (temp_header.buffer, char, MAX(1, temp_header.datasize)); 81 memcpy (temp_header.buffer, buf[0].header.buffer, temp_header.datasize); 82 82 83 83 if (temp_header.Naxes) { … … 94 94 Header Xhead; 95 95 FILE *f; 96 off_t nbytes; 96 97 int status, Nextend; 97 98 … … 125 126 126 127 /* position to begining of file to write header */ 127 fseek (f, 0, SEEK_SET);128 status = fwrite (Xhead.buffer, 1, Xhead.size, f);129 if ( status != Xhead.size) {128 fseeko (f, 0LL, SEEK_SET); 129 nbytes = fwrite (Xhead.buffer, 1, Xhead.datasize, f); 130 if (nbytes != Xhead.datasize) { 130 131 gprint (GP_ERR, "ERROR: failed writing data to image header\n"); 131 132 status = FALSE; … … 144 145 145 146 /* position to end of file to write new extend */ 146 fseek (f, 0, SEEK_END);147 status = fwrite (temp_header.buffer, 1, temp_header.size, f);147 fseeko (f, 0LL, SEEK_END); 148 nbytes = fwrite (temp_header.buffer, 1, temp_header.datasize, f); 148 149 fclose (f); 149 if ( status != temp_header.size) {150 if (nbytes != temp_header.datasize) { 150 151 gprint (GP_ERR, "failed to write file\n"); 151 152 status = FALSE; -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/aregion.c
r19823 r27295 44 44 NLINES += NDecLines[i]; 45 45 } 46 fseek (f, 5*2880 + 48*NLINES, SEEK_SET);46 fseeko (f, 5*2880 + 48*NLINES, SEEK_SET); 47 47 48 48 done = FALSE; -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/cmpload.c
r13479 r27295 56 56 return (FALSE); 57 57 } 58 fseek (f, header.size, SEEK_SET);58 fseeko (f, header.datasize, SEEK_SET); 59 59 60 60 Noverlay = 0; -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/cmpread.c
r20936 r27295 6 6 int cmpread (int argc, char **argv) { 7 7 8 int i, field, Naxis, Nbytes, Nstars; 8 off_t Nbytes; 9 int i, field, Naxis, Nstars; 9 10 double tR, tD; 10 11 float value; … … 61 62 return (FALSE); 62 63 } 63 fseek (f, header.size, SEEK_SET);64 fseeko (f, header.datasize, SEEK_SET); 64 65 65 66 /* find expected number of stars */ … … 84 85 gprint (GP_ERR, "reading from FITS cmp file %s\n", argv[2]); 85 86 Nbytes = gfits_data_size (&header); 86 fseek (f, Nbytes, SEEK_CUR);87 fseeko (f, Nbytes, SEEK_CUR); 87 88 stars = cmpReadFits (f, &Nstars); 88 89 } -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/detrend.c
r20936 r27295 133 133 return (FALSE); 134 134 } 135 fseek (f, header.size, SEEK_SET);135 fseeko (f, header.datasize, SEEK_SET); 136 136 137 137 /* load existing data from database */ -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/elixir.c
r7917 r27295 73 73 74 74 /* write message to end of file */ 75 fseek (f, 0, SEEK_END);75 fseeko (f, 0LL, SEEK_END); 76 76 fprintf (f, "%s\n", message); 77 77 -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/find_regions.c
r19823 r27295 13 13 double RA0, RA1, DEC0, DEC1; 14 14 int i, j, NBigDec; 15 int NLINES, done, NREGIONS, nregion; 15 int done, NREGIONS, nregion; 16 off_t NLINES; 16 17 17 18 VarConfig ("GSCFILE", "%s", filename); … … 91 92 NLINES += NDecLines[i]; 92 93 } 93 fseek (f, 5*2880 + 48*NLINES, SEEK_SET);94 fseeko (f, 5*2880 + 48*NLINES, SEEK_SET); 94 95 95 96 /* should be in this section. if not, there is a problem counting... */ … … 140 141 NLINES += NDecLines[i]; 141 142 } 142 fseek (f, 5*2880 + 48*NLINES, SEEK_SET);143 fseeko (f, 5*2880 + 48*NLINES, SEEK_SET); 143 144 done = FALSE; 144 145 j = 12; -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/gstar.c
r23664 r27295 11 11 double Mcat, Mrel; 12 12 double *RA, *DEC; 13 int i, j, k, m, N, *N1, Nsecfilt, NPTS, QUIET, FULL_OUTPUT, INST; 14 int Nstars, found, GetMeasures, Nlo, Nhi; 13 off_t i, Nstars, *N1; 14 int j, k, m, N, Nsecfilt, NPTS, QUIET, FULL_OUTPUT, INST; 15 int found, GetMeasures, Nlo, Nhi; 15 16 int SaveVectors; 16 17 Vector *vec1, *vec2, *vec3, *vec4, *vec5, *vec6; … … 102 103 ALLOCATE (RA, double, Nstars); 103 104 ALLOCATE (DEC, double, Nstars); 104 ALLOCATE (N1, int, Nstars);105 ALLOCATE (N1, off_t, Nstars); 105 106 106 107 /* find star(s) in RA, DEC list -- use a dumb algorithm for now, improve later */ -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/imbox.c
r25757 r27295 1 1 # include "dvoshell.h" 2 2 3 // LARGEFILES: this function is currently limited to images with Nx,Ny each < 2^31 3 4 int imbox (int argc, char **argv) { 4 5 5 int j, kapa, Nskip, status, InPic, flipped, N, haveNx, haveNy, Nx, Ny, SOLO_PHU, Npts, NPTS; 6 off_t Nskip; 7 int j, kapa, status, InPic, flipped, N, haveNx, haveNy, Nx, Ny, SOLO_PHU, Npts, NPTS; 6 8 Vector Xvec, Yvec; 7 9 double r, d, x[4], y[4], Rmin, Rmax, Rmid; … … 112 114 skip: 113 115 Nskip = gfits_data_size (&header); 114 fseek (f, Nskip, SEEK_CUR);116 fseeko (f, Nskip, SEEK_CUR); 115 117 gfits_free_header (&header); 116 118 } -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/imrough.c
r20936 r27295 262 262 if (!strcmp (line, "MDM Observatory")) { 263 263 264 fseek (f, header.size, SEEK_SET);264 fseeko (f, header.datasize, SEEK_SET); 265 265 266 266 /* load existing data from database */ -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/imsearch.c
r14590 r27295 7 7 Header header; 8 8 RegImage *pimage; 9 int i, Nimage, status, N, TimeSelect, SaveNames; 9 off_t i, Nimage, status; 10 int N, TimeSelect, SaveNames; 10 11 int ModeSelect, TypeSelect, CCDSelect, FilterSelect; 11 12 char *Filter, *obstime; … … 102 103 return (FALSE); 103 104 } 104 fseek (f, header.size, SEEK_SET);105 fseeko (f, header.datasize, SEEK_SET); 105 106 106 107 /* load existing data from database */ 107 gfits_scan (&header, "NIMAGES", "% d", 1, &Nimage);108 gfits_scan (&header, "NIMAGES", "%lld", 1, &Nimage); 108 109 ALLOCATE (pimage, RegImage, Nimage); 109 110 status = fread (pimage, sizeof(RegImage), Nimage, f); 110 111 fclose (f); 111 112 if (status != Nimage) { 112 gprint (GP_ERR, "ERROR: header and data in dB don't match (% d vs %d)\n", Nimage,status);113 gprint (GP_ERR, "ERROR: header and data in dB don't match (%lld vs %lld)\n", (long long) Nimage, (long long) status); 113 114 gfits_free_header (&header); 114 115 free (pimage); -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/lcurve.c
r20936 r27295 7 7 double *RA, *DEC; 8 8 int kapa, TimeFormat; 9 int Nstars, found, AutoLimits, ErrorBars, GalMag, AbsPhot, SaveVectors; 10 int i, j, m, N, NPTS, *N1; 9 int found, AutoLimits, ErrorBars, GalMag, AbsPhot, SaveVectors; 10 off_t i, Nstars, *N1; 11 int j, m, N, NPTS; 11 12 time_t TimeReference; 12 13 struct tm *timeptr; … … 88 89 ALLOCATE (RA, double, Nstars); 89 90 ALLOCATE (DEC, double, Nstars); 90 ALLOCATE (N1, int, Nstars);91 ALLOCATE (N1, off_t, Nstars); 91 92 92 93 /* find star(s) in RA, DEC list -- use a dumb algorithm for now, improve later */ -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/lightcurve.c
r20936 r27295 5 5 double Ra, Dec, Radius, Radius2, r; 6 6 double *RA, *DEC; 7 int Nstars, found, PhotCodeSelect; 8 int i, j, k, m, N, NPTS, Nsecfilt, RELPHOT, *N1, TimeFormat; 7 off_t i, Nstars, *N1; 8 int found, PhotCodeSelect; 9 int j, k, m, N, NPTS, Nsecfilt, RELPHOT, TimeFormat; 9 10 time_t TimeReference; 10 11 … … 71 72 ALLOCATE (RA, double, Nstars); 72 73 ALLOCATE (DEC, double, Nstars); 73 ALLOCATE (N1, int, Nstars);74 ALLOCATE (N1, off_t, Nstars); 74 75 75 76 /* find star(s) in RA, DEC list -- use a dumb algorithm for now, improve later */ -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/simage.c
r20936 r27295 89 89 return (FALSE); 90 90 } 91 fseek (f, header.size, SEEK_SET);91 fseeko (f, header.datasize, SEEK_SET); 92 92 93 93 /* set up storage buffers */ -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/dvo/subpix.c
r19823 r27295 3 3 int subpix (int argc, char **argv) { 4 4 5 int i, j, I, Nlo, Nhi, Nentry, Nstars, Nimage, Nmeasure;6 int *index, *entry;5 int i, j, I, Nlo, Nhi, *entry, Nentry; 6 off_t *index, Nstars, Nimage, Nmeasure; 7 7 int Nmin, Nsub, NSUB, status; 8 8 int TimeFormat; … … 54 54 ALLOCATE (RA, double, Nstars); 55 55 ALLOCATE (DEC, double, Nstars); 56 ALLOCATE (index, int, Nstars);56 ALLOCATE (index, off_t, Nstars); 57 57 for (i = 0; i < Nstars; i++) { 58 58 RA[i] = catalog.average[i].R; -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/lib.shell/BufferOps.c
r17903 r27295 241 241 i, buffers[i][0].name, buffers[i][0].file, 242 242 buffers[i][0].header.Naxis[0], buffers[i][0].header.Naxis[1], 243 buffers[i][0].header. size + buffers[i][0].matrix.size, buffers[i][0].bitpix,243 buffers[i][0].header.datasize + buffers[i][0].matrix.datasize, buffers[i][0].bitpix, 244 244 buffers[i][0].unsign, buffers[i][0].bzero, buffers[i][0].bscale); 245 245 } … … 252 252 i, buffers[i][0].name, buffers[i][0].file, 253 253 buffers[i][0].header.Naxis[0], buffers[i][0].header.Naxis[1], 254 buffers[i][0].header. size + buffers[i][0].matrix.size);255 } 256 return (TRUE); 257 } 254 buffers[i][0].header.datasize + buffers[i][0].matrix.datasize); 255 } 256 return (TRUE); 257 } -
branches/eam_branches/largefiles.20100314/Ohana/src/opihi/lib.shell/stack_math.c
r26891 r27295 1135 1135 /* copy all but the matrix */ 1136 1136 1137 matrix2[0].unsign = matrix1[0].unsign;1138 matrix2[0].bitpix = matrix1[0].bitpix;1139 matrix2[0]. size = matrix1[0].size;1140 matrix2[0].bzero = matrix1[0].bzero;1141 matrix2[0].bscale = matrix1[0].bscale;1142 matrix2[0].Naxes = matrix1[0].Naxes;1143 for (i = 0; i < FT_MAX_NAXES; i++) 1137 matrix2[0].unsign = matrix1[0].unsign; 1138 matrix2[0].bitpix = matrix1[0].bitpix; 1139 matrix2[0].datasize = matrix1[0].datasize; 1140 matrix2[0].bzero = matrix1[0].bzero; 1141 matrix2[0].bscale = matrix1[0].bscale; 1142 matrix2[0].Naxes = matrix1[0].Naxes; 1143 for (i = 0; i < FT_MAX_NAXES; i++) { 1144 1144 matrix2[0].Naxis[i] = matrix1[0].Naxis[i]; 1145 1145 } 1146 1146 1147 1147 return (TRUE); -
branches/eam_branches/largefiles.20100314/Ohana/src/photdbc/src/join_stars.c
r17284 r27295 3 3 void join_stars (Catalog *catalog) { 4 4 5 int i, j, k, m, M, Ni, Nj, first_j;6 int Naves, Nmeas, Ncurr;7 int Naverage, Nmeasure, *found, *index;5 off_t i, j, k, m, M, Ni, Nj, first_j, Nfirst; 6 off_t Naves, Nmeas, Ncurr; 7 off_t Naverage, Nmeasure, *index; 8 8 double *X, *Y, dX, dY, dR, RADIUS2; 9 9 double Sr, Sd, Rmid, Dmid; 10 int basecode, baseNsec, Nsecfilt, Nfirst;10 int basecode, baseNsec, Nsecfilt, *found; 11 11 12 12 Average *naverage, *average; … … 61 61 ALLOCATE (X, double, Naverage); 62 62 ALLOCATE (Y, double, Naverage); 63 ALLOCATE (index, int, Naverage);63 ALLOCATE (index, off_t, Naverage); 64 64 for (i = 0; i < Naverage; i++) { 65 65 index[i] = i; -
branches/eam_branches/largefiles.20100314/Ohana/src/relphot/src/GridOps.c
r21508 r27295 781 781 theader.Naxis[0] = RELPHOT_GRID_X; 782 782 theader.Naxis[1] = RELPHOT_GRID_Y; 783 gfits_modify (&theader, "NAXIS1", "% d", 1, RELPHOT_GRID_X);784 gfits_modify (&theader, "NAXIS2", "% d", 1, RELPHOT_GRID_Y);783 gfits_modify (&theader, "NAXIS1", "%lld", 1, RELPHOT_GRID_X); 784 gfits_modify (&theader, "NAXIS2", "%lld", 1, RELPHOT_GRID_Y); 785 785 gfits_create_matrix (&theader, &matrix); 786 786 -
branches/eam_branches/largefiles.20100314/Ohana/src/relphot/src/load_images.c
r25757 r27295 40 40 41 41 Image *image; 42 intNimage, Nx, i;42 off_t Nimage, Nx, i; 43 43 VTable *vtable; 44 44 … … 47 47 vtable = &db[0].vtable; 48 48 49 gfits_scan (vtable[0].header, "NAXIS1", "% d", 1, &Nx);49 gfits_scan (vtable[0].header, "NAXIS1", "%lld", 1, &Nx); 50 50 for (i = 0; i < Nimage; i++) { 51 51 memcpy (vtable[0].buffer[i], &image[i], Nx); -
branches/eam_branches/largefiles.20100314/Ohana/src/tools/src/ckfits.c
r15487 r27295 4 4 int main (int argc, char **argv) { 5 5 6 int i, Nbytes, nbytes, Ndata, Ntotal, nskip, status; 6 off_t i, Nbytes, nbytes, Ndata, Ntotal, nskip; 7 int status; 7 8 Header header; 8 9 FILE *f; … … 26 27 27 28 nbytes = Ntotal - Ndata; 28 nskip = Ndata + header. size;29 nskip = Ndata + header.datasize; 29 30 30 31 f = fopen (argv[1], "r"); … … 35 36 36 37 ALLOCATE (buffer, char, MAX (nbytes, 1)); 37 fseek (f, nskip, SEEK_SET);38 fseeko (f, nskip, SEEK_SET); 38 39 Nbytes = fread (buffer, 1, nbytes, f); 39 40 fclose (f); -
branches/eam_branches/largefiles.20100314/Ohana/src/tools/src/fhead.c
r12333 r27295 5 5 6 6 int N, Extend, Nextend, status; 7 int i, j, nbytes; 7 int i, j; 8 off_t nbytes; 8 9 Header head; 9 10 char *p; … … 29 30 if (!status) continue; 30 31 31 for (j = 79; j < head. size; j+= 80) {32 for (j = 79; j < head.datasize; j+= 80) { 32 33 head.buffer[j] = 10; 33 34 } -
branches/eam_branches/largefiles.20100314/Ohana/src/tools/src/fields.c
r24232 r27295 22 22 Header header; 23 23 char filename[1000], *CCDKeyword, *Extname, extname[80]; 24 int N, Nbytes,Extnum, Nextend, status, GotFile, GotField, GotExtension;25 24 int N, Extnum, Nextend, status, GotFile, GotField, GotExtension; 25 off_t Nbytes; 26 26 regex_t preg; 27 27 … … 97 97 98 98 Nbytes = gfits_data_size (&header); 99 fseek (f, Nbytes, SEEK_CUR);99 fseeko (f, Nbytes, SEEK_CUR); 100 100 Nextend ++; 101 101 -
branches/eam_branches/largefiles.20100314/Ohana/src/tools/src/fits_insert.c
r21046 r27295 7 7 int main (int argc, char **argv) { 8 8 9 int i, N, status, EXTNUM, Nbytes, skip, Delete, DeleteStart, DeleteStop; 10 int Nreserved, start_size; 9 off_t i, skip, Nbytes, start_size; 10 int N, status, EXTNUM, Delete, DeleteStart, DeleteStop; 11 int Nreserved; 11 12 char *p, keyword[16], line[256]; 12 13 FILE *f; … … 62 63 exit (1); 63 64 } 64 start_size = header. size;65 skip = Nbytes - header. size;65 start_size = header.datasize; 66 skip = Nbytes - header.datasize; 66 67 67 68 /* open header data file */ … … 116 117 /* check that the line does not already exist */ 117 118 p = (char *) NULL; 118 for (i = 0; (i < header. size) && (p == (char *) NULL) ; i+= FT_LINE_LENGTH) {119 for (i = 0; (i < header.datasize) && (p == (char *) NULL) ; i+= FT_LINE_LENGTH) { 119 120 if (!strncmp (&header.buffer[i], line, 80)) { 120 121 p = &header.buffer[i]; … … 126 127 p = (char *) NULL; 127 128 Nreserved = strlen (reserved); 128 for (i = 0; (i < header. size) && (p == (char *) NULL) ; i+= FT_LINE_LENGTH) {129 for (i = 0; (i < header.datasize) && (p == (char *) NULL) ; i+= FT_LINE_LENGTH) { 129 130 if (!strncmp (&header.buffer[i], "END ", 8)) break; 130 131 if (!strncmp (&header.buffer[i], reserved, Nreserved)) { … … 142 143 exit (1); 143 144 } 144 if (p - header.buffer + 80 == header. size) {145 if (p - header.buffer + 80 == header.datasize) { 145 146 fprintf (stderr, "no free space in block, can't insert keyword\n"); 146 147 exit (1); … … 161 162 */ 162 163 163 if (header. size != start_size) {164 if (header.datasize != start_size) { 164 165 fprintf (stderr, "header changed size: should not happen!\n"); 165 166 exit (1); … … 172 173 } 173 174 174 fseek (f, skip, SEEK_SET);175 status = fwrite (header.buffer, 1, header. size, f);176 if (status != header. size) {175 fseeko (f, skip, SEEK_SET); 176 status = fwrite (header.buffer, 1, header.datasize, f); 177 if (status != header.datasize) { 177 178 fprintf (stderr, "failed to write data to image header\n"); 178 179 exit (1); -
branches/eam_branches/largefiles.20100314/Ohana/src/tools/src/ftable.c
r26384 r27295 8 8 void list_extnames (char *file); 9 9 void print_layout (Header *header); 10 int ByteSwap (char *ptr, int size, int nitems, char *type);11 10 int Binary; 12 11 13 12 int main (int argc, char **argv) { 14 13 15 int i, N, Nx, Ny, Nbytes, Nread;16 int N extend, Column, Row, ListExtname, Layout;14 off_t i, Nx, Ny, Nbytes, Nread, Row; 15 int N, Nextend, Column, ListExtname, Layout; 17 16 char *Extname, *Colname, *line, ttype[80]; 18 17 FTable table; … … 94 93 exit (1); 95 94 } 96 table. size = Nbytes;97 98 gfits_scan (table.header, "NAXIS1", "% d", 1, &Nx);99 gfits_scan (table.header, "NAXIS2", "% d", 1, &Ny);95 table.datasize = Nbytes; 96 97 gfits_scan (table.header, "NAXIS1", "%lld", 1, &Nx); 98 gfits_scan (table.header, "NAXIS2", "%lld", 1, &Ny); 100 99 101 100 /* print a column */ … … 122 121 char *print_table_row (char *row, Header *header) { 123 122 124 int i, j, Nx, Nfields, Nbytes, Nvals, Oout, Oin; 123 off_t Nx; 124 int i, j, Nfields, Nbytes, Nvals, Oout, Oin; 125 125 char field[16], type[16], format[16], *line; 126 126 127 gfits_scan (header, "NAXIS1", "% d", 1, &Nx);127 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 128 128 gfits_scan (header, "TFIELDS", "%d", 1, &Nfields); 129 129 … … 160 160 161 161 FILE *f; 162 int i, Naxis, Nelem, Ncomp, extend, Nbytes, status; 162 off_t Nbytes, Nelem; 163 int i, Naxis, Ncomp, extend, status; 163 164 char extname[82], exttype[82], axisname[32]; 164 165 Header header; … … 169 170 exit (1); 170 171 } 171 172 /*173 if (!gfits_fread_header (f, &header)) {174 fprintf (stderr, "can't read header from %s\n", file);175 exit (1);176 }177 Nbytes = gfits_data_size (&header);178 fseek (f, Nbytes, SEEK_CUR);179 */180 172 181 173 fprintf (stdout, "%-30s %-15s NAXIS NAXIS(i)...\n", "extname", "datatype"); … … 217 209 for (i = 0; i < Naxis; i++) { 218 210 sprintf (axisname, "NAXIS%d", i+1); 219 status = gfits_scan (&header, axisname, "% d", 1, &Nelem);211 status = gfits_scan (&header, axisname, "%lld", 1, &Nelem); 220 212 if (!status) { 221 213 fprintf (stderr, "missing %s\n", axisname); … … 235 227 236 228 Nbytes = gfits_data_size (&header); 237 fseek (f, Nbytes, SEEK_CUR);229 fseeko (f, Nbytes, SEEK_CUR); 238 230 239 231 Ncomp ++; … … 245 237 FILE *load_extension (char *file, int Nextend, char *Extname, Header *header) { 246 238 247 int i, extend, Nbytes; 239 off_t Nbytes; 240 int i, extend; 248 241 char extname[82]; 249 242 FILE *f; … … 271 264 /* skip first data array */ 272 265 Nbytes = gfits_data_size (header); 273 fseek (f, Nbytes, SEEK_CUR);266 fseeko (f, Nbytes, SEEK_CUR); 274 267 275 268 /* search for extension of interest */ … … 281 274 282 275 Nbytes = gfits_data_size (header); 283 fseek (f, Nbytes, SEEK_CUR);276 fseeko (f, Nbytes, SEEK_CUR); 284 277 gfits_free_header (header); 285 278 } … … 292 285 void print_column (FTable *table, int Column, char *Colname) { 293 286 294 int i, j, Nfields, Nstart, Nv, Nb, Nx, Ny; 287 off_t Nx, Ny; 288 int i, j, Nfields, Nstart, Nv, Nb; 295 289 Header *header; 296 290 char format[16], field[16], type[16], *line, *data; … … 300 294 301 295 gfits_scan (header, "TFIELDS", "%d", 1, &Nfields); 302 gfits_scan (header, "NAXIS1", "% d", 1, &Nx);303 gfits_scan (header, "NAXIS2", "% d", 1, &Ny);296 gfits_scan (header, "NAXIS1", "%lld", 1, &Nx); 297 gfits_scan (header, "NAXIS2", "%lld", 1, &Ny); 304 298 305 299 if (Colname != (char *) NULL) { -
branches/eam_branches/largefiles.20100314/Ohana/src/tools/src/mefhead.c
r15487 r27295 5 5 6 6 struct stat filestat; 7 int NEXTEND, Nextend, Nmatrix, status; 7 int NEXTEND, Nextend, status; 8 off_t Nmatrix; 8 9 Header header; 9 10 FILE *f, *g; … … 43 44 /* skip matrix */ 44 45 Nmatrix = gfits_data_size (&header); 45 fseek (g, Nmatrix, SEEK_CUR);46 fseeko (g, Nmatrix, SEEK_CUR); 46 47 47 48 /* write PHU */ … … 65 66 /* skip matrix */ 66 67 Nmatrix = gfits_data_size (&header); 67 fseek (g, Nmatrix, SEEK_CUR);68 fseeko (g, Nmatrix, SEEK_CUR); 68 69 69 70 /* write header */
Note:
See TracChangeset
for help on using the changeset viewer.
